https://kotlinlang.org logo
Title
c

Colton Idle

05/25/2023, 1:21 PM
Has anyone been able to successfully use FlowRow and alignment? Seems like it's not possible to vertically center items in a flow row due to FlowRowScopeInstance being private.
r

Rebecca Franks

05/25/2023, 1:30 PM
Are you not able to use
Modifier.align(Alignment.Center)
?
c

Colton Idle

05/25/2023, 1:48 PM
Seems not?
2023-05-25 at 09.48.36.png
I'm using 1.5.0-beta01 from yest
If I try Center then I get this
f

Francesc

05/25/2023, 3:35 PM
you are applying the
Alignment
to the
FlowRow
which implies its parent must be a
Box
- is that the case? You can apply
Alignment
to the children of
FlowRow
c

Colton Idle

05/25/2023, 3:40 PM
Interesting. I basically have Text, Icon, Icon, Icon, Icon, Icon, Icon, Icon and the text is not in line with the icons... so lets see if that works. lol I'll just set the alignment on the text? That should do?
f

Francesc

05/25/2023, 3:41 PM
let me change one to a Text
r

Rebecca Franks

05/25/2023, 3:42 PM
Yeah you need to put the alignment modifier on the children
f

Francesc

05/25/2023, 3:43 PM
works the same regardless of the child
c

Colton Idle

05/25/2023, 3:43 PM
oh wow. so weird to me. ive been using compose for like 2 years. lol
and alignment of children was always possible from the parent i feel
like. if i just wanted every child to be centered vertically, then setting it on the layout makes sense to me.
but. if this lets me ship this feature... i will be soooo happy
AHH. that worked!
thank you all so much.
r

Rebecca Franks

05/25/2023, 3:52 PM
Yeah this changed from previous release due to not wanting to confuse verticalArrangement parameter with verticalAlignment parameter, so verticalAlignment was removed in favour of individual modifiers on each item.
c

Colton Idle

05/25/2023, 3:54 PM
intereseting. i read that release note... but it did not seem like individual modifiers on each item was required