Hama-Pengusiran-Guard/lib/screens/splash/splash_screen.dart

54 lines
1.4 KiB
Dart

// lib/screens/splash/splash_screen.dart
import 'dart:async';
import 'package:flutter/material.dart';
import '../main_screen.dart';
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
@override
State<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
super.initState();
// delay 2 detik lalu ke halaman utama
Timer(const Duration(seconds: 2), () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const MainScreen()),
);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.green[700],
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.bug_report, size: 80, color: Colors.white),
const SizedBox(height: 20),
const Text(
'HamaGuard',
style: TextStyle(
color: Colors.white,
fontSize: 28,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 10),
CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
),
],
),
),
);
}
}