import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; import 'package:google_fonts/google_fonts.dart'; import '../../../../core/storage/secure_storage.dart'; import '../../../../core/services/tts_service.dart'; import '../../../../injection_container.dart'; class SplashScreen extends StatefulWidget { const SplashScreen({super.key}); @override State createState() => _SplashScreenState(); } class _SplashScreenState extends State { @override void initState() { super.initState(); _checkAuth(); } Future _checkAuth() async { await Future.delayed(const Duration(milliseconds: 800)); final storage = sl(); final token = await storage.getAccessToken(); final role = await storage.getUserRole(); if (!mounted) return; if (token == null || role == null) { context.go('/login'); return; } final name = await storage.getDisplayName() ?? 'kembali'; sl().speak('Selamat datang, $name'); if (role == 'ROLE_GUARDIAN') { context.go('/guardian/dashboard'); } else { context.go('/user/walkguide'); } } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: const Color(0xFF1A56DB), body: Center( child: Column( mainAxisSize: MainAxisSize.min, children: [ Container( width: 80, height: 80, decoration: BoxDecoration(color: Colors.white.withOpacity(0.15), borderRadius: BorderRadius.circular(20)), child: const Icon(Icons.navigation_rounded, color: Colors.white, size: 44), ), const SizedBox(height: 20), Text('WalkGuide', style: GoogleFonts.outfit(fontSize: 32, fontWeight: FontWeight.w700, color: Colors.white)), const SizedBox(height: 8), Text('AI Navigation Assistant', style: GoogleFonts.inter(fontSize: 14, color: Colors.white60)), const SizedBox(height: 48), const CircularProgressIndicator(color: Colors.white54, strokeWidth: 2), ], ), ), ); } }