SwipeToDismissBoxState

Class

Android

Deprecated SwipeToDismissBoxState has been migrated, please import it from androidx.wear.compose.foundation.

public class SwipeToDismissBoxState(
    animationSpec: AnimationSpec<Float> = SwipeToDismissBoxDefaults.AnimationSpec,
    confirmStateChange: (SwipeToDismissValue) -> Boolean = { true },
)

State for SwipeToDismissBox.

Parameters

animationSpecThe default animation that will be used to animate to a new state.
confirmStateChangeOptional callback invoked to confirm or veto a pending state change.

Functions

public suspend fun snapTo(targetValue: SwipeToDismissValue): Unit

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

Parameters

targetValueThe new target value to set currentValue to.