title: How can I have same page destination using hero
body: <p>I am trying to make a flutter app. It is an app that can create containers. Then, when you press on those containers, it will open up a page. So, I tried to use hero with infinitely creatable containers. This is what I came up with:</p>
  
  <pre><code>import 'package:flutter/material.dart';
  
  void main() =&gt; runApp(MainPage());
  
  class MainPage extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
          debugShowCheckedModeBanner: false,
          home: Scaffold(
              backgroundColor: Colors.white,
              body: Column(children: &lt;Widget&gt;[
                Body(),
              ])));
    }
  }
  
  class Body extends StatefulWidget {
    @override
    _BodyState createState() =&gt; _BodyState();
  }
  
  class _BodyState extends State&lt;Body&gt; {
    final String open1 = 'open';
  
    int count = 1;
  
    @override
    Widget build(BuildContext context) {
      List cards = List.generate(count, (int i) =&gt; RCard(count));
  
      return Expanded(
          child: Container(
              child: NotificationListener&lt;OverscrollIndicatorNotification&gt;(
                  onNotification: (OverscrollIndicatorNotification overscroll) {
                    overscroll.disallowGlow();
                  },
                  child: PageView.builder(
                      reverse: true,
                      pageSnapping: false,
                      controller: PageController(viewportFraction: 0.85),
                      itemCount: count,
                      itemBuilder: (context, i) {
                        if (i == 0) {
                          return GestureDetector(
                              onTap: () {
                                Navigator.push(
                                  context,
                                  MaterialPageRoute(
                                      builder: (context) =&gt; Page(
                                            open: open1,
                                          )),
                                );
                                count++;
                              },
                              child: Hero(
                                  tag: open1,
                                  child: Padding(
                                      padding: EdgeInsets.only(
                                          left:
                                              MediaQuery.of(context).size.height *
                                                  0.015,
                                          right:
                                              MediaQuery.of(context).size.height *
                                                  0.015,
                                          top: MediaQuery.of(context).size.width *
                                              0.08,
                                          bottom:
                                              MediaQuery.of(context).size.width *
                                                  0.15),
                                      child: Material(
                                          borderRadius:
                                              BorderRadius.circular(40.0),
                                          color: Colors.white,
                                          elevation: 8.0,
                                          child: InkWell(
                                            child: Column(
                                                mainAxisAlignment:
                                                    MainAxisAlignment.center,
                                                children: &lt;Widget&gt;[
                                                  Icon(
                                                    Icons.add,
                                                    size: 30.0,
                                                    color: Colors.black,
                                                  )
                                                ]),
                                          )))));
                        } else {
                          return cards[i];
                        }
                      }))));
    }
  }
  
  class RCard extends StatefulWidget {
    final int count;
  
    RCard(this.count);
  
    @override
    RCardState createState() =&gt; RCardState();
  }
  
  class RCardState extends State&lt;RCard&gt; {
    int count;
    String open2;
    @override
    void initState() {
      super.initState();
      open2 = 'open$count';
      count = widget.count;
    }
  
    @override
    Widget build(BuildContext context) {
      return Hero(
        tag: open2,
        child: GestureDetector(
            onTap: () {
              Navigator.push(
                context,
                MaterialPageRoute(
                    builder: (context) =&gt; Page(
                          open: open2,
                        )),
              );
            },
            child: Padding(
              padding: EdgeInsets.only(
                  left: MediaQuery.of(context).size.height * 0.015,
                  right: MediaQuery.of(context).size.height * 0.015,
                  top: MediaQuery.of(context).size.width * 0.08,
                  bottom: MediaQuery.of(context).size.width * 0.15),
              child: Material(
                  borderRadius: BorderRadius.circular(40.0),
                  color: Colors.white,
                  elevation: 8.0,
                  child: Padding(
                    padding:
                        EdgeInsets.all(MediaQuery.of(context).size.width * 0.15),
                  )),
            )),
      );
    }
  }
  
  class Page extends StatelessWidget {
    final String open;
  
    Page({this.open});
  
    @override
    Widget build(BuildContext context) {
      return GestureDetector(
        child: Hero(tag: open, child: Material()),
        onTap: () {
          Navigator.pop(context);
        },
      );
    }
  }
  </code></pre>
  
  <p>But, this code only works when I create 1 container. When I create 2 containers and press on it, it gives me a black screen. How can I solve this problem?</p>