Migrate to singbox

This commit is contained in:
problematicconsumer
2023-08-19 22:27:23 +03:30
parent 14369d0a03
commit 684acc555d
124 changed files with 3408 additions and 2047 deletions

View File

@@ -36,7 +36,7 @@ class PrefsController extends _$PrefsController with AppLogger {
ClashConfig _getClashPrefs() {
final persisted = _prefs.getString(_overridesKey);
if (persisted == null) return ClashConfig.initial;
if (persisted == null) return const ClashConfig();
return ClashConfig.fromJson(jsonDecode(persisted) as Map<String, dynamic>);
}

View File

@@ -33,11 +33,11 @@ GoRouter router(RouterRef ref) {
int getCurrentIndex(BuildContext context) {
final String location = GoRouterState.of(context).location;
if (location == HomeRoute.path) return 0;
if (location.startsWith(ProxiesRoute.path)) return 1;
if (location.startsWith(LogsRoute.path)) return 2;
if (location.startsWith(SettingsRoute.path)) return 3;
if (location.startsWith(AboutRoute.path)) return 4;
if (location == const HomeRoute().location) return 0;
if (location.startsWith(const ProxiesRoute().location)) return 1;
if (location.startsWith(const LogsRoute().location)) return 2;
if (location.startsWith(const SettingsRoute().location)) return 3;
if (location.startsWith(const AboutRoute().location)) return 4;
return 0;
}

View File

@@ -23,9 +23,9 @@ part 'desktop_routes.g.dart';
TypedGoRoute<LogsRoute>(path: LogsRoute.path),
TypedGoRoute<SettingsRoute>(
path: SettingsRoute.path,
routes: [
TypedGoRoute<ClashOverridesRoute>(path: ClashOverridesRoute.path),
],
// routes: [
// TypedGoRoute<ClashOverridesRoute>(path: ClashOverridesRoute.path),
// ],
),
TypedGoRoute<AboutRoute>(path: AboutRoute.path),
],
@@ -59,18 +59,18 @@ class SettingsRoute extends GoRouteData {
}
}
class ClashOverridesRoute extends GoRouteData {
const ClashOverridesRoute();
static const path = 'clash';
// class ClashOverridesRoute extends GoRouteData {
// const ClashOverridesRoute();
// static const path = 'clash';
@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
return const MaterialPage(
fullscreenDialog: true,
child: ClashOverridesPage(),
);
}
}
// @override
// Page<void> buildPage(BuildContext context, GoRouterState state) {
// return const MaterialPage(
// fullscreenDialog: true,
// child: ClashOverridesPage(),
// );
// }
// }
class AboutRoute extends GoRouteData {
const AboutRoute();

View File

@@ -20,9 +20,9 @@ part 'mobile_routes.g.dart';
TypedGoRoute<LogsRoute>(path: LogsRoute.path),
TypedGoRoute<SettingsRoute>(
path: SettingsRoute.path,
routes: [
TypedGoRoute<ClashOverridesRoute>(path: ClashOverridesRoute.path),
],
// routes: [
// TypedGoRoute<ClashOverridesRoute>(path: ClashOverridesRoute.path),
// ],
),
TypedGoRoute<AboutRoute>(path: AboutRoute.path),
],
@@ -69,20 +69,20 @@ class SettingsRoute extends GoRouteData {
}
}
class ClashOverridesRoute extends GoRouteData {
const ClashOverridesRoute();
static const path = 'clash';
// class ClashOverridesRoute extends GoRouteData {
// const ClashOverridesRoute();
// static const path = 'clash';
static final GlobalKey<NavigatorState> $parentNavigatorKey = rootNavigatorKey;
// static final GlobalKey<NavigatorState> $parentNavigatorKey = rootNavigatorKey;
@override
Page<void> buildPage(BuildContext context, GoRouterState state) {
return const MaterialPage(
fullscreenDialog: true,
child: ClashOverridesPage(),
);
}
}
// @override
// Page<void> buildPage(BuildContext context, GoRouterState state) {
// return const MaterialPage(
// fullscreenDialog: true,
// child: ClashOverridesPage(),
// );
// }
// }
class AboutRoute extends GoRouteData {
const AboutRoute();