import 'package:eatvio_app/core/app_export.dart'; import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/widgets/custom_drop_down.dart'; import 'package:flutter/material.dart'; class LanguageSelectScreen extends StatefulWidget { final UserRegistrationSheet sheet; const LanguageSelectScreen({required this.sheet, super.key}); @override State createState() => _LanguageSelectScreenState(); } class _LanguageSelectScreenState extends State { final List dropdownItemList = [ SelectionPopupModel(id: 1, title: "Русский", isSelected: true), ]; SelectionPopupModel? value; @override void initState() { super.initState(); if (widget.sheet.lang.isNotEmpty) { value = dropdownItemList.first; } } @override Widget build(BuildContext context) { return SingleChildScrollView( padding: EdgeInsets.only(bottom: 80), child: Column( children: [ Container( width: 262.h, margin: EdgeInsets.only(left: 41.h, right: 39.h), child: Text( "preferred_language".tr, maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center, style: theme.textTheme.headlineSmall, ), ), const SizedBox(height: 32), CustomDropDown( value: value, hintText: "Не выбрано".tr, items: dropdownItemList, onChanged: (SelectionPopupModel newValue) => setState(() { value = newValue; final registrationCubit = context.read(); registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lang: value!.title)); }), ), ], ), ); } }