PullRefreshState
@ExperimentalMaterialApi
class PullRefreshState
internal constructor(
private val animationScope: CoroutineScope,
private val onRefreshState: State<() -> Unit>,
refreshingOffset: Float,
threshold: Float,
)
A state object that can be used in conjunction with pullRefresh
to add pull-to-refresh
behaviour to a scroll component. Based on Android's SwipeRefreshLayout.
Provides progress
, a float representing how far the user has pulled as a percentage of the
refreshThreshold. Values of one or less indicate that the user has not yet pulled past the
threshold. Values greater than one indicate how far past the threshold the user has pulled.
Can be used in conjunction with pullRefreshIndicatorTransform
to implement Android-like
pull-to-refresh behaviour with a custom indicator.
Should be created using rememberPullRefreshState
.
Properties
val progress
A float representing how far the user has pulled as a percentage of the refreshThreshold.
If the component has not been pulled at all, progress is zero. If the pull has reached halfway to the threshold, progress is 0.5f. A value greater than 1 indicates that pull has gone beyond the refreshThreshold - e.g. a value of 2f indicates that the user has pulled to two times the refreshThreshold.