How can I implement a KivyMD Navigation Drawer so that it is "clipped" and doesn't cover the top toolbar (where the hamburger menu icon button resides)?
The KivyMD documentation for the NavigationDrawer component implements the drawer so that it spans from the very top of the screen to the very bottom of the screen. This is unfortunate because it covers the hamburger menu used to close it, which I'd like to leave uncovered so the user can toggle the drawer (in both directions) using this button.
Here is an example visual of what happens by default in KivyMD when implementing a Navigation Drawer (as described above):
Meanwhile, the Google Material Design (MD) specification (of which KivyMD is following) states that the Navigation Drawer component can be "clipped" -- where the drawer spans from the bottom of the toolbar down to the very bottom of the app.
Here's an image taken from the Google MD spec documentation link above showing what a "clipped" drawer should look like
How can I implement an MDNavigationDrawer
in KivyMD that is "clipped" such that it doesn't cover the MDToolbar
?
The following hack redraws a new MDToolbar
inside the Navigation Drawer, which is what I'm using until someone provides a better solution.
I just added an MDToolbar
to my main.kv
file so it looks like this
MDNavigationDrawer:
id: nav_drawer
BoxLayout:
orientation: 'vertical'
MDToolbar:
title: 'BusKill'
left_action_items: [[ 'menu', lambda x: nav_drawer.set_state('toggle') ]]
MDList:
OneLineIconListItem:
text: 'Update'
IconLeftWidget:
icon: 'update'
Which produced the following: