Files
eatvio_app/lib/features/registration/presentation/pages/gender_screen.dart
2025-08-20 11:34:28 +03:00

76 lines
2.6 KiB
Dart

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<GenderScreen> createState() => _GenderScreenState();
}
class _GenderScreenState extends State<GenderScreen> {
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<String>(
value: 'male',
// ignore: deprecated_member_use
groupValue: currentValue,
// ignore: deprecated_member_use
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
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<String>(
value: 'female',
// ignore: deprecated_member_use
groupValue: currentValue,
// ignore: deprecated_member_use
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
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('Женский')]),
),
],
),
],
),
);
}
}