https://kotlinlang.org logo
#compose
Title
# compose
a

amar_1995

01/14/2020, 11:24 AM
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

matvei

01/14/2020, 11:42 AM
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

amar_1995

01/14/2020, 12:08 PM
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

matvei

01/14/2020, 12:09 PM
I think you can try passing empty lambda to
onStateChange
a

amar_1995

01/14/2020, 12:14 PM
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

matvei

01/14/2020, 12:24 PM
By changing the state directly
a

amar_1995

01/14/2020, 12:35 PM
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

matvei

01/16/2020, 12:16 PM
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

amar_1995

01/16/2020, 12:18 PM
My first question is there anyway to resize the
BottomDrawerLayout
m

matvei

01/16/2020, 12:20 PM
The layout itself of just the sheet that is sliding from the bottom?
a

amar_1995

01/16/2020, 12:22 PM
Yes, the layout itself
I want to resize
drawerContent
of BottomDrawer
m

matvei

01/16/2020, 12:25 PM
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

amar_1995

01/16/2020, 12:28 PM
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

matvei

01/16/2020, 12:41 PM
That's what it does right now, doesn't it?
a

amar_1995

01/16/2020, 12:50 PM
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

matvei

01/16/2020, 12:53 PM
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

amar_1995

01/16/2020, 1:09 PM
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

matvei

01/16/2020, 2:01 PM
I think you can use
gestureEnabled
to achieve this behavior