rememberRevealState

Composable Function

Android
@SuppressLint("PrimitiveInCollection")
@ExperimentalWearMaterialApi
@Composable
public fun rememberRevealState(
    initialValue: RevealValue = RevealValue.Covered,
    animationSpec: AnimationSpec<Float> = SwipeToRevealDefaults.AnimationSpec,
    confirmValueChange: (RevealValue) -> Boolean = { true },
    positionalThreshold: (totalDistance: Float) -> Float =
        SwipeToRevealDefaults.PositionalThreshold,
    anchors: Map<RevealValue, Float> = createRevealAnchors(),
): RevealState

Create and remember a RevealState.

Parameters

initialValueThe initial value of the RevealValue.
animationSpecThe animation which will be applied on the top content.
confirmValueChangeOptional callback invoked to confirm or veto a pending state change.
positionalThresholdThe positional threshold to be used when calculating the target state while the reveal is in progress and when settling after the revealing ends. This is the distance from the start of a transition. It will be, depending on the direction of the interaction, added or subtracted from/to the origin offset. It should always be a positive value.
anchorsA map of RevealValue to the fraction where the content can be revealed to reach that value. Each anchor should be between 0..1 which will be adjusted based on total width.