SwipeToDismissBoxState

class SwipeToDismissBoxState


State for SwipeToDismissBox.

Summary

Public constructors

SwipeToDismissBoxState(
    animationSpec: AnimationSpec<Float>,
    confirmStateChange: (SwipeToDismissValue) -> Boolean
)

This function is deprecated. SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

Public functions

suspend Unit

This function is deprecated. SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

Public properties

SwipeToDismissValue

This property is deprecated. SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

Boolean

This property is deprecated. SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

SwipeToDismissValue

This property is deprecated. SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

Public constructors

SwipeToDismissBoxState

Added in 1.0.0
Deprecated in 1.4.0
SwipeToDismissBoxState(
    animationSpec: AnimationSpec<Float> = SwipeToDismissBoxDefaults.AnimationSpec,
    confirmStateChange: (SwipeToDismissValue) -> Boolean = { true }
)
Parameters
animationSpec: AnimationSpec<Float> = SwipeToDismissBoxDefaults.AnimationSpec

The default animation that will be used to animate to a new state.

confirmStateChange: (SwipeToDismissValue) -> Boolean = { true }

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

Public functions

snapTo

Added in 1.0.0
Deprecated in 1.4.0
suspend fun snapTo(targetValue: SwipeToDismissValue): Unit

Set the state without any animation and suspend until it's set

Parameters
targetValue: SwipeToDismissValue

The new target value to set currentValue to.

Public properties

currentValue

Added in 1.0.0
Deprecated in 1.4.0
val currentValueSwipeToDismissValue

The current value of the state.

Before and during a swipe, corresponds to SwipeToDismissValue.Default, then switches to SwipeToDismissValue.Dismissed if the swipe has been completed.

isAnimationRunning

Added in 1.0.0
Deprecated in 1.4.0
val isAnimationRunningBoolean

Whether the state is currently animating.

targetValue

Added in 1.0.0
Deprecated in 1.4.0
val targetValueSwipeToDismissValue

The target value of the state.

If a swipe is in progress, this is the value that the state would animate to if the swipe finished. If an animation is running, this is the target value of that animation. Finally, if no swipe or animation is in progress, this is the same as the currentValue.