androidx.compose.foundation.gestures.snapping

Interfaces

SnapLayoutInfoProvider

Provides information about the layout that is using a SnapFlingBehavior.

Cmn
SnapPosition

Describes the snapping positioning (i.e. final positioning after snapping animation finishes) of a given snap item in its containing layout.

Cmn

Classes

SnapFlingBehavior

A TargetedFlingBehavior that performs snapping of items to a given position.

Cmn

Objects

SnapPosition.Center

Aligns the center of the item with the center of the containing layout.

Cmn
SnapPosition.End

Aligns the end of the item with the end of the containing layout.

Cmn
SnapPosition.Start

Aligns the start of the item with the start of the containing layout.

Cmn

Top-level functions summary

SnapLayoutInfoProvider
SnapLayoutInfoProvider(
    lazyGridState: LazyGridState,
    snapPosition: SnapPosition
)

A SnapLayoutInfoProvider for LazyGrids.

Cmn
SnapLayoutInfoProvider
SnapLayoutInfoProvider(
    lazyListState: LazyListState,
    snapPosition: SnapPosition
)

A SnapLayoutInfoProvider for LazyLists.

Cmn
FlingBehavior

Create and remember a FlingBehavior for decayed snapping in Lazy Lists.

Cmn
TargetedFlingBehavior

Creates and remember a FlingBehavior that performs snapping.

Cmn

Top-level functions

SnapLayoutInfoProvider

fun SnapLayoutInfoProvider(
    lazyGridState: LazyGridState,
    snapPosition: SnapPosition = SnapPosition.Center
): SnapLayoutInfoProvider

A SnapLayoutInfoProvider for LazyGrids.

Parameters
lazyGridState: LazyGridState

The LazyGridState with information about the current state of the grid

snapPosition: SnapPosition = SnapPosition.Center

The desired positioning of the snapped item within the main layout. This position should be considered with regards to the start edge of the item and the placement within the viewport.

SnapLayoutInfoProvider

fun SnapLayoutInfoProvider(
    lazyListState: LazyListState,
    snapPosition: SnapPosition = SnapPosition.Center
): SnapLayoutInfoProvider

A SnapLayoutInfoProvider for LazyLists.

Parameters
lazyListState: LazyListState

The LazyListState with information about the current state of the list

snapPosition: SnapPosition = SnapPosition.Center

The desired positioning of the snapped item within the main layout. This position should be considered with regard to the start edge of the item and the placement within the viewport.

rememberSnapFlingBehavior

@Composable
fun rememberSnapFlingBehavior(lazyListState: LazyListState): FlingBehavior

Create and remember a FlingBehavior for decayed snapping in Lazy Lists. This will snap the item's center to the center of the viewport.

Parameters
lazyListState: LazyListState

The LazyListState from the LazyList where this FlingBehavior will be used.

rememberSnapFlingBehavior

@Composable
fun rememberSnapFlingBehavior(
    snapLayoutInfoProvider: SnapLayoutInfoProvider
): TargetedFlingBehavior

Creates and remember a FlingBehavior that performs snapping.

Parameters
snapLayoutInfoProvider: SnapLayoutInfoProvider

The information about the layout that will do snapping