E32221362_BeramalBaik/lib/pages/splash_page.dart

62 lines
1.5 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> {
@override
void initState() {
super.initState();
// Timer untuk pindah otomatis ke halaman berikutnya
Timer(const Duration(seconds: 3), () {
Navigator.pushReplacementNamed(context, '/dashboard_public'); // Ganti sesuai rute kamu
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
fit: StackFit.expand,
children: [
// Background image
Image.asset(
'assets/images/splash.jpg',
fit: BoxFit.cover,
),
// Overlay hijau transparan
Container(
color: Colors.green.withAlpha(100),
),
// Foreground content
Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: const [
Icon(Icons.volunteer_activism, size: 80, color: Colors.white),
SizedBox(height: 20),
Text(
'BeramalBaik',
style: TextStyle(
fontSize: 28,
color: Colors.white,
fontWeight: FontWeight.bold,
letterSpacing: 1.2,
),
),
],
),
),
],
),
);
}
}