Skip to content

Commit 4a5db96

Browse files
committed
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
1 parent 08e7b8b commit 4a5db96

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

lib/content_management/view/create_source_page.dart

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ class _CreateSourceViewState extends State<_CreateSourceView> {
166166
decoration: InputDecoration(
167167
labelText: l10n.language,
168168
border: const OutlineInputBorder(),
169+
helperText: state.languagesIsLoadingMore
170+
? l10n.loadingFullList
171+
: null,
169172
),
170173
items: [
171174
DropdownMenuItem(value: null, child: Text(l10n.none)),
@@ -176,9 +179,11 @@ class _CreateSourceViewState extends State<_CreateSourceView> {
176179
),
177180
),
178181
],
179-
onChanged: (value) => context
180-
.read<CreateSourceBloc>()
181-
.add(CreateSourceLanguageChanged(value)),
182+
onChanged: state.languagesIsLoadingMore
183+
? null
184+
: (value) => context
185+
.read<CreateSourceBloc>()
186+
.add(CreateSourceLanguageChanged(value)),
182187
),
183188
const SizedBox(height: AppSpacing.lg),
184189
DropdownButtonFormField<SourceType?>(
@@ -206,6 +211,9 @@ class _CreateSourceViewState extends State<_CreateSourceView> {
206211
decoration: InputDecoration(
207212
labelText: l10n.headquarters,
208213
border: const OutlineInputBorder(),
214+
helperText: state.countriesIsLoadingMore
215+
? l10n.loadingFullList
216+
: null,
209217
),
210218
items: [
211219
DropdownMenuItem(value: null, child: Text(l10n.none)),
@@ -232,9 +240,11 @@ class _CreateSourceViewState extends State<_CreateSourceView> {
232240
),
233241
),
234242
],
235-
onChanged: (value) => context
236-
.read<CreateSourceBloc>()
237-
.add(CreateSourceHeadquartersChanged(value)),
243+
onChanged: state.countriesIsLoadingMore
244+
? null
245+
: (value) => context
246+
.read<CreateSourceBloc>()
247+
.add(CreateSourceHeadquartersChanged(value)),
238248
),
239249
const SizedBox(height: AppSpacing.lg),
240250
DropdownButtonFormField<ContentStatus>(

0 commit comments

Comments
 (0)