74 lines
1.9 KiB
Dart
74 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import '../../../core/config/env.dart';
|
|
import '../../../core/routing/routes.dart';
|
|
|
|
class SplashScreen extends StatefulWidget {
|
|
const SplashScreen({super.key});
|
|
|
|
@override
|
|
State<SplashScreen> createState() => _SplashScreenState();
|
|
}
|
|
|
|
class _SplashScreenState extends State<SplashScreen> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_initApp();
|
|
}
|
|
|
|
Future<void> _initApp() async {
|
|
// Simulate loading or initialization
|
|
await Future.delayed(const Duration(seconds: 2));
|
|
|
|
// For now: always go to Home
|
|
// Later: check login status & decide
|
|
if (mounted) {
|
|
context.go(AppRoutes.home);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: Colors.white, // Splash background color
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
// App Logo
|
|
Image.asset(
|
|
'assets/logo.png', // Make sure logo.png is in assets
|
|
width: 120,
|
|
height: 120,
|
|
),
|
|
const SizedBox(height: 20),
|
|
|
|
// App Name or Tagline
|
|
const Text(
|
|
'MyApp',
|
|
style: TextStyle(
|
|
fontSize: 28,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.blue,
|
|
),
|
|
),
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
// Environment Label (Optional)
|
|
// Text(
|
|
// "Environment: ${Env.envName.toUpperCase()}",
|
|
// style: const TextStyle(fontSize: 14, color: Colors.grey),
|
|
// ),
|
|
const SizedBox(height: 30),
|
|
|
|
// Loading Indicator
|
|
const CircularProgressIndicator(),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|