Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show both drawer button and back button in Flutter app?

For faster navigation to root pages in deep navigation, both Back and Drawer icon buttons need to be shown in AppBar.

enter image description here

How to do that in a Flutter app?

like image 754
Kyaw Tun Avatar asked Sep 09 '17 06:09

Kyaw Tun


People also ask

How do I add back button in Flutter app?

The solution is quite simple. What you need to do is to set the leading argument of the AppBar widget to your custom widget (eg: an elevated button): appBar: AppBar( // Overide the default Back button automaticallyImplyLeading: false, leadingWidth: 100, leading: ElevatedButton. icon( onPressed: () => Navigator.

Can we change drawer icon in flutter?

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.


1 Answers

Wrap your toolbar widget with Row

....
Row toolbar = new Row(
  children: <Widget>[
    new Icon(Icons.arrow_back),
    new Icon(Icons.menu),
    new Expanded(child: new Text(widget.title)),
    new Icon(Icons.arrow_forward)
  ]
);

return new Scaffold(
  appBar: new AppBar(
    title: toolbar,
  ),
....

Here it is the result enter image description here

like image 76
Putra Ardiansyah Avatar answered Sep 20 '22 07:09

Putra Ardiansyah