DismissibleModalWideNavigationRailState


State of a dismissible modal wide navigation rail, such as DismissibleModalWideNavigationRail.

Contains states relating to its swipe position as well as animations between state values.

Summary

Public companion functions

Saver<DismissibleModalWideNavigationRailStateDismissibleModalWideNavigationRailValue>
Saver(
    density: Density,
    animationSpec: AnimationSpec<Float>,
    confirmStateChange: (DismissibleModalWideNavigationRailValue) -> Boolean
)

The default Saver implementation for DismissibleModalWideNavigationRailState.

Cmn

Public constructors

DismissibleModalWideNavigationRailState(
    initialValue: DismissibleModalWideNavigationRailValue,
    density: Density,
    animationSpec: AnimationSpec<Float>,
    confirmValueChange: (DismissibleModalWideNavigationRailValue) -> Boolean
)
Cmn

Public functions

suspend Unit

Close the dismissible modal wide navigation rail with animation and suspend until it is fully closed or the animation has been cancelled.

Cmn
suspend Unit

Open the dismissible modal wide navigation rail with animation and suspend until it if fully open or the animation has been cancelled.

Cmn
suspend Unit

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

Cmn

Public properties

AnimationSpec<Float>

The animation spec that will be used to animate to a new state

Cmn
(DismissibleModalWideNavigationRailValue) -> Boolean

Optional callback invoked to confirm or veto a pending state change

Cmn
Float

The current position (in pixels) of the rail, or Float.NaN before the offset is initialized.

Cmn
DismissibleModalWideNavigationRailValue

The current value of the state.

Cmn
DismissibleModalWideNavigationRailValue

The initial value of the state

Cmn
Boolean

Whether the state is currently animating.

Cmn
Boolean

Whether the dismissible modal wide navigation rail is open.

Cmn
DismissibleModalWideNavigationRailValue

The target value of the dismissible modal wide navigation rail state.

Cmn

Public companion functions

Saver

fun Saver(
    density: Density,
    animationSpec: AnimationSpec<Float>,
    confirmStateChange: (DismissibleModalWideNavigationRailValue) -> Boolean
): Saver<DismissibleModalWideNavigationRailStateDismissibleModalWideNavigationRailValue>

The default Saver implementation for DismissibleModalWideNavigationRailState.

Public constructors

DismissibleModalWideNavigationRailState

DismissibleModalWideNavigationRailState(
    initialValue: DismissibleModalWideNavigationRailValue,
    density: Density,
    animationSpec: AnimationSpec<Float>,
    confirmValueChange: (DismissibleModalWideNavigationRailValue) -> Boolean = { true }
)
Parameters
initialValue: DismissibleModalWideNavigationRailValue

The initial value of the state

density: Density

The density that this state can use to convert values to and from dp

animationSpec: AnimationSpec<Float>

The animation spec that will be used to animate to a new state

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

Optional callback invoked to confirm or veto a pending state change

Public functions

close

suspend fun close(): Unit

Close the dismissible modal wide navigation rail with animation and suspend until it is fully closed or the animation has been cancelled. This method will throw CancellationException if the animation interrupted.

Returns
Unit

the reason the collapse animation ended

open

suspend fun open(): Unit

Open the dismissible modal wide navigation rail with animation and suspend until it if fully open or the animation has been cancelled. This method will throw CancellationException if the animation is interrupted.

Returns
Unit

the reason the expand animation ended

snapTo

suspend fun snapTo(targetValue: DismissibleModalWideNavigationRailValue): Unit

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

Parameters
targetValue: DismissibleModalWideNavigationRailValue

The new target value

Public properties

animationSpec

val animationSpecAnimationSpec<Float>

The animation spec that will be used to animate to a new state

confirmValueChange

var confirmValueChange: (DismissibleModalWideNavigationRailValue) -> Boolean

Optional callback invoked to confirm or veto a pending state change

currentOffset

val currentOffsetFloat

The current position (in pixels) of the rail, or Float.NaN before the offset is initialized.

See also
offset

for more information.

currentValue

val currentValueDismissibleModalWideNavigationRailValue

The current value of the state.

If no swipe or animation is in progress, this corresponds to the value the dismissible modal wide navigation rail is currently in. If a swipe or an animation is in progress, this corresponds to the value the rail was in before the swipe or animation started.

initialValue

var initialValueDismissibleModalWideNavigationRailValue

The initial value of the state

isAnimationRunning

val isAnimationRunningBoolean

Whether the state is currently animating.

isOpen

val isOpenBoolean

Whether the dismissible modal wide navigation rail is open.

targetValue

val targetValueDismissibleModalWideNavigationRailValue

The target value of the dismissible modal wide navigation rail state.

If a swipe is in progress, this is the value that the modal rail will animate to if the swipe finishes. 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.