在使用FloatingActionButton时报错了

floatingActionButton: Row(mainAxisAlignment: MainAxisAlignment.center,crossAxisAlignment: CrossAxisAlignment.center,children: <Widget>[FloatingActionButton(onPressed: () => _addItem(),child: Icon(Icons.add),),SizedBox(width: 60,),FloatingActionButton(onPressed: () => _removeItem(),child: Icon(Icons.remove),),],),

报错内容:

════════ Exception caught by scheduler library ═════════════════════════════════
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 (i.e. a PageRoute subtree), each Hero must have a unique non-null tag.
In this case, multiple heroes had the following tag: <default FloatingActionButton tag>
Here is the subtree for one of the offending heroes: Herotag: <default FloatingActionButton tag>state: _HeroState#2520e

主要问题是在使用多个FloatingActionButtonheroTag需是唯一的。

解决方案:

floatingActionButton: Row(mainAxisAlignment: MainAxisAlignment.center,crossAxisAlignment: CrossAxisAlignment.center,children: <Widget>[FloatingActionButton(heroTag: 'first',onPressed: () => _addItem(),child: Icon(Icons.add),),SizedBox(width: 60,),FloatingActionButton(heroTag: 'second',onPressed: () => _removeItem(),child: Icon(Icons.remove),),

Flutter笔记-There are multiple heroes that share the same tag within a subtree相关推荐

  1. Flutter: There are multiple heroes that share the same tag within a subtree异常

    今天写Demo的时候遇到了下面的错误: I/flutter: ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞══════════════════════════ ...

  2. Flutter典型错误:There are multiple heroes that share the same tag within a subtree.

    这段错误信息描述通常如下:'Within each subtree for which heroes are to be animated (i.e. a PageRoute subtree), ea ...

  3. Flutter报错总结:There are multiple heroes that share the same tag within a subtree.

    最近在项目中遇到了问题:点击每个页面都显示黑屏,并且控制台报错:There are multiple heroes that share the same tag within a subtree. ...

  4. There are multiple heroes that share the same tag within a subtree.

    There are multiple heroes that share the same tag within a subtree. 情况一:报错由于FloatingActionButton的her ...

  5. Another exception was thrown: There are multiple heroes that share the same tag w

    报错: I/flutter (18994): Another exception was thrown: There are multiple heroes that share the same t ...

  6. flutter笔记:使用flutter webvie

    flutter笔记:使用flutter webvie 作者: jcLee95 CSDN 主页:https://blog.csdn.net/qq_28550263?spm=1001.2101.3001. ...

  7. flutter笔记1 VScode安装dart code插件踩坑记录

    新手菜鸟一枚,想从产品转入技术坑,目标:移动端APP开发.最近听技术达人 飞狐 说flutter beta发布了,于是乎零基础入坑~话说想提高英文水平的同学,请移步flutter官网,从知道flutt ...

  8. flutter笔记4:使用material原生控件开发一个APP

    接着上一篇,我们做一个这样的APP: 开始之前,我发现了一个好玩的东西,每次我们在终端中输入命令: flutter run 终端里会有这个东西: 按照上图所示,我们的进入这个网页看看是个啥: 好高大上 ...

  9. Flutter 笔记 | Flutter 文件IO、网络请求、JSON、日期与国际化

    文件IO操作 Dart的 IO 库包含了文件读写的相关类,它属于 Dart 语法标准的一部分,所以通过 Dart IO 库,无论是 Dart VM 下的脚本还是 Flutter,都是通过 Dart I ...

最新文章

  1. 年季度月周日控件html,基于bootstrap按年、季度、年月、年月日的日历插件(原创)...
  2. WSE 3.0 文档翻译:安装WSE3.0
  3. 阿里愚人节发布“如影计划”,黑科技让支付宝与掌心融为一体
  4. 数据结构第5章例题 若矩阵Am×n中存在某个元素aij满足:aij是第i行中的最小值且是第j列中的最大值,则称该元素为矩阵A的一个鞍点。试编写一个算法,找出A中的所有鞍点。
  5. JMeter初探四-Fiddler录制与实战
  6. Python Django模板templates渲染及配置
  7. 如何找到SAP S4销售订单的字段tkomk是在哪里填充的
  8. python输入日期时间转换格式_python如何格式化日期?
  9. 稀疏矩阵的压缩存储--十字链表(转载)
  10. Docker 容器部署 Consul 集群
  11. 数据千万条,安全第一条
  12. nexttick使用场景_使用Jest实现Vue自动化测试
  13. 4月18日会议总结(整理—祁子梁)
  14. cs231n作业——softmax
  15. C#【多线程篇】BackgroundWorker类使用总结
  16. CodeBlocks注释和替换快捷键
  17. macOS Sierra,Xcode 8配置openCV3
  18. 新增收货地址管理 html,关于“收货地址”的二三事
  19. jar -cvfM0 暂使用 jar cvf不好用
  20. 一篇最通俗易懂的https

热门文章

  1. 学习笔记整理:网络应用技术-运输层(3)
  2. 微型计算机上的南桥芯片功能,谈论计算机主板的芯片组和南北桥
  3. 基于STM32F1的时钟芯片DS1302驱动
  4. FCK编辑器使用手册
  5. Linux下文件的编译
  6. Golang-报错-go get github/xxx
  7. 7-5 小字辈 (25 分)
  8. pixhawk飞控架构
  9. jmeter循环控制器和CSV数据文件设置搭配使用
  10. 十二 iOS之 图片擦除