So i have a main page with scaffold, app bar and drawer. My question is is there a way to add specific app bar actions from the child pages? Or do i have to add them all and conditionally show/hide them on the main page?
Asked
Active
Viewed 307 times
1 Answers
1
Usually, you should use one Scaffold()
for each page and you should not nest Scaffolds.
Inside your Scaffold()
you have your AppBar()
.
So you can control each page appbar actions with no problem.
What I mean is that each page, has this kind of code:
Widget build(BuildContext context) {
return Scaffold(
drawer: MyDrawer(),
appBar: AppBar(
title: Text("your screen title"),
actions: <Widget>[
IconButton(
icon: Icon(Icons.security),
onPressed: () { print("icon pressed"); },
),
],
body: Container(),
);
}

encubos
- 2,915
- 10
- 19