https://kotlinlang.org logo
a

Andreas Jost

01/08/2020, 2:45 PM
Hi, if I use a Spacer in SwiftUI without a height argument, the spacer takes all available space. Is there an equivalent in Compose? So if I have a Column, that has the following subviews: "HeightSpacer, Text, HeightSpacer, Text, HeightSpacer" the HeightSpacers should equally take the remaining space automatically.
z

Zsolt

01/08/2020, 2:50 PM
I guess you could use FlexColumn to achieve this instead of spacers
l

Luca Nicoletti

01/08/2020, 2:53 PM
SpaceEvenly as an argument of alignment for the column, without even adding the spacers, will do the same
a

Andreas Jost

01/08/2020, 3:06 PM
Alright, that works if you want only evenly spaced lines, that's great! But what if you needed something like "SpaceEvenly, Text, HeightSpacer(10.dp), Text, SpaceEvenly" (mixing fixed Spacers with Spacers, that should take the remaining spaces) Seems like you have to use nested Columns? That makes it more complicated than the SwiftUI approach imho, or do I miss something?
z

Zsolt

01/08/2020, 6:51 PM
In that case you can have Column with Center alignment. In more advanced cases you can have FlexColumn.
6 Views