forked from eatvio/eatvio_app
220 lines
10 KiB
Dart
220 lines
10 KiB
Dart
import 'bloc/blood_pressure_bloc.dart';
|
|
import 'models/blood_pressure_model.dart';
|
|
import 'package:eatvio_app/core/app_export.dart';
|
|
import 'package:eatvio_app/widgets/app_bar/appbar_leading_image.dart';
|
|
import 'package:eatvio_app/widgets/app_bar/appbar_title_image.dart';
|
|
import 'package:eatvio_app/widgets/app_bar/custom_app_bar.dart';
|
|
import 'package:eatvio_app/widgets/custom_drop_down.dart';
|
|
import 'package:eatvio_app/widgets/next_step_button.dart';
|
|
import 'package:eatvio_app/data/models/userRegistrationModel/user_registration_model.dart';
|
|
import 'package:eatvio_app/widgets/custom_text_form_field.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class BloodPressureScreen extends StatefulWidget {
|
|
const BloodPressureScreen({Key? key}) : super(key: key);
|
|
|
|
static Widget builder(BuildContext context) {
|
|
return BlocProvider<BloodPressureBloc>(
|
|
create: (context) => BloodPressureBloc(
|
|
BloodPressureState(bloodPressureModelObj: BloodPressureModel()))
|
|
..add(BloodPressureInitialEvent()),
|
|
child: BloodPressureScreen());
|
|
}
|
|
|
|
@override
|
|
State<BloodPressureScreen> createState() => _BloodPressureScreenState();
|
|
}
|
|
|
|
class _BloodPressureScreenState extends State<BloodPressureScreen> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
mediaQueryData = MediaQuery.of(context);
|
|
return SafeArea(
|
|
child: Scaffold(
|
|
resizeToAvoidBottomInset: false,
|
|
appBar: _buildAppBar(context),
|
|
body: Container(
|
|
width: double.maxFinite,
|
|
padding: EdgeInsets.symmetric(horizontal: 12.h, vertical: 9.v),
|
|
child: Column(children: [
|
|
SizedBox(height: 7.v),
|
|
Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 4.h),
|
|
child: Container(
|
|
height: 16.v,
|
|
width: 343.h,
|
|
decoration: BoxDecoration(
|
|
color: theme.colorScheme.onPrimary,
|
|
borderRadius: BorderRadius.circular(8.h),
|
|
border: Border.all(
|
|
color: theme.colorScheme.primary,
|
|
width: 1.h)),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(8.h),
|
|
child: LinearProgressIndicator(
|
|
value: 0.76,
|
|
backgroundColor: theme.colorScheme.onPrimary,
|
|
valueColor: AlwaysStoppedAnimation<Color>(
|
|
appTheme.blueA400))))),
|
|
SizedBox(height: 21.v),
|
|
SizedBox(
|
|
width: 224.h,
|
|
child: Text("your_blood_pressure".tr,
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
textAlign: TextAlign.center,
|
|
style: theme.textTheme.headlineSmall)),
|
|
SizedBox(height: 21.v),
|
|
Container(
|
|
margin: EdgeInsets.only(right: 1.h),
|
|
padding: EdgeInsets.symmetric(horizontal: 3.h),
|
|
child: Column(children: [
|
|
Text("up_pressure".tr,
|
|
style: theme.textTheme.bodyLarge),
|
|
SizedBox(height: 2.v),
|
|
BlocSelector<BloodPressureBloc, BloodPressureState,
|
|
TextEditingController?>(
|
|
selector: (state) => state.valueController1,
|
|
builder: (context, valueController1) {
|
|
return CustomTextFormField(
|
|
controller: valueController1,
|
|
hintText: "90".tr);
|
|
})
|
|
])),
|
|
SizedBox(height: 21.v),
|
|
Container(
|
|
margin: EdgeInsets.only(right: 1.h),
|
|
padding: EdgeInsets.symmetric(horizontal: 3.h),
|
|
child: Column(children: [
|
|
Text("down_pressure".tr,
|
|
style: theme.textTheme.bodyLarge),
|
|
SizedBox(height: 2.v),
|
|
BlocSelector<BloodPressureBloc, BloodPressureState,
|
|
TextEditingController?>(
|
|
selector: (state) => state.valueController2,
|
|
builder: (context, valueController2) {
|
|
return CustomTextFormField(
|
|
controller: valueController2,
|
|
hintText: "90".tr);
|
|
})
|
|
])),
|
|
SizedBox(height: 22.v),
|
|
Text("do_you_have_hypotension_tendency".tr,
|
|
style: theme.textTheme.bodyLarge),
|
|
SizedBox(height: 2.v),
|
|
Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 4.h),
|
|
child: BlocSelector<BloodPressureBloc, BloodPressureState,
|
|
BloodPressureModel?>(
|
|
selector: (state) => state.bloodPressureModelObj,
|
|
builder: (context, bloodPressureModelObj) {
|
|
return CustomDropDown(
|
|
icon: Container(
|
|
margin: EdgeInsets.fromLTRB(
|
|
30.h, 11.v, 13.h, 11.v),
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.circular(1.h)),
|
|
child: CustomImageView(
|
|
imagePath: ImageConstant.imgFavorite,
|
|
height: 12.adaptSize,
|
|
width: 12.adaptSize)),
|
|
hintText: "no".tr,
|
|
items:
|
|
bloodPressureModelObj?.dropdownItemList ??
|
|
[],
|
|
onChanged: (value) {
|
|
context
|
|
.read<BloodPressureBloc>()
|
|
.add(ChangeDropDownEvent(value: value));
|
|
});
|
|
})),
|
|
SizedBox(height: 22.v),
|
|
Text("do_you_have_hypertension_tendency".tr,
|
|
style: theme.textTheme.bodyLarge),
|
|
SizedBox(height: 2.v),
|
|
Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 4.h),
|
|
child: BlocSelector<BloodPressureBloc, BloodPressureState,
|
|
BloodPressureModel?>(
|
|
selector: (state) => state.bloodPressureModelObj,
|
|
builder: (context, bloodPressureModelObj) {
|
|
return CustomDropDown(
|
|
icon: Container(
|
|
margin: EdgeInsets.fromLTRB(
|
|
30.h, 11.v, 13.h, 11.v),
|
|
decoration: BoxDecoration(
|
|
borderRadius:
|
|
BorderRadius.circular(1.h)),
|
|
child: CustomImageView(
|
|
imagePath: ImageConstant.imgFavorite,
|
|
height: 12.adaptSize,
|
|
width: 12.adaptSize)),
|
|
hintText: "no".tr,
|
|
items:
|
|
bloodPressureModelObj?.dropdownItemList ??
|
|
[],
|
|
onChanged: (value) {
|
|
context
|
|
.read<BloodPressureBloc>()
|
|
.add(ChangeDropDownEvent(value: value));
|
|
});
|
|
})),
|
|
Spacer(),
|
|
NextStepButton(
|
|
text: "continue".tr.toUpperCase(),
|
|
margin: EdgeInsets.symmetric(horizontal: 4.h),
|
|
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
|
onPressed: () {
|
|
navigateToSports(context);
|
|
}),
|
|
SizedBox(height: 17.v),
|
|
Text("skip".tr, style: theme.textTheme.bodyLarge)
|
|
]))));
|
|
}
|
|
|
|
/// Section Widget
|
|
PreferredSizeWidget _buildAppBar(BuildContext context) {
|
|
return CustomAppBar(
|
|
leadingWidth: 29.h,
|
|
leading: AppbarLeadingImage(
|
|
imagePath: ImageConstant.imgArrowLeft,
|
|
margin: EdgeInsets.only(left: 16.h, top: 15.v, bottom: 15.v),
|
|
onTap: () {
|
|
onTapArrowLeft(context);
|
|
}),
|
|
centerTitle: true,
|
|
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
|
}
|
|
|
|
/// Section Widget
|
|
Widget _buildThirtyThree(BuildContext context) {
|
|
return Container(
|
|
margin: EdgeInsets.only(right: 1.h),
|
|
padding: EdgeInsets.symmetric(horizontal: 3.h),
|
|
child: Column(children: [
|
|
Text("average_pressure".tr, style: theme.textTheme.bodyLarge),
|
|
SizedBox(height: 2.v),
|
|
BlocSelector<BloodPressureBloc, BloodPressureState,
|
|
TextEditingController?>(
|
|
selector: (state) => state.valueController,
|
|
builder: (context, valueController) {
|
|
return CustomTextFormField(
|
|
controller: valueController, hintText: "90".tr);
|
|
})
|
|
]));
|
|
}
|
|
|
|
/// Navigates to the previous screen.
|
|
onTapArrowLeft(BuildContext context) {
|
|
NavigatorService.goBack();
|
|
}
|
|
|
|
/// Navigates to the favoriteSportsScreen when the action is triggered.
|
|
navigateToSports(BuildContext context) {
|
|
NavigatorService.pushNamed(
|
|
AppRoutes.favoriteSportsScreen,
|
|
);
|
|
}
|
|
}
|