rememberRevealState

Functions summary

RevealState
@ExperimentalWearFoundationApi
@Composable
rememberRevealState(
    initialValue: RevealValue,
    animationSpec: AnimationSpec<Float>,
    confirmValueChange: (RevealValue) -> Boolean,
    positionalThreshold: (totalDistance: Float) -> Float,
    anchors: Map<RevealValueFloat>
)

This function is deprecated. The SwipeToReveal component from the latest material library should be used instead.

Functions

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

Create and remember a RevealState.

Parameters
initialValue: RevealValue = RevealValue.Covered

The initial value of the RevealValue.

animationSpec: AnimationSpec<Float> = SwipeToRevealDefaults.AnimationSpec

The animation which will be applied on the top content.

confirmValueChange: (RevealValue) -> Boolean = { true }

Optional callback invoked to confirm or veto a pending state change.

positionalThreshold: (totalDistance: Float) -> Float = SwipeToRevealDefaults.PositionalThreshold

The 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.

anchors: Map<RevealValueFloat> = createRevealAnchors()

A 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.