Skip to main content

rememberLazyListState

Function rememberLazyListState 

Source
pub fn rememberLazyListState() -> LazyListState
Expand description

Creates a remembered LazyListState with default initial position.

This is the recommended way to create a LazyListState in composition. The returned state is Copy and can be passed to multiple closures without .clone().

§Example

let list_state = rememberLazyListState();

// Pass to multiple closures - no .clone() needed!
LazyColumn(modifier, list_state, spec, content);
Button(move || list_state.scroll_to_item(0, 0.0));