PullToRefreshState

@Stable
interface PullToRefreshState

The state of a PullToRefreshBox which tracks the distance that the container and indicator have been pulled.

Each instance of PullToRefreshBox should have its own PullToRefreshState.

PullToRefreshState can be used with other progress indicators like so:

Samples

androidx.compose.material3.samples.PullToRefreshLinearProgressIndicatorSample

Properties

Link copied to clipboard
@get:FloatRange(from = 0.0)
abstract val distanceFraction: Float

Distance percentage towards the refresh threshold. 0.0 indicates no distance, 1.0 indicates being at the threshold offset, 1.0 indicates overshoot beyond the provided threshold.

Link copied to clipboard

Whether the state is currently animating

Functions

Link copied to clipboard
abstract suspend fun animateToHidden()

Animate the distance towards the position where the indicator will be hidden when idle

Link copied to clipboard
abstract suspend fun animateToThreshold()

Animate the distance towards the anchor or threshold position, where the indicator will be shown when refreshing.

Link copied to clipboard
abstract suspend fun snapTo(@FloatRange(from = 0.0) targetValue: Float)

Snap the indicator to the desired threshold fraction