androidx.compose.material3
DrawerState
Class
No hand-written docs yet.
State of the ModalNavigationDrawer and DismissibleNavigationDrawer composable.
class DrawerState(
initialValue: DrawerValue,
confirmStateChange: (DrawerValue) -> Boolean = { true },
)
How to get one
Create it
DrawerState(initialValue, confirmStateChange)constructor
Ready-made values and functions that return it
Used by
Parameters that take a DrawerState.
DismissibleDrawerSheet(drawerState)DismissibleNavigationDrawer(drawerState)ModalDrawerSheet(drawerState)ModalNavigationDrawer(drawerState)
Properties
isOpen
val isOpen: Boolean
Whether the drawer is open.
isClosed
val isClosed: Boolean
Whether the drawer is closed.
currentValue
val currentValue: DrawerValue
The current value of the state.
isAnimationRunning
val isAnimationRunning: Boolean
Whether the state is currently animating.
targetValue
val targetValue: DrawerValue
The target value of the drawer state.
currentOffset
val currentOffset: Float
The current position (in pixels) of the drawer sheet, or Float.NaN before the offset is initialized.
Functions
open
fun open(): AnimationResult<T, V>
Open the drawer with animation and suspend until it if fully opened or animation has been cancelled. This method will throw CancellationException if the animation is interrupted
close
fun close(): AnimationResult<T, V>
Close the drawer with animation and suspend until it if fully closed or animation has been cancelled. This method will throw CancellationException if the animation is interrupted
snapTo
fun snapTo(targetValue: DrawerValue)
Set the state without any animation and suspend until it's set
Saver
fun Saver(confirmStateChange: (DrawerValue) -> Boolean): Saver
The default Saver implementation for DrawerState.
Library docs
State of the ModalNavigationDrawer and DismissibleNavigationDrawer composable.