DeKekem
DeKekem

Reputation: 1743

keep ModalBottomSheet expanded compose

I have the following code for my bottom sheet.

val skipPartiallyExpanded by remember {
    mutableStateOf(true)
}
val bottomSheetState =
    rememberModalBottomSheetState(skipPartiallyExpanded = skipPartiallyExpanded)

    ModalBottomSheet(
        onDismissRequest = {
            onDismissRequest()
            onSearchTextChange("")
        },
        sheetState = bottomSheetState,
    )

I want to keep the bottom sheet expanded at all time, but it gets smaller whenever the content gets smaller too. I thought that setting skipPartiallyExpanded to true would do the trick, but it is not working as I would expect.

Upvotes: 3

Views: 4810

Answers (1)

DeKekem
DeKekem

Reputation: 1743

I solve the problem by making the content of the bottom sheet fill the max size.

modifier = modifier.fillMaxSize()

And of course skipPartiallyExpanded is always true

val bottomSheetState =
    rememberModalBottomSheetState(skipPartiallyExpanded = true)

Upvotes: 18

Related Questions