Snapper Fling Behavior
fun SnapperFlingBehavior( layoutInfo: SnapperLayoutInfo, decayAnimationSpec: DecayAnimationSpec<Float>, springAnimationSpec: AnimationSpec<Float> = SnapperFlingBehaviorDefaults.SpringAnimationSpec, snapIndex: (SnapperLayoutInfo, startIndex: Int, targetIndex: Int) -> Int = SnapperFlingBehaviorDefaults.SnapIndex)
Content copied to clipboard
Parameters
layout Info
The SnapperLayoutInfo to use.
decay Animation Spec
The decay animation spec to use for decayed flings.
spring Animation Spec
The animation spec to use when snapping.
snap Index
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.
Content copied to clipboard
Parameters
layout Info
The SnapperLayoutInfo to use.
decay Animation Spec
The decay animation spec to use for decayed flings.
spring Animation Spec
The animation spec to use when snapping.
maximum Fling Distance
Block which returns the maximum fling distance in pixels. The returned value should be 0.