initial multi user feature
This commit is contained in:
@@ -64,11 +64,28 @@ part of 'routes.dart';
|
||||
name: 'OpenSharedContentRoute',
|
||||
path: 'open_content',
|
||||
),
|
||||
TypedGoRoute<SelectProfileRoute>(
|
||||
name: 'SelectProfileRoute',
|
||||
path: 'profile',
|
||||
),
|
||||
TypedGoRoute<ProfileListRoute>(
|
||||
name: 'ProfileListRoute',
|
||||
path: 'profiles',
|
||||
routes: [
|
||||
TypedGoRoute<EditProfileRoute>(name: 'ProfileEditScreen', path: 'edit'),
|
||||
TypedGoRoute<CreateProfileRoute>(
|
||||
name: 'CreateProfileRoute',
|
||||
path: 'create',
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
class BrowserRoute extends GoRouteData with $BrowserRoute {
|
||||
static const name = 'BrowserRoute';
|
||||
|
||||
const BrowserRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const BrowserScreen();
|
||||
@@ -106,6 +123,8 @@ class SearchRoute extends GoRouteData with $SearchRoute {
|
||||
}
|
||||
|
||||
class TorProxyRoute extends GoRouteData with $TorProxyRoute {
|
||||
const TorProxyRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const TorProxyScreen();
|
||||
@@ -113,6 +132,8 @@ class TorProxyRoute extends GoRouteData with $TorProxyRoute {
|
||||
}
|
||||
|
||||
class ContainerDraftRoute extends GoRouteData with $ContainerDraftRoute {
|
||||
const ContainerDraftRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const ContainerDraftSuggestionsScreen();
|
||||
@@ -120,6 +141,8 @@ class ContainerDraftRoute extends GoRouteData with $ContainerDraftRoute {
|
||||
}
|
||||
|
||||
class ContainerListRoute extends GoRouteData with $ContainerListRoute {
|
||||
const ContainerListRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const ContainerListScreen();
|
||||
@@ -128,6 +151,8 @@ class ContainerListRoute extends GoRouteData with $ContainerListRoute {
|
||||
|
||||
class ContainerSelectionRoute extends GoRouteData
|
||||
with $ContainerSelectionRoute {
|
||||
const ContainerSelectionRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const ContainerSelectionScreen();
|
||||
@@ -137,7 +162,7 @@ class ContainerSelectionRoute extends GoRouteData
|
||||
class ContainerEditRoute extends GoRouteData with $ContainerEditRoute {
|
||||
final String containerData;
|
||||
|
||||
ContainerEditRoute({required this.containerData});
|
||||
const ContainerEditRoute({required this.containerData});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
@@ -205,6 +230,8 @@ class OpenSharedContentRoute extends GoRouteData with $OpenSharedContentRoute {
|
||||
}
|
||||
|
||||
class HistoryRoute extends GoRouteData with $HistoryRoute {
|
||||
const HistoryRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const HistoryScreen();
|
||||
@@ -212,8 +239,46 @@ class HistoryRoute extends GoRouteData with $HistoryRoute {
|
||||
}
|
||||
|
||||
class TabViewRoute extends GoRouteData with $TabViewRoute {
|
||||
const TabViewRoute();
|
||||
|
||||
@override
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return DialogPage(builder: (_) => const TabViewScreen());
|
||||
}
|
||||
}
|
||||
|
||||
class SelectProfileRoute extends GoRouteData with $SelectProfileRoute {
|
||||
const SelectProfileRoute();
|
||||
|
||||
@override
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
return DialogPage(builder: (_) => 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>),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:nullability/nullability.dart';
|
||||
import 'package:weblibre/core/routing/widgets/dialog_page.dart';
|
||||
import 'package:weblibre/domain/entities/profile.dart';
|
||||
import 'package:weblibre/features/about/presentation/screens/about.dart';
|
||||
import 'package:weblibre/features/bangs/data/models/bang.dart';
|
||||
import 'package:weblibre/features/bangs/presentation/screens/categories.dart';
|
||||
@@ -57,6 +58,9 @@ import 'package:weblibre/features/settings/presentation/screens/web_engine_harde
|
||||
import 'package:weblibre/features/settings/presentation/screens/web_engine_hardening_group.dart';
|
||||
import 'package:weblibre/features/settings/presentation/screens/web_engine_settings.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_edit.dart';
|
||||
import 'package:weblibre/features/user/domain/presentation/screens/profile_list.dart';
|
||||
import 'package:weblibre/features/web_feed/presentation/add_feed_dialog.dart';
|
||||
import 'package:weblibre/features/web_feed/presentation/screens/feed_article.dart';
|
||||
import 'package:weblibre/features/web_feed/presentation/screens/feed_article_list.dart';
|
||||
|
||||
@@ -442,11 +442,33 @@ RouteBase get $browserRoute => GoRouteData.$route(
|
||||
name: 'OpenSharedContentRoute',
|
||||
factory: $OpenSharedContentRoute._fromState,
|
||||
),
|
||||
GoRouteData.$route(
|
||||
path: 'profile',
|
||||
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: 'create',
|
||||
name: 'CreateProfileRoute',
|
||||
factory: $CreateProfileRoute._fromState,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
mixin $BrowserRoute on GoRouteData {
|
||||
static BrowserRoute _fromState(GoRouterState state) => BrowserRoute();
|
||||
static BrowserRoute _fromState(GoRouterState state) => const BrowserRoute();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/browser');
|
||||
@@ -511,7 +533,7 @@ const _$TabTypeEnumMap = {
|
||||
};
|
||||
|
||||
mixin $TorProxyRoute on GoRouteData {
|
||||
static TorProxyRoute _fromState(GoRouterState state) => TorProxyRoute();
|
||||
static TorProxyRoute _fromState(GoRouterState state) => const TorProxyRoute();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/browser/tor_proxy');
|
||||
@@ -531,7 +553,7 @@ mixin $TorProxyRoute on GoRouteData {
|
||||
}
|
||||
|
||||
mixin $HistoryRoute on GoRouteData {
|
||||
static HistoryRoute _fromState(GoRouterState state) => HistoryRoute();
|
||||
static HistoryRoute _fromState(GoRouterState state) => const HistoryRoute();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/browser/history');
|
||||
@@ -551,7 +573,7 @@ mixin $HistoryRoute on GoRouteData {
|
||||
}
|
||||
|
||||
mixin $TabViewRoute on GoRouteData {
|
||||
static TabViewRoute _fromState(GoRouterState state) => TabViewRoute();
|
||||
static TabViewRoute _fromState(GoRouterState state) => const TabViewRoute();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/browser/tab_view');
|
||||
@@ -598,7 +620,7 @@ mixin $ContextMenuRoute on GoRouteData {
|
||||
|
||||
mixin $ContainerDraftRoute on GoRouteData {
|
||||
static ContainerDraftRoute _fromState(GoRouterState state) =>
|
||||
ContainerDraftRoute();
|
||||
const ContainerDraftRoute();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/browser/container_draft');
|
||||
@@ -619,7 +641,7 @@ mixin $ContainerDraftRoute on GoRouteData {
|
||||
|
||||
mixin $ContainerListRoute on GoRouteData {
|
||||
static ContainerListRoute _fromState(GoRouterState state) =>
|
||||
ContainerListRoute();
|
||||
const ContainerListRoute();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/browser/containers');
|
||||
@@ -692,7 +714,7 @@ mixin $ContainerEditRoute on GoRouteData {
|
||||
|
||||
mixin $ContainerSelectionRoute on GoRouteData {
|
||||
static ContainerSelectionRoute _fromState(GoRouterState state) =>
|
||||
ContainerSelectionRoute();
|
||||
const ContainerSelectionRoute();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/browser/select_container');
|
||||
@@ -766,6 +788,94 @@ mixin $OpenSharedContentRoute on GoRouteData {
|
||||
void replace(BuildContext context) => context.replace(location);
|
||||
}
|
||||
|
||||
mixin $SelectProfileRoute on GoRouteData {
|
||||
static SelectProfileRoute _fromState(GoRouterState state) =>
|
||||
const SelectProfileRoute();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/browser/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 $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 $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);
|
||||
}
|
||||
|
||||
T? _$convertMapValue<T>(
|
||||
String key,
|
||||
Map<String, String> map,
|
||||
|
||||
Reference in New Issue
Block a user