object PullToRefreshDefaults
Contains the default values for PullToRefreshBox
Properties
Deprecated Use indicatorShape instead
val shape: Shape
The default shape for Indicator
val indicatorShape: Shape
The default shape for Indicator
Deprecated Use indicatorContainerColor instead
val containerColor: Color
The default container color for Indicator
val indicatorContainerColor: Color
The default container color for Indicator
val loadingIndicatorContainerColor: Color
The default container color for the loading indicator that appears when pulling to refresh.
val indicatorColor: Color
The default indicator color for Indicator
val loadingIndicatorColor: Color
The default active indicator color for the loading indicator that appears when pulling to refresh.
val PositionalThreshold = 80.dp
The default refresh threshold for rememberPullToRefreshState
val IndicatorMaxDistance = PositionalThreshold
The default maximum distance Indicator, IndicatorBox and LoadingIndicator can be pulled before a refresh is triggered.
val Elevation = ElevationTokens.Level2
The default elevation for an IndicatorBox that is applied to an Indicator
val LoadingIndicatorElevation = ElevationTokens.Level0
The default elevation for an IndicatorBox that is applied to a LoadingIndicator
Functions
IndicatorBox
@Composable
fun IndicatorBox(
state: PullToRefreshState,
isRefreshing: Boolean,
modifier: Modifier = Modifier,
maxDistance: Dp = IndicatorMaxDistance,
shape: Shape = indicatorShape,
containerColor: Color = Color.Unspecified,
elevation: Dp = Elevation,
content: @Composable BoxScope.() -> Unit,
)
A Wrapper that handles the size, offset, clipping, shadow, and background drawing for a pull-to-refresh indicator, useful when implementing custom indicators. PullToRefreshDefaults.Indicator uses this as the container.
Parameters
| state | the state of this modifier, will use state.distanceFraction and maxDistance to calculate the offset |
| isRefreshing | whether a refresh is occurring |
| modifier | the modifier applied to this layout |
| maxDistance | the max distance the indicator can be pulled down before a refresh is triggered on release |
| shape | the Shape of this indicator |
| containerColor | the container color of this indicator |
| elevation | the elevation for the indicator |
| content | content for this IndicatorBox |
Indicator
@Composable
fun Indicator(
state: PullToRefreshState,
isRefreshing: Boolean,
modifier: Modifier = Modifier,
containerColor: Color = this.indicatorContainerColor,
color: Color = this.indicatorColor,
maxDistance: Dp = IndicatorMaxDistance,
)
The default indicator for PullToRefreshBox.
Parameters
| state | the state of this modifier, will use state.distanceFraction and maxDistance to calculate the offset |
| isRefreshing | whether a refresh is occurring |
| modifier | the modifier applied to this layout |
| containerColor | the container color of this indicator |
| color | the color of this indicator |
| maxDistance | the max distance the indicator can be pulled down before a refresh is triggered on release |
LoadingIndicator
@Composable
fun LoadingIndicator(
state: PullToRefreshState,
isRefreshing: Boolean,
modifier: Modifier = Modifier,
containerColor: Color = this.loadingIndicatorContainerColor,
color: Color = this.loadingIndicatorColor,
elevation: Dp = LoadingIndicatorElevation,
maxDistance: Dp = IndicatorMaxDistance,
)
A LoadingIndicator indicator for PullToRefreshBox.
Parameters
| state | the state of this modifier, will use state.distanceFraction and maxDistance to calculate the offset |
| isRefreshing | whether a refresh is occurring |
| modifier | the modifier applied to this layout |
| containerColor | the container color of this indicator |
| color | the color of this indicator |
| elevation | the elevation of this indicator |
| maxDistance | the max distance the indicator can be pulled down before a refresh is triggered on release |