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",
|
||||
"searchBarHint": "Search patches",
|
||||
"doneButton": "Done",
|
||||
"recommended": "Recommended",
|
||||
"all" : "All",
|
||||
"none" : "None",
|
||||
"loadPatchesSelection": "Load patches selection",
|
||||
"noSavedPatches": "No saved patches for the selected app\nPress Done to save current selection",
|
||||
"noPatchesFound": "No patches found for the selected app",
|
||||
|
@ -67,7 +67,7 @@ class HomeView extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
DashboardChip(
|
||||
CustomChip(
|
||||
label: I18nText('homeView.installed'),
|
||||
isSelected: !model.showUpdatableApps,
|
||||
onSelected: (value) {
|
||||
@ -75,7 +75,7 @@ class HomeView extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
DashboardChip(
|
||||
CustomChip(
|
||||
label: I18nText('homeView.updatesAvailable'),
|
||||
isSelected: model.showUpdatableApps,
|
||||
onSelected: (value) {
|
||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.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/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/search_bar.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
@ -140,7 +141,33 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0)
|
||||
.copyWith(bottom: 80),
|
||||
child: Column(
|
||||
children: model
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
CustomChip(
|
||||
label:
|
||||
I18nText('patchesSelectorView.recommended'),
|
||||
onSelected: (value) {
|
||||
model.selectRecommendedPatches();
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
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(
|
||||
@ -158,6 +185,7 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -92,6 +92,11 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void clearPatches() {
|
||||
selectedPatches.clear();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void selectPatches() {
|
||||
locator<PatcherViewModel>().selectedPatches = selectedPatches;
|
||||
saveSelectedPatches();
|
||||
|
@ -1,14 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DashboardChip extends StatelessWidget {
|
||||
class CustomChip extends StatelessWidget {
|
||||
final Widget label;
|
||||
final bool isSelected;
|
||||
final Function(bool)? onSelected;
|
||||
|
||||
const DashboardChip({
|
||||
const CustomChip({
|
||||
Key? key,
|
||||
required this.label,
|
||||
required this.isSelected,
|
||||
this.isSelected = false,
|
||||
this.onSelected,
|
||||
}) : super(key: key);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user