@@ -198,24 +198,36 @@ class _EditSourceViewState extends State<_EditSourceView> {
198
198
),
199
199
),
200
200
const SizedBox (height: AppSpacing .lg),
201
- DropdownButtonFormField <Language ?>(
202
- value: state.language,
203
- decoration: InputDecoration (
204
- labelText: l10n.language,
205
- border: const OutlineInputBorder (),
206
- ),
207
- items: [
208
- DropdownMenuItem (value: null , child: Text (l10n.none)),
209
- ...state.languages.map (
210
- (language) => DropdownMenuItem (
211
- value: language,
212
- child: Text (language.name),
201
+ BlocBuilder <ContentManagementBloc , ContentManagementState >(
202
+ builder: (context, contentState) {
203
+ final isLoading = contentState.allLanguagesStatus ==
204
+ ContentManagementStatus .loading;
205
+ return DropdownButtonFormField <Language ?>(
206
+ value: state.language,
207
+ decoration: InputDecoration (
208
+ labelText: l10n.language,
209
+ border: const OutlineInputBorder (),
210
+ helperText:
211
+ isLoading ? l10n.loadingFullList : null ,
213
212
),
214
- ),
215
- ],
216
- onChanged: (value) => context.read <EditSourceBloc >().add (
217
- EditSourceLanguageChanged (value),
218
- ),
213
+ items: [
214
+ DropdownMenuItem (
215
+ value: null , child: Text (l10n.none)),
216
+ ...state.languages.map (
217
+ (language) => DropdownMenuItem (
218
+ value: language,
219
+ child: Text (language.name),
220
+ ),
221
+ ),
222
+ ],
223
+ onChanged: isLoading
224
+ ? null
225
+ : (value) =>
226
+ context.read <EditSourceBloc >().add (
227
+ EditSourceLanguageChanged (value),
228
+ ),
229
+ );
230
+ },
219
231
),
220
232
const SizedBox (height: AppSpacing .lg),
221
233
DropdownButtonFormField <SourceType ?>(
@@ -238,40 +250,52 @@ class _EditSourceViewState extends State<_EditSourceView> {
238
250
),
239
251
),
240
252
const SizedBox (height: AppSpacing .lg),
241
- DropdownButtonFormField <Country ?>(
242
- value: state.headquarters,
243
- decoration: InputDecoration (
244
- labelText: l10n.headquarters,
245
- border: const OutlineInputBorder (),
246
- ),
247
- items: [
248
- DropdownMenuItem (value: null , child: Text (l10n.none)),
249
- ...state.countries.map (
250
- (country) => DropdownMenuItem (
251
- value: country,
252
- child: Row (
253
- children: [
254
- SizedBox (
255
- width: 32 ,
256
- height: 20 ,
257
- child: Image .network (
258
- country.flagUrl,
259
- fit: BoxFit .cover,
260
- errorBuilder:
261
- (context, error, stackTrace) =>
262
- const Icon (Icons .flag),
263
- ),
253
+ BlocBuilder <ContentManagementBloc , ContentManagementState >(
254
+ builder: (context, contentState) {
255
+ final isLoading = contentState.allCountriesStatus ==
256
+ ContentManagementStatus .loading;
257
+ return DropdownButtonFormField <Country ?>(
258
+ value: state.headquarters,
259
+ decoration: InputDecoration (
260
+ labelText: l10n.headquarters,
261
+ border: const OutlineInputBorder (),
262
+ helperText:
263
+ isLoading ? l10n.loadingFullList : null ,
264
+ ),
265
+ items: [
266
+ DropdownMenuItem (
267
+ value: null , child: Text (l10n.none)),
268
+ ...state.countries.map (
269
+ (country) => DropdownMenuItem (
270
+ value: country,
271
+ child: Row (
272
+ children: [
273
+ SizedBox (
274
+ width: 32 ,
275
+ height: 20 ,
276
+ child: Image .network (
277
+ country.flagUrl,
278
+ fit: BoxFit .cover,
279
+ errorBuilder:
280
+ (context, error, stackTrace) =>
281
+ const Icon (Icons .flag),
282
+ ),
283
+ ),
284
+ const SizedBox (width: AppSpacing .md),
285
+ Text (country.name),
286
+ ],
264
287
),
265
- const SizedBox (width: AppSpacing .md),
266
- Text (country.name),
267
- ],
288
+ ),
268
289
),
269
- ),
270
- ),
271
- ],
272
- onChanged: (value) => context.read <EditSourceBloc >().add (
273
- EditSourceHeadquartersChanged (value),
274
- ),
290
+ ],
291
+ onChanged: isLoading
292
+ ? null
293
+ : (value) =>
294
+ context.read <EditSourceBloc >().add (
295
+ EditSourceHeadquartersChanged (value),
296
+ ),
297
+ );
298
+ },
275
299
),
276
300
const SizedBox (height: AppSpacing .lg),
277
301
DropdownButtonFormField <ContentStatus >(
0 commit comments