I'm producing 2 FloatingActionButtons within a Row. I'm getting the following error when routing to its file...
The following assertion was thrown during a scheduler callback: There are multiple heroes that share the same tag within a subtree. Within each subtree for which heroes are to be animated (typically a PageRoute subtree), each Hero must have a unique non-null tag. In this case, multiple heroes had the tag "Instance of 'Object'".
Here is my code...
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new FloatingActionButton(
child: new Icon(Icons.remove), onPressed: _decline),
new Padding(padding: new EdgeInsets.all(10.0)),
new Text(
_count.toString(),
style: new TextStyle(
fontSize: 40.0,
fontWeight: FontWeight.bold,
color: Colors.black),
),
new Padding(padding: new EdgeInsets.all(10.0)),
new FloatingActionButton(
child: new Icon(Icons.add), onPressed: _increment),
],
)
This is how I'm routing to my file...
Navigator.push(context, new MaterialPageRoute(builder: (_) => new Video.VideoPage()));
When I comment out the first FloatingActionButton it works fine. It only errors out when they're both used. My Row
is also a child of a Column
widget if that matters.
Try adding a unique heroTag
for each of the FloatingActionButton
s, so that Flutter does not confuse the two button with each other, something like:
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new FloatingActionButton(
heroTag: "Decline",
child: new Icon(Icons.remove), onPressed: _decline),
new Padding(padding: new EdgeInsets.all(10.0)),
new Text(
_count.toString(),
style: new TextStyle(
fontSize: 40.0,
fontWeight: FontWeight.bold,
color: Colors.black),
),
new Padding(padding: new EdgeInsets.all(10.0)),
new FloatingActionButton(
heroTag: "Increment",
child: new Icon(Icons.add), onPressed: _increment),
],
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With