-
Notifications
You must be signed in to change notification settings - Fork 70
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
Width and Height configuration for children of Rows and Columns #855
Comments
This is relatively straightforward to implement - we could override a child's minimum width/height by overriding the return value of As for renaming Also semi-related, but I'm planning to introduce a Button(
layoutModifier = LayoutModifier
.horizontalAlignment(CrossAxisAlignment.Stretch)
.width(0.dp)
.grow(1.0),
text = "RIGHT",
) |
Regarding |
I think we should opt for the "alternative CSS box model", where the width and height does include the padding. I've often seen |
@colinrtwhite Is this still the case? After adding some |
@veyndan It behaves as padding when passed as an argument to the Row/Column functions, but it applies margin to any child items that have margin added using Margin applied to children inside of |
Problem Statement
I’ve got a column where I’d like to configure the minimum size of a child element. Perhaps something like this:
For this occurrence I think I want to specify a minimum height, because if the row’s contents exceed that height (perhaps due to a long label text-wrapping), I’m happy with the element being taller than that size.
In another part of my layout I’d like to specify an element’s exact width=0 with
grow(1.0)
so that I can achieve 50/50 balance for adjacent elements:Without locking the width in at 0, the side-by-side elements only balance if their contents are the exact same width.
Syntax
I’d like to express these layout goals in the API. The above syntax is illustrative; I’m not at all attached to it. Borrowing terms from HTML or iOS or Android would be ideal.
Margin, Padding, Size
We have to decide if width and height includes padding or not. My preference is we follow the standard CSS Box Model and not include padding in width or height.
I’d also like for us to rename
Padding
toMargin
, if that’s closer to its behavior. In particular, if an element doesn’t paint its background in the padding area we should probably rename it to margin.The text was updated successfully, but these errors were encountered: