title: Open drawer menu from different stateful widget
body: <p>I have 3 StatefulWidget, MainPage, CustomAppbar &amp; ProfileCustomAppbar. In my MainPage I populate my drawer like this:</p>
  
  <pre><code>    Widget build(BuildContext context) {
      return MaterialApp(
  
        home: Scaffold(
          appBar: (currentPage == profilePage)
  
              ? ProfileCustomAppbar(
                  height: 60,
                )
              : CustomAppbar(
                  height: 60,
                ),
          endDrawer: populateDrawer(),
          body: Container(
            decoration: BoxDecoration(color: Colors.white),
            child: currentPage,
          ),
  
        ),
      );
    }
        populateDrawer() {
          return Theme(
            data: Theme.of(context).copyWith(
                canvasColor:
                Colors.white //This will change the drawer background to blue.
              //other styles
            ),
            child: Drawer(
              child: Column(
                children: &lt;Widget&gt;[
                  DrawerHeader(
                    child: Center(
                      child: Image.asset("assets/images/lf_logo.png",
                          height: 100, width: 100),
                    ),
                  ),
                  Divider(color: Configuration.PrimaryColor),
  
                ],
              ),
            ),
          );
        }
  </code></pre>
  
  <p>Now I want to open the drawer from <code>ProfileCustomAppbar</code> here is how I call the drawer:</p>
  
  <pre><code>IconButton(
                 icon: Icon(Icons.settings, color: Colors.brown,),
                 onPressed: () {
                   Scaffold.of(context).openDrawer();
                 },
               )
  </code></pre>
  
  <p>but the drawer is not open, how can I fix it?</p>