解决each Hero must have a unique non-null tag.
- 发表于
- flutter
完整错误如:
Within each subtree for which heroes are to be animated (i.e. a PageRoute subtree), each Hero must have a unique non-null tag.
或者
I/flutter (8790): Another exception was thrown: There are multiple heroes that share the same tag within a subtree.
一开始以为是Hero交互ID没绑定,检查已经绑定了。
这是因为我在一个屏幕上有两个 FloatingAction 按钮,我必须为每个 FloatingActionButton 添加一个 heroTag 属性 + 值才能消除错误。
类似
new FloatingActionButton(
heroTag: "btn1",
...
)
new FloatingActionButton(
heroTag: "btn2",
...
)
原文连接:解决each Hero must have a unique non-null tag.
所有媒体,可在保留署名、
原文连接
的情况下转载,若非则不得使用我方内容。