|
|
|
|
@ -1,9 +1,7 @@
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/enums.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/book_appointment/select_clinic_page.dart';
|
|
|
|
|
@ -19,7 +17,6 @@ import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/ibw.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/ovulation.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/triglycerides.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/services/dialog_service.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/theme/colors.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
|
|
|
|
@ -27,11 +24,11 @@ import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class HealthCalculatorDetailedPage extends StatefulWidget {
|
|
|
|
|
HealthCalculatorsTypeEnum calculatorType;
|
|
|
|
|
int? clinicID;
|
|
|
|
|
int? calculationID;
|
|
|
|
|
final HealthCalculatorsTypeEnum calculatorType;
|
|
|
|
|
final int? clinicID;
|
|
|
|
|
final int? calculationID;
|
|
|
|
|
|
|
|
|
|
HealthCalculatorDetailedPage({super.key, required this.calculatorType, this.clinicID, this.calculationID});
|
|
|
|
|
const HealthCalculatorDetailedPage({super.key, required this.calculatorType, this.clinicID, this.calculationID});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<HealthCalculatorDetailedPage> createState() => _HealthCalculatorDetailedPageState();
|
|
|
|
|
@ -52,8 +49,8 @@ class _HealthCalculatorDetailedPageState extends State<HealthCalculatorDetailedP
|
|
|
|
|
widget.calculatorType == HealthCalculatorsTypeEnum.triglycerides
|
|
|
|
|
? SizedBox()
|
|
|
|
|
: Container(
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.only(topLeft: Radius.circular(24.r), topRight: Radius.circular(24.r))),
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
color: AppColors.whiteColor, customBorder: BorderRadius.only(topLeft: Radius.circular(24.r), topRight: Radius.circular(24.r))),
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 20.h),
|
|
|
|
|
child: CustomButton(
|
|
|
|
|
text: widget.calculatorType == HealthCalculatorsTypeEnum.bloodSugar ||
|
|
|
|
|
@ -131,36 +128,6 @@ class _HealthCalculatorDetailedPageState extends State<HealthCalculatorDetailedP
|
|
|
|
|
: {'result': provider.triglyceridesResult ?? result, 'clinicId': widget.clinicID, 'calculationID': widget.calculationID};
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
// switch (widget.calculatorType) {
|
|
|
|
|
// case HealthCalculatorsTypeEnum.bmi:
|
|
|
|
|
// calculatedResult = provider.bmiResultMap ?? result;
|
|
|
|
|
// break;
|
|
|
|
|
// case HealthCalculatorsTypeEnum.calories:
|
|
|
|
|
// case HealthCalculatorsTypeEnum.bmr:
|
|
|
|
|
// calculatedResult = provider.caloriesResultMap ?? result;
|
|
|
|
|
// break;
|
|
|
|
|
// case HealthCalculatorsTypeEnum.idealBodyWeight:
|
|
|
|
|
// calculatedResult = provider.ibwResultMap ?? result;
|
|
|
|
|
// break;
|
|
|
|
|
// case HealthCalculatorsTypeEnum.bodyFat:
|
|
|
|
|
// calculatedResult = provider.bodyFatResultMap ?? result;
|
|
|
|
|
// break;
|
|
|
|
|
// case HealthCalculatorsTypeEnum.crabsProteinFat:
|
|
|
|
|
// calculatedResult = provider.macrosResultMap ?? result;
|
|
|
|
|
// break;
|
|
|
|
|
// case HealthCalculatorsTypeEnum.ovulation:
|
|
|
|
|
// calculatedResult = provider.ovulationResult ?? result;
|
|
|
|
|
// break;
|
|
|
|
|
// case HealthCalculatorsTypeEnum.deliveryDueDate:
|
|
|
|
|
// calculatedResult = provider.deliveryResult ?? result;
|
|
|
|
|
// break;
|
|
|
|
|
// case HealthCalculatorsTypeEnum.bloodSugar:
|
|
|
|
|
// calculatedResult = provider.bloodSugarResult ?? result;
|
|
|
|
|
// case HealthCalculatorsTypeEnum.bloodCholesterol:
|
|
|
|
|
// calculatedResult = provider.bloodCholesterolResult ?? result;
|
|
|
|
|
// case HealthCalculatorsTypeEnum.triglycerides:
|
|
|
|
|
// calculatedResult = provider.triglyceridesResult ?? result;
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
).paddingSymmetrical(20.w, 24.h),
|
|
|
|
|
);
|
|
|
|
|
@ -172,58 +139,69 @@ class _HealthCalculatorDetailedPageState extends State<HealthCalculatorDetailedP
|
|
|
|
|
switch (widget.calculatorType) {
|
|
|
|
|
case HealthCalculatorsTypeEnum.bmi:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: BMIWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
case HealthCalculatorsTypeEnum.calories:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: CaloriesWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
case HealthCalculatorsTypeEnum.bmr:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: BMRWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
case HealthCalculatorsTypeEnum.idealBodyWeight:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: IdealBodyWeightWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
case HealthCalculatorsTypeEnum.bodyFat:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: BodyFatWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
case HealthCalculatorsTypeEnum.crabsProteinFat:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: CrabsWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
case HealthCalculatorsTypeEnum.ovulation:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: OvulationWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
case HealthCalculatorsTypeEnum.deliveryDueDate:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: DeliveryDueDWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
case HealthCalculatorsTypeEnum.bloodSugar:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: BloodSugarWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
case HealthCalculatorsTypeEnum.bloodCholesterol:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: BloodCholesterolWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
case HealthCalculatorsTypeEnum.triglycerides:
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
decoration:
|
|
|
|
|
RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, customBorder: BorderRadius.all(Radius.circular(24.r))),
|
|
|
|
|
child: TriglyceridesWidget(onChange: onCalculate),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|