gpt4 book ai didi

flutter - Flutter:AnimationController-无需按钮即可控制吗?

转载 作者:行者123 更新时间:2023-12-03 04:25:23 25 4
gpt4 key购买 nike

我使用AnimationController制作了动画,我希望它在用户打开应用程序时开始,并且当动画结束时,用户无需按任何按钮即可转到另一页。

最佳答案

StatefulWidget子类中使用此代码。

AnimationController _controller; // member variable

@override
void initState() {
super.initState();

_controller = AnimationController(vsync: this, duration: Duration(seconds: 1));

// start the animation when this page opens
_controller.forward().then((value) {
// animation is finished, you can now go to any page
Navigator.push(context, MaterialPageRoute(builder: (_) => YourPage())); // changed
});

_controller.addListener(() {
// this is your listener, you can also control lots of things from here
});
}

关于flutter - Flutter:AnimationController-无需按钮即可控制吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60041728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com