import 'package:drifter/pages/animated_widgets/rotate_icon.dart'; import 'package:drifter/pages/main_screen/main_screen_widget.dart'; import 'package:drifter/theme/app_colors.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import '../../utilities/assets.dart'; class Splash extends StatefulWidget { const Splash({super.key}); @override State createState() => _SplashState(); } class _SplashState extends State { late final RotateIconController _rotateIconController; @override void initState() { _rotateIconController = RotateIconController(); Future.delayed(const Duration(seconds: 3), () { Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => const MainScreenWidget())); }); super.initState(); } @override dispose() { _rotateIconController.repeat = null; _rotateIconController.reset = null; super.dispose(); } @override Widget build(BuildContext context) { _rotateIconController.reset?.call(); _rotateIconController.repeat?.call(); return Scaffold( backgroundColor: AppColors.background, body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ const SizedBox( height: 200, ), SvgPicture.asset( Assets.svg.drifterIcon, height: 150, width: 150, ), const SizedBox( height: 10, ), const Text( "Drifter", style: TextStyle( color: AppColors.mainAccent, fontSize: 50, fontWeight: FontWeight.bold, ), ), const SizedBox( height: 230, ), //replace with rotating drifter icon RotateIcon( icon: SvgPicture.asset( Assets.svg.drifterIcon, height: 45, width: 45, ), curve: Curves.easeInOutSine, animationDurationMultiplier: 1.2, rotationPercent: 1.0, controller: _rotateIconController, ), ], ), ), ); } }