I want to make something like this, but always get this:
Scaffold(
drawer: Drawer(..),
..
)
How do I create a Drawer
that is not displayed in the status bar?
To change the drawer icon in Flutter, add an IconButton widget inside the leading property of the AppBar widget. Inside the IconButton you can set any icon of your choice. Then, inside the onPressed of an IconButton, you can write a method to open the drawer.
To change status bar color in Flutter, you should set the systemOverlayStyle . Inside the SystemUiOverlayStyle, you can use properties to specify the status bar color as well as the color for the icon and text.
For this kind of scenario, Flutter has the SafeArea
widget. This widget will make sure that nothing is rendered e.g. beneath the status bar, i.e. a padding is added.
To apply this to your Drawer
, you can simply wrap your Drawer
with a SafeArea
:
Scaffold(
drawer: SafeArea(
child: Drawer(..),
),
..
)
Screenshot of the drawer
You can also specify if you want to remove some of the padding added by SafeArea
using the optional parameters top
, bottom
, left
& right
, e.g. SafeArea(bottom: false, ..)
.
Adding the padding: const EdgeInsets.all(0.0),
to ListView resolves the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With