carbaj0
03/21/2021, 3:21 PMAdam Powell
03/21/2021, 3:23 PMcarbaj0
03/21/2021, 3:24 PMcarbaj0
03/21/2021, 3:28 PMcarbaj0
03/21/2021, 3:28 PMAdam Powell
03/21/2021, 3:31 PMModifier.offset
I might avoid that, since its modifications don't participate in the parent layout; it's easy to make a parent layout confused when those offsets are large and usually an indication that you want to involve the parent more in some wayAdam Powell
03/21/2021, 3:31 PMcarbaj0
03/21/2021, 3:33 PMAdam Powell
03/21/2021, 3:34 PMModifier.weight(1f)
.wrapContentWidth(align = Alignment { size, space, layoutDirection -> /* TODO: return a value based on the animation */ })
Adam Powell
03/21/2021, 3:35 PMAlignment.Horizontal
instead of Alignment
if you only care about the one dimensionAdam Powell
03/21/2021, 3:35 PMcarbaj0
03/21/2021, 3:38 PMcarbaj0
03/21/2021, 3:39 PMAdam Powell
03/21/2021, 3:53 PMAdam Powell
03/21/2021, 3:54 PMAdam Powell
03/21/2021, 3:54 PMAdam Powell
03/21/2021, 3:54 PMAdam Powell
03/21/2021, 3:55 PMAdam Powell
03/21/2021, 3:57 PMLayout
composable for coordinating multiple elements together and the Modifier.layout {}
modifier for altering the sizing and positioning of single elements in isolation. We only needed to manipulate one thing, so the modifier is the easier way to work with it. The Layout
composable always has to deal with the possibility of zero or more than one child element, which always adds some complexity. Better to skip that when you can.Adam Powell
03/21/2021, 3:59 PMAdam Powell
03/21/2021, 4:00 PMModifier.wrapContentSize
already implements most of that for us and by writing a custom Alignment
we can worry only about that last part - the positioning within the space occupied.Adam Powell
03/21/2021, 4:01 PMModifier.wrapContentWidth
or Height
if all we need is either vertical or horizontal alignment, but not both.carbaj0
03/21/2021, 4:13 PMkrzysztof
03/21/2021, 4:15 PMAdam Powell
03/21/2021, 4:18 PMAdam Powell
03/21/2021, 4:19 PMkrzysztof
03/21/2021, 4:20 PMAdam Powell
03/21/2021, 4:21 PMAdam Powell
03/21/2021, 4:21 PMkrzysztof
03/21/2021, 4:25 PMkrzysztof
03/21/2021, 4:25 PM