@@ -168,24 +168,35 @@ class _CreateSourceViewState extends State<_CreateSourceView> {
168
168
.add (CreateSourceUrlChanged (value)),
169
169
),
170
170
const SizedBox (height: AppSpacing .lg),
171
- DropdownButtonFormField <Language ?>(
172
- value: state.language,
173
- decoration: InputDecoration (
174
- labelText: l10n.language,
175
- border: const OutlineInputBorder (),
176
- ),
177
- items: [
178
- DropdownMenuItem (value: null , child: Text (l10n.none)),
179
- ...state.languages.map (
180
- (language) => DropdownMenuItem (
181
- value: language,
182
- child: Text (language.name),
171
+ BlocBuilder <ContentManagementBloc , ContentManagementState >(
172
+ builder: (context, contentState) {
173
+ final isLoading = contentState.allLanguagesStatus ==
174
+ ContentManagementStatus .loading;
175
+ return DropdownButtonFormField <Language ?>(
176
+ value: state.language,
177
+ decoration: InputDecoration (
178
+ labelText: l10n.language,
179
+ border: const OutlineInputBorder (),
180
+ helperText:
181
+ isLoading ? l10n.loadingFullList : null ,
183
182
),
184
- ),
185
- ],
186
- onChanged: (value) => context
187
- .read <CreateSourceBloc >()
188
- .add (CreateSourceLanguageChanged (value)),
183
+ items: [
184
+ DropdownMenuItem (
185
+ value: null , child: Text (l10n.none)),
186
+ ...state.languages.map (
187
+ (language) => DropdownMenuItem (
188
+ value: language,
189
+ child: Text (language.name),
190
+ ),
191
+ ),
192
+ ],
193
+ onChanged: isLoading
194
+ ? null
195
+ : (value) => context
196
+ .read <CreateSourceBloc >()
197
+ .add (CreateSourceLanguageChanged (value)),
198
+ );
199
+ },
189
200
),
190
201
const SizedBox (height: AppSpacing .lg),
191
202
DropdownButtonFormField <SourceType ?>(
@@ -208,40 +219,50 @@ class _CreateSourceViewState extends State<_CreateSourceView> {
208
219
.add (CreateSourceTypeChanged (value)),
209
220
),
210
221
const SizedBox (height: AppSpacing .lg),
211
- DropdownButtonFormField <Country ?>(
212
- value: state.headquarters,
213
- decoration: InputDecoration (
214
- labelText: l10n.headquarters,
215
- border: const OutlineInputBorder (),
216
- ),
217
- items: [
218
- DropdownMenuItem (value: null , child: Text (l10n.none)),
219
- ...state.countries.map (
220
- (country) => DropdownMenuItem (
221
- value: country,
222
- child: Row (
223
- children: [
224
- SizedBox (
225
- width: 32 ,
226
- height: 20 ,
227
- child: Image .network (
228
- country.flagUrl,
229
- fit: BoxFit .cover,
230
- errorBuilder:
231
- (context, error, stackTrace) =>
232
- const Icon (Icons .flag),
233
- ),
222
+ BlocBuilder <ContentManagementBloc , ContentManagementState >(
223
+ builder: (context, contentState) {
224
+ final isLoading = contentState.allCountriesStatus ==
225
+ ContentManagementStatus .loading;
226
+ return DropdownButtonFormField <Country ?>(
227
+ value: state.headquarters,
228
+ decoration: InputDecoration (
229
+ labelText: l10n.headquarters,
230
+ border: const OutlineInputBorder (),
231
+ helperText:
232
+ isLoading ? l10n.loadingFullList : null ,
233
+ ),
234
+ items: [
235
+ DropdownMenuItem (
236
+ value: null , child: Text (l10n.none)),
237
+ ...state.countries.map (
238
+ (country) => DropdownMenuItem (
239
+ value: country,
240
+ child: Row (
241
+ children: [
242
+ SizedBox (
243
+ width: 32 ,
244
+ height: 20 ,
245
+ child: Image .network (
246
+ country.flagUrl,
247
+ fit: BoxFit .cover,
248
+ errorBuilder:
249
+ (context, error, stackTrace) =>
250
+ const Icon (Icons .flag),
251
+ ),
252
+ ),
253
+ const SizedBox (width: AppSpacing .md),
254
+ Text (country.name),
255
+ ],
234
256
),
235
- const SizedBox (width: AppSpacing .md),
236
- Text (country.name),
237
- ],
257
+ ),
238
258
),
239
- ),
240
- ),
241
- ],
242
- onChanged: (value) => context
243
- .read <CreateSourceBloc >()
244
- .add (CreateSourceHeadquartersChanged (value)),
259
+ ],
260
+ onChanged: isLoading
261
+ ? null
262
+ : (value) => context.read <CreateSourceBloc >().add (
263
+ CreateSourceHeadquartersChanged (value)),
264
+ );
265
+ },
245
266
),
246
267
const SizedBox (height: AppSpacing .lg),
247
268
DropdownButtonFormField <ContentStatus >(
0 commit comments