SnapperFlingBehavior

constructor(layoutInfo: SnapperLayoutInfo, decayAnimationSpec: DecayAnimationSpec<Float>, springAnimationSpec: AnimationSpec<Float> = SnapperFlingBehaviorDefaults.SpringAnimationSpec, snapIndex: (SnapperLayoutInfo, startIndex: Int, targetIndex: Int) -> Int = SnapperFlingBehaviorDefaults.SnapIndex)(source)

Parameters

layoutInfo

The SnapperLayoutInfo to use.

decayAnimationSpec

The decay animation spec to use for decayed flings.

springAnimationSpec

The animation spec to use when snapping.

snapIndex

Block which returns the index to snap to. The block is provided with the SnapperLayoutInfo, the index where the fling started, and the index which Snapper has determined is the correct target index. Callers can override this value to any valid index for the layout. Some common use cases include limiting the fling distance, and rounding up/down to achieve snapping to groups of items.