title: Flutter grid of buttons that redirects to other page when clicked
body: <p>Hi guys i am new to flutter. I have a grid of clickable buttons. Right now its only two, but it can grow to many. how can I refactor this to make it more dynamic and handle many future buttons? like a grid list of buttons that you can each click to navigate to different pages.</p>
  <pre><code>class HomePage extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text('Home Page'),
        ),
        body: Container(
          margin: EdgeInsets.all(10),
          padding: EdgeInsets.all(30.0),
          child: GridView.extent(
            maxCrossAxisExtent: 150,
            crossAxisSpacing: 15.0,
            mainAxisSpacing: 15.0,
            children: &lt;Widget&gt;[
              FlatButton(
                onPressed: () {
                  Navigator.of(context).push(
                    MaterialPageRoute(
                      builder: (_) =&gt; ProductScreen(),
                    ),
                  );
                },
                padding: EdgeInsets.only(top: 33),
                child: Column(
                  children: [
                    Icon(
                      Icons.shopping_cart_outlined,
                      color: Colors.white,
                    ),
                    Text(
                      &quot;Products&quot;,
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ],
                ),
              ),
              FlatButton(
                   onPressed: () {
                  Navigator.of(context).push(
                    MaterialPageRoute(
                      builder: (_) =&gt; MailScreen(),
                    ),
                  );
                },
                padding: EdgeInsets.only(top: 33),
                child: Column(
                  children: [
                    Icon(
                      Icons.mail,
                      color: Colors.white,
                    ),
                    Text(
                      &quot;Mail&quot;,
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      );
    }
  }
  </code></pre>