uaestats_fe/lib/config/sessionCheckScreen.dart

33 lines
1.0 KiB
Dart
Executable File

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:uae_stat/lib/features/splash/presentation/splash_screen.dart'
as new_splash;
/// Legacy splash/deep-link entrypoint kept only for compatibility with the
/// old router. It now delegates to the new splash screen.
class SessionCheckScreen extends StatelessWidget {
const SessionCheckScreen({super.key});
String _resolveNextPath(BuildContext context) {
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')) {
return normalized;
}
return '/home';
}
@override
Widget build(BuildContext context) {
return new_splash.SplashScreen(nextPath: _resolveNextPath(context));
}
}