SpatialScrollBehavior

@Stable
class SpatialScrollBehavior(springParams: SpatialSpringParams = SpatialSpringParams(), flingParams: SpatialFlingParams = SpatialFlingParams(), scope: CoroutineScope) : FlingBehavior, OverscrollEffect

A custom FlingBehavior and OverscrollEffect implementation that simulates a spring-like behavior when scrolling past the boundaries of the content.

This implementation separates the physics engine from the platform defaults, allowing for customizable fling decay and spring back animations.

Constructors

Link copied to clipboard
constructor(springParams: SpatialSpringParams = SpatialSpringParams(), flingParams: SpatialFlingParams = SpatialFlingParams(), scope: CoroutineScope)

Properties

Link copied to clipboard

Remaining vertical velocity captured when fling reaches a scroll boundary.

Link copied to clipboard

Remaining horizontal velocity captured when fling reaches a scroll boundary.

Link copied to clipboard

Maximum vertical overscroll offset recorded during the latest interaction.

Link copied to clipboard

Maximum horizontal overscroll offset recorded during the latest interaction.

Link copied to clipboard

Vertical fling velocity received when the latest fling was released.

Link copied to clipboard

Horizontal fling velocity received when the latest fling was released.

Link copied to clipboard
var isDownOrRightSwipe: Boolean

Whether the latest vertical fling direction was downward.

Link copied to clipboard
open override val isInProgress: Boolean
Link copied to clipboard
var isRightSwipeX: Boolean

Whether the latest horizontal fling direction was rightward.

Link copied to clipboard
open override val node: DelegatableNode

Functions

Link copied to clipboard
open suspend override fun applyToFling(velocity: Velocity, performFling: suspend (Velocity) -> Velocity)
Link copied to clipboard
open override fun applyToScroll(delta: Offset, source: NestedScrollSource, performScroll: (Offset) -> Offset): Offset
Link copied to clipboard
open suspend override fun ScrollScope.performFling(initialVelocity: Float): Float