androidx.compose.foundation.lazy.staggeredgrid
LazyVerticalStaggeredGrid
Composable function · from org.jetbrains.compose.foundation:foundation:1.12.2
One of the grid types. It works like LazyVerticalGrid. Only the parameters that differ are described here.
A vertical grid where items keep their own height. Each item goes into the shortest column, so there are no gaps. Set the columns with StaggeredGridCells.Fixed(2) or StaggeredGridCells.Adaptive(160.dp).
Parameters
@Composable
fun LazyVerticalStaggeredGrid(
columns: StaggeredGridCells,
modifier: Modifier = Modifier,
state: LazyStaggeredGridState = rememberLazyStaggeredGridState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
verticalItemSpacing: Dp = 0.dp,
horizontalArrangement: Arrangement.Horizontal = Arrangement.spacedBy(0.dp),
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
userScrollEnabled: Boolean = true,
overscrollEffect: OverscrollEffect? = rememberOverscrollEffect(),
content: LazyStaggeredGridScope.() -> Unit,
)
columns: StaggeredGridCellsRequired
columns: StaggeredGridCellsRequiredHow many columns, and how wide. See GridCells above.
state: LazyStaggeredGridStateOptional
state: LazyStaggeredGridStateOptionalDefault: rememberLazyStaggeredGridState()
Reads and controls the scroll position. Create it with rememberLazyGridState().
verticalItemSpacing: DpOptional
verticalItemSpacing: DpOptionalDefault: 0.dp
The space between items in a column of a staggered grid.
content: LazyStaggeredGridScope.() -> UnitRequired
content: LazyStaggeredGridScope.() -> UnitRequiredThe items: calls to item and items.
Defaults that differ from LazyVerticalGrid:
Same as in LazyVerticalGrid: modifier, contentPadding, reverseLayout, horizontalArrangement, flingBehavior, userScrollEnabled, overscrollEffect.
Grid types
LazyVerticalGridLazyHorizontalGridLazyVerticalStaggeredGridLazyHorizontalStaggeredGrid