Google is committed to advancing racial equity for Black communities. See how.

BottomDrawerState

class BottomDrawerState : SwipeableState<BottomDrawerValue>
kotlin.Any
   ↳ androidx.compose.material.SwipeableState<androidx.compose.material.BottomDrawerValue>
   ↳ androidx.compose.material.BottomDrawerState

State of the BottomDrawerLayout composable.

Summary

Public constructors
<init>(initialValue: BottomDrawerValue, clock: AnimationClockObservable, confirmStateChange: (BottomDrawerValue) -> Boolean = { true })

State of the BottomDrawerLayout composable.

Public methods
Unit
close(onClosed: () -> Unit = null)

Close the drawer with an animation.

Unit
expand(onExpanded: () -> Unit = null)

Expand the drawer with an animation.

Unit
open(onOpened: () -> Unit = null)

Open the drawer with an animation.

Companion functions
Saver<BottomDrawerState, BottomDrawerValue>
Saver(clock: AnimationClockObservable, confirmStateChange: (BottomDrawerValue) -> Boolean)

The default Saver implementation for BottomDrawerState.

Inherited functions
Properties
Boolean

Whether the drawer is closed.

Boolean

Whether the drawer is expanded.

Boolean

Whether the drawer is open.

Inherited properties

Public constructors

<init>

BottomDrawerState(
    initialValue: BottomDrawerValue,
    clock: AnimationClockObservable,
    confirmStateChange: (BottomDrawerValue) -> Boolean = { true })

State of the BottomDrawerLayout composable.

Parameters
initialValue: BottomDrawerValue The initial value of the state.
clock: AnimationClockObservable The animation clock that will be used to drive the animations.
confirmStateChange: (BottomDrawerValue) -> Boolean = { true } Optional callback invoked to confirm or veto a pending state change.

Public methods

close

fun close(onClosed: () -> Unit = null): Unit

Close the drawer with an animation.

Parameters
onClosed: () -> Unit = null Optional callback invoked when the drawer has finished closing.

expand

fun expand(onExpanded: () -> Unit = null): Unit

Expand the drawer with an animation.

Parameters
onExpanded: () -> Unit = null Optional callback invoked when the drawer has finished expanding.

open

fun open(onOpened: () -> Unit = null): Unit

Open the drawer with an animation.

Parameters
onOpened: () -> Unit = null Optional callback invoked when the drawer has finished opening.

Properties

isClosed

val isClosed: Boolean

Whether the drawer is closed.

isExpanded

val isExpanded: Boolean

Whether the drawer is expanded.

isOpen

val isOpen: Boolean

Whether the drawer is open.

Companion functions

Saver

fun Saver(
    clock: AnimationClockObservable,
    confirmStateChange: (BottomDrawerValue) -> Boolean
): Saver<BottomDrawerState, BottomDrawerValue>

The default Saver implementation for BottomDrawerState.