androidx.compose.material3.pulltorefresh

PullToRefreshState

Interface

No hand-written docs yet.

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

interface PullToRefreshState

How to get one

Create it

Ready-made values and functions that return it

Used by

Parameters that take a PullToRefreshState.

Properties

distanceFraction

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.

isAnimating

val isAnimating: Boolean

whether the state is currently animating the indicator to the threshold offset, or back to the hidden offset

Functions

animateToThreshold

fun animateToThreshold()

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

animateToHidden

fun animateToHidden()

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

snapTo

fun snapTo(targetValue: Float)

Snap the indicator to the desired threshold fraction

Library docs

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: