2024-01-27 13:51:45 +00:00
|
|
|
import 'package:aurcache/screens/aur_screen.dart';
|
2023-12-30 15:46:13 +00:00
|
|
|
import 'package:aurcache/screens/build_screen.dart';
|
2023-12-30 21:23:42 +00:00
|
|
|
import 'package:aurcache/screens/builds_screen.dart';
|
2023-12-30 15:46:13 +00:00
|
|
|
import 'package:aurcache/screens/dashboard_screen.dart';
|
2024-01-01 16:11:05 +00:00
|
|
|
import 'package:aurcache/components/routing/menu_shell.dart';
|
2023-12-30 21:23:42 +00:00
|
|
|
import 'package:aurcache/screens/package_screen.dart';
|
2024-01-19 19:00:10 +00:00
|
|
|
import 'package:aurcache/screens/packages_screen.dart';
|
2023-12-30 15:46:13 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
|
|
|
|
final GlobalKey<NavigatorState> _rootNavigatorKey = GlobalKey<NavigatorState>();
|
|
|
|
final GlobalKey<NavigatorState> _shellNavigatorKey =
|
|
|
|
GlobalKey<NavigatorState>();
|
|
|
|
|
|
|
|
final appRouter = GoRouter(
|
|
|
|
navigatorKey: _rootNavigatorKey,
|
|
|
|
initialLocation: '/',
|
|
|
|
routes: [
|
|
|
|
ShellRoute(
|
|
|
|
navigatorKey: _shellNavigatorKey,
|
|
|
|
builder: (context, state, child) {
|
|
|
|
return MenuShell(child: child);
|
|
|
|
},
|
|
|
|
routes: [
|
|
|
|
GoRoute(
|
|
|
|
path: '/',
|
|
|
|
builder: (context, state) => DashboardScreen(),
|
2023-12-30 21:23:42 +00:00
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: '/build/:id',
|
|
|
|
builder: (context, state) {
|
|
|
|
final id = int.parse(state.pathParameters['id']!);
|
|
|
|
return BuildScreen(buildID: id);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
GoRoute(
|
|
|
|
path: '/builds',
|
|
|
|
builder: (context, state) => const BuildsScreen(),
|
|
|
|
),
|
2024-01-19 19:00:10 +00:00
|
|
|
GoRoute(
|
|
|
|
path: '/packages',
|
|
|
|
builder: (context, state) => const PackagesScreen(),
|
|
|
|
),
|
2024-01-27 13:51:45 +00:00
|
|
|
GoRoute(
|
|
|
|
path: '/aur',
|
2024-01-29 21:42:11 +00:00
|
|
|
builder: (context, state) {
|
|
|
|
return AurScreen(initalQuery: state.uri.queryParameters["query"]);
|
|
|
|
},
|
2024-01-27 13:51:45 +00:00
|
|
|
),
|
2023-12-30 21:23:42 +00:00
|
|
|
GoRoute(
|
|
|
|
path: '/package/:id',
|
|
|
|
builder: (context, state) {
|
|
|
|
final id = int.parse(state.pathParameters['id']!);
|
|
|
|
return PackageScreen(pkgID: id);
|
|
|
|
},
|
2023-12-30 15:46:13 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|