Files
eatvio_app_old/lib/presentation/registration/height_screen/height_screen.dart
2024-07-15 11:19:29 +03:00

80 lines
2.4 KiB
Dart

import 'package:go_router/go_router.dart';
import 'bloc/height_bloc.dart';
import 'package:eatvio_app/core/app_export.dart';
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
import 'package:flutter/services.dart';
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
import 'package:flutter/material.dart';
class HeightScreen extends StatefulWidget {
final UserRegistrationSheet sheet;
const HeightScreen({super.key, required this.sheet});
@override
State<HeightScreen> createState() => _HeightScreenState();
}
class _HeightScreenState extends State<HeightScreen> {
@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(
"height_measurements".tr,
style: theme.textTheme.headlineSmall,
),
SizedBox(height: 16.v),
Column(
children: [
Text(
"your_height".tr,
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,
],
);
},
),
],
),
],
),
),
);
}
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();
}
}