I'm using LazyVerticalGrid
to create a responsive grid with 96 dp columns, it looks like this:
LazyVerticalGrid(
columns = GridCells.Adaptive(96.dp),
horizontalArrangement = Arrangement.spacedBy(8.dp),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Card {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
) {
Card {...}
Text(title)
}
}
}
but there is a problem: the card content can has different heights due to text wrapping and I get negative space between the cards (marked with red arrows). Which of these solutions is possible in Compose without resorting to creating a custom layout?
- Make the height of other cards equals the maximum available height
- Make a staggered grid like this: