在使用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. 重磅!公开课|四旋翼飞行器:算法与实战
  2. .中英文系统底层编码导致乱码问题
  3. malloc、calloc、realloc和free
  4. python pip安装失败vtk_安装最新的VTK库验证安装出错该怎么解决
  5. P4852-yyf hates choukapai【单调队列优化dp】
  6. ffmpeg图片缩放
  7. ubuntu mysql 多硬盘_ubuntu下磁盘空间不足导致mysql无法启动的解决方法
  8. oracle语法和sql的区别吗,ORACLE和SQL语法区别归纳
  9. 浅析tomcat原理
  10. 【java】面向程序员的 10 大 Java 书籍 — 历久弥新
  11. docker快速搭建http服务器
  12. 一文搞懂 UndeclaredThrowableException
  13. 计算机网络:第四章 网络层
  14. Excel 入门基础
  15. 浅谈如何使用Google reCAPTCHA进行人机验证
  16. Unity 用什么IDE比较好?
  17. 民间秘术——可怕的死亡诅咒
  18. 路飞学城-Python爬虫实战密训-第1章
  19. CMakeLists学习二、链接库搜索路径与ld
  20. 爬虫实战入门级教学(数据爬取->数据分析->数据存储)

热门文章

  1. soot代码分析框架的基础知识(一)
  2. mysql餐饮管理系统设计_酒店餐饮管理系统的设计与实现(MySQL)(含录像)
  3. pythonjava有什么区别_python,java,go语言之间的区别!
  4. 画论92 张大千《画论》
  5. 既然知道失去才觉得美好,为什么不珍惜现在
  6. 《乔布斯传》英文原著重点词汇笔记(一)【 Introduction 】
  7. 亲手实践图片木马之捆绑工具(BD2.Net Injector By BD2)
  8. Alcohol 120%刻录教程:制作镜像文件
  9. 提高睡眠质量的助眠好物,双十一值得买的助眠好物
  10. 滴滴开源的深度与温度——滴滴开源委员会秘书长吴国斌专访