feature(registration): refactor i5

This commit is contained in:
mso7nueh
2024-07-15 12:45:52 +03:00
parent 8cf2388b18
commit ee37f02d78
15 changed files with 470 additions and 718 deletions

View File

@@ -1,6 +1,4 @@
import 'package:go_router/go_router.dart';
import 'bloc/height_bloc.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/services.dart';
@@ -17,6 +15,14 @@ class HeightScreen extends StatefulWidget {
}
class _HeightScreenState extends State<HeightScreen> {
final heightController = TextEditingController();
@override
void initState() {
super.initState();
heightController.text = widget.sheet.height;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
@@ -38,17 +44,17 @@ class _HeightScreenState extends State<HeightScreen> {
style: theme.textTheme.bodyLarge,
),
SizedBox(height: 4.v),
BlocBuilder<HeightBloc, HeightState>(
builder: (context, state) {
return CustomTextFormField(
width: 150.h,
textInputAction: TextInputAction.done,
controller: state.heightController,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly,
],
);
CustomTextFormField(
width: 150.h,
textInputAction: TextInputAction.done,
controller: heightController,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly,
],
onChanged: (newValue) {
final registrationCubit = context.read<RegistrationCubit>();
registrationCubit.updateSheet(registrationCubit.state.sheet.copyWith(height: newValue));
},
),
],
@@ -58,22 +64,4 @@ class _HeightScreenState extends State<HeightScreen> {
),
);
}
onTapNext(HeightState state, BuildContext context) {
return () {
UserRegistrationSheet sheet = state.heightModelObj!.userRegistrationSheet;
GoRouter.of(context).goNamed('bloodPressureScreen', extra: sheet);
};
}
Function onTapBack(BuildContext context) {
return () {
onTapArrowLeft(context);
};
}
/// Navigates to the previous screen.
onTapArrowLeft(BuildContext context) {
GoRouter.of(context).pop();
}
}