androidx.compose.material3

SheetStateExperimental

Class

No hand-written docs yet.

State of a sheet composable, such as ModalBottomSheet

class SheetState

How to get one

Ready-made values and functions that return it

Used by

Parameters that take a SheetState.

Properties

currentValue

val currentValue: SheetValue

The current value of the state.

targetValue

val targetValue: SheetValue

The target value of the bottom sheet state.

isVisible

val isVisible: Boolean

Whether the modal bottom sheet is visible.

isAnimationRunningSince 1.9

val isAnimationRunning: Boolean

Whether an expanding or collapsing sheet animation is currently in progress.

hasExpandedState

val hasExpandedState: Boolean

Whether the sheet has an expanded state defined.

hasPartiallyExpandedState

val hasPartiallyExpandedState: Boolean

Whether the modal bottom sheet has a partially expanded state defined.

Functions

requireOffset

fun requireOffset(): Float

Require the current offset (in pixels) of the bottom sheet.

expand

fun expand()

If confirmValueChange returns true, fully expand the bottom sheet with animation and suspend until it is fully expanded or animation has been cancelled.

partialExpand

fun partialExpand()

If confirmValueChange returns true, animate the bottom sheet and suspend until it is partially expanded or animation has been cancelled.

show

fun show()

If confirmValueChange returns true, expand the bottom sheet with animation and suspend until it is PartiallyExpanded if defined, else Expanded.

hide

fun hide()

If confirmValueChange returns true, hide the bottom sheet with animation and suspend until it is fully hidden or animation has been cancelled.

Saver

fun Saver(
    enabledValues: Set<SheetValue>,
    positionalThreshold: () -> Float,
    velocityThreshold: () -> Float,
    confirmValueChange: (SheetValue) -> Boolean,
): Saver<SheetState, SheetValue>

The default Saver implementation for SheetState.

Library docs

State of a sheet composable, such as ModalBottomSheet

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