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:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class GenderScreen extends StatefulWidget { final UserRegistrationSheet sheet; const GenderScreen({super.key, required this.sheet}); @override State createState() => _GenderScreenState(); } class _GenderScreenState extends State { late String currentValue; @override void initState() { super.initState(); currentValue = widget.sheet.gender; } @override Widget build(BuildContext context) { return SingleChildScrollView( padding: const EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16), child: Column( children: [ Row( children: [ Radio( value: 'male', // ignore: deprecated_member_use groupValue: currentValue, // ignore: deprecated_member_use onChanged: (newValue) { final registrationCubit = context.read(); registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'male')); setState(() { currentValue = 'male'; }); }, ), Expanded( child: Row(children: [Image.asset('assets/images/img_male.png', width: 40, height: 40), const SizedBox(width: 8), const Text('Мужской')]), ), ], ), const SizedBox(height: 16), Row( children: [ Radio( value: 'female', // ignore: deprecated_member_use groupValue: currentValue, // ignore: deprecated_member_use onChanged: (newValue) { final registrationCubit = context.read(); registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'female')); setState(() { currentValue = 'female'; }); }, ), Expanded( child: Row(children: [Image.asset('assets/images/img_female.png', width: 40, height: 40), const SizedBox(width: 8), const Text('Женский')]), ), ], ), ], ), ); } }