Package-level declarations

Types

Link copied to clipboard

Contains the default values for PullToRefreshBox

Link copied to clipboard
@Stable
interface PullToRefreshState

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

Functions

Link copied to clipboard
fun Modifier.pullToRefresh(isRefreshing: Boolean, state: PullToRefreshState, enabled: Boolean = true, threshold: Dp = PullToRefreshDefaults.PositionalThreshold, onRefresh: () -> Unit): Modifier

A Modifier that adds nested scroll to a container to support a pull-to-refresh gesture. When the user pulls a distance greater than threshold and releases the gesture, onRefresh is invoked. PullToRefreshBox applies this automatically.

Link copied to clipboard
@Composable
fun PullToRefreshBox(isRefreshing: Boolean, onRefresh: () -> Unit, modifier: Modifier = Modifier, state: PullToRefreshState = rememberPullToRefreshState(), contentAlignment: Alignment = Alignment.TopStart, indicator: @Composable BoxScope.() -> Unit = { Indicator( modifier = Modifier.align(Alignment.TopCenter), isRefreshing = isRefreshing, state = state ) }, content: @Composable BoxScope.() -> Unit)

PullToRefreshBox is a container that expects a scrollable layout as content and adds gesture support for manually refreshing when the user swipes downward at the beginning of the content. By default, it uses PullToRefreshDefaults.Indicator as the refresh indicator.

Link copied to clipboard
fun Modifier.pullToRefreshIndicator(state: PullToRefreshState, isRefreshing: Boolean, threshold: Dp = PullToRefreshDefaults.PositionalThreshold, shape: Shape = PullToRefreshDefaults.shape, containerColor: Color = Color.Unspecified, elevation: Dp = PullToRefreshDefaults.Elevation): Modifier

A Modifier that handles the size, offset, clipping, shadow, and background drawing of a pull-to-refresh indicator, useful when implementing custom indicators. PullToRefreshDefaults.Indicator applies this automatically.

Link copied to clipboard

Create and remember the default PullToRefreshState.