From 4a5db96358fa8d0dbe4f3e4088c5003670acc9e7 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 1 Aug 2025 10:45:08 +0100 Subject: [PATCH 1/7] feat(content_management): improve language and country dropdowns - Add loading indicator for language and country lists - Disable dropdowns when loading more items - Display helper text when lists are loading --- .../view/create_source_page.dart | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/content_management/view/create_source_page.dart b/lib/content_management/view/create_source_page.dart index 7487e056..d971a0cf 100644 --- a/lib/content_management/view/create_source_page.dart +++ b/lib/content_management/view/create_source_page.dart @@ -166,6 +166,9 @@ class _CreateSourceViewState extends State<_CreateSourceView> { decoration: InputDecoration( labelText: l10n.language, border: const OutlineInputBorder(), + helperText: state.languagesIsLoadingMore + ? l10n.loadingFullList + : null, ), items: [ DropdownMenuItem(value: null, child: Text(l10n.none)), @@ -176,9 +179,11 @@ class _CreateSourceViewState extends State<_CreateSourceView> { ), ), ], - onChanged: (value) => context - .read() - .add(CreateSourceLanguageChanged(value)), + onChanged: state.languagesIsLoadingMore + ? null + : (value) => context + .read() + .add(CreateSourceLanguageChanged(value)), ), const SizedBox(height: AppSpacing.lg), DropdownButtonFormField( @@ -206,6 +211,9 @@ class _CreateSourceViewState extends State<_CreateSourceView> { decoration: InputDecoration( labelText: l10n.headquarters, border: const OutlineInputBorder(), + helperText: state.countriesIsLoadingMore + ? l10n.loadingFullList + : null, ), items: [ DropdownMenuItem(value: null, child: Text(l10n.none)), @@ -232,9 +240,11 @@ class _CreateSourceViewState extends State<_CreateSourceView> { ), ), ], - onChanged: (value) => context - .read() - .add(CreateSourceHeadquartersChanged(value)), + onChanged: state.countriesIsLoadingMore + ? null + : (value) => context + .read() + .add(CreateSourceHeadquartersChanged(value)), ), const SizedBox(height: AppSpacing.lg), DropdownButtonFormField( From 5c4731433c7fa86561b18c81efd9ad3946b43a09 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 1 Aug 2025 10:45:15 +0100 Subject: [PATCH 2/7] feat(content_management): disable country dropdown when loading more - Add helper text to show loading status in country dropdown - Disable country selection when more countries are being loaded --- lib/content_management/view/edit_headline_page.dart | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/content_management/view/edit_headline_page.dart b/lib/content_management/view/edit_headline_page.dart index bd92f724..42fb4403 100644 --- a/lib/content_management/view/edit_headline_page.dart +++ b/lib/content_management/view/edit_headline_page.dart @@ -287,6 +287,9 @@ class _EditHeadlineViewState extends State<_EditHeadlineView> { decoration: InputDecoration( labelText: l10n.countryName, border: const OutlineInputBorder(), + helperText: state.countriesIsLoadingMore + ? l10n.loadingFullList + : null, ), items: [ DropdownMenuItem(value: null, child: Text(l10n.none)), @@ -313,9 +316,11 @@ class _EditHeadlineViewState extends State<_EditHeadlineView> { ), ), ], - onChanged: (value) => context - .read() - .add(EditHeadlineCountryChanged(value)), + onChanged: state.countriesIsLoadingMore + ? null + : (value) => context + .read() + .add(EditHeadlineCountryChanged(value)), ), const SizedBox(height: AppSpacing.lg), DropdownButtonFormField( From c7fc8308c6e6b841af2baba4c2703e1746f207c1 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 1 Aug 2025 10:45:40 +0100 Subject: [PATCH 3/7] feat(content_management): add loading indicator and disable dropdowns when fetching items - Add helper text and disable onChanged callback for language dropdown when loading more languages - Add helper text and disable onChanged callback for country dropdown when loading more countries - Improve user experience by indicating when the full list is being loaded --- .../view/edit_source_page.dart | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/content_management/view/edit_source_page.dart b/lib/content_management/view/edit_source_page.dart index edb25a40..7cc04736 100644 --- a/lib/content_management/view/edit_source_page.dart +++ b/lib/content_management/view/edit_source_page.dart @@ -196,6 +196,9 @@ class _EditSourceViewState extends State<_EditSourceView> { decoration: InputDecoration( labelText: l10n.language, border: const OutlineInputBorder(), + helperText: state.languagesIsLoadingMore + ? l10n.loadingFullList + : null, ), items: [ DropdownMenuItem(value: null, child: Text(l10n.none)), @@ -206,9 +209,11 @@ class _EditSourceViewState extends State<_EditSourceView> { ), ), ], - onChanged: (value) => context - .read() - .add(EditSourceLanguageChanged(value)), + onChanged: state.languagesIsLoadingMore + ? null + : (value) => context + .read() + .add(EditSourceLanguageChanged(value)), ), const SizedBox(height: AppSpacing.lg), DropdownButtonFormField( @@ -236,6 +241,9 @@ class _EditSourceViewState extends State<_EditSourceView> { decoration: InputDecoration( labelText: l10n.headquarters, border: const OutlineInputBorder(), + helperText: state.countriesIsLoadingMore + ? l10n.loadingFullList + : null, ), items: [ DropdownMenuItem(value: null, child: Text(l10n.none)), @@ -262,9 +270,11 @@ class _EditSourceViewState extends State<_EditSourceView> { ), ), ], - onChanged: (value) => context - .read() - .add(EditSourceHeadquartersChanged(value)), + onChanged: state.countriesIsLoadingMore + ? null + : (value) => context + .read() + .add(EditSourceHeadquartersChanged(value)), ), const SizedBox(height: AppSpacing.lg), DropdownButtonFormField( From 71eb5a39850e4b168b038187113ca15acb4afbf6 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 1 Aug 2025 10:46:00 +0100 Subject: [PATCH 4/7] feat(l10n): add Arabic translation for 'loading full list' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add new localization string 'loadingFullList' in AppLocalizationsAr class - Translation: 'جاري تحميل القائمة الكاملة...' --- lib/l10n/app_localizations_ar.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/l10n/app_localizations_ar.dart b/lib/l10n/app_localizations_ar.dart index 04471a03..9aaa4b20 100644 --- a/lib/l10n/app_localizations_ar.dart +++ b/lib/l10n/app_localizations_ar.dart @@ -696,6 +696,9 @@ class AppLocalizationsAr extends AppLocalizations { @override String get loadingData => 'جاري تحميل البيانات...'; + @override + String get loadingFullList => 'جاري تحميل القائمة الكاملة...'; + @override String get createSource => 'إنشاء مصدر'; From 649e4f3030785058a58781ce4180f35ed7ab30ab Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 1 Aug 2025 10:46:08 +0100 Subject: [PATCH 5/7] feat(l10n): add English translation for 'Loading full list...' - Add new localization string 'loadingFullList' to AppLocalizationsEn class - This string can be used in the UI to indicate that a complete list is being loaded --- lib/l10n/app_localizations_en.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 462f47e2..d9053896 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -695,6 +695,9 @@ class AppLocalizationsEn extends AppLocalizations { @override String get loadingData => 'Loading data...'; + @override + String get loadingFullList => 'Loading full list...'; + @override String get createSource => 'Create Source'; From ae1a59e2d8230df72bdff0423c1a45540fa029fb Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 1 Aug 2025 10:46:46 +0100 Subject: [PATCH 6/7] feat(l10n): add new string for loading full list in dropdown - Add new localization string 'loadingFullList' for displaying a message in dropdowns when their full list of items is being loaded in the background. - This new string will improve user experience by providing feedback when large datasets are being processed. --- lib/l10n/app_localizations.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index b88c8ce8..ef0eb1f1 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -1328,6 +1328,12 @@ abstract class AppLocalizations { /// **'Loading data...'** String get loadingData; + /// Message displayed in a dropdown when its full list of items is being loaded in the background. + /// + /// In en, this message translates to: + /// **'Loading full list...'** + String get loadingFullList; + /// Title for the Create Source page /// /// In en, this message translates to: From 61424ca22e296e7ee5dbf8484f4508ddceb54d66 Mon Sep 17 00:00:00 2001 From: fulleni Date: Fri, 1 Aug 2025 10:47:37 +0100 Subject: [PATCH 7/7] feat(l10n): add loading full list translation - Add new translation key "loadingFullList" for Arabic and English - Include description for the new key in both language files - Message indicates that the full list of items in a dropdown is being loaded --- lib/l10n/arb/app_ar.arb | 6 +++++- lib/l10n/arb/app_en.arb | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/l10n/arb/app_ar.arb b/lib/l10n/arb/app_ar.arb index 95552bfa..795602dc 100644 --- a/lib/l10n/arb/app_ar.arb +++ b/lib/l10n/arb/app_ar.arb @@ -854,6 +854,10 @@ "@loadingData": { "description": "رسالة عامة تُعرض أثناء تحميل البيانات لنموذج" }, + "loadingFullList": "جاري تحميل القائمة الكاملة...", + "@loadingFullList": { + "description": "رسالة تُعرض في قائمة منسدلة عند تحميل قائمتها الكاملة من العناصر في الخلفية." + }, "createSource": "إنشاء مصدر", "@createSource": { "description": "عنوان صفحة إنشاء مصدر" @@ -1090,4 +1094,4 @@ "@countryPickerSelectCountryLabel": { "description": "التسمية المعروضة عند عدم اختيار أي دولة في حقل نموذج منتقي البلد" } -} \ No newline at end of file +} diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb index 3192882d..330be9dc 100644 --- a/lib/l10n/arb/app_en.arb +++ b/lib/l10n/arb/app_en.arb @@ -854,6 +854,10 @@ "@loadingData": { "description": "Generic message displayed while loading data for a form" }, + "loadingFullList": "Loading full list...", + "@loadingFullList": { + "description": "Message displayed in a dropdown when its full list of items is being loaded in the background." + }, "createSource": "Create Source", "@createSource": { "description": "Title for the Create Source page"