Skip to content

Commit 929d752

Browse files
committed
feat(content_management): replace CountryPicker with CountryDropdown
- Remove country_picker package - Add CountryDropdownFormField to _CreateHeadlineViewState - Update CreateHeadlineBloc to include countriesRepository - Adapt country selection logic to use core.Country directly
1 parent a3da1ef commit 929d752

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

lib/content_management/view/create_headline_page.dart

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'package:core/core.dart';
2-
import 'package:country_picker/country_picker.dart' as picker;
32
import 'package:data_repository/data_repository.dart';
43
import 'package:flutter/material.dart';
54
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -25,6 +24,7 @@ class CreateHeadlinePage extends StatelessWidget {
2524
headlinesRepository: context.read<DataRepository<Headline>>(),
2625
sourcesRepository: context.read<DataRepository<Source>>(),
2726
topicsRepository: context.read<DataRepository<Topic>>(),
27+
countriesRepository: context.read<DataRepository<Country>>(),
2828
)..add(const CreateHeadlineDataLoaded()),
2929
child: const _CreateHeadlineView(),
3030
);
@@ -214,18 +214,13 @@ class _CreateHeadlineViewState extends State<_CreateHeadlineView> {
214214
.add(CreateHeadlineTopicChanged(value)),
215215
),
216216
const SizedBox(height: AppSpacing.lg),
217-
CountryPickerFormField(
217+
CountryDropdownFormField(
218218
labelText: l10n.countryName,
219-
initialValue: state.eventCountry != null
220-
? adaptCoreCountryToPackageCountry(
221-
state.eventCountry!,
222-
)
223-
: null,
224-
onChanged: (picker.Country country) {
225-
context.read<CreateHeadlineBloc>().add(
226-
CreateHeadlineCountryChanged(country),
227-
);
228-
},
219+
countries: state.countries,
220+
initialValue: state.eventCountry,
221+
onChanged: (value) => context
222+
.read<CreateHeadlineBloc>()
223+
.add(CreateHeadlineCountryChanged(value)),
229224
),
230225
const SizedBox(height: AppSpacing.lg),
231226
DropdownButtonFormField<ContentStatus>(

0 commit comments

Comments
 (0)