SheetState

@Stable
class SheetState(skipPartiallyExpanded: Boolean, density: Density, initialValue: SheetValue = Hidden, confirmValueChange: (SheetValue) -> Boolean = { true }, skipHiddenState: Boolean = false)

State of a sheet composable, such as ModalBottomSheet

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

Parameters

skipPartiallyExpanded

Whether the partially expanded state, if the sheet is large enough, should be skipped. If true, the sheet will always expand to the Expanded state and move to the Hidden state if available when hiding the sheet, either programmatically or by user interaction.

initialValue

The initial value of the state.

density

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

confirmValueChange

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

skipHiddenState

Whether the hidden state should be skipped. If true, the sheet will always expand to the Expanded state and move to the PartiallyExpanded if available, either programmatically or by user interaction.

Constructors

Link copied to clipboard
constructor(skipPartiallyExpanded: Boolean, density: Density, initialValue: SheetValue = Hidden, confirmValueChange: (SheetValue) -> Boolean = { true }, skipHiddenState: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The current value of the state.

Link copied to clipboard

Whether the sheet has an expanded state defined.

Link copied to clipboard

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

Link copied to clipboard

Whether the modal bottom sheet is visible.

Link copied to clipboard

The target value of the bottom sheet state.

Functions

Link copied to clipboard
suspend fun expand()

Fully expand the bottom sheet with animation and suspend until it is fully expanded or animation has been cancelled.

Link copied to clipboard
suspend fun hide()

Hide the bottom sheet with animation and suspend until it is fully hidden or animation has been cancelled.

Link copied to clipboard
suspend fun partialExpand()

Animate the bottom sheet and suspend until it is partially expanded or animation has been cancelled.

Link copied to clipboard

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

Link copied to clipboard
suspend fun show()

Expand the bottom sheet with animation and suspend until it is PartiallyExpanded if defined else Expanded.