|
|
|
@ -15,15 +15,37 @@ class SplashPage extends StatefulWidget { |
|
|
|
State<SplashPage> createState() => _SplashPageState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _SplashPageState extends State<SplashPage> { |
|
|
|
class _SplashPageState extends State<SplashPage> with SingleTickerProviderStateMixin{ |
|
|
|
late AnimationController _controller; |
|
|
|
late Animation<double> _translateY; |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
|
|
|
|
_controller = AnimationController( |
|
|
|
vsync: this, |
|
|
|
duration: const Duration(milliseconds: 900), |
|
|
|
); |
|
|
|
|
|
|
|
_translateY = Tween<double>(begin: 40, end: 0).animate( |
|
|
|
CurvedAnimation( |
|
|
|
parent: _controller, |
|
|
|
curve: Curves.easeOutBack, // gives that slight bounce |
|
|
|
), |
|
|
|
); |
|
|
|
|
|
|
|
_controller.forward(); |
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) { |
|
|
|
context.read<SplashBloc>().goToHomePage(context); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
_controller.dispose(); |
|
|
|
super.dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
@ -50,13 +72,29 @@ class _SplashPageState extends State<SplashPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
child: Stack( |
|
|
|
alignment: Alignment.center, |
|
|
|
children: [ |
|
|
|
Positioned.fill(child: _image()), |
|
|
|
_loading(context), |
|
|
|
], |
|
|
|
child: Center( |
|
|
|
child: AnimatedBuilder( |
|
|
|
animation: _translateY, |
|
|
|
builder: (context, child) { |
|
|
|
return Transform.translate( |
|
|
|
offset: Offset(0, _translateY.value), |
|
|
|
child: child, |
|
|
|
); |
|
|
|
}, |
|
|
|
child: Image.asset( |
|
|
|
'assets/images/splash_logo.png', |
|
|
|
height: 245, |
|
|
|
width: 245, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
// Stack( |
|
|
|
// alignment: Alignment.center, |
|
|
|
// children: [ |
|
|
|
// Positioned.fill(child: _image()), |
|
|
|
// _loading(context), |
|
|
|
// ], |
|
|
|
// ), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|