🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

DismissState

State of the SwipeToDismiss composable.

Source set: Common
public class DismissState(
    initialValue: DismissValue,
    confirmStateChange: (DismissValue) -> Boolean = { true },
) : SwipeableState<DismissValue>(initialValue, confirmStateChange = confirmStateChange)

State of the SwipeToDismiss composable.

Parameters

initialValue The initial value of the state.
confirmStateChange Optional callback invoked to confirm or veto a pending state change.

Properties

dismissDirection

Source set: Common
public val dismissDirection: DismissDirection?

The direction (if any) in which the composable has been or is being dismissed.

If the composable is settled at the default state, then this will be null. Use this to change the background of the SwipeToDismiss if you want different actions on each side.

Functions

isDismissed

Source set: Common
public fun isDismissed(direction: DismissDirection): Boolean

Whether the component has been dismissed in the given direction.

Parameters

direction The dismiss direction.

reset

Source set: Common
public suspend fun reset(): Unit

Reset the component to the default position with animation and suspend until it if fully reset or animation has been cancelled. This method will throw CancellationException if the animation is interrupted

Return

the reason the reset animation ended

dismiss

Source set: Common
public suspend fun dismiss(direction: DismissDirection)

Dismiss the component in the given direction, with an animation and suspend. This method will throw CancellationException if the animation is interrupted

Parameters

direction The dismiss direction.

Members

Companion

Source set: Common
public companion object

Functions

Saver

Source set: Common
public fun Saver(
            confirmStateChange: (DismissValue) -> Boolean
        ): Saver<DismissState, DismissValue>

The default Saver implementation for DismissState.