MIF_E31221269/lib/screens/splash.dart

107 lines
2.8 KiB
Dart

import 'package:flutter/material.dart';
import 'login.dart'; // Pastikan file login.dart diimport
class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _animation;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: Duration(seconds: 2),
);
_animation = CurvedAnimation(
parent: _controller,
curve: Curves.easeInOut,
);
_controller.forward();
Future.delayed(Duration(seconds: 3), () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => LoginScreen()),
);
});
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [Colors.white, Color(0xFFFDEDEE)],
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Logo dengan animasi
ScaleTransition(
scale: _animation,
child: Image.asset(
'assets/jago.jpg',
width: 220,
height: 220,
fit: BoxFit.contain,
),
),
SizedBox(height: 30),
// Text dengan fade in
FadeTransition(
opacity: _animation,
child: Text(
"JAGO",
style: TextStyle(
color: Color(0xFFA82429),
fontSize: 36,
fontWeight: FontWeight.bold,
letterSpacing: 2.0,
),
),
),
SizedBox(height: 10),
FadeTransition(
opacity: _animation,
child: Text(
"Aplikasi Otomasi Pada Kandang Anak Ayam",
style: TextStyle(
color: Colors.black87,
fontSize: 18,
fontWeight: FontWeight.w500,
),
),
),
SizedBox(height: 50),
// Loading indicator
CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Color(0xFFA82429)),
),
],
),
),
),
);
}
}