Skip to content

Commit 7cefb3c

Browse files
committed
feat(content): update edit headline page to use reactive dropdown
Refactored the `edit_headline_page.dart` to use the new BLoC-aware `SearchableDropdownFormField` for country selection. - Replaced the old dropdown implementation with the new generic `SearchableDropdownFormField<Country, EditHeadlineBloc, EditHeadlineState>`. - Injected the `EditHeadlineBloc` 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 0b3a1c9 commit 7cefb3c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/content_management/view/edit_headline_page.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,12 +282,15 @@ class _EditHeadlineViewState extends State<_EditHeadlineView> {
282282
.add(EditHeadlineTopicChanged(value)),
283283
),
284284
const SizedBox(height: AppSpacing.lg),
285-
SearchableDropdownFormField<Country>(
285+
SearchableDropdownFormField<Country, EditHeadlineBloc,
286+
EditHeadlineState>(
286287
labelText: l10n.countryName,
287-
items: state.countries,
288+
bloc: context.read<EditHeadlineBloc>(),
288289
initialValue: selectedCountry,
289-
hasMore: state.countriesHasMore,
290-
isLoading: state.status == EditHeadlineStatus.loading,
290+
itemsExtractor: (state) => state.countries,
291+
hasMoreExtractor: (state) => state.countriesHasMore,
292+
isLoadingExtractor: (state) =>
293+
state.status == EditHeadlineStatus.loading,
291294
onChanged: (value) => context
292295
.read<EditHeadlineBloc>()
293296
.add(EditHeadlineCountryChanged(value)),

0 commit comments

Comments
 (0)