reorganize routes

This commit is contained in:
Fabian Freund
2026-02-03 00:21:07 +01:00
parent 006b56a7ca
commit e3d583dbe7
7 changed files with 675 additions and 575 deletions
+108
View File
@@ -0,0 +1,108 @@
/*
* Copyright (c) 2024-2025 Fabian Freund.
*
* This file is part of WebLibre
* (see https://weblibre.eu).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
part of 'routes.dart';
@TypedGoRoute<BookmarkListRoute>(
name: 'BookmarkListRoute',
path: '/bookmarks/:entryGuid',
)
class BookmarkListRoute extends GoRouteData with $BookmarkListRoute {
final String entryGuid;
const BookmarkListRoute({required this.entryGuid});
@override
Widget build(BuildContext context, GoRouterState state) {
return BookmarkListScreen(entryGuid: entryGuid);
}
}
@TypedGoRoute<BookmarkFolderAddRoute>(
name: 'BookmarkFolderAddRoute',
path: '/bookmarks/createFolder',
)
class BookmarkFolderAddRoute extends GoRouteData with $BookmarkFolderAddRoute {
final String? parentGuid;
const BookmarkFolderAddRoute({required this.parentGuid});
@override
Widget build(BuildContext context, GoRouterState state) {
return BookmarkFolderEditScreen(parentGuid: parentGuid, folder: null);
}
}
@TypedGoRoute<BookmarkFolderEditRoute>(
name: 'BookmarkFolderEditRoute',
path: '/bookmarks/editFolder',
)
class BookmarkFolderEditRoute extends GoRouteData
with $BookmarkFolderEditRoute {
final String folder;
const BookmarkFolderEditRoute({required this.folder});
@override
Widget build(BuildContext context, GoRouterState state) {
return BookmarkFolderEditScreen(
folder: BookmarkFolder.fromJson(
jsonDecode(folder) as Map<String, dynamic>,
),
);
}
}
@TypedGoRoute<BookmarkEntryAddRoute>(
name: 'BookmarkEntryAddRoute',
path: '/bookmarks/createEntry',
)
class BookmarkEntryAddRoute extends GoRouteData with $BookmarkEntryAddRoute {
final String bookmarkInfo;
const BookmarkEntryAddRoute({required this.bookmarkInfo});
@override
Widget build(BuildContext context, GoRouterState state) {
return BookmarkEntryEditScreen(
initialInfo: BookmarkInfo.decode(jsonDecode(bookmarkInfo) as Object),
exisitingEntry: null,
);
}
}
@TypedGoRoute<BookmarkEntryEditRoute>(
name: 'BookmarkEntryEditRoute',
path: '/bookmarks/editEntry',
)
class BookmarkEntryEditRoute extends GoRouteData with $BookmarkEntryEditRoute {
final String bookmarkEntry;
const BookmarkEntryEditRoute({required this.bookmarkEntry});
@override
Widget build(BuildContext context, GoRouterState state) {
return BookmarkEntryEditScreen(
initialInfo: null,
exisitingEntry: BookmarkEntry.fromJson(
jsonDecode(bookmarkEntry) as Map<String, dynamic>,
),
);
}
}
-189
View File
@@ -27,8 +27,6 @@ part of 'routes.dart';
name: 'SearchRoute',
path: 'search/:tabType/:searchText',
),
TypedGoRoute<TorProxyRoute>(name: 'TorProxyRoute', path: 'tor_proxy'),
TypedGoRoute<HistoryRoute>(name: 'HistoryRoute', path: 'history'),
TypedGoRoute<TabViewRoute>(name: 'TabViewRoute', path: 'tab_view'),
TypedGoRoute<ContextMenuRoute>(
name: 'ContextMenuRoute',
@@ -68,49 +66,6 @@ part of 'routes.dart';
name: 'SelectProfileRoute',
path: 'profile',
),
TypedGoRoute<ProfileListRoute>(
name: 'ProfileListRoute',
path: 'profiles',
routes: [
TypedGoRoute<EditProfileRoute>(name: 'ProfileEditScreen', path: 'edit'),
TypedGoRoute<ProfileBackupListRoute>(
name: 'ProfileBackupListRoute',
path: 'backup_list',
),
TypedGoRoute<RestoreProfileRoute>(
name: 'RestoreProfileRoute',
path: 'restore',
),
TypedGoRoute<BackupProfileRoute>(
name: 'BackupProfileRoute',
path: 'backup',
),
TypedGoRoute<CreateProfileRoute>(
name: 'CreateProfileRoute',
path: 'create',
),
],
),
TypedGoRoute<BookmarkListRoute>(
name: 'BookmarkListRoute',
path: 'bookmarks/:entryGuid',
),
TypedGoRoute<BookmarkFolderAddRoute>(
name: 'BookmarkFolderAddRoute',
path: 'createFolder',
),
TypedGoRoute<BookmarkFolderEditRoute>(
name: 'BookmarkFolderEditRoute',
path: 'editFolder',
),
TypedGoRoute<BookmarkEntryAddRoute>(
name: 'BookmarkEntryAddRoute',
path: 'createEntry',
),
TypedGoRoute<BookmarkEntryEditRoute>(
name: 'BookmarkEntryEditRoute',
path: 'editEntry',
),
],
)
class BrowserRoute extends GoRouteData with $BrowserRoute {
@@ -161,15 +116,6 @@ class SearchRoute extends GoRouteData with $SearchRoute {
}
}
class TorProxyRoute extends GoRouteData with $TorProxyRoute {
const TorProxyRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const TorProxyScreen();
}
}
class ContainerDraftRoute extends GoRouteData with $ContainerDraftRoute {
const ContainerDraftRoute();
@@ -268,15 +214,6 @@ class OpenSharedContentRoute extends GoRouteData with $OpenSharedContentRoute {
}
}
class HistoryRoute extends GoRouteData with $HistoryRoute {
const HistoryRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const HistoryScreen();
}
}
class TabViewRoute extends GoRouteData with $TabViewRoute {
const TabViewRoute();
@@ -294,129 +231,3 @@ class SelectProfileRoute extends GoRouteData with $SelectProfileRoute {
return BottomSheetPage(builder: (_) => const SelectProfileDialog());
}
}
class ProfileListRoute extends GoRouteData with $ProfileListRoute {
@override
Widget build(BuildContext context, GoRouterState state) {
return const ProfileListScreen();
}
}
class CreateProfileRoute extends GoRouteData with $CreateProfileRoute {
@override
Widget build(BuildContext context, GoRouterState state) {
return const ProfileEditScreen(profile: null);
}
}
class EditProfileRoute extends GoRouteData with $EditProfileRoute {
final String profile;
const EditProfileRoute({required this.profile});
@override
Widget build(BuildContext context, GoRouterState state) {
return ProfileEditScreen(
profile: Profile.fromJson(jsonDecode(profile) as Map<String, dynamic>),
);
}
}
class BackupProfileRoute extends GoRouteData with $BackupProfileRoute {
final String profile;
const BackupProfileRoute({required this.profile});
@override
Widget build(BuildContext context, GoRouterState state) {
return ProfileBackupScreen(
profile: Profile.fromJson(jsonDecode(profile) as Map<String, dynamic>),
);
}
}
class RestoreProfileRoute extends GoRouteData with $RestoreProfileRoute {
final String backupFilePath;
const RestoreProfileRoute({required this.backupFilePath});
@override
Widget build(BuildContext context, GoRouterState state) {
return ProfileRestoreScreen(backupFile: File(backupFilePath));
}
}
class ProfileBackupListRoute extends GoRouteData with $ProfileBackupListRoute {
@override
Widget build(BuildContext context, GoRouterState state) {
return const ProfileBackupListScreen();
}
}
class BookmarkListRoute extends GoRouteData with $BookmarkListRoute {
final String entryGuid;
const BookmarkListRoute({required this.entryGuid});
@override
Widget build(BuildContext context, GoRouterState state) {
return BookmarkListScreen(entryGuid: entryGuid);
}
}
class BookmarkFolderAddRoute extends GoRouteData with $BookmarkFolderAddRoute {
final String? parentGuid;
const BookmarkFolderAddRoute({required this.parentGuid});
@override
Widget build(BuildContext context, GoRouterState state) {
return BookmarkFolderEditScreen(parentGuid: parentGuid, folder: null);
}
}
class BookmarkFolderEditRoute extends GoRouteData
with $BookmarkFolderEditRoute {
final String folder;
const BookmarkFolderEditRoute({required this.folder});
@override
Widget build(BuildContext context, GoRouterState state) {
return BookmarkFolderEditScreen(
folder: BookmarkFolder.fromJson(
jsonDecode(folder) as Map<String, dynamic>,
),
);
}
}
class BookmarkEntryAddRoute extends GoRouteData with $BookmarkEntryAddRoute {
final String bookmarkInfo;
const BookmarkEntryAddRoute({required this.bookmarkInfo});
@override
Widget build(BuildContext context, GoRouterState state) {
return BookmarkEntryEditScreen(
initialInfo: BookmarkInfo.decode(jsonDecode(bookmarkInfo) as Object),
exisitingEntry: null,
);
}
}
class BookmarkEntryEditRoute extends GoRouteData with $BookmarkEntryEditRoute {
final String bookmarkEntry;
const BookmarkEntryEditRoute({required this.bookmarkEntry});
@override
Widget build(BuildContext context, GoRouterState state) {
return BookmarkEntryEditScreen(
initialInfo: null,
exisitingEntry: BookmarkEntry.fromJson(
jsonDecode(bookmarkEntry) as Map<String, dynamic>,
),
);
}
}
+4
View File
@@ -85,10 +85,14 @@ import 'package:weblibre/features/web_feed/presentation/screens/feed_list.dart';
import 'package:weblibre/features/web_feed/presentation/select_feed_dialog.dart';
part 'routes.bangs.dart';
part 'routes.bookmarks.dart';
part 'routes.browser.dart';
part 'routes.feeds.dart';
part 'routes.g.dart';
part 'routes.history.dart';
part 'routes.profiles.dart';
part 'routes.settings.dart';
part 'routes.tor.dart';
@TypedGoRoute<AboutRoute>(name: 'AboutRoute', path: '/about')
class AboutRoute extends GoRouteData with $AboutRoute {
+402 -386
View File
@@ -10,9 +10,17 @@ List<RouteBase> get $appRoutes => [
$aboutRoute,
$onboardingRoute,
$bangMenuRoute,
$bookmarkListRoute,
$bookmarkFolderAddRoute,
$bookmarkFolderEditRoute,
$bookmarkEntryAddRoute,
$bookmarkEntryEditRoute,
$browserRoute,
$feedListRoute,
$historyRoute,
$profileListRoute,
$settingsRoute,
$torProxyRoute,
];
RouteBase get $aboutRoute => GoRouteData.$route(
@@ -313,6 +321,173 @@ mixin $BangSubCategoryRoute on GoRouteData {
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $bookmarkListRoute => GoRouteData.$route(
path: '/bookmarks/:entryGuid',
name: 'BookmarkListRoute',
factory: $BookmarkListRoute._fromState,
);
mixin $BookmarkListRoute on GoRouteData {
static BookmarkListRoute _fromState(GoRouterState state) =>
BookmarkListRoute(entryGuid: state.pathParameters['entryGuid']!);
BookmarkListRoute get _self => this as BookmarkListRoute;
@override
String get location => GoRouteData.$location(
'/bookmarks/${Uri.encodeComponent(_self.entryGuid)}',
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $bookmarkFolderAddRoute => GoRouteData.$route(
path: '/bookmarks/createFolder',
name: 'BookmarkFolderAddRoute',
factory: $BookmarkFolderAddRoute._fromState,
);
mixin $BookmarkFolderAddRoute on GoRouteData {
static BookmarkFolderAddRoute _fromState(GoRouterState state) =>
BookmarkFolderAddRoute(
parentGuid: state.uri.queryParameters['parent-guid'],
);
BookmarkFolderAddRoute get _self => this as BookmarkFolderAddRoute;
@override
String get location => GoRouteData.$location(
'/bookmarks/createFolder',
queryParams: {
if (_self.parentGuid != null) 'parent-guid': _self.parentGuid,
},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $bookmarkFolderEditRoute => GoRouteData.$route(
path: '/bookmarks/editFolder',
name: 'BookmarkFolderEditRoute',
factory: $BookmarkFolderEditRoute._fromState,
);
mixin $BookmarkFolderEditRoute on GoRouteData {
static BookmarkFolderEditRoute _fromState(GoRouterState state) =>
BookmarkFolderEditRoute(folder: state.uri.queryParameters['folder']!);
BookmarkFolderEditRoute get _self => this as BookmarkFolderEditRoute;
@override
String get location => GoRouteData.$location(
'/bookmarks/editFolder',
queryParams: {'folder': _self.folder},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $bookmarkEntryAddRoute => GoRouteData.$route(
path: '/bookmarks/createEntry',
name: 'BookmarkEntryAddRoute',
factory: $BookmarkEntryAddRoute._fromState,
);
mixin $BookmarkEntryAddRoute on GoRouteData {
static BookmarkEntryAddRoute _fromState(GoRouterState state) =>
BookmarkEntryAddRoute(
bookmarkInfo: state.uri.queryParameters['bookmark-info']!,
);
BookmarkEntryAddRoute get _self => this as BookmarkEntryAddRoute;
@override
String get location => GoRouteData.$location(
'/bookmarks/createEntry',
queryParams: {'bookmark-info': _self.bookmarkInfo},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $bookmarkEntryEditRoute => GoRouteData.$route(
path: '/bookmarks/editEntry',
name: 'BookmarkEntryEditRoute',
factory: $BookmarkEntryEditRoute._fromState,
);
mixin $BookmarkEntryEditRoute on GoRouteData {
static BookmarkEntryEditRoute _fromState(GoRouterState state) =>
BookmarkEntryEditRoute(
bookmarkEntry: state.uri.queryParameters['bookmark-entry']!,
);
BookmarkEntryEditRoute get _self => this as BookmarkEntryEditRoute;
@override
String get location => GoRouteData.$location(
'/bookmarks/editEntry',
queryParams: {'bookmark-entry': _self.bookmarkEntry},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $browserRoute => GoRouteData.$route(
path: '/browser',
name: 'BrowserRoute',
@@ -323,16 +498,6 @@ RouteBase get $browserRoute => GoRouteData.$route(
name: 'SearchRoute',
factory: $SearchRoute._fromState,
),
GoRouteData.$route(
path: 'tor_proxy',
name: 'TorProxyRoute',
factory: $TorProxyRoute._fromState,
),
GoRouteData.$route(
path: 'history',
name: 'HistoryRoute',
factory: $HistoryRoute._fromState,
),
GoRouteData.$route(
path: 'tab_view',
name: 'TabViewRoute',
@@ -385,63 +550,6 @@ RouteBase get $browserRoute => GoRouteData.$route(
name: 'SelectProfileRoute',
factory: $SelectProfileRoute._fromState,
),
GoRouteData.$route(
path: 'profiles',
name: 'ProfileListRoute',
factory: $ProfileListRoute._fromState,
routes: [
GoRouteData.$route(
path: 'edit',
name: 'ProfileEditScreen',
factory: $EditProfileRoute._fromState,
),
GoRouteData.$route(
path: 'backup_list',
name: 'ProfileBackupListRoute',
factory: $ProfileBackupListRoute._fromState,
),
GoRouteData.$route(
path: 'restore',
name: 'RestoreProfileRoute',
factory: $RestoreProfileRoute._fromState,
),
GoRouteData.$route(
path: 'backup',
name: 'BackupProfileRoute',
factory: $BackupProfileRoute._fromState,
),
GoRouteData.$route(
path: 'create',
name: 'CreateProfileRoute',
factory: $CreateProfileRoute._fromState,
),
],
),
GoRouteData.$route(
path: 'bookmarks/:entryGuid',
name: 'BookmarkListRoute',
factory: $BookmarkListRoute._fromState,
),
GoRouteData.$route(
path: 'createFolder',
name: 'BookmarkFolderAddRoute',
factory: $BookmarkFolderAddRoute._fromState,
),
GoRouteData.$route(
path: 'editFolder',
name: 'BookmarkFolderEditRoute',
factory: $BookmarkFolderEditRoute._fromState,
),
GoRouteData.$route(
path: 'createEntry',
name: 'BookmarkEntryAddRoute',
factory: $BookmarkEntryAddRoute._fromState,
),
GoRouteData.$route(
path: 'editEntry',
name: 'BookmarkEntryEditRoute',
factory: $BookmarkEntryEditRoute._fromState,
),
],
);
@@ -512,46 +620,6 @@ const _$TabTypeEnumMap = {
TabType.child: 'child',
};
mixin $TorProxyRoute on GoRouteData {
static TorProxyRoute _fromState(GoRouterState state) => const TorProxyRoute();
@override
String get location => GoRouteData.$location('/browser/tor_proxy');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $HistoryRoute on GoRouteData {
static HistoryRoute _fromState(GoRouterState state) => const HistoryRoute();
@override
String get location => GoRouteData.$location('/browser/history');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $TabViewRoute on GoRouteData {
static TabViewRoute _fromState(GoRouterState state) => const TabViewRoute();
@@ -789,285 +857,6 @@ mixin $SelectProfileRoute on GoRouteData {
void replace(BuildContext context) => context.replace(location);
}
mixin $ProfileListRoute on GoRouteData {
static ProfileListRoute _fromState(GoRouterState state) => ProfileListRoute();
@override
String get location => GoRouteData.$location('/browser/profiles');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $EditProfileRoute on GoRouteData {
static EditProfileRoute _fromState(GoRouterState state) =>
EditProfileRoute(profile: state.uri.queryParameters['profile']!);
EditProfileRoute get _self => this as EditProfileRoute;
@override
String get location => GoRouteData.$location(
'/browser/profiles/edit',
queryParams: {'profile': _self.profile},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $ProfileBackupListRoute on GoRouteData {
static ProfileBackupListRoute _fromState(GoRouterState state) =>
ProfileBackupListRoute();
@override
String get location => GoRouteData.$location('/browser/profiles/backup_list');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $RestoreProfileRoute on GoRouteData {
static RestoreProfileRoute _fromState(GoRouterState state) =>
RestoreProfileRoute(
backupFilePath: state.uri.queryParameters['backup-file-path']!,
);
RestoreProfileRoute get _self => this as RestoreProfileRoute;
@override
String get location => GoRouteData.$location(
'/browser/profiles/restore',
queryParams: {'backup-file-path': _self.backupFilePath},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $BackupProfileRoute on GoRouteData {
static BackupProfileRoute _fromState(GoRouterState state) =>
BackupProfileRoute(profile: state.uri.queryParameters['profile']!);
BackupProfileRoute get _self => this as BackupProfileRoute;
@override
String get location => GoRouteData.$location(
'/browser/profiles/backup',
queryParams: {'profile': _self.profile},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $CreateProfileRoute on GoRouteData {
static CreateProfileRoute _fromState(GoRouterState state) =>
CreateProfileRoute();
@override
String get location => GoRouteData.$location('/browser/profiles/create');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $BookmarkListRoute on GoRouteData {
static BookmarkListRoute _fromState(GoRouterState state) =>
BookmarkListRoute(entryGuid: state.pathParameters['entryGuid']!);
BookmarkListRoute get _self => this as BookmarkListRoute;
@override
String get location => GoRouteData.$location(
'/browser/bookmarks/${Uri.encodeComponent(_self.entryGuid)}',
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $BookmarkFolderAddRoute on GoRouteData {
static BookmarkFolderAddRoute _fromState(GoRouterState state) =>
BookmarkFolderAddRoute(
parentGuid: state.uri.queryParameters['parent-guid'],
);
BookmarkFolderAddRoute get _self => this as BookmarkFolderAddRoute;
@override
String get location => GoRouteData.$location(
'/browser/createFolder',
queryParams: {
if (_self.parentGuid != null) 'parent-guid': _self.parentGuid,
},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $BookmarkFolderEditRoute on GoRouteData {
static BookmarkFolderEditRoute _fromState(GoRouterState state) =>
BookmarkFolderEditRoute(folder: state.uri.queryParameters['folder']!);
BookmarkFolderEditRoute get _self => this as BookmarkFolderEditRoute;
@override
String get location => GoRouteData.$location(
'/browser/editFolder',
queryParams: {'folder': _self.folder},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $BookmarkEntryAddRoute on GoRouteData {
static BookmarkEntryAddRoute _fromState(GoRouterState state) =>
BookmarkEntryAddRoute(
bookmarkInfo: state.uri.queryParameters['bookmark-info']!,
);
BookmarkEntryAddRoute get _self => this as BookmarkEntryAddRoute;
@override
String get location => GoRouteData.$location(
'/browser/createEntry',
queryParams: {'bookmark-info': _self.bookmarkInfo},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $BookmarkEntryEditRoute on GoRouteData {
static BookmarkEntryEditRoute _fromState(GoRouterState state) =>
BookmarkEntryEditRoute(
bookmarkEntry: state.uri.queryParameters['bookmark-entry']!,
);
BookmarkEntryEditRoute get _self => this as BookmarkEntryEditRoute;
@override
String get location => GoRouteData.$location(
'/browser/editEntry',
queryParams: {'bookmark-entry': _self.bookmarkEntry},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
T? _$convertMapValue<T>(
String key,
Map<String, String> map,
@@ -1302,6 +1091,207 @@ mixin $FeedEditRoute on GoRouteData {
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $historyRoute => GoRouteData.$route(
path: '/history',
name: 'HistoryRoute',
factory: $HistoryRoute._fromState,
);
mixin $HistoryRoute on GoRouteData {
static HistoryRoute _fromState(GoRouterState state) => const HistoryRoute();
@override
String get location => GoRouteData.$location('/history');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $profileListRoute => GoRouteData.$route(
path: '/profiles',
name: 'ProfileListRoute',
factory: $ProfileListRoute._fromState,
routes: [
GoRouteData.$route(
path: 'edit',
name: 'ProfileEditRoute',
factory: $EditProfileRoute._fromState,
),
GoRouteData.$route(
path: 'backup_list',
name: 'ProfileBackupListRoute',
factory: $ProfileBackupListRoute._fromState,
),
GoRouteData.$route(
path: 'restore',
name: 'RestoreProfileRoute',
factory: $RestoreProfileRoute._fromState,
),
GoRouteData.$route(
path: 'backup',
name: 'BackupProfileRoute',
factory: $BackupProfileRoute._fromState,
),
GoRouteData.$route(
path: 'create',
name: 'CreateProfileRoute',
factory: $CreateProfileRoute._fromState,
),
],
);
mixin $ProfileListRoute on GoRouteData {
static ProfileListRoute _fromState(GoRouterState state) => ProfileListRoute();
@override
String get location => GoRouteData.$location('/profiles');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $EditProfileRoute on GoRouteData {
static EditProfileRoute _fromState(GoRouterState state) =>
EditProfileRoute(profile: state.uri.queryParameters['profile']!);
EditProfileRoute get _self => this as EditProfileRoute;
@override
String get location => GoRouteData.$location(
'/profiles/edit',
queryParams: {'profile': _self.profile},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $ProfileBackupListRoute on GoRouteData {
static ProfileBackupListRoute _fromState(GoRouterState state) =>
ProfileBackupListRoute();
@override
String get location => GoRouteData.$location('/profiles/backup_list');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $RestoreProfileRoute on GoRouteData {
static RestoreProfileRoute _fromState(GoRouterState state) =>
RestoreProfileRoute(
backupFilePath: state.uri.queryParameters['backup-file-path']!,
);
RestoreProfileRoute get _self => this as RestoreProfileRoute;
@override
String get location => GoRouteData.$location(
'/profiles/restore',
queryParams: {'backup-file-path': _self.backupFilePath},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $BackupProfileRoute on GoRouteData {
static BackupProfileRoute _fromState(GoRouterState state) =>
BackupProfileRoute(profile: state.uri.queryParameters['profile']!);
BackupProfileRoute get _self => this as BackupProfileRoute;
@override
String get location => GoRouteData.$location(
'/profiles/backup',
queryParams: {'profile': _self.profile},
);
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $CreateProfileRoute on GoRouteData {
static CreateProfileRoute _fromState(GoRouterState state) =>
CreateProfileRoute();
@override
String get location => GoRouteData.$location('/profiles/create');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $settingsRoute => GoRouteData.$route(
path: '/settings',
name: 'SettingsRoute',
@@ -1752,3 +1742,29 @@ mixin $ErrorLogsRoute on GoRouteData {
@override
void replace(BuildContext context) => context.replace(location);
}
RouteBase get $torProxyRoute => GoRouteData.$route(
path: '/tor',
name: 'TorProxyRoute',
factory: $TorProxyRoute._fromState,
);
mixin $TorProxyRoute on GoRouteData {
static TorProxyRoute _fromState(GoRouterState state) => const TorProxyRoute();
@override
String get location => GoRouteData.$location('/tor');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location);
@override
void replace(BuildContext context) => context.replace(location);
}
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2024-2025 Fabian Freund.
*
* This file is part of WebLibre
* (see https://weblibre.eu).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
part of 'routes.dart';
@TypedGoRoute<HistoryRoute>(name: 'HistoryRoute', path: '/history')
class HistoryRoute extends GoRouteData with $HistoryRoute {
const HistoryRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const HistoryScreen();
}
}
+101
View File
@@ -0,0 +1,101 @@
/*
* Copyright (c) 2024-2025 Fabian Freund.
*
* This file is part of WebLibre
* (see https://weblibre.eu).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
part of 'routes.dart';
@TypedGoRoute<ProfileListRoute>(
name: 'ProfileListRoute',
path: '/profiles',
routes: [
TypedGoRoute<EditProfileRoute>(name: 'ProfileEditRoute', path: 'edit'),
TypedGoRoute<ProfileBackupListRoute>(
name: 'ProfileBackupListRoute',
path: 'backup_list',
),
TypedGoRoute<RestoreProfileRoute>(
name: 'RestoreProfileRoute',
path: 'restore',
),
TypedGoRoute<BackupProfileRoute>(
name: 'BackupProfileRoute',
path: 'backup',
),
TypedGoRoute<CreateProfileRoute>(
name: 'CreateProfileRoute',
path: 'create',
),
],
)
class ProfileListRoute extends GoRouteData with $ProfileListRoute {
@override
Widget build(BuildContext context, GoRouterState state) {
return const ProfileListScreen();
}
}
class CreateProfileRoute extends GoRouteData with $CreateProfileRoute {
@override
Widget build(BuildContext context, GoRouterState state) {
return const ProfileEditScreen(profile: null);
}
}
class EditProfileRoute extends GoRouteData with $EditProfileRoute {
final String profile;
const EditProfileRoute({required this.profile});
@override
Widget build(BuildContext context, GoRouterState state) {
return ProfileEditScreen(
profile: Profile.fromJson(jsonDecode(profile) as Map<String, dynamic>),
);
}
}
class BackupProfileRoute extends GoRouteData with $BackupProfileRoute {
final String profile;
const BackupProfileRoute({required this.profile});
@override
Widget build(BuildContext context, GoRouterState state) {
return ProfileBackupScreen(
profile: Profile.fromJson(jsonDecode(profile) as Map<String, dynamic>),
);
}
}
class RestoreProfileRoute extends GoRouteData with $RestoreProfileRoute {
final String backupFilePath;
const RestoreProfileRoute({required this.backupFilePath});
@override
Widget build(BuildContext context, GoRouterState state) {
return ProfileRestoreScreen(backupFile: File(backupFilePath));
}
}
class ProfileBackupListRoute extends GoRouteData with $ProfileBackupListRoute {
@override
Widget build(BuildContext context, GoRouterState state) {
return const ProfileBackupListScreen();
}
}
+30
View File
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2024-2025 Fabian Freund.
*
* This file is part of WebLibre
* (see https://weblibre.eu).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
part of 'routes.dart';
@TypedGoRoute<TorProxyRoute>(name: 'TorProxyRoute', path: '/tor')
class TorProxyRoute extends GoRouteData with $TorProxyRoute {
const TorProxyRoute();
@override
Widget build(BuildContext context, GoRouterState state) {
return const TorProxyScreen();
}
}