I'm trying to migrate my android app to compose an...
# compose
j
I'm trying to migrate my android app to compose and I'm having some trouble figuring out how to make a drawer that opens with an AppBar button. I tried to set it through drawerContent in a scaffold, but that seems to use a dragging gesture instead of a button in the AppBar
1
this is how it looks in my android app, tapping the hamburger icon opens the drawer
nevermind, I added "hamburger" to my search and I found this that ended up working for me https://stackoverflow.com/questions/63738585/add-drawer-toggle-button-in-jetpack-compose
t
In the Scaffold you can disable the drawer gesture and only open it with an a button or some action
j
I just tried that with
drawerGesturesEnabled = false
, but now I can't close the drawer by tapping off the drawer. Is it possible to disable dragging the drawer open without disabling closing it with a tap?
t
Yes you can intercept a tap, click, touch any gesture and simply send some callback, flow or event to the composable. There you can control the state if the drawer
j
oh, apparently you can do it just by setting it as
drawerGesturesEnabled = scaffoldState.drawerState.isOpen
K 3