How to remove the hamburger button from a flutter drawer?
Solution 1:
In AppBar you need to do the following to hide default rendering hamburger icon
AppBar(
automaticallyImplyLeading: false, // this will hide Drawer hamburger icon
actions: <Widget>[Container()], // this will hide endDrawer hamburger icon
... // other props
),
and In SilverAppBar do the following to hide default rendering hamburger icon
SilverAppBar(
automaticallyImplyLeading: false, // this will hide Drawer hamburger icon
actions: <Widget>[Container()], // this will hide endDrawer hamburger icon
... // other props
}
I hope this will help...
Solution 2:
Just set the leading
property in your AppBar
to an empty Container
appBar: new AppBar(
leading: new Container(),
....
And in order to remove endDrawer
(for RtL). It is placed where the action
property is, so also just add an empty Container
as a single child
of the action
property
appBar: new AppBar(
actions: <Widget>[
new Container(),
],
.....
Solution 3:
Use the https://docs.flutter.io/flutter/material/AppBar/automaticallyImplyLeading.html property on the AppBar
Solution 4:
For the normal drawer you should set https://docs.flutter.io/flutter/material/AppBar/automaticallyImplyLeading.html to false.
For the end drawer you should do the following:
actions: [Container()]