android - Flutter 在子树中共享相同标签的多个英雄
问题描述
我正在尝试从帖子视图屏幕到全屏帖子视图的英雄动画。据我所见,这似乎很正常(我的代码),我真的不明白为什么我会收到这个错误......
我的代码中没有任何其他 Hero 小部件,所以我不明白为什么会出现此错误...
这是我得到的错误:
There are multiple heroes that share the same tag within a subtree.
这是我的代码:
Stack(
alignment: Alignment.center,
children: <Widget>[
Hero(
tag: 'test',
child: Container(
height: MediaQuery.of(context).size.width,
child: Padding(
padding: const EdgeInsets.all(6.0),
child: Align(
alignment: Alignment.topRight,
child: Container(
decoration: BoxDecoration(
color: Colors.grey.shade400.withOpacity(0.5),
borderRadius: BorderRadius.circular(12.0),
),
width: 120,
height: 40,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 3,
itemBuilder: (BuildContext context, int index) {
return _configureEmoji(index);
},
),
),
),
),
decoration: BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(widget.post.imageURL),
fit: BoxFit.cover,
),
),
),
),
],
),
这是我希望英雄动画去的地方:
class FullScreenView extends StatelessWidget {
final String imageURL;
FullScreenView({this.imageURL});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Hero(
tag: 'test',
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
image: DecorationImage(
image: CachedNetworkImageProvider(imageURL),
fit: BoxFit.cover,
),
),
),
),
);
}
}
非常感谢,我非常感谢您的帮助!
解决方案
推荐阅读
- sql - 确定日志条目是否是产品的第一个条目
- mysql - Vapor 4 Fluent 创建模型不会将其保存到数据库中
- c++ - 适配器和适配器类
- android - 尽管布局为空,但 ScrollView 仍在滚动
- pine-script - Pine Script:当一个接一个地满足两个条件时绘制标签
- windows-installer - 在 U 盘上安装 .msi
- sql - 根据选择的值返回
- typescript - 电子/乏味:需要(“事件”)未定义
- javascript - 我能够使用 GET 请求,但不知道如何发布。如果有人可以快速浏览一下,我已经在这里添加了我的 git 存储库?
- javascript - 在矩形内以一定角度绘制对角线