Better UX for mobile

Better text rendering of "ignore filters" checkbox on mobile.
Adds a line break to mobile devices, where horizontal space is limited.
This commit is contained in:
Enbiya Olgun 2025-04-27 03:15:04 +02:00
parent 2a59ae7b70
commit 6b4a86d2b5
5 changed files with 25 additions and 9 deletions

View file

@ -8,7 +8,10 @@
"open_random_entry": "สุ่มอ่าน",
"import": "นำเข้า",
"filter": "ตัวกรอง",
"ignore_filters": "ไม่สนใจตัวกรอง",
"ignore_filters": "ไม่สนใจ\nตัวกรอง",
"@ignore_filters": {
"description": "Manual line break added for better rendering of the ignore filters text on mobile."
},
"downloaded": "ดาวน์โหลดแล้ว",
"unread": "ยังไม่อ่าน",
"started": "เริ่มแล้ว",

View file

@ -8,7 +8,10 @@
"open_random_entry": "随机打开条目",
"import": "导入",
"filter": "筛选",
"ignore_filters": "忽略筛选",
"ignore_filters": "忽略\n筛选",
"@ignore_filters": {
"description": "Manual line break added for better rendering of the ignore filters text on mobile."
},
"downloaded": "已下载",
"unread": "未读",
"started": "已开始",

View file

@ -33,7 +33,7 @@ class AppLocalizationsTh extends AppLocalizations {
String get filter => 'ตัวกรอง';
@override
String get ignore_filters => 'ไม่สนใจตัวกรอง';
String get ignore_filters => 'ไม่สนใจ\nตัวกรอง';
@override
String get downloaded => 'ดาวน์โหลดแล้ว';

View file

@ -33,7 +33,7 @@ class AppLocalizationsZh extends AppLocalizations {
String get filter => '筛选';
@override
String get ignore_filters => '忽略筛选';
String get ignore_filters => '忽略\n筛选';
@override
String get downloaded => '已下载';

View file

@ -1039,7 +1039,7 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
List<Manga>? mangas;
final searchQuery = _textEditingController.text;
// Skip all filters, just do search
if (searchQuery.isNotEmpty && ignoreFiltersOnSearch) {
if (searchQuery.isNotEmpty && _ignoreFiltersOnSearch) {
mangas =
data
.where((element) => matchesSearchQuery(element, searchQuery))
@ -2053,7 +2053,8 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
return l10n.date_added;
}
bool ignoreFiltersOnSearch = false;
bool _ignoreFiltersOnSearch = false;
final bool _isMobile = Platform.isIOS || Platform.isAndroid;
PreferredSize _appBar(
bool isNotFiltering,
bool showNumbersOfItems,
@ -2217,12 +2218,21 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(l10n.ignore_filters),
Text(
_isMobile
// Adds a line break where spaces exist for better mobile layout.
// Works for languages that use spaces between words.
? l10n.ignore_filters.replaceAll(' ', '\n')
// Removes manually added line breaks for Thai and Chinese,
// where spaces arent used, to ensure proper desktop rendering.
: l10n.ignore_filters.replaceAll('\n', ''),
textAlign: TextAlign.center,
),
Checkbox(
value: ignoreFiltersOnSearch,
value: _ignoreFiltersOnSearch,
onChanged: (val) {
setState(() {
ignoreFiltersOnSearch = val ?? false;
_ignoreFiltersOnSearch = val ?? false;
});
},
),