134 lines
5.3 KiB
Dart
134 lines
5.3 KiB
Dart
import 'package:go_router/go_router.dart';
|
|
|
|
import '../core/constants/app_constants.dart';
|
|
import '../features/activity_log/activity_log_screen.dart' as activity;
|
|
import '../features/ai_benchmark/ai_benchmark_screen.dart' as benchmark;
|
|
import '../features/auth/login_screen.dart' as auth_login;
|
|
import '../features/auth/register_screen.dart' as auth_register;
|
|
import '../features/auth/splash_screen.dart' as auth_splash;
|
|
import '../features/call/call_screen.dart' as call;
|
|
import '../features/guardian_dashboard/guardian_activity_log_screen.dart'
|
|
as guardian_logs;
|
|
import '../features/guardian_dashboard/guardian_ai_config_screen.dart'
|
|
as guardian_ai;
|
|
import '../features/guardian_dashboard/guardian_map_screen.dart'
|
|
as guardian_map;
|
|
import '../features/guardian_dashboard/guardian_send_notification_screen.dart'
|
|
as guardian_send;
|
|
import '../features/guardian_dashboard/guardian_settings_screen.dart'
|
|
as guardian_settings;
|
|
import '../features/guardian_dashboard/guardian_tools_screen.dart'
|
|
as guardian_tools;
|
|
import '../features/home/presentation/guardian_dashboard_screen.dart'
|
|
as guardian_home;
|
|
import '../features/navigation_mode/navigation_mode_screen.dart' as nav;
|
|
import '../features/notifications/notification_screen.dart' as notifications;
|
|
import '../features/pairing/pairing_screens.dart' as pairing;
|
|
import '../features/server_connect/server_connect_server.dart'
|
|
as server_connect;
|
|
import '../features/settings/user_settings_screen.dart' as user_settings;
|
|
import '../features/sos/sos_screen.dart' as sos;
|
|
import '../features/walk_guide/walk_guide_screen.dart' as walk_guide;
|
|
import '../shared/widgets/app_shells.dart';
|
|
|
|
final GoRouter appRouter = GoRouter(
|
|
initialLocation: '/splash',
|
|
redirect: (context, state) async {
|
|
final path = state.matchedLocation;
|
|
final serverUrl = await AppConstants.getServerUrl();
|
|
|
|
if ((serverUrl == null || serverUrl.isEmpty) && path != '/server-connect') {
|
|
return '/server-connect';
|
|
}
|
|
if (path == '/server-connect' &&
|
|
serverUrl != null &&
|
|
serverUrl.isNotEmpty) {
|
|
return '/splash';
|
|
}
|
|
return null;
|
|
},
|
|
routes: [
|
|
GoRoute(
|
|
path: '/server-connect',
|
|
builder: (_, __) => const server_connect.ServerConnectScreen()),
|
|
GoRoute(
|
|
path: '/splash', builder: (_, __) => const auth_splash.SplashScreen()),
|
|
GoRoute(path: '/login', builder: (_, __) => const auth_login.LoginScreen()),
|
|
GoRoute(
|
|
path: '/register',
|
|
builder: (_, __) => const auth_register.RegisterScreen()),
|
|
GoRoute(
|
|
path: '/incoming-call',
|
|
builder: (_, __) => const call.IncomingCallScreen()),
|
|
ShellRoute(
|
|
builder: (_, __, child) => UserShell(child: child),
|
|
routes: [
|
|
GoRoute(
|
|
path: '/user/walkguide',
|
|
builder: (_, __) => const walk_guide.WalkGuideScreen()),
|
|
GoRoute(path: '/user/sos', builder: (_, __) => const sos.SosScreen()),
|
|
GoRoute(
|
|
path: '/user/activity',
|
|
builder: (_, __) => const activity.ActivityLogScreen()),
|
|
GoRoute(
|
|
path: '/user/notifications',
|
|
builder: (_, __) => const notifications.NotificationScreen()),
|
|
GoRoute(
|
|
path: '/user/navigation',
|
|
builder: (_, __) => const nav.NavigationModeScreen()),
|
|
GoRoute(
|
|
path: '/user/settings',
|
|
builder: (_, __) => const user_settings.UserSettingsScreen()),
|
|
GoRoute(
|
|
path: '/user/pairing',
|
|
builder: (_, __) => const pairing.UserPairingScreen()),
|
|
GoRoute(
|
|
path: '/user/call', builder: (_, __) => const call.CallScreen()),
|
|
GoRoute(
|
|
path: '/user/benchmark',
|
|
builder: (_, __) => const benchmark.AiBenchmarkScreen()),
|
|
],
|
|
),
|
|
ShellRoute(
|
|
builder: (_, __, child) => GuardianShell(child: child),
|
|
routes: [
|
|
GoRoute(
|
|
path: '/guardian/dashboard',
|
|
builder: (_, __) => const guardian_home.GuardianDashboardScreen()),
|
|
GoRoute(
|
|
path: '/guardian/map',
|
|
builder: (_, __) => const guardian_map.GuardianMapScreen()),
|
|
GoRoute(
|
|
path: '/guardian/logs',
|
|
builder: (_, __) =>
|
|
const guardian_logs.GuardianActivityLogScreen()),
|
|
GoRoute(
|
|
path: '/guardian/send-notif',
|
|
builder: (_, __) => const guardian_send.GuardianSendNotifScreen()),
|
|
GoRoute(
|
|
path: '/guardian/ai-config',
|
|
builder: (_, __) => const guardian_ai.GuardianAiConfigScreen()),
|
|
GoRoute(
|
|
path: '/guardian/voice-cmd',
|
|
builder: (_, __) => const guardian_tools.GuardianVoiceCmdScreen()),
|
|
GoRoute(
|
|
path: '/guardian/shortcuts',
|
|
builder: (_, __) => const guardian_tools.GuardianShortcutScreen()),
|
|
GoRoute(
|
|
path: '/guardian/geofence',
|
|
builder: (_, __) => const guardian_tools.GuardianGeofenceScreen()),
|
|
GoRoute(
|
|
path: '/guardian/pairing',
|
|
builder: (_, __) => const pairing.GuardianPairingScreen()),
|
|
GoRoute(
|
|
path: '/guardian/settings',
|
|
builder: (_, __) =>
|
|
const guardian_settings.GuardianSettingsScreen()),
|
|
GoRoute(
|
|
path: '/guardian/benchmark',
|
|
builder: (_, __) => const benchmark.AiBenchmarkScreen()),
|
|
],
|
|
),
|
|
],
|
|
);
|