import 'package:flutter/material.dart';
class SplashPage extends StatefulWidget {
@override
_SplashPageState createState() => _SplashPageState();
}
class _SplashPageState extends State<SplashPage>
with SingleTickerProviderStateMixin {
AnimationController _animationController;
Animation<double> _fadeAnimation;
@override
void initState() {
super.initState();
_animationController = AnimationController(
vsync: this,
duration: Duration(milliseconds: 1000),
);
_fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(
parent: _animationController,
curve: Curves.easeIn,
),
);
_animationController.forward();
}
@override
void dispose() {
_animationController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: AnimatedBuilder(
animation: _animationController,
builder: (BuildContext context, Widget child) {
return Opacity(
opacity: _fadeAnimation.value,
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/splash_image.png'),
fit: BoxFit.cover,
),
),
),
);
},
),
);
}
}