forked from eatvio/eatvio_app
feature(registration): refactor i5
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user