support private tabs

This commit is contained in:
Fabian Freund
2025-04-25 20:41:08 +02:00
parent 9064a961ac
commit f95331c654
15 changed files with 212 additions and 74 deletions
+13 -2
View File
@@ -5,7 +5,10 @@ part of 'routes.dart';
path: '/',
routes: [
TypedGoRoute<WebPageRoute>(name: 'WebPageRoute', path: 'page/:url'),
TypedGoRoute<SearchRoute>(name: 'SearchRoute', path: 'search/:searchText'),
TypedGoRoute<SearchRoute>(
name: 'SearchRoute',
path: 'search/:tabType/:searchText',
),
TypedGoRoute<TorProxyRoute>(name: 'TorProxyRoute', path: 'tor_proxy'),
TypedGoRoute<ContextMenuRoute>(
name: 'ContextMenuRoute',
@@ -50,17 +53,25 @@ class WebPageRoute extends GoRouteData {
}
}
enum TabType { regular, private }
class SearchRoute extends GoRouteData {
static const String emptySearchText = ' ';
final TabType tabType;
//This should be nullable but isnt allowed by go_router
final String searchText;
const SearchRoute({this.searchText = SearchRoute.emptySearchText});
const SearchRoute({
required this.tabType,
this.searchText = SearchRoute.emptySearchText,
});
@override
Widget build(BuildContext context, GoRouterState state) {
return SearchScreen(
tabType: tabType,
initialSearchText:
(searchText.isEmpty || searchText == emptySearchText)
? null