Closed TurKurT656 closed 1 year ago
Thanks for filing that issue, sorry about that error in the migration guide. I will fix that up.
Cross axis spacing was added in Compose 1.5 which is currently in beta. The verticalArrangement should be there and let you achieve what you are trying to do.
Your fix of using Arrangement
not HorizontalArrangement
is correct and will work with vertical as well in 1.5.
I am migrating from accompanist-flowlayout:0.28.0
to fundation:1.5.4
, the migration guide from Accompanist website states that
For
FlowRow
mainAxisAlignment
is nowhorizontalArrangement
crossAxisAlignment
is nowverticalArrangement
The crossAxisAlignment
in Accompanist FlowRow
behaves like the one in Row
. However fundation FlowRow
only provides verticalArrangement
but no verticalAlignment
. According to Flow layouts docs, we need to use Modifier.align()
on row items.
Thus the following code
FlowRow(crossAxisAlignment = FlowCrossAxisAlignment.Center) {
Item()
Item()
}
should be migrated to
FlowRow {
Item(modifier = Modifier.align(Alignment.CenterVertically))
Item(modifier = Modifier.align(Alignment.CenterVertically))
}
Description I'm trying to migrate
appcompanist FlowRow
tofoundationlayout FlowRow
. in the migration guide it says that instead ofmainAxisSpacing
andcrossAxisSpacing
we must usehorizontalArrangement = HorizontalArrangement.spacedBy(50.dp, Alignment.Start)
andverticalArrangement = VerticalArrangement.spacedBy(50.dp, Alignment.Top)
like this:For
horizontalArrangement
parameter there isn't any provider namedHorizontalArrangement
so I replaced it withArrangement.spacedBy(50.dp, Alignment.Start)
and it fixed the issue but there isn't any parameter namedverticalArrangement
inFlowRow
.FlowRow
hasverticalAlignment
and for that parameter there isn't any provider likeAlignment.spacedBy(50.dp, Alignment.Top)
. So have can I havecrossAxisSpacing
in newFlowRow
?