67 lines
1.8 KiB
Dart
67 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:mymuseum_visitapp/constants.dart';
|
|
|
|
class SplashScreen extends StatefulWidget {
|
|
const SplashScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<SplashScreen> createState() => _SplashScreenState();
|
|
}
|
|
|
|
class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin {
|
|
late AnimationController _controller;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_controller = AnimationController(
|
|
duration: const Duration(milliseconds: 1200),
|
|
vsync: this,
|
|
)..repeat(reverse: true);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final size = MediaQuery.of(context).size;
|
|
return Scaffold(
|
|
backgroundColor: kBackgroundColor,
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Image.asset(
|
|
kSplashLogoAsset,
|
|
width: 200,
|
|
height: 200,
|
|
fit: BoxFit.contain,
|
|
errorBuilder: (_, __, ___) => Icon(
|
|
Icons.museum_outlined,
|
|
size: 100,
|
|
color: kMainColor1,
|
|
),
|
|
),
|
|
const SizedBox(height: 48),
|
|
RotationTransition(
|
|
turns: Tween(begin: 0.0, end: 3.0).animate(_controller),
|
|
child: Image.asset(
|
|
kLoaderAsset,
|
|
width: size.height * 0.07,
|
|
height: size.height * 0.07,
|
|
fit: BoxFit.contain,
|
|
errorBuilder: (_, __, ___) =>
|
|
CircularProgressIndicator(color: kMainColor1),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|