SnapFlingBehavior



Summary

Public constructors

SnapFlingBehavior(
    snapLayoutInfoProvider: SnapLayoutInfoProvider,
    decayAnimationSpec: DecayAnimationSpec<Float>,
    snapAnimationSpec: AnimationSpec<Float>
)
Cmn

Public functions

open operator Boolean
equals(other: Any?)
Cmn
open Int
Cmn
open suspend Float
ScrollScope.performFling(
    initialVelocity: Float,
    onRemainingDistanceUpdated: (Float) -> Unit
)

Perform a snapping fling animation with given velocity and suspend until fling has finished.

Cmn

Inherited functions

From androidx.compose.foundation.gestures.TargetedFlingBehavior
open suspend Float
ScrollScope.performFling(initialVelocity: Float)

Perform settling via fling animation with given velocity and suspend until fling has finished.

Cmn

Public constructors

SnapFlingBehavior

SnapFlingBehavior(
    snapLayoutInfoProvider: SnapLayoutInfoProvider,
    decayAnimationSpec: DecayAnimationSpec<Float>,
    snapAnimationSpec: AnimationSpec<Float>
)

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int
open suspend fun ScrollScope.performFling(
    initialVelocity: Float,
    onRemainingDistanceUpdated: (Float) -> Unit
): Float

Perform a snapping fling animation with given velocity and suspend until fling has finished. This will behave the same way as performFling except it will report on each remainingOffsetUpdate using the onRemainingDistanceUpdated lambda.

Parameters
initialVelocity: Float

velocity available for fling in the orientation specified in androidx.compose.foundation.gestures.scrollable that invoked this method.

onRemainingDistanceUpdated: (Float) -> Unit

a lambda that will be called anytime the distance to the settling offset is updated. The settling offset is the final offset where this fling will stop and may change depending on the snapping animation progression.

Returns
Float

remaining velocity after fling operation has ended