Flutter笔记-There are multiple heroes that share the same tag within a subtree
在使用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
主要问题是在使用多个FloatingActionButton
时heroTag
需是唯一的。
解决方案:
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相关推荐
- Flutter: There are multiple heroes that share the same tag within a subtree异常
今天写Demo的时候遇到了下面的错误: I/flutter: ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞══════════════════════════ ...
- 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 ...
- 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. ...
- 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 ...
- 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 ...
- flutter笔记:使用flutter webvie
flutter笔记:使用flutter webvie 作者: jcLee95 CSDN 主页:https://blog.csdn.net/qq_28550263?spm=1001.2101.3001. ...
- flutter笔记1 VScode安装dart code插件踩坑记录
新手菜鸟一枚,想从产品转入技术坑,目标:移动端APP开发.最近听技术达人 飞狐 说flutter beta发布了,于是乎零基础入坑~话说想提高英文水平的同学,请移步flutter官网,从知道flutt ...
- flutter笔记4:使用material原生控件开发一个APP
接着上一篇,我们做一个这样的APP: 开始之前,我发现了一个好玩的东西,每次我们在终端中输入命令: flutter run 终端里会有这个东西: 按照上图所示,我们的进入这个网页看看是个啥: 好高大上 ...
- Flutter 笔记 | Flutter 文件IO、网络请求、JSON、日期与国际化
文件IO操作 Dart的 IO 库包含了文件读写的相关类,它属于 Dart 语法标准的一部分,所以通过 Dart IO 库,无论是 Dart VM 下的脚本还是 Flutter,都是通过 Dart I ...
最新文章
- 年季度月周日控件html,基于bootstrap按年、季度、年月、年月日的日历插件(原创)...
- WSE 3.0 文档翻译:安装WSE3.0
- 阿里愚人节发布“如影计划”,黑科技让支付宝与掌心融为一体
- 数据结构第5章例题 若矩阵Am×n中存在某个元素aij满足:aij是第i行中的最小值且是第j列中的最大值,则称该元素为矩阵A的一个鞍点。试编写一个算法,找出A中的所有鞍点。
- JMeter初探四-Fiddler录制与实战
- Python Django模板templates渲染及配置
- 如何找到SAP S4销售订单的字段tkomk是在哪里填充的
- python输入日期时间转换格式_python如何格式化日期?
- 稀疏矩阵的压缩存储--十字链表(转载)
- Docker 容器部署 Consul 集群
- 数据千万条,安全第一条
- nexttick使用场景_使用Jest实现Vue自动化测试
- 4月18日会议总结(整理—祁子梁)
- cs231n作业——softmax
- C#【多线程篇】BackgroundWorker类使用总结
- CodeBlocks注释和替换快捷键
- macOS Sierra,Xcode 8配置openCV3
- 新增收货地址管理 html,关于“收货地址”的二三事
- jar -cvfM0 暂使用 jar cvf不好用
- 一篇最通俗易懂的https