s3rius
02/14/2024, 9:31 AMGridCells.Adaptive
, so there isn't a fixed amount of columns. Now I want to show a full row's worth of items in the grid.
So, for example: if the Grid is wide enough to hold 4 items, I want to insert 4 items
In code it would look something like this:
LazyVerticalGrid(...) {
// some items here
item(span = { GridItemSpan(maxLineSpan) }) { ... } // Full-width header
// maxLineSpan only exists in LazyGridItemSpanScope so it can't be used like this
items(count = maxLineSpan) { ... } // one full row's worth of items
// more items to follow
}
Is there a convenient way of achieving this?
The only option I see right now is to wrap the Grid in a BoxWithConstraints
, calculate span count manually based on the box width and use GridCells.Fixed(calculatedSpanCount)
for the Grid.