rememberModalBottomSheetState

Functions summary

ModalBottomSheetState
@Composable
rememberModalBottomSheetState(
    initialValue: ModalBottomSheetValue,
    animationSpec: AnimationSpec<Float>,
    confirmValueChange: (ModalBottomSheetValue) -> Boolean,
    skipHalfExpanded: Boolean
)

Create a ModalBottomSheetState and remember it.

Cmn

Functions

rememberModalBottomSheetState

@Composable
fun rememberModalBottomSheetState(
    initialValue: ModalBottomSheetValue,
    animationSpec: AnimationSpec<Float> = ModalBottomSheetDefaults.AnimationSpec,
    confirmValueChange: (ModalBottomSheetValue) -> Boolean = { true },
    skipHalfExpanded: Boolean = false
): ModalBottomSheetState

Create a ModalBottomSheetState and remember it.

Parameters
initialValue: ModalBottomSheetValue

The initial value of the state.

animationSpec: AnimationSpec<Float> = ModalBottomSheetDefaults.AnimationSpec

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

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

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

skipHalfExpanded: Boolean = false

Whether the half expanded state, if the sheet is tall enough, should be skipped. If true, the sheet will always expand to the Expanded state and move to the Hidden state when hiding the sheet, either programmatically or by user interaction. Must not be set to true if the initialValue is ModalBottomSheetValue.HalfExpanded. If supplied with ModalBottomSheetValue.HalfExpanded for the initialValue, an IllegalArgumentException will be thrown.