revanced-manager/lib/ui/views/patcher/patcher_viewmodel.dart

36 lines
1013 B
Dart
Raw Normal View History

2022-08-18 16:33:33 +02:00
import 'package:injectable/injectable.dart';
2022-08-06 23:35:35 +02:00
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/app/app.router.dart';
2022-08-18 16:33:33 +02:00
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
2022-08-18 16:33:33 +02:00
@lazySingleton
class PatcherViewModel extends BaseViewModel {
2022-08-18 16:33:33 +02:00
PatchedApplication? selectedApp;
List<Patch> selectedPatches = [];
final NavigationService _navigationService = locator<NavigationService>();
void navigateToAppSelector() {
2022-08-07 21:15:52 +02:00
_navigationService.navigateTo(Routes.appSelectorView);
}
void navigateToPatchesSelector() {
_navigationService.navigateTo(Routes.patchesSelectorView);
}
void navigateToInstaller() {
_navigationService.navigateTo(Routes.installerView);
}
bool showFabButton() {
2022-08-18 16:33:33 +02:00
return selectedPatches.isNotEmpty;
}
bool dimPatchesCard() {
2022-08-18 16:33:33 +02:00
return selectedApp == null;
}
}