91 lines
2.7 KiB
Dart
Executable File
91 lines
2.7 KiB
Dart
Executable File
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
/// Splash / deep-link handler — navigates to home or an intended path (no auth).
|
|
class SessionCheckScreen extends StatefulWidget {
|
|
const SessionCheckScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<SessionCheckScreen> createState() => _SessionCheckScreenState();
|
|
}
|
|
|
|
class _SessionCheckScreenState extends State<SessionCheckScreen> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
WidgetsBinding.instance.addPostFrameCallback((_) => _navigate());
|
|
}
|
|
|
|
void _navigate() {
|
|
final uri = GoRouter.of(context).routeInformationProvider.value.uri;
|
|
final intendedPath = uri.queryParameters['intendedPath'];
|
|
final normalized = (intendedPath != null && intendedPath.isNotEmpty)
|
|
? Uri.decodeComponent(intendedPath)
|
|
: null;
|
|
|
|
if (normalized != null &&
|
|
normalized.isNotEmpty &&
|
|
normalized != '/' &&
|
|
!normalized.startsWith('/login')) {
|
|
context.go(normalized);
|
|
} else {
|
|
context.go('/uaenumbers');
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) => const SplashScreen();
|
|
}
|
|
|
|
class SplashScreen extends StatelessWidget {
|
|
const SplashScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDark = Theme.of(context).brightness == Brightness.dark;
|
|
return Scaffold(
|
|
backgroundColor: isDark ? null : Colors.white,
|
|
body: Container(
|
|
decoration: BoxDecoration(
|
|
color: isDark ? null : Colors.white,
|
|
image: isDark
|
|
? const DecorationImage(
|
|
image: AssetImage(
|
|
'assets/splash_screen/background_splash_dark.png',
|
|
),
|
|
fit: BoxFit.cover,
|
|
)
|
|
: null,
|
|
),
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Spacer(),
|
|
Image.asset(
|
|
isDark
|
|
? 'assets/splash_screen/FCSCLogo_dark.png'
|
|
: 'assets/splash_screen/FCSCLogo_light.png',
|
|
width: 150,
|
|
),
|
|
const SizedBox(height: 20),
|
|
const Spacer(),
|
|
Padding(
|
|
padding: const EdgeInsets.only(bottom: 24.0),
|
|
child: Text(
|
|
'© حقوق التأليف والنشر',
|
|
style: TextStyle(
|
|
color: isDark ? Colors.white70 : Colors.black54,
|
|
fontSize: 14,
|
|
fontFamily: 'NotoKufi',
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|