forked from eatvio/eatvio_app
78 lines
2.4 KiB
Dart
78 lines
2.4 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: EdgeInsets.only(bottom: 80, top: 16, left: 16, right: 16),
|
|
child: Column(
|
|
children: [
|
|
RadioListTile(
|
|
contentPadding: EdgeInsets.zero,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
title: Text('Мужской'),
|
|
value: 'male',
|
|
groupValue: currentValue,
|
|
onChanged: (newValue) {
|
|
final registrationCubit = context.read<RegistrationCubit>();
|
|
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'male'));
|
|
setState(() {
|
|
currentValue = 'male';
|
|
});
|
|
},
|
|
secondary: Image.asset(
|
|
'assets/images/img_male.png',
|
|
width: 40,
|
|
height: 40,
|
|
),
|
|
),
|
|
SizedBox(height: 16),
|
|
RadioListTile(
|
|
contentPadding: EdgeInsets.zero,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
title: Text('Женский'),
|
|
value: 'female',
|
|
groupValue: currentValue,
|
|
onChanged: (newValue) {
|
|
final registrationCubit = context.read<RegistrationCubit>();
|
|
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(gender: 'female'));
|
|
setState(() {
|
|
currentValue = 'female';
|
|
});
|
|
},
|
|
secondary: Image.asset(
|
|
'assets/images/img_female.png',
|
|
width: 40,
|
|
height: 40,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|