routes – 在Row抛出错误的相同颤振窗口小部件?

我在一行中生成2个FloatingActionButtons.路由到其文件时出现以下错误

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'”.

这是我的代码……

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 FloatingActionButton(
                    child: new Icon(Icons.add),onpressed: _increment),],)

这是我如何路由到我的文件

Navigator.push(context,new MaterialPageRoute(builder:(_)=> new Video.VideoPage()));

当我注释掉第一个FloatingActionButton时它工作正常.只有当它们都被使用时它才会出错.如果重要的话,My Row也是Column小部件的子代.

解决方法

尝试为每个FloatingActionButtons添加一个唯一的 heroTag,这样Flutter就不会将这两个按钮相互混淆,例如:

new Row(
        mainAxisAlignment: MainAxisAlignment.center,children: <Widget>[
          new FloatingActionButton(
              heroTag: "Decline",child: new Icon(Icons.remove),new Text(
            _count.toString(),style: new TextStyle(
                fontSize: 40.0,new FloatingActionButton(
              heroTag: "Increment",child: new Icon(Icons.add),

相关文章

这篇文章主要讲解了“FlutterComponent动画的显和隐怎么实现...
这篇文章主要讲解了“flutter微信聊天输入框功能如何实现”,...
本篇内容介绍了“Flutter之Navigator的高级用法有哪些”的有...
这篇文章主要介绍“Flutter怎么使用Android原生播放器”,在...
Flutter开发的android端如何修改APP名称,logo,版本号,具体...
Flutter路由管理初识路由概念一.路由管理1.1.Route1.2.Mater...