125 lines
3.7 KiB
Dart
125 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'dart:async';
|
|
|
|
class SplashScreen extends StatefulWidget {
|
|
const SplashScreen({super.key});
|
|
|
|
@override
|
|
State<SplashScreen> createState() => _SplashScreenState();
|
|
}
|
|
|
|
class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin {
|
|
late AnimationController _controller;
|
|
late Animation<double> _fadeAnimation;
|
|
late Animation<double> _scaleAnimation;
|
|
late Animation<Offset> _slideAnimation;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
_controller = AnimationController(
|
|
duration: const Duration(milliseconds: 2000),
|
|
vsync: this,
|
|
);
|
|
|
|
_fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
|
CurvedAnimation(
|
|
parent: _controller,
|
|
curve: const Interval(0.0, 0.6, curve: Curves.easeOut)),
|
|
);
|
|
|
|
_scaleAnimation = Tween<double>(begin: 0.5, end: 1.0).animate(
|
|
CurvedAnimation(
|
|
parent: _controller,
|
|
curve: const Interval(0.0, 0.8, curve: Curves.elasticOut)),
|
|
);
|
|
|
|
_slideAnimation =
|
|
Tween<Offset>(begin: const Offset(0, 0.5), end: Offset.zero).animate(
|
|
CurvedAnimation(
|
|
parent: _controller,
|
|
curve: const Interval(0.3, 1.0, curve: Curves.easeOutBack)),
|
|
);
|
|
|
|
_controller.forward();
|
|
|
|
Timer(const Duration(seconds: 3), () {
|
|
Navigator.pushReplacementNamed(context, '/login');
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Container(
|
|
decoration: const BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [
|
|
Color(0xFF0D47A1),
|
|
Color(0xFF1976D2),
|
|
Color(0xFF42A5F5),
|
|
Color(0xFF90CAF9),
|
|
],
|
|
stops: [0.0, 0.3, 0.7, 1.0],
|
|
),
|
|
),
|
|
child: SafeArea(
|
|
child: Center(
|
|
child: FadeTransition(
|
|
opacity: _fadeAnimation,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
ScaleTransition(
|
|
scale: _scaleAnimation,
|
|
child: Image.asset(
|
|
'assets/images/logo.png',
|
|
width: 380,
|
|
height: 380,
|
|
fit: BoxFit.contain,
|
|
gaplessPlayback: true,
|
|
),
|
|
),
|
|
Transform.translate(
|
|
offset: const Offset(0, -140),
|
|
child: SlideTransition(
|
|
position: _slideAnimation,
|
|
child: Text(
|
|
'INVENTORY\nSYSTEM',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: 36,
|
|
fontWeight: FontWeight.w900,
|
|
letterSpacing: 4,
|
|
color: Colors.white,
|
|
height: 1.0,
|
|
shadows: [
|
|
Shadow(
|
|
offset: const Offset(2, 2),
|
|
blurRadius: 6,
|
|
color: Colors.black.withOpacity(0.4),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |