I am implementing `BottomSheet` using `BottomDrawe...
# compose
a
I am implementing
BottomSheet
using
BottomDrawerLayout
but in doc it written that bottomDrawer is only used with bottom app bars. So, Is it okay to make bottomSheet using BottomDrawerLayout ?
m
I think BottomSheet will exist like a separate component. We don't have it now though. The idea is pretty similar to BottomDrawerLayout, so you can try. If you have any questions, or, more importantly, feedback -- hit me up 🙂
a
I tried making
BottomSheet
with
BottomDrawerLayout
but when ever I click on blank space bottomsheet closes. I want that it will only close by clicking cancel or save button.
I kept
gestureEnabled
false
m
I think you can try passing empty lambda to
onStateChange
a
But then how to change the state when cancel or save button is click ?
Cancel and save button will be inside my bottomSheet drawer. So, I only want to change the state when cancel and save button clicked.
m
By changing the state directly
a
Thanks, It is working.
👍 1
@matvei Is there anyway to resize the
BottomDrawerLayout
as
Persistant
or
Modal
bottomsheet or is there anyway to expand it to whole screen ?
Or is there anyway to make a new
activity
with custom size in compose ?
m
I'm not sure I understand the question, sorry. You want to open BottomSheet fullscreen instead of half of the screen right away?
I don't think we do anything special about Activities in compose, so second question is just pure Android activity question 🙂
a
My first question is there anyway to resize the
BottomDrawerLayout
m
The layout itself of just the sheet that is sliding from the bottom?
a
Yes, the layout itself
I want to resize
drawerContent
of BottomDrawer
m
I think it's forced to have surface that will take whole screen's width. That what material design says. What's your use case?
a
I want to resize height
For example, drawerContent show up. Let say it will occupied half-screen. Then user drag the drawerContent and now it will takes full-screen.
m
That's what it does right now, doesn't it?
a
I think we can't able to drag up the drawerContent to full-screen. When we change the state of
drawerState
to opened DrawerContent shows up and it will have a fixed height
m
Hm. I just checked it in my simple demo from BottomDrawerLayout sample. When you change drawerState to DrawerState.Open in open on half the screen, and then user can drag it and expand as full screen, and then close it or drag back to half. Is it not working for you?
a
Okay keeping gestureEnable true will allow it expand in full screen. But I want drawer open only when any click(trigger) occurs and then it will be dragged to full screen.
m
I think you can use
gestureEnabled
to achieve this behavior