dedicated screen for tor countries

This commit is contained in:
Fabian Freund
2026-02-16 07:29:12 +01:00
parent c8d46ad0c2
commit 8758fe821c
5 changed files with 262 additions and 121 deletions
+1
View File
@@ -70,6 +70,7 @@ import 'package:weblibre/features/settings/presentation/screens/tabs_behavior_se
import 'package:weblibre/features/settings/presentation/screens/tracking_protection_exceptions.dart';
import 'package:weblibre/features/settings/presentation/screens/web_engine_hardening.dart';
import 'package:weblibre/features/settings/presentation/screens/web_engine_hardening_group.dart';
import 'package:weblibre/features/tor/presentation/screens/country_picker.dart';
import 'package:weblibre/features/tor/presentation/screens/tor_proxy.dart';
import 'package:weblibre/features/user/domain/presentation/dialogs/select_profile.dart';
import 'package:weblibre/features/user/domain/presentation/screens/profile_backup.dart';
+38
View File
@@ -1795,6 +1795,13 @@ RouteBase get $torProxyRoute => GoRouteData.$route(
path: '/tor',
name: 'TorProxyRoute',
factory: $TorProxyRoute._fromState,
routes: [
GoRouteData.$route(
path: 'country_picker',
name: 'TorCountryPickerRoute',
factory: $TorCountryPickerRoute._fromState,
),
],
);
mixin $TorProxyRoute on GoRouteData {
@@ -1816,3 +1823,34 @@ mixin $TorProxyRoute on GoRouteData {
@override
void replace(BuildContext context) => context.replace(location);
}
mixin $TorCountryPickerRoute on GoRouteData {
static TorCountryPickerRoute _fromState(GoRouterState state) =>
TorCountryPickerRoute(
title: state.uri.queryParameters['title']!,
$extra: state.extra as String?,
);
TorCountryPickerRoute get _self => this as TorCountryPickerRoute;
@override
String get location => GoRouteData.$location(
'/tor/country_picker',
queryParams: {'title': _self.title},
);
@override
void go(BuildContext context) => context.go(location, extra: _self.$extra);
@override
Future<T?> push<T>(BuildContext context) =>
context.push<T>(location, extra: _self.$extra);
@override
void pushReplacement(BuildContext context) =>
context.pushReplacement(location, extra: _self.$extra);
@override
void replace(BuildContext context) =>
context.replace(location, extra: _self.$extra);
}
+25 -1
View File
@@ -19,7 +19,16 @@
*/
part of 'routes.dart';
@TypedGoRoute<TorProxyRoute>(name: 'TorProxyRoute', path: '/tor')
@TypedGoRoute<TorProxyRoute>(
name: 'TorProxyRoute',
path: '/tor',
routes: [
TypedGoRoute<TorCountryPickerRoute>(
name: 'TorCountryPickerRoute',
path: 'country_picker',
),
],
)
class TorProxyRoute extends GoRouteData with $TorProxyRoute {
const TorProxyRoute();
@@ -28,3 +37,18 @@ class TorProxyRoute extends GoRouteData with $TorProxyRoute {
return const TorProxyScreen();
}
}
class TorCountryPickerRoute extends GoRouteData with $TorCountryPickerRoute {
final String title;
final String? $extra;
const TorCountryPickerRoute({required this.title, this.$extra});
@override
Widget build(BuildContext context, GoRouterState state) {
return CountryPickerScreen(
title: title,
selectedCountryCode: $extra,
);
}
}