正如标题所述,我真的不知道为什么会这样,页面正在切换,但是没有动画。我想做的是使用static const int JUMP_TABLE[] = { &&case0 - &&case0, &&case1 - &&case0
和切换用例在页面之间切换来实现多页面注册表单,我尝试应用动画,但失败了。
setState
答案 0 :(得分:0)
你的密钥在你的 AnimatedSwitcher 里面, 你应该把它放在你想制作动画的小部件中。
示例:
class yourclass...{
Container _container;
@override
void initState() {
_container = _yourWidget();
}
@override
Widget build(BuildContext context) {
return AnimatedSwitcher(
....
....
child:_container
);
}
Container _yourWidget(){
return Container(
key:ValueKey<int>(your key that will change whenever the you decide to change)
)
}
}
然后在 setState 上更改 _container 和键的值