| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import 'package:flutter/material.dart';
- import 'package:go_router/go_router.dart';
- import 'package:sino_med_cloud/features/main_tab_page.dart';
- import 'package:sino_med_cloud/l10n/app_localizations.dart';
- import '../features/auth/presentation/login_page.dart';
- import '../features/MediaTestPage/presentation/media_test_page.dart';
- import '../core/network/pages/no_network_page.dart';
- final rootNavigatorKey = GlobalKey<NavigatorState>();
- class AppRouter {
- static final router = GoRouter(
- navigatorKey: rootNavigatorKey,
- routes: [
- GoRoute(
- path: '/',
- builder: (context, state) => const LoginPage(),
- ),
- GoRoute(
- path: '/mainTab',
- builder: (context, state) => const MainTabPage(),
- ),
- GoRoute(
- path: '/mediaTest',
- builder: (context, state) => const MediaTestPage(),
- ),
- GoRoute(
- path: '/noNetwork',
- builder: (context, state) => const NoNetworkPage(),
- ),
- ],
- errorBuilder: (context, state) {
- final l10n = AppLocalizations.of(context)!;
- return Scaffold(
- appBar: AppBar(
- title: Text(l10n.pageNotFound),
- ),
- body: Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- const Icon(
- Icons.error_outline,
- size: 64,
- color: Colors.grey,
- ),
- const SizedBox(height: 16),
- Text(
- l10n.pageNotFoundWithUri(state.uri.toString()),
- style: const TextStyle(fontSize: 16),
- ),
- const SizedBox(height: 16),
- ElevatedButton(
- onPressed: () => context.go('/'),
- child: Text(l10n.returnHome),
- ),
- ],
- ),
- ),
- );
- },
- );
- }
|