mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: add search bar hints to i18n
This commit is contained in:
parent
047e00cf2c
commit
960646ba77
@ -37,5 +37,11 @@
|
||||
"patchSelectorCard": {
|
||||
"widgetTitle": "Select patches",
|
||||
"widgetSubtitle": "Select an application first."
|
||||
},
|
||||
"appSelectorView": {
|
||||
"searchBarHint": "Search applications"
|
||||
},
|
||||
"patchesSelectorView": {
|
||||
"searchBarHint": "Search patches"
|
||||
}
|
||||
}
|
@ -6,7 +6,9 @@
|
||||
|
||||
// ignore_for_file: public_member_api_docs
|
||||
|
||||
// ignore: depend_on_referenced_packages
|
||||
import 'package:stacked_core/stacked_core.dart';
|
||||
// ignore: implementation_imports
|
||||
import 'package:stacked_services/src/navigation/navigation_service.dart';
|
||||
|
||||
import '../services/patcher_api.dart';
|
||||
|
@ -40,7 +40,10 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
||||
child: Column(
|
||||
children: [
|
||||
SearchBar(
|
||||
hintText: "Search applications",
|
||||
hintText: FlutterI18n.translate(
|
||||
context,
|
||||
'appSelectorView.searchBarHint',
|
||||
),
|
||||
onQueryChanged: (searchQuery) {
|
||||
setState(() {
|
||||
query = searchQuery;
|
||||
|
@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:revanced_manager/models/patch.dart';
|
||||
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/patch_item.dart';
|
||||
@ -28,7 +29,10 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0, left: 8.0, right: 8.0),
|
||||
child: SearchBar(
|
||||
hintText: "Search patches",
|
||||
hintText: FlutterI18n.translate(
|
||||
context,
|
||||
'patchesSelectorView.searchBarHint',
|
||||
),
|
||||
onQueryChanged: (searchQuery) {
|
||||
setState(
|
||||
() {
|
||||
@ -46,27 +50,27 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
return ListView.builder(
|
||||
itemCount: snapshot.data!.length,
|
||||
itemBuilder: (context, index) {
|
||||
if (query.isEmpty ||
|
||||
query.length < 2) {
|
||||
if (query.isEmpty || query.length < 2) {
|
||||
return PatchItem(
|
||||
name: snapshot.data![index].simpleName,
|
||||
version: snapshot.data![index].version,
|
||||
description: snapshot.data![index].description,
|
||||
isSelected: false,
|
||||
);
|
||||
}
|
||||
else if(query.isNotEmpty &&
|
||||
} else if (query.isNotEmpty &&
|
||||
query.length >= 2 &&
|
||||
snapshot.data![index].simpleName.toLowerCase().contains(query.toLowerCase())) {
|
||||
snapshot.data![index].simpleName
|
||||
.toLowerCase()
|
||||
.contains(query.toLowerCase())) {
|
||||
return PatchItem(
|
||||
name: snapshot.data![index].simpleName,
|
||||
version: snapshot.data![index].version,
|
||||
description: snapshot.data![index].description,
|
||||
isSelected: false,
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
else {return Container();}
|
||||
|
||||
},
|
||||
);
|
||||
} else if (snapshot.hasError) {
|
||||
|
Loading…
Reference in New Issue
Block a user