class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> with TickerProviderStateMixin{
AnimationController _controller;
Animation _animation;
@override
void initState() {
// TODO: implement initState
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(seconds: 6),
);
_animation = Tween(begin: 0.0, end: 1,).animate(_controller);
_animation.addStatusListener((status) {
if (status == AnimationStatus.completed) {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) {
return IndexPage();
}), (route) => route == null);
}
});
_controller.forward();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
width: window.physicalSize.width,
height: window.physicalSize.height,
child: Image.asset('images/a.jpg',fit: BoxFit.cover,),
),
);
}
}
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄