BackdropScaffoldState


State of the BackdropScaffold composable.

Summary

Public companion functions

Saver<BackdropScaffoldState, *>
Saver(
    animationSpec: AnimationSpec<Float>,
    confirmStateChange: (BackdropValue) -> Boolean,
    snackbarHostState: SnackbarHostState,
    density: Density
)

The default Saver implementation for BackdropScaffoldState.

Cmn

Public constructors

BackdropScaffoldState(
    initialValue: BackdropValue,
    animationSpec: AnimationSpec<Float>,
    confirmValueChange: (BackdropValue) -> Boolean,
    snackbarHostState: SnackbarHostState
)

This function is deprecated. This constructor is deprecated.

Cmn

Public functions

suspend Unit

Conceal the back layer with animation and suspend until it if fully concealed or animation has been cancelled.

Cmn
@FloatRange(from = 0.0, to = 1.0) Float

The fraction of the offset between from and to, as a fraction between 0f..1f, or 1f if from is equal to to.

Cmn
Float

Require the current offset.

Cmn
suspend Unit

Reveal the back layer with animation and suspend until it if fully revealed or animation has been cancelled.

Cmn

Public properties

(BackdropValue) -> Boolean

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

Cmn
BackdropValue

The current value of the BottomSheetState.

Cmn
Boolean

Whether the back layer is concealed.

Cmn
Boolean

Whether the back layer is revealed.

Cmn
SnackbarHostState

The SnackbarHostState used to show snackbars inside the scaffold.

Cmn
BackdropValue

The target value the state will settle at once the current interaction ends, or the currentValue if there is no interaction in progress.

Cmn

Public companion functions

Saver

fun Saver(
    animationSpec: AnimationSpec<Float>,
    confirmStateChange: (BackdropValue) -> Boolean,
    snackbarHostState: SnackbarHostState,
    density: Density
): Saver<BackdropScaffoldState, *>

The default Saver implementation for BackdropScaffoldState.

Public constructors

BackdropScaffoldState

BackdropScaffoldState(
    initialValue: BackdropValue,
    animationSpec: AnimationSpec<Float> = BackdropScaffoldDefaults.AnimationSpec,
    confirmValueChange: (BackdropValue) -> Boolean = { true },
    snackbarHostState: SnackbarHostState = SnackbarHostState()
)
Parameters
initialValue: BackdropValue

The initial value of the state.

animationSpec: AnimationSpec<Float> = BackdropScaffoldDefaults.AnimationSpec

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

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

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

snackbarHostState: SnackbarHostState = SnackbarHostState()

The SnackbarHostState used to show snackbars inside the scaffold.

Public functions

conceal

suspend fun conceal(): Unit

Conceal the back layer with animation and suspend until it if fully concealed or animation has been cancelled. This method will throw CancellationException if the animation is interrupted

progress

fun progress(from: BackdropValue, to: BackdropValue): @FloatRange(from = 0.0, to = 1.0) Float

The fraction of the offset between from and to, as a fraction between 0f..1f, or 1f if from is equal to to.

Parameters
from: BackdropValue

The starting value used to calculate the distance

to: BackdropValue

The end value used to calculate the distance

requireOffset

fun requireOffset(): Float

Require the current offset.

Throws
kotlin.IllegalStateException

If the offset has not been initialized yet

reveal

suspend fun reveal(): Unit

Reveal the back layer with animation and suspend until it if fully revealed or animation has been cancelled. This method will throw CancellationException if the animation is interrupted

Public properties

confirmValueChange

val confirmValueChange: (BackdropValue) -> Boolean

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

currentValue

val currentValueBackdropValue

The current value of the BottomSheetState.

isConcealed

val isConcealedBoolean

Whether the back layer is concealed.

isRevealed

val isRevealedBoolean

Whether the back layer is revealed.

snackbarHostState

val snackbarHostStateSnackbarHostState

The SnackbarHostState used to show snackbars inside the scaffold.

targetValue

val targetValueBackdropValue

The target value the state will settle at once the current interaction ends, or the currentValue if there is no interaction in progress.