Skip to content

Commit 0b3a1c9

Browse files
committed
feat(content): update create headline page to use reactive dropdown
Refactored the `create_headline_page.dart` to use the new BLoC-aware `SearchableDropdownFormField` for country selection. - Replaced the old dropdown implementation with the new generic `SearchableDropdownFormField<Country, CreateHeadlineBloc, CreateHeadlineState>`. - Injected the `CreateHeadlineBloc` instance into the widget. - Provided extractor functions (`itemsExtractor`, `hasMoreExtractor`, `isLoadingExtractor`) to enable the dropdown to reactively pull data from the BLoC's state. This change ensures that the country list in the search dialog updates automatically when more items are loaded via pagination, fixing the core UI refresh bug.
1 parent 36ba973 commit 0b3a1c9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/content_management/view/create_headline_page.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,15 @@ class _CreateHeadlineViewState extends State<_CreateHeadlineView> {
214214
.add(CreateHeadlineTopicChanged(value)),
215215
),
216216
const SizedBox(height: AppSpacing.lg),
217-
SearchableDropdownFormField<Country>(
217+
SearchableDropdownFormField<Country, CreateHeadlineBloc,
218+
CreateHeadlineState>(
218219
labelText: l10n.countryName,
219-
items: state.countries,
220+
bloc: context.read<CreateHeadlineBloc>(),
220221
initialValue: state.eventCountry,
221-
hasMore: state.countriesHasMore,
222-
isLoading: state.status == CreateHeadlineStatus.loading,
222+
itemsExtractor: (state) => state.countries,
223+
hasMoreExtractor: (state) => state.countriesHasMore,
224+
isLoadingExtractor: (state) =>
225+
state.status == CreateHeadlineStatus.loading,
223226
onChanged: (value) => context
224227
.read<CreateHeadlineBloc>()
225228
.add(CreateHeadlineCountryChanged(value)),

0 commit comments

Comments
 (0)