Pull To Refresh
A container that supports the "pull-to-refresh" gesture.
This composable follows a hoisted state pattern, where the logical isRefreshing state is managed by the caller (e.g., a ViewModel). It coordinates nested scrolling to enable a pull-to-refresh action, displays a customizable indicator, and triggers a callback when a refresh is requested.
Parameters
A boolean state representing whether a refresh is currently in progress. This state should be hoisted and is the source of truth for the refresh operation.
A lambda to be invoked when a refresh is triggered by the user. This lambda should initiate the data loading and is responsible for eventually setting isRefreshing back to false upon completion.
The modifier to be applied to this container.
The state object that manages the UI and animations of the indicator. See rememberPullToRefreshState.
The padding to be applied to the content. The top padding is used to correctly offset the refresh indicator.
An optional ScrollBehavior for a TopAppBar to coordinate scrolling between the app bar and the pull-to-refresh gesture.
The color of the refresh indicator.
The size of the refresh indicator's animated circle.
A list of strings representing the text shown in different states.
The TextStyle for the refresh indicator text.
The content to be displayed inside the container.