title: error: Undefined name 'context' in flutter
body: <p>I am a beginner with flutter, I had just started a few days ago. I want to go from one page to another page . But when I use the navigator it shows an error.</p>
  <p>I've tried to solve it using some answers to similar problems on stack overflow, but I can't solve it. Also, I am not able to understand those properly.</p>
  <p>These are some of them:</p>
  <p>Undefined name 'context'</p>
  <p>Undefined name 'context' in flutter navigation</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:origitive_app/main.dart';
  import 'package:origitive_app/Productpage.dart';
  
  void main() {
    runApp(chooseCategory());
  }
  
  class chooseCategory extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return new MaterialApp(
          debugShowCheckedModeBanner: false,
          home: new DefaultTabController(
            length: 3,
            child: new Scaffold(
              appBar: new AppBar(
                title: const Text('Collections'),
                backgroundColor: Colors.grey[400],
  
                actions: [
                  //list if widget in appbar actions
                  PopupMenuButton(
                    icon: Icon(Icons.menu),
                    //don't specify icon if you want 3 dot menu
                    color: Colors.blue,
                    itemBuilder: (context) =&gt;
                    [
                      PopupMenuItem&lt;int&gt;(
                        value: 0,
                        child: Text(
                          &quot;Home&quot;, style: TextStyle(color: Colors.white),),
                      ),
                      PopupMenuItem&lt;int&gt;(
                        value: 0,
                        child: Text(
                          &quot;About&quot;, style: TextStyle(color: Colors.white),),
                      ),
                      PopupMenuItem&lt;int&gt;(
                        value: 0,
                        child: Text(
                          &quot;Settings&quot;, style: TextStyle(color: Colors.white),),
                      ),
                    ],
                    onSelected: (item) =&gt; {print(item)},
                  ),
                ],
                bottom: new TabBar(isScrollable: true, tabs: [
                  new Tab(text: 'MEN',),
                  new Tab(text: 'WOMEN',),
                  new Tab(text: 'KIDS',),
                ]),
              ),
              body: new TabBarView(
                children: [
                  new ListView(
                    children: list1,
                  ),
  
                  new ListView(
                    children: list2,
                  ),
                  new ListView(
                    children: list3,
                  ),
                ],
              ),
  
              bottomNavigationBar: BottomNavigationBar(
                type: BottomNavigationBarType.fixed,
                items: const &lt;BottomNavigationBarItem&gt;[
                  BottomNavigationBarItem(
                    icon: Icon(Icons.home),
                    title: Text('Home'),
                  ),
                  BottomNavigationBarItem(
                    icon: Icon(Icons.business),
                    title: Text('Business'),
                  ),
                  BottomNavigationBarItem(
                    icon: Icon(Icons.computer),
                    title: Text('Technology'),
                  ),
                  BottomNavigationBarItem(
                    icon: Icon(Icons.book),
                    title: Text('Education'),
                  ),
                ],
  
  
              ),
  
            ),
          ));
    }
  
    List&lt;Widget&gt; list1 = &lt;Widget&gt;[
      new ListTile(
        title: new Text('Shoes',
            style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
        leading: new Image.asset(&quot;assets/Images/men1.png&quot;),
        trailing: Icon(Icons.arrow_forward),
        onTap: (){
          Navigator.push(
              context,//error
              MaterialPageRoute(builder: (context) =&gt; Productpage()));
        },
  
      ),
      new ListTile(
        title: new Text('Clothing',
            style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
        subtitle: new Text('429 Castro St'),
        leading: new Image.asset(&quot;assets/Images/men2.png&quot;),
        trailing: Icon(Icons.arrow_forward),
        onTap: (){
          Navigator.push(
              context,//error
              MaterialPageRoute(builder: (context) =&gt; Productpage()));
        },
  
  
      ),
      new ListTile(
        title: new Text('Accessories',
            style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
        leading: new Image.asset(&quot;assets/Images/men3.png&quot;),
        trailing: Icon(Icons.arrow_forward),
        onTap: (){
          Navigator.push(
              context,//error
              MaterialPageRoute(builder: (context) =&gt; Productpage()));
        },
      ),
    ];
  
    List&lt;Widget&gt; list2 = &lt;Widget&gt;[
      new ListTile(
        title: new Text('Shoes',
            style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
        subtitle: new Text('85 W Portal Ave'),
        leading: new Image.asset(&quot;assets/Images/women1.png&quot;),
        trailing: Icon(Icons.arrow_forward),
        onTap: (){
          Navigator.push(
              context,//error
              MaterialPageRoute(builder: (context) =&gt; Productpage()));
        },
      ),
      new ListTile(
        title: new Text('Clothing',
            style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
        leading: new Image.asset(&quot;assets/Images/women2.png&quot;),
        trailing: Icon(Icons.arrow_forward),
        onTap: (){
          Navigator.push(
              context,//error
              MaterialPageRoute(builder: (context) =&gt; Productpage()));
        },
      ),
      new ListTile(
        title: new Text('Accessories',
            style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
        leading: new Image.asset(&quot;assets/Images/women3.png&quot;),
        trailing: Icon(Icons.arrow_forward),
        onTap: (){
          Navigator.push(
              context,//error
              MaterialPageRoute(builder: (context) =&gt; Productpage()));
        },
      ),
    ];
    List&lt;Widget&gt; list3 = &lt;Widget&gt;[
      new ListTile(
        title: new Text('Boys Shoes',
            style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
        leading: new Image.asset(&quot;assets/Images/boy1.png&quot;),
        trailing: Icon(Icons.arrow_forward),
        onTap: (){
          Navigator.push(
              context,//error
              MaterialPageRoute(builder: (context) =&gt; Productpage());
          );
        },
      ),
      new ListTile(
        title: new Text('Girls Shoes',
            style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
        leading: new Image.asset(&quot;assets/Images/girl1.png&quot;),
        trailing: Icon(Icons.arrow_forward),
        onTap: (){
          Navigator.push(
              context,//error
              MaterialPageRoute(builder: (context) =&gt; Productpage()));
        },
      ),
      new ListTile(
        title: new Text('Boys Clothing',
            style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
  
           leading: new Image.asset(&quot;assets/Images/boy1.png&quot;),
           trailing: Icon(Icons.arrow_forward),
            onTap: () {
              Navigator.push(
                  context,//error
                  MaterialPageRoute(builder: (context) =&gt; Productpage()));
              );
            },
      ),
      new ListTile(
        title: new Text('Girls Clothing',
            style: new TextStyle(fontWeight: FontWeight.w500, fontSize: 20.0)),
        leading: new Image.asset(&quot;assets/Images/girl2.png&quot;),
        onTap: (){
          Navigator.push(
              context,//error
              MaterialPageRoute(builder: (context) =&gt; Productpage()));
        },trailing: Icon(Icons.arrow_forward),
      ),
    ];
  }
  }
  </code></pre>
  <p>tried adding a static build context but failed.it gave a null error.</p>