import 'package:eatvio_app/features/registration/models/user_registration_model.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart'; import 'package:eatvio_app/generated/l10n.dart'; import 'package:eatvio_app/core/widgets/custom_text_form_field.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class AllergiesScreen extends StatefulWidget { final UserRegistrationSheet sheet; const AllergiesScreen({super.key, required this.sheet}); @override State createState() => _AllergiesScreenState(); } class _AllergiesScreenState extends State { final enterInformationController = TextEditingController(); final infoFocusNode = FocusNode(); @override void initState() { super.initState(); enterInformationController.text = widget.sheet.aboutAllergy; infoFocusNode.requestFocus(); } @override Widget build(BuildContext context) { final s = S.of(context); return SingleChildScrollView( padding: EdgeInsets.only(bottom: 80, left: 16, right: 16, top: 16), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(s.allergies_presence + ' (не обязательно)'), SizedBox(height: 4), CustomTextFormField( controller: enterInformationController, hintText: 'Например: орехи, мёд и т.д.', textInputAction: TextInputAction.done, focusNode: infoFocusNode, autofocus: true, minLines: 2, maxLines: 8, onChanged: (newValue) { final registrationCubit = context.read(); registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(aboutAllergy: newValue)); }, ), ], ), ); } }