Android 在一个子树中使用同一标签的多个英雄
我试图有一个英雄动画从后视图屏幕到全屏后视图。就我所见,这似乎很正常(我的代码),我真的不明白为什么我会出现这个错误 我的代码中没有任何其他英雄小部件,所以我不明白为什么会出现这个错误 以下是我得到的错误:Android 在一个子树中使用同一标签的多个英雄,android,ios,flutter,animation,dart,Android,Ios,Flutter,Animation,Dart,我试图有一个英雄动画从后视图屏幕到全屏后视图。就我所见,这似乎很正常(我的代码),我真的不明白为什么我会出现这个错误 我的代码中没有任何其他英雄小部件,所以我不明白为什么会出现这个错误 以下是我得到的错误: There are multiple heroes that share the same tag within a subtree. 这是我的密码: Stack( alignment: Alignment.center, children:
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,
),
),
),
),
],
),
非常感谢,我真的很感谢你的帮助 您如何
导航到全屏视图
?我想导航
在页面路径
s之间的代码可能有问题<代码>英雄
动画用于在两个页面
之间设置特定小部件的动画。我没有在我的整个应用程序中使用任何heroTag,但在编译时仍会出错“有多个英雄在子树中共享同一个标记”请说明问题所在以及如何解决。谢谢。您如何导航到全屏视图?我想导航
在页面路径
s之间的代码可能有问题<代码>英雄
动画用于在两个页面
之间设置特定小部件的动画。我没有在我的整个应用程序中使用任何heroTag,但在编译时仍会出错“有多个英雄在子树中共享同一个标记”请说明问题所在以及如何解决。谢谢
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,
),
),
),
),
);
}
}