feature(registration): refactor i 2.

This commit is contained in:
mso7nueh
2024-07-14 22:16:59 +03:00
parent da447d6960
commit d49ce2120a
9 changed files with 430 additions and 357 deletions

View File

@@ -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));
}),
),
],