diff --git a/lib/core/router/routes/desktop_routes.dart b/lib/core/router/routes/desktop_routes.dart index 44d03da9..8444d76f 100644 --- a/lib/core/router/routes/desktop_routes.dart +++ b/lib/core/router/routes/desktop_routes.dart @@ -12,22 +12,48 @@ part 'desktop_routes.g.dart'; routes: [ TypedGoRoute( path: HomeRoute.path, + name: HomeRoute.name, routes: [ - TypedGoRoute(path: AddProfileRoute.path), - TypedGoRoute(path: ProfilesRoute.path), - TypedGoRoute(path: NewProfileRoute.path), - TypedGoRoute(path: ProfileDetailsRoute.path), + TypedGoRoute( + path: AddProfileRoute.path, + name: AddProfileRoute.name, + ), + TypedGoRoute( + path: ProfilesRoute.path, + name: ProfilesRoute.name, + ), + TypedGoRoute( + path: NewProfileRoute.path, + name: NewProfileRoute.name, + ), + TypedGoRoute( + path: ProfileDetailsRoute.path, + name: ProfileDetailsRoute.name, + ), ], ), - TypedGoRoute(path: ProxiesRoute.path), - TypedGoRoute(path: LogsRoute.path), + TypedGoRoute( + path: ProxiesRoute.path, + name: ProxiesRoute.name, + ), + TypedGoRoute( + path: LogsRoute.path, + name: LogsRoute.name, + ), TypedGoRoute( path: SettingsRoute.path, + name: SettingsRoute.name, routes: [ - TypedGoRoute(path: ConfigOptionsRoute.path), + TypedGoRoute( + path: ConfigOptionsRoute.path, + name: ConfigOptionsRoute.name, + ), ], ), - TypedGoRoute(path: AboutRoute.path), + TypedGoRoute( + path: AboutRoute.path, + name: AboutRoute.name, + ), ], ) class DesktopWrapperRoute extends ShellRouteData { @@ -42,31 +68,35 @@ class DesktopWrapperRoute extends ShellRouteData { class LogsRoute extends GoRouteData { const LogsRoute(); static const path = '/logs'; + static const name = 'Logs'; @override Page buildPage(BuildContext context, GoRouterState state) { - return const NoTransitionPage(child: LogsPage()); + return const NoTransitionPage(name: name, child: LogsPage()); } } class SettingsRoute extends GoRouteData { const SettingsRoute(); static const path = '/settings'; + static const name = 'Settings'; @override Page buildPage(BuildContext context, GoRouterState state) { - return const NoTransitionPage(child: SettingsPage()); + return const NoTransitionPage(name: name, child: SettingsPage()); } } class ConfigOptionsRoute extends GoRouteData { const ConfigOptionsRoute(); static const path = 'config-options'; + static const name = 'Config Options'; @override Page buildPage(BuildContext context, GoRouterState state) { return const MaterialPage( fullscreenDialog: true, + name: name, child: ConfigOptionsPage(), ); } @@ -75,9 +105,13 @@ class ConfigOptionsRoute extends GoRouteData { class AboutRoute extends GoRouteData { const AboutRoute(); static const path = '/about'; + static const name = 'About'; @override Page buildPage(BuildContext context, GoRouterState state) { - return const NoTransitionPage(child: AboutPage()); + return const NoTransitionPage( + name: name, + child: AboutPage(), + ); } } diff --git a/lib/core/router/routes/mobile_routes.dart b/lib/core/router/routes/mobile_routes.dart index 98004ed0..1846cbf2 100644 --- a/lib/core/router/routes/mobile_routes.dart +++ b/lib/core/router/routes/mobile_routes.dart @@ -12,23 +12,52 @@ part 'mobile_routes.g.dart'; routes: [ TypedGoRoute( path: HomeRoute.path, + name: HomeRoute.name, routes: [ - TypedGoRoute(path: AddProfileRoute.path), - TypedGoRoute(path: ProfilesRoute.path), - TypedGoRoute(path: NewProfileRoute.path), - TypedGoRoute(path: ProfileDetailsRoute.path), - TypedGoRoute(path: LogsRoute.path), + TypedGoRoute( + path: AddProfileRoute.path, + name: AddProfileRoute.name, + ), + TypedGoRoute( + path: ProfilesRoute.path, + name: ProfilesRoute.name, + ), + TypedGoRoute( + path: NewProfileRoute.path, + name: NewProfileRoute.name, + ), + TypedGoRoute( + path: ProfileDetailsRoute.path, + name: ProfileDetailsRoute.name, + ), + TypedGoRoute( + path: LogsRoute.path, + name: LogsRoute.name, + ), TypedGoRoute( path: SettingsRoute.path, + name: SettingsRoute.name, routes: [ - TypedGoRoute(path: ConfigOptionsRoute.path), - TypedGoRoute(path: PerAppProxyRoute.path), + TypedGoRoute( + path: ConfigOptionsRoute.path, + name: ConfigOptionsRoute.name, + ), + TypedGoRoute( + path: PerAppProxyRoute.path, + name: PerAppProxyRoute.name, + ), ], ), - TypedGoRoute(path: AboutRoute.path), + TypedGoRoute( + path: AboutRoute.path, + name: AboutRoute.name, + ), ], ), - TypedGoRoute(path: ProxiesRoute.path), + TypedGoRoute( + path: ProxiesRoute.path, + name: ProxiesRoute.name, + ), ], ) class MobileWrapperRoute extends ShellRouteData { @@ -43,6 +72,7 @@ class MobileWrapperRoute extends ShellRouteData { class LogsRoute extends GoRouteData { const LogsRoute(); static const path = 'logs'; + static const name = 'Logs'; static final GlobalKey $parentNavigatorKey = rootNavigatorKey; @@ -50,6 +80,7 @@ class LogsRoute extends GoRouteData { Page buildPage(BuildContext context, GoRouterState state) { return const MaterialPage( fullscreenDialog: true, + name: name, child: LogsPage(), ); } @@ -58,6 +89,7 @@ class LogsRoute extends GoRouteData { class SettingsRoute extends GoRouteData { const SettingsRoute(); static const path = 'settings'; + static const name = 'Settings'; static final GlobalKey $parentNavigatorKey = rootNavigatorKey; @@ -65,6 +97,7 @@ class SettingsRoute extends GoRouteData { Page buildPage(BuildContext context, GoRouterState state) { return const MaterialPage( fullscreenDialog: true, + name: name, child: SettingsPage(), ); } @@ -73,6 +106,7 @@ class SettingsRoute extends GoRouteData { class ConfigOptionsRoute extends GoRouteData { const ConfigOptionsRoute(); static const path = 'config-options'; + static const name = 'Config Options'; static final GlobalKey $parentNavigatorKey = rootNavigatorKey; @@ -80,6 +114,7 @@ class ConfigOptionsRoute extends GoRouteData { Page buildPage(BuildContext context, GoRouterState state) { return const MaterialPage( fullscreenDialog: true, + name: name, child: ConfigOptionsPage(), ); } @@ -88,6 +123,7 @@ class ConfigOptionsRoute extends GoRouteData { class PerAppProxyRoute extends GoRouteData { const PerAppProxyRoute(); static const path = 'per-app-proxy'; + static const name = 'Per-app Proxy'; static final GlobalKey $parentNavigatorKey = rootNavigatorKey; @@ -95,6 +131,7 @@ class PerAppProxyRoute extends GoRouteData { Page buildPage(BuildContext context, GoRouterState state) { return const MaterialPage( fullscreenDialog: true, + name: name, child: PerAppProxyPage(), ); } @@ -103,6 +140,7 @@ class PerAppProxyRoute extends GoRouteData { class AboutRoute extends GoRouteData { const AboutRoute(); static const path = 'about'; + static const name = 'About'; static final GlobalKey $parentNavigatorKey = rootNavigatorKey; @@ -110,6 +148,7 @@ class AboutRoute extends GoRouteData { Page buildPage(BuildContext context, GoRouterState state) { return const MaterialPage( fullscreenDialog: true, + name: name, child: AboutPage(), ); } diff --git a/lib/core/router/routes/shared_routes.dart b/lib/core/router/routes/shared_routes.dart index d0908005..12a13b59 100644 --- a/lib/core/router/routes/shared_routes.dart +++ b/lib/core/router/routes/shared_routes.dart @@ -14,26 +14,35 @@ final GlobalKey rootNavigatorKey = GlobalKey(); class HomeRoute extends GoRouteData { const HomeRoute(); static const path = '/'; + static const name = 'Home'; @override Page buildPage(BuildContext context, GoRouterState state) { - return const NoTransitionPage(child: HomePage()); + return const NoTransitionPage( + name: name, + child: HomePage(), + ); } } class ProxiesRoute extends GoRouteData { const ProxiesRoute(); static const path = '/proxies'; + static const name = 'Proxies'; @override Page buildPage(BuildContext context, GoRouterState state) { - return const NoTransitionPage(child: ProxiesPage()); + return const NoTransitionPage( + name: name, + child: ProxiesPage(), + ); } } class AddProfileRoute extends GoRouteData { const AddProfileRoute({this.url}); static const path = 'add'; + static const name = 'Add Profile'; final String? url; static final GlobalKey $parentNavigatorKey = rootNavigatorKey; @@ -42,6 +51,7 @@ class AddProfileRoute extends GoRouteData { Page buildPage(BuildContext context, GoRouterState state) { return BottomSheetPage( fixed: true, + name: name, builder: (controller) => AddProfileModal( url: url, scrollController: controller, @@ -50,15 +60,17 @@ class AddProfileRoute extends GoRouteData { } } -@TypedGoRoute(path: IntroRoute.path) +@TypedGoRoute(path: IntroRoute.path, name: IntroRoute.name) class IntroRoute extends GoRouteData { const IntroRoute(); static const path = '/intro'; + static const name = 'Intro'; @override Page buildPage(BuildContext context, GoRouterState state) { return const MaterialPage( fullscreenDialog: true, + name: name, child: IntroPage(), ); } @@ -67,22 +79,25 @@ class IntroRoute extends GoRouteData { class ProfilesRoute extends GoRouteData { const ProfilesRoute(); static const path = 'profiles'; + static const name = 'Profiles'; static final GlobalKey $parentNavigatorKey = rootNavigatorKey; @override Page buildPage(BuildContext context, GoRouterState state) { return BottomSheetPage( + name: name, builder: (controller) => ProfilesModal(scrollController: controller), ); } } class NewProfileRoute extends GoRouteData { - const NewProfileRoute({this.url, this.name}); + const NewProfileRoute({this.url, this.profileName}); static const path = 'profiles/new'; + static const name = 'New Profile'; final String? url; - final String? name; + final String? profileName; static final GlobalKey $parentNavigatorKey = rootNavigatorKey; @@ -90,10 +105,11 @@ class NewProfileRoute extends GoRouteData { Page buildPage(BuildContext context, GoRouterState state) { return MaterialPage( fullscreenDialog: true, + name: name, child: ProfileDetailPage( "new", url: url, - name: name, + name: profileName, ), ); } @@ -103,6 +119,7 @@ class ProfileDetailsRoute extends GoRouteData { const ProfileDetailsRoute(this.id); final String id; static const path = 'profiles/:id'; + static const name = 'Profile Details'; static final GlobalKey $parentNavigatorKey = rootNavigatorKey; @@ -110,6 +127,7 @@ class ProfileDetailsRoute extends GoRouteData { Page buildPage(BuildContext context, GoRouterState state) { return MaterialPage( fullscreenDialog: true, + name: name, child: ProfileDetailPage(id), ); } diff --git a/lib/utils/bottom_sheet_page.dart b/lib/utils/bottom_sheet_page.dart index efb118b3..659301f6 100644 --- a/lib/utils/bottom_sheet_page.dart +++ b/lib/utils/bottom_sheet_page.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; class BottomSheetPage extends Page { const BottomSheetPage({ + super.key, + super.name, required this.builder, this.fixed = false, });