Michael Marshall
06/21/2024, 11:34 AMBottomSheetScaffold
just act normal? I can't find any combination of sheetPeekHeight
, scaffoldState
and skipHiddenState
that give you a normal behaviour (note: I'm not looking for a modal sheet).
The bottom sheet should:
1. Begin hidden (or not even in the Composition, if need be?)
2. Open to a half a partially expanded height of 400dp I can set - I'm assuming through sheetPeekHeight
- after I click something
3. Can be dragged to fully expanded
4. Can be hidden by dragging closed, pressing a close button, or tapping outside the bottomsheet
At the moment I can achieve everything, except the peek height is always 0dp or always 400dp, depending on the initial value. I've tried using derivedStateOf
for the peek height but that's not working either 🤔
val peekHeight by remember {
derivedStateOf {
// Neither of these work
if (viewState.selectedChat != null) 400.dp else 0.dp
if (bottomSheetScaffoldState.bottomSheetState.currentValue == SheetValue.PartiallyExpanded) 400.dp else 0.dp
}
BottomSheetScaffold(
scaffoldState = bottomSheetScaffoldState,
sheetPeekHeight = peekHeight,
sheetContent = {
viewState.selectedChat?.let { chat ->
ChatDetailsBottomSheetContent()
}
},
content = { }
)
Michael Marshall
06/21/2024, 12:35 PM