drifter_app/lib/pages/splash_screen/splash_screen.dart

89 lines
2.3 KiB
Dart
Raw Normal View History

2023-05-15 15:55:49 +00:00
import 'package:drifter/pages/main_screen/main_screen_widget.dart';
2023-05-15 20:32:54 +00:00
import 'package:drifter/pages/widgets/animated_widgets/rotate_icon.dart';
import 'package:drifter/theme/app_colors.dart';
2023-05-15 20:32:54 +00:00
import 'package:drifter/utilities/assets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class Splash extends StatefulWidget {
const Splash({super.key});
@override
State<Splash> createState() => _SplashState();
}
class _SplashState extends State<Splash> {
2023-05-15 15:55:49 +00:00
late final RotateIconController _rotateIconController;
@override
void initState() {
2023-05-15 15:55:49 +00:00
_rotateIconController = RotateIconController();
Future.delayed(const Duration(seconds: 3), () {
Navigator.pushReplacement(context,
MaterialPageRoute(builder: (context) => const MainScreenWidget()));
});
2023-05-15 15:55:49 +00:00
super.initState();
}
@override
dispose() {
_rotateIconController.repeat = null;
_rotateIconController.reset = null;
super.dispose();
}
@override
Widget build(BuildContext context) {
2023-05-15 15:55:49 +00:00
_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(
2023-05-15 15:55:49 +00:00
height: 230,
),
//replace with rotating drifter icon
2023-05-15 15:55:49 +00:00
RotateIcon(
icon: SvgPicture.asset(
Assets.svg.drifterIcon,
height: 45,
width: 45,
),
curve: Curves.easeInOutSine,
animationDurationMultiplier: 1.2,
rotationPercent: 1.0,
controller: _rotateIconController,
),
],
),
),
);
}
}