Files
penyaluran_app/lib/app/modules/splash/views/splash_view.dart
Khafidh Fuadi 5aaeb58d2b h-1 lebaran
2025-03-30 14:45:16 +07:00

89 lines
2.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:penyaluran_app/app/modules/auth/controllers/auth_controller.dart';
import 'package:penyaluran_app/app/theme/app_theme.dart';
class SplashView extends StatefulWidget {
const SplashView({super.key});
@override
State<SplashView> createState() => _SplashViewState();
}
class _SplashViewState extends State<SplashView> {
@override
void initState() {
super.initState();
_checkAuthAndNavigate();
}
_checkAuthAndNavigate() async {
// Tunggu 2 detik untuk menampilkan splash screen
await Future.delayed(const Duration(seconds: 2));
// Dapatkan AuthController dan periksa status autentikasi
final AuthController authController = Get.find<AuthController>();
await authController.checkAuthStatus();
// Navigasi akan ditangani oleh AuthController
// Tidak perlu navigasi manual di sini
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/images/logo-disalurkita.png',
width: 150,
height: 150,
errorBuilder: (context, error, stackTrace) {
return Container(
width: 120,
height: 120,
decoration: BoxDecoration(
color: AppTheme.primaryColor,
borderRadius: BorderRadius.circular(20),
),
child: const Icon(
Icons.people,
size: 60,
color: AppTheme.primaryColor,
),
);
},
),
const SizedBox(height: 24),
const Text(
'DisalurKita',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: AppTheme.primaryColor,
),
),
const SizedBox(height: 8),
const Text(
'Salurkan dengan Pasti, Pantau dengan Bukti',
style: TextStyle(
fontSize: 16,
color: AppTheme.primaryColor,
),
),
const SizedBox(height: 48),
const CircularProgressIndicator(
valueColor:
AlwaysStoppedAnimation<Color>(AppTheme.primaryColor),
),
],
),
),
),
);
}
}