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
| animationSpec | The default animation that will be used to animate to a new state. |
| confirmStateChange | Optional callback invoked to confirm or veto a pending state change. |
Properties
currentValue
public val currentValue: SwipeToDismissValue
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.
targetValue
public val targetValue: SwipeToDismissValue
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.
isAnimationRunning
public val isAnimationRunning: Boolean
Whether the state is currently animating.
foundationState
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public val foundationState: androidx.wear.compose.foundation.SwipeToDismissBoxState
Foundation version of the SwipeToDismissBoxState.
Functions
snapTo
public suspend fun snapTo(targetValue: SwipeToDismissValue): Unit
Set the state without any animation and suspend until it's set
Parameters
| targetValue | The new target value to set currentValue to. |