@@ -214,57 +214,50 @@ class _CreateHeadlineViewState extends State<_CreateHeadlineView> {
214
214
.add (CreateHeadlineTopicChanged (value)),
215
215
),
216
216
const SizedBox (height: AppSpacing .lg),
217
- SearchableDropdownFormField <Country , CreateHeadlineBloc ,
218
- CreateHeadlineState >(
219
- labelText: l10n.countryName,
220
- bloc: context.read <CreateHeadlineBloc >(),
221
- initialValue: state.eventCountry,
222
- itemsExtractor: (state) => state.countries,
223
- hasMoreExtractor: (state) => state.countriesHasMore,
224
- isLoadingExtractor: (state) =>
225
- state.status == CreateHeadlineStatus .loading,
226
- onChanged: (value) => context
227
- .read <CreateHeadlineBloc >()
228
- .add (CreateHeadlineCountryChanged (value)),
229
- onSearchChanged: (value) => context
230
- .read <CreateHeadlineBloc >()
231
- .add (CreateHeadlineCountrySearchChanged (value)),
232
- onLoadMore: () => context.read <CreateHeadlineBloc >().add (
233
- const CreateHeadlineLoadMoreCountriesRequested (),
234
- ),
235
- itemBuilder: (context, country) {
236
- return ListTile (
237
- leading: SizedBox (
238
- width: 32 ,
239
- height: 20 ,
240
- child: Image .network (
241
- country.flagUrl,
242
- fit: BoxFit .cover,
243
- errorBuilder: (context, error, stackTrace) =>
244
- const Icon (Icons .flag),
217
+ DropdownButtonFormField <Country ?>(
218
+ value: state.eventCountry,
219
+ decoration: InputDecoration (
220
+ labelText: l10n.countryName,
221
+ border: const OutlineInputBorder (),
222
+ ),
223
+ items: [
224
+ DropdownMenuItem (value: null , child: Text (l10n.none)),
225
+ ...state.countries.map (
226
+ (country) => DropdownMenuItem (
227
+ value: country,
228
+ child: Row (
229
+ children: [
230
+ SizedBox (
231
+ width: 32 ,
232
+ height: 20 ,
233
+ child: Image .network (
234
+ country.flagUrl,
235
+ fit: BoxFit .cover,
236
+ errorBuilder:
237
+ (context, error, stackTrace) =>
238
+ const Icon (Icons .flag),
239
+ ),
240
+ ),
241
+ const SizedBox (width: AppSpacing .md),
242
+ Text (country.name),
243
+ ],
245
244
),
246
245
),
247
- title: Text (country.name),
248
- );
249
- },
250
- selectedItemBuilder: (context, country) {
251
- return Row (
252
- children: [
253
- SizedBox (
254
- width: 32 ,
255
- height: 20 ,
256
- child: Image .network (
257
- country.flagUrl,
258
- fit: BoxFit .cover,
259
- errorBuilder: (context, error, stackTrace) =>
260
- const Icon (Icons .flag),
261
- ),
246
+ ),
247
+ if (state.countriesHasMore)
248
+ DropdownMenuItem (
249
+ value: null ,
250
+ child: Center (
251
+ child: Text (l10n.loadMore),
262
252
),
263
- const SizedBox (width: AppSpacing .md),
264
- Text (country.name),
265
- ],
266
- );
267
- },
253
+ onTap: () => context.read <CreateHeadlineBloc >().add (
254
+ const CreateHeadlineLoadMoreCountriesRequested (),
255
+ ),
256
+ ),
257
+ ],
258
+ onChanged: (value) => context
259
+ .read <CreateHeadlineBloc >()
260
+ .add (CreateHeadlineCountryChanged (value)),
268
261
),
269
262
const SizedBox (height: AppSpacing .lg),
270
263
DropdownButtonFormField <ContentStatus >(
0 commit comments