How to place Drawer widget on the right. Also is possible to place two Drawer widget in a single page one either side of the appbar
Widget build(BuildContext context){
return Scaffold(
drawer: Drawer(
child: ListView(
children: <Widget>[
ListTile(
leading: Icon(Icons.shopping_cart),
title: Text('Checkout'),
onTap: (){
Navigator.pushNamed(context, '/home');
},
),
ListTile(
leading: Icon(Icons.report),
title: Text('Transactions'),
onTap: (){
Navigator.pushNamed(context, '/transactionsList');
},
),
]
)
),
body: SingleChildScrollView(
child: Column(
children : [
_buildOrderHeader(),
_buildOrderDetails(context),
]
)
)
);
}'
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.
Drawer widget is used to provide access to different destinations and functionalities provided in your application. It is represented by three horizontal parallel lines on the upper end of the scaffold.
By using endDrawer: ...
instead or in addition to drawer: ...
to set a drawer, like this:
Scaffold( endDrawer: Drawer(...), // ... )
To open it programmatically, use
Scaffold.of(context).openEndDrawer(); //This might have been updated by flutter team since the last edit
See also https://docs.flutter.io/flutter/material/Scaffold/endDrawer.html
endDrawer:Drawer(child:Center(child:Columun( children: <Widget>[
Text('End Drawer) ],
),))
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