import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import '../../core/constants/app_colors.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../map/map_view.dart'; import '../onboarding/onboarding_view.dart'; class SplashView extends StatefulWidget { const SplashView({super.key}); @override State createState() => _SplashViewState(); } class _SplashViewState extends State with SingleTickerProviderStateMixin { late AnimationController _animController; late Animation _scaleAnimation; late Animation _fadeAnimation; @override void initState() { super.initState(); _animController = AnimationController( vsync: this, duration: const Duration(milliseconds: 1500), ); _scaleAnimation = Tween(begin: 0.88, end: 1.0).animate( CurvedAnimation(parent: _animController, curve: Curves.easeOutCubic), ); _fadeAnimation = Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation(parent: _animController, curve: Curves.easeIn), ); _animController.forward(); Future.delayed(const Duration(milliseconds: 2800), () async { if (mounted) { final prefs = await SharedPreferences.getInstance(); final hasSeen = prefs.getBool('has_seen_onboarding') ?? false; final targetWidget = hasSeen ? const MapView() : const OnboardingView(); if (mounted) { Navigator.of(context).pushReplacement( PageRouteBuilder( pageBuilder: (context, anim, secAnim) => targetWidget, transitionsBuilder: (context, animation, secAnim, child) => FadeTransition(opacity: animation, child: child), transitionDuration: const Duration(milliseconds: 600), ), ); } } }); } @override void dispose() { _animController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.canvasLight, body: Center( child: FadeTransition( opacity: _fadeAnimation, child: ScaleTransition( scale: _scaleAnimation, child: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 20), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ // Luxury Uruk Emblem Container Container( width: 114, height: 114, decoration: BoxDecoration( color: const Color(0xFF131722), borderRadius: BorderRadius.circular(32), border: Border.all( color: AppColors.urukGold.withValues(alpha: 0.35), width: 1.5, ), boxShadow: [ BoxShadow( color: AppColors.urukGold.withValues(alpha: 0.22), blurRadius: 36, offset: const Offset(0, 14), ), const BoxShadow( color: Color(0x24000000), blurRadius: 20, offset: Offset(0, 6), ), ], ), child: ClipRRect( borderRadius: BorderRadius.circular(30), child: Image.asset( 'assets/images/siro_uruk_logo.png', fit: BoxFit.cover, ), ), ), const SizedBox(height: 24), // App Title Text( 'خرائط أوروك', style: GoogleFonts.alexandria( fontSize: 28, fontWeight: FontWeight.w800, color: AppColors.textPrimary, letterSpacing: -0.5, ), ), const SizedBox(height: 6), // Subtitle Text( 'Uruk Map • منظومة الخرائط والملاحة الذكية', style: GoogleFonts.alexandria( fontSize: 13, fontWeight: FontWeight.w600, color: AppColors.textSecondary, ), ), const SizedBox(height: 26), // Official Uruk International Prize Award Badge Container( constraints: const BoxConstraints(maxWidth: 340), padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 11), decoration: BoxDecoration( gradient: const LinearGradient( colors: [ Color(0xFFFFFDF7), Color(0xFFFFF6D8), ], begin: Alignment.topRight, end: Alignment.bottomLeft, ), borderRadius: BorderRadius.circular(18), border: Border.all(color: AppColors.urukGoldBorder, width: 1.2), boxShadow: [ BoxShadow( color: AppColors.urukGold.withValues(alpha: 0.14), blurRadius: 22, offset: const Offset(0, 8), ), ], ), child: Row( mainAxisSize: MainAxisSize.min, children: [ Container( width: 44, height: 44, decoration: BoxDecoration( shape: BoxShape.circle, color: AppColors.pureWhite, border: Border.all( color: AppColors.urukGold.withValues(alpha: 0.4), width: 1.2, ), ), child: ClipOval( child: Image.asset( 'assets/images/uruk_prize_logo.png', fit: BoxFit.contain, ), ), ), const SizedBox(width: 12), Flexible( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ Row( mainAxisSize: MainAxisSize.min, children: [ const Icon( Icons.workspace_premium_rounded, size: 16, color: AppColors.urukGoldDark, ), const SizedBox(width: 4), Flexible( child: Text( 'الحائز على جائزة أوروك الدولية', style: GoogleFonts.alexandria( fontSize: 12, fontWeight: FontWeight.w700, color: AppColors.urukGoldDark, ), ), ), ], ), const SizedBox(height: 2), Text( 'مشروع منبثق عن برنامج جوائز أوروك للسيادة الرقمية', style: GoogleFonts.alexandria( fontSize: 10, fontWeight: FontWeight.w500, color: AppColors.textSecondary, ), maxLines: 2, overflow: TextOverflow.ellipsis, ), ], ), ), ], ), ), const SizedBox(height: 28), // Regional Sovereignty Pill Badge Container( padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 6), decoration: BoxDecoration( color: AppColors.surfaceMuted, borderRadius: BorderRadius.circular(20), border: Border.all(color: AppColors.borderSubtle), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ Container( width: 7, height: 7, decoration: const BoxDecoration( color: AppColors.tacticalEmerald, shape: BoxShape.circle, ), ), const SizedBox(width: 8), Text( '🌍 شبكة ملاحة إقليمية مستقلة • v2.4 PRO', style: GoogleFonts.alexandria( fontSize: 11, fontWeight: FontWeight.w600, color: AppColors.textSecondary, ), ), ], ), ), ], ), ), ), ), ), ); } }