forked from eatvio/eatvio_app
feature(registration): refactor i 2.
This commit is contained in:
@@ -18,12 +18,14 @@ class _LanguageSelectScreenState extends State<LanguageSelectScreen> {
|
||||
SelectionPopupModel(id: 1, title: "Русский", isSelected: true),
|
||||
];
|
||||
|
||||
late SelectionPopupModel value;
|
||||
SelectionPopupModel? value;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
value = SelectionPopupModel(title: widget.sheet.lang);
|
||||
if (widget.sheet.lang.isNotEmpty) {
|
||||
value = dropdownItemList.first;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -45,23 +47,13 @@ class _LanguageSelectScreenState extends State<LanguageSelectScreen> {
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
CustomDropDown(
|
||||
icon: Container(
|
||||
margin: EdgeInsets.fromLTRB(30.h, 11.v, 17.h, 11.v),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(1.h),
|
||||
),
|
||||
child: CustomImageView(
|
||||
imagePath: ImageConstant.imgFavorite,
|
||||
height: 12.adaptSize,
|
||||
width: 12.adaptSize,
|
||||
),
|
||||
),
|
||||
value: value,
|
||||
hintText: "Не выбрано".tr,
|
||||
items: dropdownItemList,
|
||||
onChanged: (SelectionPopupModel newValue) => setState(() {
|
||||
value = newValue;
|
||||
final registrationCubit = context.read<RegistrationCubit>();
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lang: value.title));
|
||||
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lang: value!.title));
|
||||
}),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user