tab trees

This commit is contained in:
Fabian Freund
2025-06-23 19:43:36 +02:00
parent 8445b768f0
commit 4f682744da
28 changed files with 2687 additions and 2256 deletions
+15
View File
@@ -28,6 +28,10 @@ part of 'routes.dart';
),
],
),
TypedGoRoute<TabTreeRoute>(
name: 'TabTreeRoute',
path: 'tab_tree/:rootTabId',
),
],
)
class BrowserRoute extends GoRouteData with _$BrowserRoute {
@@ -128,3 +132,14 @@ class ContextMenuRoute extends GoRouteData with _$ContextMenuRoute {
);
}
}
class TabTreeRoute extends GoRouteData with _$TabTreeRoute {
final String rootTabId;
const TabTreeRoute(this.rootTabId);
@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
return DialogPage(builder: (_) => TabTreeDialog(rootTabId));
}
}
+1
View File
@@ -8,6 +8,7 @@ import 'package:weblibre/features/about/presentation/screens/about.dart';
import 'package:weblibre/features/bangs/presentation/screens/categories.dart';
import 'package:weblibre/features/bangs/presentation/screens/list.dart';
import 'package:weblibre/features/bangs/presentation/screens/search.dart';
import 'package:weblibre/features/geckoview/features/browser/presentation/dialogs/tab_tree.dart';
import 'package:weblibre/features/geckoview/features/browser/presentation/dialogs/web_page_dialog.dart';
import 'package:weblibre/features/geckoview/features/browser/presentation/screens/browser.dart';
import 'package:weblibre/features/geckoview/features/contextmenu/extensions/hit_result.dart';
+31
View File
@@ -300,6 +300,12 @@ RouteBase get $browserRoute => GoRouteData.$route(
),
],
),
GoRouteData.$route(
path: 'tab_tree/:rootTabId',
name: 'TabTreeRoute',
factory: _$TabTreeRoute._fromState,
),
],
);
@@ -500,6 +506,31 @@ mixin _$ContainerEditRoute on GoRouteData {
context.replace(location, extra: _self.$extra);
}
mixin _$TabTreeRoute on GoRouteData {
static TabTreeRoute _fromState(GoRouterState state) =>
TabTreeRoute(state.pathParameters['rootTabId']!);
TabTreeRoute get _self => this as TabTreeRoute;
@override
String get location => GoRouteData.$location(
'/tab_tree/${Uri.encodeComponent(_self.rootTabId)}',
);
@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);
}
extension<T extends Enum> on Map<T, String> {
T? _$fromName(String? value) =>
entries.where((element) => element.value == value).firstOrNull?.key;