RotarySnapLayoutInfoProvider

interface RotarySnapLayoutInfoProvider


A provider which connects scrollableState to a rotary input for snapping scroll actions.

This interface defines the essential properties and methods required for a scrollable to be controlled by rotary input and perform a snap action.

Summary

Public properties

Float

The average size in pixels of an item within the scrollable.

Int

The index of the item that is closest to the center.

Float

The offset in pixels of the currently centered item from its centered position.

Int

The total number of items within the scrollable

Public properties

averageItemSize

Added in 1.4.0
val averageItemSizeFloat

The average size in pixels of an item within the scrollable. This is used to estimate scrolling distances for snapping when responding to rotary input.

currentItemIndex

Added in 1.4.0
val currentItemIndexInt

The index of the item that is closest to the center.

currentItemOffset

Added in 1.4.0
val currentItemOffsetFloat

The offset in pixels of the currently centered item from its centered position. This value can be positive or negative.

totalItemCount

Added in 1.4.0
val totalItemCountInt

The total number of items within the scrollable