-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make TableListLayout
respect padding by default
#286
Make TableListLayout
respect padding by default
#286
Conversation
Looking at the updated |
Previously while you could set padding on the `TableListLayout`, that padding would be equally distributed to the left and right rather than respecting any difference between the two. Even if a custom width was set on the section or items, if the center alignment was used the resulting attributes would be globally centered versus centered in the available width between the padding. This change resolves the issue on two fronts. First, the `CustomWidth.Alignment.center` now center aligns between the provided padding. Second, because the `CustomWidth.default` will center align completely ignoring padding, this change introduces a root `CustomWidth` during the layout which all other components merge against to calculate their origin. This allows the correct center alignment with respect to padding to cascade down throughout the attributes until a component overrides the width with something else.
63e9ea1
to
59be358
Compare
Oops, I missed propagating the |
constraint: layout.width | ||
) | ||
width: layout.width, | ||
alignment: .center |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume / think the actual value passed here doesn't matter, since we're measuring within a container of the same width, right? Eg, no other place we should be pulling this value from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I can think of. I didn't see an alignment option in the layout itself. I chose .center
because it most closely matched the behavior of CustomWidth.default
, with the addition of considering the padding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Looks great, thank you for fixing! Just one quick last question. |
@zradke I added you as a collaborator for this repo, so once you accept you should be able to merge (sorry, didnt realize you weren't one already). |
Previously while you could set padding on the
TableListLayout
, thatpadding would be equally distributed to the left and right rather than
respecting any difference between the two. Even if a custom width was
set on the section or items, if the center alignment was used the
resulting attributes would be globally centered versus centered in the
available width between the padding.
This change resolves the issue on two fronts. First, the
CustomWidth.Alignment.center
now center aligns between the providedpadding. Second, because the
CustomWidth.default
will center aligncompletely ignoring padding, this change introduces a root
CustomWidth
during the layout which all other components merge against to calculate
their origin. This allows the correct center alignment with respect to
padding to cascade down throughout the attributes until a component
overrides the width with something else.