@@ -191,32 +191,34 @@ class _EditSourceViewState extends State<_EditSourceView> {
191
191
),
192
192
),
193
193
const SizedBox (height: AppSpacing .lg),
194
- SearchableDropdownFormField <Language , EditSourceBloc ,
195
- EditSourceState >(
196
- labelText: l10n.language,
197
- bloc: context.read <EditSourceBloc >(),
198
- initialValue: state.language,
199
- itemsExtractor: (state) => state.languages,
200
- hasMoreExtractor: (state) => state.languagesHasMore,
201
- isLoadingExtractor: (state) =>
202
- state.status == EditSourceStatus .loading,
194
+ DropdownButtonFormField <Language ?>(
195
+ value: state.language,
196
+ decoration: InputDecoration (
197
+ labelText: l10n.language,
198
+ border: const OutlineInputBorder (),
199
+ ),
200
+ items: [
201
+ DropdownMenuItem (value: null , child: Text (l10n.none)),
202
+ ...state.languages.map (
203
+ (language) => DropdownMenuItem (
204
+ value: language,
205
+ child: Text (language.name),
206
+ ),
207
+ ),
208
+ if (state.languagesHasMore)
209
+ DropdownMenuItem (
210
+ value: null ,
211
+ child: const Center (
212
+ child: Text ('Load More' ),
213
+ ),
214
+ onTap: () => context.read <EditSourceBloc >().add (
215
+ const EditSourceLoadMoreLanguagesRequested (),
216
+ ),
217
+ ),
218
+ ],
203
219
onChanged: (value) => context
204
220
.read <EditSourceBloc >()
205
221
.add (EditSourceLanguageChanged (value)),
206
- onSearchChanged: (value) => context
207
- .read <EditSourceBloc >()
208
- .add (EditSourceLanguageSearchChanged (value)),
209
- onLoadMore: () => context.read <EditSourceBloc >().add (
210
- const EditSourceLoadMoreLanguagesRequested (),
211
- ),
212
- itemBuilder: (context, language) {
213
- return ListTile (
214
- title: Text (language.name),
215
- );
216
- },
217
- selectedItemBuilder: (context, language) {
218
- return Text (language.name);
219
- },
220
222
),
221
223
const SizedBox (height: AppSpacing .lg),
222
224
DropdownButtonFormField <SourceType ?>(
@@ -239,57 +241,50 @@ class _EditSourceViewState extends State<_EditSourceView> {
239
241
),
240
242
),
241
243
const SizedBox (height: AppSpacing .lg),
242
- SearchableDropdownFormField <Country , EditSourceBloc ,
243
- EditSourceState >(
244
- labelText: l10n.headquarters,
245
- bloc: context.read <EditSourceBloc >(),
246
- initialValue: state.headquarters,
247
- itemsExtractor: (state) => state.countries,
248
- hasMoreExtractor: (state) => state.countriesHasMore,
249
- isLoadingExtractor: (state) =>
250
- state.status == EditSourceStatus .loading,
251
- onChanged: (value) => context
252
- .read <EditSourceBloc >()
253
- .add (EditSourceHeadquartersChanged (value)),
254
- onSearchChanged: (value) => context
255
- .read <EditSourceBloc >()
256
- .add (EditSourceCountrySearchChanged (value)),
257
- onLoadMore: () => context.read <EditSourceBloc >().add (
258
- const EditSourceLoadMoreCountriesRequested (),
259
- ),
260
- itemBuilder: (context, country) {
261
- return ListTile (
262
- leading: SizedBox (
263
- width: 32 ,
264
- height: 20 ,
265
- child: Image .network (
266
- country.flagUrl,
267
- fit: BoxFit .cover,
268
- errorBuilder: (context, error, stackTrace) =>
269
- const Icon (Icons .flag),
244
+ DropdownButtonFormField <Country ?>(
245
+ value: state.headquarters,
246
+ decoration: InputDecoration (
247
+ labelText: l10n.headquarters,
248
+ border: const OutlineInputBorder (),
249
+ ),
250
+ items: [
251
+ DropdownMenuItem (value: null , child: Text (l10n.none)),
252
+ ...state.countries.map (
253
+ (country) => DropdownMenuItem (
254
+ value: country,
255
+ child: Row (
256
+ children: [
257
+ SizedBox (
258
+ width: 32 ,
259
+ height: 20 ,
260
+ child: Image .network (
261
+ country.flagUrl,
262
+ fit: BoxFit .cover,
263
+ errorBuilder:
264
+ (context, error, stackTrace) =>
265
+ const Icon (Icons .flag),
266
+ ),
267
+ ),
268
+ const SizedBox (width: AppSpacing .md),
269
+ Text (country.name),
270
+ ],
270
271
),
271
272
),
272
- title: Text (country.name),
273
- );
274
- },
275
- selectedItemBuilder: (context, country) {
276
- return Row (
277
- children: [
278
- SizedBox (
279
- width: 32 ,
280
- height: 20 ,
281
- child: Image .network (
282
- country.flagUrl,
283
- fit: BoxFit .cover,
284
- errorBuilder: (context, error, stackTrace) =>
285
- const Icon (Icons .flag),
286
- ),
273
+ ),
274
+ if (state.countriesHasMore)
275
+ DropdownMenuItem (
276
+ value: null ,
277
+ child: const Center (
278
+ child: Text ('Load More' ),
287
279
),
288
- const SizedBox (width: AppSpacing .md),
289
- Text (country.name),
290
- ],
291
- );
292
- },
280
+ onTap: () => context.read <EditSourceBloc >().add (
281
+ const EditSourceLoadMoreCountriesRequested (),
282
+ ),
283
+ ),
284
+ ],
285
+ onChanged: (value) => context
286
+ .read <EditSourceBloc >()
287
+ .add (EditSourceHeadquartersChanged (value)),
293
288
),
294
289
const SizedBox (height: AppSpacing .lg),
295
290
DropdownButtonFormField <ContentStatus >(
0 commit comments