rememberLazyStaggeredGridState

Composable Function

Common
@Composable
fun rememberLazyStaggeredGridState(
    initialFirstVisibleItemIndex: Int = 0,
    initialFirstVisibleItemScrollOffset: Int = 0,
): LazyStaggeredGridState

Creates a LazyStaggeredGridState that is remembered across composition.

Calling this function with different parameters on recomposition WILL NOT recreate or change the state. Use LazyStaggeredGridState.scrollToItem or LazyStaggeredGridState.animateScrollToItem to adjust position instead.

Parameters

initialFirstVisibleItemIndexinitial position for LazyStaggeredGridState.firstVisibleItemIndex
initialFirstVisibleItemScrollOffsetinitial value for LazyStaggeredGridState.firstVisibleItemScrollOffset

Returns

created and memoized LazyStaggeredGridState with given parameters.