forked from eatvio/eatvio_app
82 lines
2.5 KiB
Dart
82 lines
2.5 KiB
Dart
import 'package:go_router/go_router.dart';
|
|
|
|
import 'bloc/height_bloc.dart';
|
|
import 'models/height_model.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 StatelessWidget {
|
|
const HeightScreen({Key? key}) : super(key: key);
|
|
|
|
static Widget builder(BuildContext context, sheet) {
|
|
return BlocProvider<HeightBloc>(
|
|
create: (context) => HeightBloc(HeightState(heightModelObj: HeightModel(userRegistrationSheet: sheet)))..add(HeightInitialEvent()),
|
|
child: 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: 174.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();
|
|
}
|
|
}
|