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

initialFirstVisibleItemIndex initial position for LazyStaggeredGridState.firstVisibleItemIndex
initialFirstVisibleItemScrollOffset initial value for LazyStaggeredGridState.firstVisibleItemScrollOffset

Returns

created and memoized LazyStaggeredGridState with given parameters.