forked from eatvio/eatvio_app
123 lines
4.9 KiB
Dart
123 lines
4.9 KiB
Dart
import 'bloc/medicine_intake_bloc.dart';
|
|
import 'models/medicine_intake_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/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 MedicineIntakeScreen extends StatefulWidget {
|
|
const MedicineIntakeScreen({Key? key}) : super(key: key);
|
|
|
|
static Widget builder(BuildContext context) {
|
|
return BlocProvider<MedicineIntakeBloc>(
|
|
create: (context) => MedicineIntakeBloc(
|
|
MedicineIntakeState(medicineIntakeModelObj: MedicineIntakeModel()))
|
|
..add(MedicineIntakeInitialEvent()),
|
|
child: MedicineIntakeScreen());
|
|
}
|
|
|
|
@override
|
|
State<MedicineIntakeScreen> createState() => _MedicineIntakeScreenState();
|
|
}
|
|
|
|
class _MedicineIntakeScreenState extends State<MedicineIntakeScreen> {
|
|
@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: 16.h, vertical: 9.v),
|
|
child: Column(children: [
|
|
SizedBox(height: 7.v),
|
|
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.69,
|
|
backgroundColor: theme.colorScheme.onPrimary,
|
|
valueColor: AlwaysStoppedAnimation<Color>(
|
|
appTheme.blueA400)))),
|
|
SizedBox(height: 20.v),
|
|
Container(
|
|
width: 271.h,
|
|
margin: EdgeInsets.only(left: 35.h, right: 36.h),
|
|
child: Text("do_you_take_pills".tr,
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
textAlign: TextAlign.center,
|
|
style: CustomTextStyles.headlineSmallMulish)),
|
|
SizedBox(height: 86.v),
|
|
_buildTextFormField(context),
|
|
Spacer(),
|
|
NextStepButton(
|
|
text: "continue".tr.toUpperCase(),
|
|
buttonStyle: CustomButtonStyles.outlinePrimaryTL15,
|
|
onPressed: () {
|
|
navigateToPressure(context);
|
|
}),
|
|
SizedBox(height: 17.v),
|
|
Text("skip".tr, style: theme.textTheme.bodyLarge)
|
|
]))));
|
|
}
|
|
|
|
/// Section Widget
|
|
PreferredSizeWidget _buildAppBar(BuildContext context) {
|
|
return CustomAppBar(
|
|
leadingWidth: 31.h,
|
|
leading: AppbarLeadingImage(
|
|
imagePath: ImageConstant.imgArrowLeft,
|
|
margin: EdgeInsets.only(left: 18.h, top: 15.v, bottom: 15.v),
|
|
onTap: () {
|
|
onTapArrowLeft(context);
|
|
}),
|
|
centerTitle: true,
|
|
title: AppbarTitleImage(imagePath: ImageConstant.imgLogoEatvio));
|
|
}
|
|
|
|
/// Section Widget
|
|
Widget _buildTextFormField(BuildContext context) {
|
|
return Column(children: [
|
|
Text("fill_in_information".tr,
|
|
style: CustomTextStyles.titleMediumSegoeUI),
|
|
SizedBox(height: 2.v),
|
|
BlocSelector<MedicineIntakeBloc, MedicineIntakeState,
|
|
TextEditingController?>(
|
|
selector: (state) => state.enterInformationController,
|
|
builder: (context, enterInformationController) {
|
|
return CustomTextFormField(
|
|
controller: enterInformationController,
|
|
hintText: "enter_information".tr,
|
|
textInputAction: TextInputAction.done,
|
|
maxLines: 8);
|
|
})
|
|
]);
|
|
}
|
|
|
|
/// Navigates to the previous screen.
|
|
onTapArrowLeft(BuildContext context) {
|
|
NavigatorService.goBack();
|
|
}
|
|
|
|
/// Navigates to the bloodPressureScreen when the action is triggered.
|
|
navigateToPressure(BuildContext context) {
|
|
NavigatorService.pushNamed(
|
|
AppRoutes.bloodPressureScreen,
|
|
);
|
|
}
|
|
}
|