new extension management
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2026 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<AddonManagerRoute>(
|
||||
name: 'AddonManagerRoute',
|
||||
path: '/addons',
|
||||
routes: [
|
||||
TypedGoRoute<AddonDetailsRoute>(
|
||||
name: 'AddonDetailsRoute',
|
||||
path: 'details/:addonId',
|
||||
),
|
||||
TypedGoRoute<AddonPermissionsRoute>(
|
||||
name: 'AddonPermissionsRoute',
|
||||
path: 'permissions/:addonId',
|
||||
),
|
||||
TypedGoRoute<AddonInternalSettingsRoute>(
|
||||
name: 'AddonInternalSettingsRoute',
|
||||
path: 'settings/:addonId',
|
||||
),
|
||||
],
|
||||
)
|
||||
class AddonManagerRoute extends GoRouteData with $AddonManagerRoute {
|
||||
const AddonManagerRoute();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return const AddonManagerScreen();
|
||||
}
|
||||
}
|
||||
|
||||
class AddonDetailsRoute extends GoRouteData with $AddonDetailsRoute {
|
||||
final String addonId;
|
||||
|
||||
const AddonDetailsRoute({required this.addonId});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return AddonDetailsScreen(addonId: addonId);
|
||||
}
|
||||
}
|
||||
|
||||
class AddonPermissionsRoute extends GoRouteData with $AddonPermissionsRoute {
|
||||
final String addonId;
|
||||
|
||||
const AddonPermissionsRoute({required this.addonId});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return AddonPermissionsScreen(addonId: addonId);
|
||||
}
|
||||
}
|
||||
|
||||
class AddonInternalSettingsRoute extends GoRouteData
|
||||
with $AddonInternalSettingsRoute {
|
||||
final String addonId;
|
||||
|
||||
const AddonInternalSettingsRoute({required this.addonId});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, GoRouterState state) {
|
||||
return AddonInternalSettingsScreen(addonId: addonId);
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,10 @@ import 'package:weblibre/core/routing/widgets/bottom_sheet_page.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/addons/presentation/screens/addon_details.dart';
|
||||
import 'package:weblibre/features/addons/presentation/screens/addon_internal_settings.dart';
|
||||
import 'package:weblibre/features/addons/presentation/screens/addon_manager.dart';
|
||||
import 'package:weblibre/features/addons/presentation/screens/addon_permissions.dart';
|
||||
import 'package:weblibre/features/bangs/data/models/bang.dart';
|
||||
import 'package:weblibre/features/bangs/presentation/screens/categories.dart';
|
||||
import 'package:weblibre/features/bangs/presentation/screens/category.dart';
|
||||
@@ -97,6 +101,7 @@ 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.addons.dart';
|
||||
part 'routes.feeds.dart';
|
||||
part 'routes.g.dart';
|
||||
part 'routes.history.dart';
|
||||
|
||||
@@ -13,6 +13,7 @@ List<RouteBase> get $appRoutes => [
|
||||
$bangMenuRoute,
|
||||
$bookmarksRoute,
|
||||
$browserRoute,
|
||||
$addonManagerRoute,
|
||||
$feedListRoute,
|
||||
$historyRoute,
|
||||
$profileListRoute,
|
||||
@@ -931,6 +932,125 @@ extension<T extends Enum> on Map<T, String> {
|
||||
entries.where((element) => element.value == value).firstOrNull?.key;
|
||||
}
|
||||
|
||||
RouteBase get $addonManagerRoute => GoRouteData.$route(
|
||||
path: '/addons',
|
||||
name: 'AddonManagerRoute',
|
||||
factory: $AddonManagerRoute._fromState,
|
||||
routes: [
|
||||
GoRouteData.$route(
|
||||
path: 'details/:addonId',
|
||||
name: 'AddonDetailsRoute',
|
||||
factory: $AddonDetailsRoute._fromState,
|
||||
),
|
||||
GoRouteData.$route(
|
||||
path: 'permissions/:addonId',
|
||||
name: 'AddonPermissionsRoute',
|
||||
factory: $AddonPermissionsRoute._fromState,
|
||||
),
|
||||
GoRouteData.$route(
|
||||
path: 'settings/:addonId',
|
||||
name: 'AddonInternalSettingsRoute',
|
||||
factory: $AddonInternalSettingsRoute._fromState,
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
mixin $AddonManagerRoute on GoRouteData {
|
||||
static AddonManagerRoute _fromState(GoRouterState state) =>
|
||||
const AddonManagerRoute();
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location('/addons');
|
||||
|
||||
@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 $AddonDetailsRoute on GoRouteData {
|
||||
static AddonDetailsRoute _fromState(GoRouterState state) =>
|
||||
AddonDetailsRoute(addonId: state.pathParameters['addonId']!);
|
||||
|
||||
AddonDetailsRoute get _self => this as AddonDetailsRoute;
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location(
|
||||
'/addons/details/${Uri.encodeComponent(_self.addonId)}',
|
||||
);
|
||||
|
||||
@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 $AddonPermissionsRoute on GoRouteData {
|
||||
static AddonPermissionsRoute _fromState(GoRouterState state) =>
|
||||
AddonPermissionsRoute(addonId: state.pathParameters['addonId']!);
|
||||
|
||||
AddonPermissionsRoute get _self => this as AddonPermissionsRoute;
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location(
|
||||
'/addons/permissions/${Uri.encodeComponent(_self.addonId)}',
|
||||
);
|
||||
|
||||
@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 $AddonInternalSettingsRoute on GoRouteData {
|
||||
static AddonInternalSettingsRoute _fromState(GoRouterState state) =>
|
||||
AddonInternalSettingsRoute(addonId: state.pathParameters['addonId']!);
|
||||
|
||||
AddonInternalSettingsRoute get _self => this as AddonInternalSettingsRoute;
|
||||
|
||||
@override
|
||||
String get location => GoRouteData.$location(
|
||||
'/addons/settings/${Uri.encodeComponent(_self.addonId)}',
|
||||
);
|
||||
|
||||
@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 $feedListRoute => GoRouteData.$route(
|
||||
path: '/feeds',
|
||||
name: 'FeedListRoute',
|
||||
|
||||
Reference in New Issue
Block a user