forked from eatvio/eatvio_app
64 lines
2.3 KiB
Dart
64 lines
2.3 KiB
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/core/app_export.dart';
|
|
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class NameScreen extends StatefulWidget {
|
|
final UserRegistrationSheet sheet;
|
|
|
|
const NameScreen({required this.sheet, super.key});
|
|
|
|
@override
|
|
State<NameScreen> createState() => _NameScreenState();
|
|
}
|
|
|
|
class _NameScreenState extends State<NameScreen> {
|
|
final firstNameController = TextEditingController();
|
|
final lastNameController = TextEditingController();
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
firstNameController.text = widget.sheet.firstName;
|
|
lastNameController.text = widget.sheet.lastName;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
padding: EdgeInsets.only(bottom: 80),
|
|
child: Container(
|
|
width: double.maxFinite,
|
|
padding: EdgeInsets.symmetric(horizontal: 16.h, vertical: 9.v),
|
|
child: Column(
|
|
children: [
|
|
Text("what_is_your_name".tr, style: theme.textTheme.headlineSmall),
|
|
SizedBox(height: 16.v),
|
|
Text("first_name".tr, style: theme.textTheme.bodyLarge),
|
|
SizedBox(height: 3.v),
|
|
CustomTextFormField(
|
|
controller: firstNameController,
|
|
textInputAction: TextInputAction.done,
|
|
onChanged: (newValue) {
|
|
final registrationCubit = context.read<RegistrationCubit>();
|
|
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(firstName: newValue));
|
|
},
|
|
),
|
|
SizedBox(height: 19.v),
|
|
Text("last_name".tr, style: theme.textTheme.bodyLarge),
|
|
SizedBox(height: 5.v),
|
|
CustomTextFormField(
|
|
controller: lastNameController,
|
|
onChanged: (newValue) {
|
|
final registrationCubit = context.read<RegistrationCubit>();
|
|
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(lastName: newValue));
|
|
},
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|