Compose Modifier

pullRefreshIndicatorTransform

A modifier for translating the position and scaling the size of a pull-to-refresh indicator based on the given [PullRefreshState].

pullRefreshIndicatorTransform

Common
@ExperimentalMaterialApi
fun Modifier.pullRefreshIndicatorTransform(state: PullRefreshState, scale: Boolean = false) =
    drawWithContent {
            clipRect(
                top = 0f,
                left = -Float.MAX_VALUE,
                right = Float.MAX_VALUE,
                bottom = Float.MAX_VALUE,
            ) {
                [email protected]()
            }
        }
        .graphicsLayer {
            translationY = state.position - size.height

            if (scale && !state.refreshing) {
                val scaleFraction =
                    LinearOutSlowInEasing.transform(state.position / state.threshold)
                        .fastCoerceIn(0f, 1f)
                scaleX = scaleFraction
                scaleY = scaleFraction
            }
        }

A modifier for translating the position and scaling the size of a pull-to-refresh indicator based on the given PullRefreshState.

Parameters

state The PullRefreshState which determines the position of the indicator.
scale A boolean controlling whether the indicator's size scales with pull progress or not.