androidx.compose.foundation.lazy.staggeredgrid

LazyStaggeredGridState

Class · from org.jetbrains.compose.foundation:foundation:1.12.2

No hand-written docs yet.

Hoisted state object controlling LazyVerticalStaggeredGrid or LazyHorizontalStaggeredGrid. In most cases, it should be created via rememberLazyStaggeredGridState.

class LazyStaggeredGridState : ScrollableState

Is a

Used by

Parameters that take a LazyStaggeredGridState.

Properties

firstVisibleItemIndex

val firstVisibleItemIndex: Int

Index of the first visible item across all staggered grid lanes. This does not include items in the content padding region. For the first visible item that includes items in the content padding please use LazyStaggeredGridLayoutInfo.visibleItemsInfo.

firstVisibleItemScrollOffset

val firstVisibleItemScrollOffset: Int

Current offset of the item with firstVisibleItemIndex relative to the container start.

layoutInfo

val layoutInfo: LazyStaggeredGridLayoutInfo

Layout information calculated during last layout pass, with information about currently visible items and container parameters.

interactionSource

val interactionSource: MutableInteractionSource

InteractionSource that will be used to dispatch drag events when this list is being dragged. If you want to know whether the fling (or animated scroll) is in progress, use isScrollInProgress.

Saver

val Saver

The default implementation of Saver for LazyStaggeredGridState

Functions

scrollToItem

fun scrollToItem(
    index: Int,
    scrollOffset: Int = 0,
)

Instantly brings the item at index to the top of layout viewport, offset by scrollOffset pixels.

animateScrollToItem

fun animateScrollToItem(
    index: Int,
    scrollOffset: Int = 0,
)

Animate (smooth scroll) to the given item.

requestScrollToItem

fun requestScrollToItem(
    index: Int,
    scrollOffset: Int = 0,
)

Requests the item at index to be at the start of the viewport during the next remeasure, offset by scrollOffset, and schedules a remeasure.

Library docs

Hoisted state object controlling LazyVerticalStaggeredGrid or LazyHorizontalStaggeredGrid. In most cases, it should be created via rememberLazyStaggeredGridState.