Is there any easy way to hide bottom sheet complet...
# compose
s
Is there any easy way to hide bottom sheet completely not just half collapse?
r
set the peekHeight to 0.dp
sheetPeekHeight=0.dp
inside
BottomSheetScaffold
calling
bottomSheetState.collapse()
after that will hide it completely
s
Thanks, But I tried setting peekHeight to 0.dp, now when i call expand It doesn't show don,t know it a bug or not.
a
Are you calling expand in a coroutine scope
I've recently used it and it worked properly
m
Check here https://twitter.com/manueldidonna/status/1365421315524591620?s=19 I've done something similar to your usecase. I have used a bottom sheet with 3 states: hidden, collapsed and expanded https://github.com/manueldidonna/puppy-finder
👍 1
r
The
expand()
function on the bottomSheetScaffoldState will only work properly inside the
rememberCoroutineScope
@manueldidonna The default bottomsheet only has two states, Collapsed and Expanded.
m
@Rafs yeah, I set the peek height to 0.dp when I need to hide the bottosheet
s
@manueldidonna Thanks, I will try it.
r
@manueldidonna You may not get the animation if you store the peekheight as a state and modify it
m
@Rafs take a look to the video demonstration that I posted on twitter