VirtualListState

class VirtualListState<K : Any>(val scrollState: ScrollState = ScrollState(), initialIndex: Int? = null)(source)

Caller-owned navigation state shared by one VirtualList and optional independent Scrollbar, confined to its construction execution owner.

Index and key jumps issued before attachment remain pending and are applied when a list model attaches. A refresh issued before attachment also remains pending and is applied before pending navigation. A key jump returns false when the attached model can prove the key is absent; before attachment it is accepted as pending. Only one retained VirtualList may attach at a time, while any number of Scrollbars may observe VirtualListState.scrollState.

Parameters

initialIndex

optional initial zero-based item target.

Type Parameters

K

stable item key type.

Constructors

Link copied to clipboard
constructor(scrollState: ScrollState = ScrollState(), initialIndex: Int? = null)

Properties

Link copied to clipboard

position and geometry shared with independent scrollbars.

Functions

Link copied to clipboard
fun jumpToIndex(index: Int): Boolean

Moves the target item to the viewport start or retains the request until attachment.

Link copied to clipboard
fun jumpToKey(key: K): Boolean

Moves the keyed item to the viewport start or retains the request until attachment.

Link copied to clipboard
fun refresh()

Invalidates materialized rows after a caller-owned source or row-presentation mutation.