0
I would like to create a Drawer unique to my entire application and get a consistency on it. How can I do this without having to rewrite it on all my pages?
For example, I have the following Drawer in my HomePage:
final drawer = Drawer(
  child: ListView(
    padding: EdgeInsets.zero,
    children: <Widget> [
      DrawerHeader(
        child: logo,
        decoration: BoxDecoration(
          color: Colors.blue,
        ),
      ),
      ListTile(
        leading: Icon(Icons.compare_arrows),
        title: Text('Transmissão'),
        onTap: () {
          Navigator.of(context).pushNamed(TransmissionListPage.tag);
        },
      ),
      ListTile(
        leading: Icon(Icons.attach_money),
        title: Text('Cotação'),
        onTap: () {
          Navigator.of(context).pushNamed(CotationListPage.tag);
        },
      ),
    ],
  ),
);
But when I go to the broadcast page, I have to rewrite all this code in order to have the same navigation capabilities. I would like to write only once, preferably by deleting the current page from the listing.
Another way is to create a method that makes Scaffold’s Body dynamic. Follow the link of the post that teaches how to do this: https://magrizo.wordpress.com/2018/12/11/como-usar-o-drawer-para-varias-telas-no-flutter/
– Daniel Magri