mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 12:47:37 +02:00
fix: add some minor improvements and fix release builds
This commit is contained in:
@ -4,11 +4,11 @@
|
||||
// StackedLocatorGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: public_member_api_docs, depend_on_referenced_packages, implementation_imports
|
||||
// ignore_for_file: public_member_api_docs, depend_on_referenced_packages
|
||||
|
||||
import 'package:stacked_core/stacked_core.dart';
|
||||
import 'package:stacked_services/src/navigation/navigation_service.dart';
|
||||
import 'package:stacked_themes/src/theme_service.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
import 'package:stacked_themes/stacked_themes.dart';
|
||||
|
||||
import '../services/patcher_api.dart';
|
||||
import '../ui/views/app_selector/app_selector_viewmodel.dart';
|
||||
|
@ -4,165 +4,176 @@
|
||||
// StackedRouterGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// ignore_for_file: no_leading_underscores_for_library_prefixes, implementation_imports
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/src/foundation/key.dart' as _i7;
|
||||
import 'package:stacked/stacked.dart' as _i1;
|
||||
import 'package:stacked_services/stacked_services.dart' as _i8;
|
||||
// ignore_for_file: public_member_api_docs, unused_import, non_constant_identifier_names
|
||||
|
||||
import '../ui/views/app_selector/app_selector_view.dart' as _i2;
|
||||
import '../ui/views/contributors/contributors_view.dart' as _i6;
|
||||
import '../ui/views/installer/installer_view.dart' as _i4;
|
||||
import '../ui/views/patches_selector/patches_selector_view.dart' as _i3;
|
||||
import '../ui/views/settings/settings_view.dart' as _i5;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
import '../ui/views/app_selector/app_selector_view.dart';
|
||||
import '../ui/views/contributors/contributors_view.dart';
|
||||
import '../ui/views/installer/installer_view.dart';
|
||||
import '../ui/views/patches_selector/patches_selector_view.dart';
|
||||
import '../ui/views/settings/settings_view.dart';
|
||||
|
||||
class Routes {
|
||||
static const appSelectorView = '/app-selector-view';
|
||||
|
||||
static const patchesSelectorView = '/patches-selector-view';
|
||||
|
||||
static const installerView = '/installer-view';
|
||||
|
||||
static const settingsView = '/settings-view';
|
||||
|
||||
static const contributorsView = '/contributors-view';
|
||||
|
||||
static const String appSelectorView = '/app-selector-view';
|
||||
static const String patchesSelectorView = '/patches-selector-view';
|
||||
static const String installerView = '/installer-view';
|
||||
static const String settingsView = '/settings-view';
|
||||
static const String contributorsView = '/contributors-view';
|
||||
static const all = <String>{
|
||||
appSelectorView,
|
||||
patchesSelectorView,
|
||||
installerView,
|
||||
settingsView,
|
||||
contributorsView
|
||||
contributorsView,
|
||||
};
|
||||
}
|
||||
|
||||
class StackedRouter extends _i1.RouterBase {
|
||||
final _routes = <_i1.RouteDef>[
|
||||
_i1.RouteDef(Routes.appSelectorView, page: _i2.AppSelectorView),
|
||||
_i1.RouteDef(Routes.patchesSelectorView, page: _i3.PatchesSelectorView),
|
||||
_i1.RouteDef(Routes.installerView, page: _i4.InstallerView),
|
||||
_i1.RouteDef(Routes.settingsView, page: _i5.SettingsView),
|
||||
_i1.RouteDef(Routes.contributorsView, page: _i6.ContributorsView)
|
||||
class StackedRouter extends RouterBase {
|
||||
@override
|
||||
List<RouteDef> get routes => _routes;
|
||||
final _routes = <RouteDef>[
|
||||
RouteDef(Routes.appSelectorView, page: AppSelectorView),
|
||||
RouteDef(Routes.patchesSelectorView, page: PatchesSelectorView),
|
||||
RouteDef(Routes.installerView, page: InstallerView),
|
||||
RouteDef(Routes.settingsView, page: SettingsView),
|
||||
RouteDef(Routes.contributorsView, page: ContributorsView),
|
||||
];
|
||||
|
||||
final _pagesMap = <Type, _i1.StackedRouteFactory>{
|
||||
_i2.AppSelectorView: (data) {
|
||||
@override
|
||||
Map<Type, StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
final _pagesMap = <Type, StackedRouteFactory>{
|
||||
AppSelectorView: (data) {
|
||||
return MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i2.AppSelectorView(),
|
||||
builder: (context) => const AppSelectorView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i3.PatchesSelectorView: (data) {
|
||||
PatchesSelectorView: (data) {
|
||||
return MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i3.PatchesSelectorView(),
|
||||
builder: (context) => const PatchesSelectorView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i4.InstallerView: (data) {
|
||||
final args = data.getArgs<InstallerViewArguments>(
|
||||
orElse: () => const InstallerViewArguments(),
|
||||
InstallerView: (data) {
|
||||
var args = data.getArgs<InstallerViewArguments>(
|
||||
orElse: () => InstallerViewArguments(),
|
||||
);
|
||||
return MaterialPageRoute<dynamic>(
|
||||
builder: (context) => _i4.InstallerView(key: args.key),
|
||||
builder: (context) => InstallerView(key: args.key),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i5.SettingsView: (data) {
|
||||
SettingsView: (data) {
|
||||
return MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i5.SettingsView(),
|
||||
builder: (context) => const SettingsView(),
|
||||
settings: data,
|
||||
);
|
||||
},
|
||||
_i6.ContributorsView: (data) {
|
||||
ContributorsView: (data) {
|
||||
return MaterialPageRoute<dynamic>(
|
||||
builder: (context) => const _i6.ContributorsView(),
|
||||
builder: (context) => const ContributorsView(),
|
||||
settings: data,
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@override
|
||||
List<_i1.RouteDef> get routes => _routes;
|
||||
@override
|
||||
Map<Type, _i1.StackedRouteFactory> get pagesMap => _pagesMap;
|
||||
}
|
||||
|
||||
/// ************************************************************************
|
||||
/// Arguments holder classes
|
||||
/// *************************************************************************
|
||||
|
||||
/// InstallerView arguments holder class
|
||||
class InstallerViewArguments {
|
||||
const InstallerViewArguments({this.key});
|
||||
|
||||
final _i7.Key? key;
|
||||
final Key? key;
|
||||
InstallerViewArguments({this.key});
|
||||
}
|
||||
|
||||
extension NavigatorStateExtension on _i8.NavigationService {
|
||||
Future<dynamic> navigateToAppSelectorView(
|
||||
[int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(
|
||||
BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition]) async {
|
||||
navigateTo(Routes.appSelectorView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
/// ************************************************************************
|
||||
/// Extension for strongly typed navigation
|
||||
/// *************************************************************************
|
||||
|
||||
extension NavigatorStateExtension on NavigationService {
|
||||
Future<dynamic> navigateToAppSelectorView({
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
}) async {
|
||||
return navigateTo(
|
||||
Routes.appSelectorView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition,
|
||||
);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToPatchesSelectorView(
|
||||
[int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(
|
||||
BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition]) async {
|
||||
navigateTo(Routes.patchesSelectorView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
Future<dynamic> navigateToPatchesSelectorView({
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
}) async {
|
||||
return navigateTo(
|
||||
Routes.patchesSelectorView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition,
|
||||
);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToInstallerView(
|
||||
{_i7.Key? key,
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(
|
||||
BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition}) async {
|
||||
navigateTo(Routes.installerView,
|
||||
arguments: InstallerViewArguments(key: key),
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
Future<dynamic> navigateToInstallerView({
|
||||
Key? key,
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
}) async {
|
||||
return navigateTo(
|
||||
Routes.installerView,
|
||||
arguments: InstallerViewArguments(key: key),
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition,
|
||||
);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToSettingsView(
|
||||
[int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(
|
||||
BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition]) async {
|
||||
navigateTo(Routes.settingsView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
Future<dynamic> navigateToSettingsView({
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
}) async {
|
||||
return navigateTo(
|
||||
Routes.settingsView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition,
|
||||
);
|
||||
}
|
||||
|
||||
Future<dynamic> navigateToContributorsView(
|
||||
[int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(
|
||||
BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition]) async {
|
||||
navigateTo(Routes.contributorsView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition);
|
||||
Future<dynamic> navigateToContributorsView({
|
||||
int? routerId,
|
||||
bool preventDuplicates = true,
|
||||
Map<String, String>? parameters,
|
||||
Widget Function(BuildContext, Animation<double>, Animation<double>, Widget)?
|
||||
transition,
|
||||
}) async {
|
||||
return navigateTo(
|
||||
Routes.contributorsView,
|
||||
id: routerId,
|
||||
preventDuplicates: preventDuplicates,
|
||||
parameters: parameters,
|
||||
transition: transition,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user