SnapperFlingBehavior

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

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.


fun SnapperFlingBehavior(    layoutInfo: SnapperLayoutInfo,     decayAnimationSpec: DecayAnimationSpec<Float>,     springAnimationSpec: AnimationSpec<Float> = SnapperFlingBehaviorDefaults.SpringAnimationSpec,     maximumFlingDistance: (SnapperLayoutInfo) -> Float = SnapperFlingBehaviorDefaults.MaximumFlingDistance)

Parameters

layoutInfo

The SnapperLayoutInfo to use.

decayAnimationSpec

The decay animation spec to use for decayed flings.

springAnimationSpec

The animation spec to use when snapping.

maximumFlingDistance

Block which returns the maximum fling distance in pixels. The returned value should be 0.