rememberSwipeToDismissBoxState

Functions summary

SwipeToDismissBoxState
@Composable
rememberSwipeToDismissBoxState(
    initialValue: SwipeToDismissBoxValue,
    positionalThreshold: (totalDistance: Float) -> Float
)

Create and remember a SwipeToDismissBoxState.

Cmn
SwipeToDismissBoxState
@Composable
rememberSwipeToDismissBoxState(
    initialValue: SwipeToDismissBoxValue,
    confirmValueChange: (SwipeToDismissBoxValue) -> Boolean,
    positionalThreshold: (totalDistance: Float) -> Float
)

This function is deprecated. confirmValueChange is deprecated without replacement.

Cmn

Functions

rememberSwipeToDismissBoxState

@Composable
fun rememberSwipeToDismissBoxState(
    initialValue: SwipeToDismissBoxValue = SwipeToDismissBoxValue.Settled,
    positionalThreshold: (totalDistance: Float) -> Float = SwipeToDismissBoxDefaults.positionalThreshold
): SwipeToDismissBoxState

Create and remember a SwipeToDismissBoxState.

Parameters
initialValue: SwipeToDismissBoxValue = SwipeToDismissBoxValue.Settled

The initial value of the state.

positionalThreshold: (totalDistance: Float) -> Float = SwipeToDismissBoxDefaults.positionalThreshold

The positional threshold to be used when calculating the target state while a swipe is in progress and when settling after the swipe 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.

rememberSwipeToDismissBoxState

@Composable
fun rememberSwipeToDismissBoxState(
    initialValue: SwipeToDismissBoxValue = SwipeToDismissBoxValue.Settled,
    confirmValueChange: (SwipeToDismissBoxValue) -> Boolean = { true },
    positionalThreshold: (totalDistance: Float) -> Float = SwipeToDismissBoxDefaults.positionalThreshold
): SwipeToDismissBoxState

Create and remember a SwipeToDismissBoxState.

Parameters
initialValue: SwipeToDismissBoxValue = SwipeToDismissBoxValue.Settled

The initial value of the state.

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

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

positionalThreshold: (totalDistance: Float) -> Float = SwipeToDismissBoxDefaults.positionalThreshold

The positional threshold to be used when calculating the target state while a swipe is in progress and when settling after the swipe 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.