Files
Aira-Mobile-App/lib/screens/splash_screen.dart
T

174 lines
5.1 KiB
Dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:permission_handler/permission_handler.dart';
import '../config/app_config.dart';
import 'webview_screen.dart';
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
@override
State<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _scaleAnimation;
late Animation<double> _fadeAnimation;
@override
void initState() {
super.initState();
// Set immersive status bar
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.light,
systemNavigationBarColor: Color(0xFF09090B),
systemNavigationBarIconBrightness: Brightness.light,
),
);
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 1400),
);
_scaleAnimation = Tween<double>(begin: 0.85, end: 1.0).animate(
CurvedAnimation(parent: _controller, curve: Curves.easeOutCubic),
);
_fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(parent: _controller, curve: Curves.easeIn),
);
_controller.forward();
_initializeApp();
}
Future<void> _initializeApp() async {
// Request microphone & camera permissions in advance for voice & multimodal chat
try {
await [
Permission.microphone,
Permission.camera,
].request();
} catch (_) {}
// Wait for animation to finish
await Future.delayed(const Duration(milliseconds: 1800));
if (!mounted) return;
Navigator.of(context).pushReplacement(
PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) =>
const WebViewScreen(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return FadeTransition(opacity: animation, child: child);
},
transitionDuration: const Duration(milliseconds: 400),
),
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF09090B), // Dark sovereign black
body: Center(
child: FadeTransition(
opacity: _fadeAnimation,
child: ScaleTransition(
scale: _scaleAnimation,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Logo Container with soft ambient glow
Container(
width: 110,
height: 110,
decoration: BoxDecoration(
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: const Color(0xFF2563EB).withOpacity(0.35),
blurRadius: 36,
spreadRadius: 4,
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(28),
child: Image.asset(
'assets/icons/app_icon.png',
fit: BoxFit.cover,
),
),
),
const SizedBox(height: 28),
// App Title
const Text(
AppConfig.appName,
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
letterSpacing: 1.2,
color: Colors.white,
),
),
const SizedBox(height: 6),
// Subtitle
Text(
"SOVEREIGN INTELLIGENCE • ENGINE V3.6",
style: TextStyle(
fontSize: 11,
letterSpacing: 2.0,
fontWeight: FontWeight.w600,
color: Colors.blueAccent.shade100.withOpacity(0.9),
),
),
const SizedBox(height: 48),
// Loader
const SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
valueColor: AlwaysStoppedAnimation<Color>(Color(0xFF3B82F6)),
),
),
const SizedBox(height: 40),
// Founder & Org Footer
Text(
"${AppConfig.organization}\nArchitect: ${AppConfig.founder}",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 11,
color: Colors.white.withOpacity(0.4),
height: 1.4,
),
),
],
),
),
),
),
);
}
}