diff --git a/assets/i18n/en.json b/assets/i18n/en.json index cae87ffb..291e11d6 100644 --- a/assets/i18n/en.json +++ b/assets/i18n/en.json @@ -37,5 +37,11 @@ "patchSelectorCard": { "widgetTitle": "Select patches", "widgetSubtitle": "Select an application first." + }, + "appSelectorView": { + "searchBarHint": "Search applications" + }, + "patchesSelectorView": { + "searchBarHint": "Search patches" } } \ No newline at end of file diff --git a/lib/app/app.locator.dart b/lib/app/app.locator.dart index 17f0de78..ba377dc1 100644 --- a/lib/app/app.locator.dart +++ b/lib/app/app.locator.dart @@ -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'; diff --git a/lib/ui/views/app_selector/app_selector_view.dart b/lib/ui/views/app_selector/app_selector_view.dart index 37bdb303..d43f8e1e 100644 --- a/lib/ui/views/app_selector/app_selector_view.dart +++ b/lib/ui/views/app_selector/app_selector_view.dart @@ -40,7 +40,10 @@ class _AppSelectorViewState extends State { child: Column( children: [ SearchBar( - hintText: "Search applications", + hintText: FlutterI18n.translate( + context, + 'appSelectorView.searchBarHint', + ), onQueryChanged: (searchQuery) { setState(() { query = searchQuery; diff --git a/lib/ui/views/patches_selector/patches_selector_view.dart b/lib/ui/views/patches_selector/patches_selector_view.dart index 4cc87d96..38c83c6d 100644 --- a/lib/ui/views/patches_selector/patches_selector_view.dart +++ b/lib/ui/views/patches_selector/patches_selector_view.dart @@ -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 { 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 { 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) {