In Scaffold if 'actions' parameter is used it hides the 'endDrawer'. Is it possible to display both?
var tmp = new Scaffold(
/// end drawer
endDrawer: Container(color: Colors.red,
child: Text('END DRAWER')),
appBar: new AppBar(
title: Text('Title'),
actions: <Widget>[
/// Cancel, Save
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: IconButton(
icon: Icon(Icons.clear,size: 24.0,),
onPressed: () => Navigator.pop(context), //cancelButton,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: IconButton(
icon: Icon(Icons.check_circle,size: 30.0,),
onPressed: () => Navigator.pop(context),
),)
],
),
body: new Container(color: Colors.amber,);
I faced the same problem. I only used a tricky solution to solve this do the following:
1.
class _MainPageState extends State<MainPage> {
final _scaffoldKey = GlobalKey<ScaffoldState>(); `
here we add (final _scaffoldKey). inside the class.
2.
return Scaffold(
key: _scaffoldKey
here inside the scaffold assign the variable to the key
3. Add the first icon button to be icon.menu, when the icon pressed it will show the end drawer as shown bellow:
IconButton(
icon: new Icon(Icons.menu,color: Colors.white),
onPressed: () {
_scaffoldKey.currentState.openEndDrawer();
},
),
AND
class _MainPageState extends State<MainPage> {
final _scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
actions: [
return IconButton(
icon: new Icon(Icons.menu, color: Colors.white),
onPressed: () {
_scaffoldKey.currentState.openEndDrawer();
});
]
),
);
}
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