mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
feat: add chips for patches selection.
This commit is contained in:
parent
c5958f1257
commit
6e05120aa5
@ -77,6 +77,9 @@
|
|||||||
"viewTitle": "Select patches",
|
"viewTitle": "Select patches",
|
||||||
"searchBarHint": "Search patches",
|
"searchBarHint": "Search patches",
|
||||||
"doneButton": "Done",
|
"doneButton": "Done",
|
||||||
|
"recommended": "Recommended",
|
||||||
|
"all" : "All",
|
||||||
|
"none" : "None",
|
||||||
"loadPatchesSelection": "Load patches selection",
|
"loadPatchesSelection": "Load patches selection",
|
||||||
"noSavedPatches": "No saved patches for the selected app\nPress Done to save current selection",
|
"noSavedPatches": "No saved patches for the selected app\nPress Done to save current selection",
|
||||||
"noPatchesFound": "No patches found for the selected app",
|
"noPatchesFound": "No patches found for the selected app",
|
||||||
|
@ -67,7 +67,7 @@ class HomeView extends StatelessWidget {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
DashboardChip(
|
CustomChip(
|
||||||
label: I18nText('homeView.installed'),
|
label: I18nText('homeView.installed'),
|
||||||
isSelected: !model.showUpdatableApps,
|
isSelected: !model.showUpdatableApps,
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
@ -75,7 +75,7 @@ class HomeView extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
DashboardChip(
|
CustomChip(
|
||||||
label: I18nText('homeView.updatesAvailable'),
|
label: I18nText('homeView.updatesAvailable'),
|
||||||
isSelected: model.showUpdatableApps,
|
isSelected: model.showUpdatableApps,
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_item.dart';
|
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_item.dart';
|
||||||
|
import 'package:revanced_manager/ui/widgets/shared/custom_chip.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/search_bar.dart';
|
import 'package:revanced_manager/ui/widgets/shared/search_bar.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
@ -140,24 +141,51 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 12.0)
|
padding: const EdgeInsets.symmetric(horizontal: 12.0)
|
||||||
.copyWith(bottom: 80),
|
.copyWith(bottom: 80),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: model
|
children: [
|
||||||
.getQueriedPatches(_query)
|
Row(
|
||||||
.map(
|
children: [
|
||||||
(patch) => PatchItem(
|
CustomChip(
|
||||||
name: patch.name,
|
label:
|
||||||
simpleName: patch.getSimpleName(),
|
I18nText('patchesSelectorView.recommended'),
|
||||||
version: patch.version,
|
onSelected: (value) {
|
||||||
description: patch.description,
|
model.selectRecommendedPatches();
|
||||||
packageVersion: model.getAppVersion(),
|
},
|
||||||
supportedPackageVersions:
|
|
||||||
model.getSupportedVersions(patch),
|
|
||||||
isUnsupported: !model.isPatchSupported(patch),
|
|
||||||
isSelected: model.isSelected(patch),
|
|
||||||
onChanged: (value) =>
|
|
||||||
model.selectPatch(patch, value),
|
|
||||||
),
|
),
|
||||||
)
|
const SizedBox(width: 8),
|
||||||
.toList(),
|
CustomChip(
|
||||||
|
label: I18nText('patchesSelectorView.all'),
|
||||||
|
onSelected: (value) {
|
||||||
|
model.selectAllPatches(true);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
CustomChip(
|
||||||
|
label: I18nText('patchesSelectorView.none'),
|
||||||
|
onSelected: (value) {
|
||||||
|
model.clearPatches();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
...model
|
||||||
|
.getQueriedPatches(_query)
|
||||||
|
.map(
|
||||||
|
(patch) => PatchItem(
|
||||||
|
name: patch.name,
|
||||||
|
simpleName: patch.getSimpleName(),
|
||||||
|
version: patch.version,
|
||||||
|
description: patch.description,
|
||||||
|
packageVersion: model.getAppVersion(),
|
||||||
|
supportedPackageVersions:
|
||||||
|
model.getSupportedVersions(patch),
|
||||||
|
isUnsupported: !model.isPatchSupported(patch),
|
||||||
|
isSelected: model.isSelected(patch),
|
||||||
|
onChanged: (value) =>
|
||||||
|
model.selectPatch(patch, value),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -92,6 +92,11 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearPatches() {
|
||||||
|
selectedPatches.clear();
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
void selectPatches() {
|
void selectPatches() {
|
||||||
locator<PatcherViewModel>().selectedPatches = selectedPatches;
|
locator<PatcherViewModel>().selectedPatches = selectedPatches;
|
||||||
saveSelectedPatches();
|
saveSelectedPatches();
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class DashboardChip extends StatelessWidget {
|
class CustomChip extends StatelessWidget {
|
||||||
final Widget label;
|
final Widget label;
|
||||||
final bool isSelected;
|
final bool isSelected;
|
||||||
final Function(bool)? onSelected;
|
final Function(bool)? onSelected;
|
||||||
|
|
||||||
const DashboardChip({
|
const CustomChip({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.label,
|
required this.label,
|
||||||
required this.isSelected,
|
this.isSelected = false,
|
||||||
this.onSelected,
|
this.onSelected,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user