diff --git a/assets/images/svg/document.svg b/assets/images/svg/document.svg
new file mode 100644
index 00000000..5073ead5
--- /dev/null
+++ b/assets/images/svg/document.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/images/svg/report.svg b/assets/images/svg/report.svg
new file mode 100644
index 00000000..b5ca54b1
--- /dev/null
+++ b/assets/images/svg/report.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/images/svg/sucess.svg b/assets/images/svg/sucess.svg
new file mode 100644
index 00000000..6df93d5e
--- /dev/null
+++ b/assets/images/svg/sucess.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json
index 96d967d4..28aab087 100644
--- a/assets/langs/ar-SA.json
+++ b/assets/langs/ar-SA.json
@@ -680,8 +680,8 @@
"noOffersAvailable": "لا توجد عروض متاحة!",
"accessibility": "وضع الوصول",
"orderStatus": "حالة الطلب",
- "findUs": "اعثر علينا",
- "liveChat": "دردشة مباشرة",
+ "findUs": "فروعنا",
+ "liveChat": "محادثة مباشرة",
"service": "خدمة",
"hmgServiceLabel": "خدمة مجموعة الحبيب الطبية",
"healthWeatherIndicators": "مؤشرات الطقس الصحية",
@@ -1049,9 +1049,9 @@
"noServicesAvailable": "لا توجد خدمات متاحة",
"selectAService": "اختر خدمة",
"comprehensiveCheckup": "الفحص الشامل",
- "viewNearestHMGLocations": "عرض أقرب مواقع مجموعة الحبيب الطبية",
+ "viewNearestHMGLocations": "عرض أقرب فرع",
"provideFeedbackOnServices": "قدم ملاحظاتك على خدماتنا",
- "liveChatWithHMG": "خيار الدردشة المباشرة مع مجموعة الحبيب الطبية",
+ "liveChatWithHMG": "حدث مباشرة مع الموظف",
"send": "إرسال",
"status": "الحالة",
"sendingFeedback": "جاري إرسال الملاحظات...",
@@ -1160,11 +1160,18 @@
"recharge": "اضافة رصيد",
"activityLevel": "مستوى النشاط",
"selectActivityLevel": "حدد مستوى النشاط",
+ "almostInactive": "غير نشط تقريبًا (بدون تمارين)",
+ "lightlyActive": "نشاط خفيف",
+ "lightlyActive13Days": "نشاط خفيف (١-٣) أيام في الأسبوع",
+ "superActive": "نشاط مكثف (تمارين شاقة جدًا)",
"caloriesPerDay": "السعرات الحرارية في اليوم الواحد",
"dietType": "نوع النظام الغذائي",
"selectDietType": "حدد نوع النظام الغذائي",
"bodyFrameSize": "حجم إطار الجسم",
"selectBodyFrameSize": "حدد حجم إطار الجسم",
+ "bodyFrameSmall": "صغير (الأصابع متداخلة)",
+ "bodyFrameMedium": "متوسط (الأصابع متلامسة)",
+ "bodyFrameLarge": "كبير (الأصابع لا تتلامس)",
"averageCycleLength": "متوسط طول الدورة الشهرية (عادةً 28 يومًا)",
"averageLutealPhase": "متوسط طول المرحلة الأصفرية (عادةً 14 يومًا)",
"convert": "تحويل الوحدات",
@@ -1255,7 +1262,7 @@
"virtualTour": "جولة افتراضية",
"carParking": "موقف السيارات",
"latestNews": "آخر الأخبار",
- "hmgContact": "اتصل بمجموعة الحبيب الطبية",
+ "hmgContact": "تواصل معنا",
"durationCannotExceed90": "لا يجوز أن تتجاوز المدة 90 دقيقة",
"unexpectedError": "حدث خطأ غير متوقع",
"gettingAmbulanceTransportOption": "جاري الحصول على خيارات نقل الإسعاف",
@@ -1334,6 +1341,7 @@
"askYourDoctor": "اسأل طبيبك",
"internetPairing": "الاقتران بالإنترنت",
"requested": "مطلوب",
+ "readyToDownload": "جاهز للتحميل",
"youDontHaveAnyMedicalReportsYet": "ليس لديك أي تقارير طبية بعد.",
"requestMedicalReport": "طلب تقرير طبي",
"youDoNotHaveAnyAppointmentsToRequestMedicalReport": "ليس لديك أي مواعيد لطلب تقرير طبي.",
@@ -1705,7 +1713,7 @@
"enterAmount": "يرجى إدخال المبلغ للمتابعة.",
"selectHospitalContinue": "يرجى اختيار المستشفى للمتابعة.",
"year": "سنة",
- "notifyPrescription": "أبلغني قبل وقت الاستهلاك",
+ "notifyPrescription": "تنبيه قبل موعد الجرعة",
"doctorRatingAppointment": "طبيب\nتصنيف",
"ratingSubmitted": "تم إرسال التقييم",
"rateTheDoctor": "يرجى تقييم الطبيب",
@@ -1768,6 +1776,14 @@
"locationServicesDisabled": "حالة الطقس غير متوفرة لتعطيل خدمات الموقع. يرجى تفعيل خدمات الموقع لتتمكن من رؤية معلومات الطقس.",
"selectDateTimeKey": "اختيار",
"medicalKey": "الطبية",
+ "carbsAlert": "حساب نسب المغذيات (الكربوهيدرات ،البروتين والدهون) بالسعرات الحرارية والقرامات وفقا لنسب محددة مسبقا",
+ "bodyFatAlert": "يحسب بناءً على الحجم",
+ "ibwAlert": "حساب الوزن المثالي بناءً على الطول، الوزن، وبنية الجسم",
+ "glucoseAlert":"تغيير وحدات القياس بين مليجرام لكل ديسيلتر و ملي مول لكل لتر",
+ "selectBloodGroup": "اختر الفصيلة",
+ "routePrescription": "طريقة الاستخدام",
+ "noNearestER": "لا يوجد طوارئ قريب منك",
+ "loginToUseServiceLiveCare": "تحتاج إلى تسجيل الدخول لاستخدام هذه الخدمة"
"convertBloodcholesterolInfo":"حول قيمة كوليسترول الدم بين ملجم/ديسيلتر و مليمول/لتر",
"mldl": "مليجرام لكل ديسيلتر",
"mmol": "ملي مول لكل لتر",
diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json
index 25a16577..9564b6b2 100644
--- a/assets/langs/en-US.json
+++ b/assets/langs/en-US.json
@@ -944,7 +944,7 @@
"doctorWillContact": "Doctor will contact you",
"specialisedDoctorWillContactYou": "A specialized doctor will contact you and will be able to view your medical history",
"freeMedicineDelivery": "Free medicine delivery",
- "offersFreeMedicineDelivery": "Offers free medicine delivery for the LiveCare appointment",
+ "offersFreeMedicineDelivery": "Receive free medicine delivery with your LiveCare appointment.",
"dentalChiefComplaints": "Dental Chief Complaints",
"viewAvailableAppointments": "View available appointments",
"doctorProfile": "Doctor Profile",
@@ -1136,14 +1136,14 @@
"allFacilities": "All Facilities",
"selectLocation": "Select Location",
"pleaseSelectTheLocation": "Please select the location",
- "viewLocationGoogleMaps": "View Location on Google Maps",
+ "viewLocationGoogleMaps": "Get Directions on Google Maps",
"callAmbulance": "Call Ambulance",
- "requestAmbulanceInEmergency": "Request an ambulance in emergency from home or hospital",
+ "requestAmbulanceInEmergency": "Request an ambulance for immediate assistance in cases of emergency.",
"confirmation": "Confirmation",
"areYouSureYouWantToCallAmbulance": "Are you sure you want to call an ambulance?",
- "getDetailsOfNearestBranch": "Get the details of nearest branch including directions",
+ "getDetailsOfNearestBranch": "Find the nearest ER and get directions.",
"areYouSureYouWantToCallRRT": "Are you sure you want to call Rapid Response Team (RRT)?",
- "priorERCheckInToSkipLine": "Prior ER Check-In to skip the line & payment at the reception.",
+ "priorERCheckInToSkipLine": "Check in before you arrive to the ER to skip the line & payment at reception.",
"areYouSureYouWantToMakeERCheckIn": "Are you sure you want to request an online ER check-in?",
"checkingYourERAppointmentStatus": "Please Wait...",
"transportOptions": "Transport Options",
@@ -1151,11 +1151,18 @@
"recharge": "Add Funds",
"activityLevel": "Activity Level",
"selectActivityLevel": "Select Activity Level",
+ "almostInactive": "Almost Inactive (no exercise)",
+ "lightlyActive": "Lightly active",
+ "lightlyActive13Days": "Lightly active (1-3) days per week",
+ "superActive": "Super active (very hard exercise)",
"caloriesPerDay": "Calories Per Day",
"dietType": "Diet Type",
"selectDietType": "Select Diet Type",
"bodyFrameSize": "Body Frame Size",
"selectBodyFrameSize": "Select Body Frame Size",
+ "bodyFrameSmall": "Small (fingers overlaps)",
+ "bodyFrameMedium": "Medium (fingers touch)",
+ "bodyFrameLarge": "Large (fingers don't touch)",
"averageCycleLength": "Average Cycle Length (Usually 28 days)",
"averageLutealPhase": "Average Luteal Phase Length(Usually 14 days)",
"convert": "Convert",
@@ -1323,6 +1330,7 @@
"askYourDoctor": "Ask Your Doctor",
"internetPairing": "Internet Pairing",
"requested": "Requested",
+ "readyToDownload": "Ready to download",
"youDontHaveAnyMedicalReportsYet": "You don't have any medical reports yet.",
"requestMedicalReport": "Request medical report",
"youDoNotHaveAnyAppointmentsToRequestMedicalReport": "You do not have any appointments to request a medical report.",
@@ -1662,8 +1670,8 @@
"smartWatchServiceDescription": "Seamlessly connect your smartwatch to our health app for effortless data tracking and personalized insights.",
"liveChatServiceHeader": "24/7 Expert\nAssistance",
"liveChatServiceDescription": "Need help ? Our live chat connects you with expert support for any questions about features, settings, or troubleshooting.",
- "emergencyServiceHeader": "ER Check-in, Faster Than Ever. Call ambulance / Rapid Response Team instantly",
- "emergencyServiceDescription": "In a medical emergency? Our ambulances and rapid response teams are on standby 24/7. Plus, quick ER check-in for faster care.",
+ "emergencyServiceHeader": "Emergency Care, Faster than Ever.",
+ "emergencyServiceDescription": "Facing a medical emergency? Our ambulances are on standby 24/7 for your immediate assistance.",
"homeHealthCareServiceHeader": "Premium care, delivered right to your doorstep",
"homeHealthCareServiceDescription": "We provide the highest degree of patient care at home in a value-oriented, efficient, and professional manner.",
"profileOnlyText": "Profile",
@@ -1705,7 +1713,7 @@
"overWeight": "OverWeight",
"underWeight": "UnderWeight",
"nearestGate": "Nearest Gate",
- "RRTDDetails": "The Rapid response team provides a comprehensive medical service for all sorts of urgent and stable cases of all ages, including adult and paediatric patients.",
+ "RRTDDetails": "Comprehensive medical services for stable and urgent cases, available for all ages.",
"fromHospitalSubtitle": "Transfer from the hospital back to your home",
"normalMapType": "Default",
"satelliteMapType": "Satellite",
@@ -1756,6 +1764,14 @@
"selectCriteria": "Select Criteria",
"locationServicesDisabled": "Weather is unavailable because location services are disabled. Please enable location services to see the weather information.",
"selectDateTimeKey": "Select",
+ "carbsAlert":"Calculate carbohydrate based protein and fat ration in calories and grams according to a pre set ratio.",
+ "bodyFatAlert": "Estimate the total body fat based on the size.",
+ "ibwAlert": "Calculates the ideal body weight based on height, weight and body size.",
+ "glucoseAlert":"Convert blood glucose values between mg/dL and mmol/L. (1 mmol/L ≈ 18.0182 mg/dL)",
+ "selectBloodGroup": "Select Blood Group",
+ "routePrescription": "Route",
+ "noNearestER": "No nearest Er Around you",
+ "loginToUseServiceLiveCare": "Log In to Use This Service",
"medicalKey": "Medical",
"convertBloodcholesterolInfo": "Convert blood cholesterol values between mg/dL and mmol/L. ",
"mldl": "مليجرام لكل ديسيلتر",
diff --git a/lib/core/app_assets.dart b/lib/core/app_assets.dart
index feb2c196..107e06d1 100644
--- a/lib/core/app_assets.dart
+++ b/lib/core/app_assets.dart
@@ -17,6 +17,9 @@ class AppAssets {
static const String email = '$svgBasePath/email.svg';
static const String globe = '$svgBasePath/globe.svg';
static const String globeOther = '$svgBasePath/globe_other.svg';
+ static const String document = '$svgBasePath/document.svg';
+ static const String report = '$svgBasePath/report.svg';
+ static const String sucess = '$svgBasePath/sucess.svg';
// static const String globeOther = '$svgBasePath/globe_other.svg';
static const String cancel = '$svgBasePath/cancel.svg';
diff --git a/lib/core/enums.dart b/lib/core/enums.dart
index 2d42a2ae..4ac919e7 100644
--- a/lib/core/enums.dart
+++ b/lib/core/enums.dart
@@ -5,8 +5,11 @@
// unverified,
// }
+import 'package:easy_localization/easy_localization.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
+import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
+import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
enum AuthMethodTypesEnum { sms, whatsApp, fingerPrint, faceID, moreOptions }
@@ -20,6 +23,17 @@ enum SelectionTypeEnum { dropdown, calendar, search, time }
enum GenderTypeEnum { male, female }
+extension GenderTypeEnumExtension on GenderTypeEnum {
+ String get displayName {
+ switch (this) {
+ case GenderTypeEnum.male:
+ return LocaleKeys.malE.tr();
+ case GenderTypeEnum.female:
+ return LocaleKeys.femaleGender.tr();
+ }
+ }
+}
+
enum MaritalStatusTypeEnum { single, married, divorced, widowed }
enum ChipTypeEnum { success, error, alert, info, warning, lightBg, primaryRed }
@@ -68,7 +82,7 @@ extension HealthCalculatorExtenshion on HealthCalculatorsTypeEnum {
case HealthCalculatorsTypeEnum.bodyFat:
return isArabic ? "دهون الجسم" : "Body Fat Calculator";
case HealthCalculatorsTypeEnum.crabsProteinFat:
- return isArabic ? "حاسبة البروتين والدهون في سرطان البحر" : "Crabs Protein & Fat Calculator";
+ return isArabic ? "حاسبة المغذيات" : "Crabs Protein & Fat Calculator";
case HealthCalculatorsTypeEnum.ovulation:
return isArabic ? "فترة الإباضة" : "Ovulation Period";
case HealthCalculatorsTypeEnum.deliveryDueDate:
@@ -80,6 +94,22 @@ extension HealthCalculatorExtenshion on HealthCalculatorsTypeEnum {
case HealthCalculatorsTypeEnum.triglycerides:
return isArabic ? "الدهون الثلاثية في الدم" : "Triglycerides Fat Blood";
}
+ }
+
+ String get title {
+ AppState appState = getIt.get();
+ bool isArabic = appState.getLanguageID() == 1 ? true : false;
+ switch (this) {
+ case HealthCalculatorsTypeEnum.crabsProteinFat:
+ return isArabic ? "نتيجة المغذيات" : "Nutrient Results";
+ case HealthCalculatorsTypeEnum.calories:
+ return isArabic ? "سعراتك الحرارية" : "Calories";
+
+ case HealthCalculatorsTypeEnum.calories:
+ return isArabic ? "مؤشر كتلة الجسم" : "BMI";
+ default:
+ return "Your ${this.name.toCamelCase}";
+ }
}
static LoginTypeEnum? fromValue(int value) {
diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart
index 49bd90b9..38b1cead 100644
--- a/lib/generated/locale_keys.g.dart
+++ b/lib/generated/locale_keys.g.dart
@@ -1158,11 +1158,18 @@ abstract class LocaleKeys {
static const recharge = 'recharge';
static const activityLevel = 'activityLevel';
static const selectActivityLevel = 'selectActivityLevel';
+ static const almostInactive = 'almostInactive';
+ static const lightlyActive = 'lightlyActive';
+ static const lightlyActive13Days = 'lightlyActive13Days';
+ static const superActive = 'superActive';
static const caloriesPerDay = 'caloriesPerDay';
static const dietType = 'dietType';
static const selectDietType = 'selectDietType';
static const bodyFrameSize = 'bodyFrameSize';
static const selectBodyFrameSize = 'selectBodyFrameSize';
+ static const bodyFrameSmall = 'bodyFrameSmall';
+ static const bodyFrameMedium = 'bodyFrameMedium';
+ static const bodyFrameLarge = 'bodyFrameLarge';
static const averageCycleLength = 'averageCycleLength';
static const averageLutealPhase = 'averageLutealPhase';
static const convert = 'convert';
@@ -1330,6 +1337,7 @@ abstract class LocaleKeys {
static const askYourDoctor = 'askYourDoctor';
static const internetPairing = 'internetPairing';
static const requested = 'requested';
+ static const readyToDownload = 'readyToDownload';
static const youDontHaveAnyMedicalReportsYet = 'youDontHaveAnyMedicalReportsYet';
static const requestMedicalReport = 'requestMedicalReport';
static const youDoNotHaveAnyAppointmentsToRequestMedicalReport = 'youDoNotHaveAnyAppointmentsToRequestMedicalReport';
@@ -1760,6 +1768,14 @@ abstract class LocaleKeys {
static const selectDateTimeKey = 'selectDateTimeKey';
static const medicalKey = 'medicalKey';
static const convertBloodcholesterolInfo = 'convertBloodcholesterolInfo';
+ static const carbsAlert = 'carbsAlert';
+ static const bodyFatAlert = 'bodyFatAlert';
+ static const ibwAlert = 'ibwAlert';
+ static const glucoseAlert = 'glucoseAlert';
+ static const selectBloodGroup = 'selectBloodGroup';
+ static const routePrescription = 'routePrescription';
+ static const noNearestER = 'noNearestER';
+ static const loginToUseServiceLiveCare = 'loginToUseServiceLiveCare';
static const mldl = 'mldl';
static const mmol = 'mmol';
static const triglycerideInfo = 'triglycerideInfo';
diff --git a/lib/presentation/blood_donation/blood_donation_page.dart b/lib/presentation/blood_donation/blood_donation_page.dart
index 4a8f91a6..b706d2cd 100644
--- a/lib/presentation/blood_donation/blood_donation_page.dart
+++ b/lib/presentation/blood_donation/blood_donation_page.dart
@@ -219,7 +219,7 @@ class _BloodDonationPageState extends State {
],
).onPress(() {
showCommonBottomSheetWithoutHeight(context,
- title: LocaleKeys.select.tr(context: context),
+ title: LocaleKeys.selectBloodGroup.tr(context: context),
isDismissible: true,
child: SelectBloodGroupWidget(isArabic: appState.isArabic(), bloodDonationViewModel: bloodDonationVM),
callBackFunc: () {});
diff --git a/lib/presentation/book_appointment/book_appointment_page.dart b/lib/presentation/book_appointment/book_appointment_page.dart
index d0ef2a4f..15b019e9 100644
--- a/lib/presentation/book_appointment/book_appointment_page.dart
+++ b/lib/presentation/book_appointment/book_appointment_page.dart
@@ -907,7 +907,7 @@ class _BookAppointmentPageState extends State {
),
SizedBox(height: 36.h),
CustomButton(
- text: LocaleKeys.loginToUseService.tr(),
+ text: LocaleKeys.loginToUseServiceLiveCare.tr(),
onPressed: () async {
await authVM.onLoginPressed();
},
diff --git a/lib/presentation/book_appointment/select_clinic_page.dart b/lib/presentation/book_appointment/select_clinic_page.dart
index 131b4d3d..fc102b4d 100644
--- a/lib/presentation/book_appointment/select_clinic_page.dart
+++ b/lib/presentation/book_appointment/select_clinic_page.dart
@@ -80,7 +80,7 @@ class _SelectClinicPageState extends State {
appState = getIt.get();
if (widget.calculatorType != null) {
return CollapsingListView(
- title: "Your ${widget.calculatorType!.name.toCamelCase}",
+ title: widget.calculatorType!.title,
bottomChild: Container(
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),
diff --git a/lib/presentation/emergency_services/emergency_services_page.dart b/lib/presentation/emergency_services/emergency_services_page.dart
index 3d5470a8..2d4ef828 100644
--- a/lib/presentation/emergency_services/emergency_services_page.dart
+++ b/lib/presentation/emergency_services/emergency_services_page.dart
@@ -90,7 +90,7 @@ class _EmergencyServicesPageState extends State {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.callAmbulance.tr().toText16(isBold: true, color: AppColors.blackColor),
- LocaleKeys.requestAmbulanceInEmergency.tr().toText12(color: AppColors.greyTextColor, isBold: true),
+ LocaleKeys.requestAmbulanceInEmergency.tr().toText12(color: AppColors.greyTextColor, isBold: true),
],
),
),
diff --git a/lib/presentation/emergency_services/nearest_er_page.dart b/lib/presentation/emergency_services/nearest_er_page.dart
index ea9a1517..97e601d5 100644
--- a/lib/presentation/emergency_services/nearest_er_page.dart
+++ b/lib/presentation/emergency_services/nearest_er_page.dart
@@ -92,7 +92,7 @@ class _NearestErPageState extends State {
},
);
} else {
- return Center(child: Utils.getNoDataWidget(context, noDataText: "No nearest Er Around you"));
+ return Center(child: Utils.getNoDataWidget(context, noDataText: LocaleKeys.noNearestER.tr()));
}
}),
),
diff --git a/lib/presentation/health_calculators_and_converts/health_calculators_page.dart b/lib/presentation/health_calculators_and_converts/health_calculators_page.dart
index a7fe0ef5..8b351ecf 100644
--- a/lib/presentation/health_calculators_and_converts/health_calculators_page.dart
+++ b/lib/presentation/health_calculators_and_converts/health_calculators_page.dart
@@ -146,7 +146,10 @@ class _HealthCalculatorsPageState extends State {
SizedBox(
width: 12.w,
),
- Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h, fit: BoxFit.contain, iconColor: AppColors.textColor),
+ Transform.flip(
+ flipX: getIt.get().isArabic(),
+ child: Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h,
+ fit: BoxFit.contain, iconColor: AppColors.textColor),),
],
).paddingAll(16.w))
.onPress(() {
@@ -172,8 +175,10 @@ class _HealthCalculatorsPageState extends State {
),
),
SizedBox(width: 12.w),
- Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h, fit: BoxFit.contain, iconColor: AppColors.textColor),
- ],
+ Transform.flip(
+ flipX: getIt.get().isArabic(),
+ child: Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h,
+ fit: BoxFit.contain, iconColor: AppColors.textColor),), ],
).paddingAll(16.w))
.onPress(() {
Navigator.of(context).push(
@@ -201,8 +206,10 @@ class _HealthCalculatorsPageState extends State {
),
),
SizedBox(width: 12.w),
- Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h, fit: BoxFit.contain, iconColor: AppColors.textColor),
- ],
+ Transform.flip(
+ flipX: getIt.get().isArabic(),
+ child: Utils.buildSvgWithAssets(icon: AppAssets.arrowRight, width: 24.w, height: 24.h,
+ fit: BoxFit.contain, iconColor: AppColors.textColor),), ],
).paddingAll(16.w))
.onPress(() {
Navigator.of(context).push(
diff --git a/lib/presentation/health_calculators_and_converts/widgets/bf.dart b/lib/presentation/health_calculators_and_converts/widgets/bf.dart
index d71566a2..a2d804b0 100644
--- a/lib/presentation/health_calculators_and_converts/widgets/bf.dart
+++ b/lib/presentation/health_calculators_and_converts/widgets/bf.dart
@@ -26,7 +26,19 @@ class _BodyFatWidgetState extends State {
final TextEditingController _neckController = TextEditingController();
final TextEditingController _waistController = TextEditingController();
final TextEditingController _hipController = TextEditingController();
- final List _heightUnits = ['cm', 'm', 'ft', 'in'];
+
+ final Map _heightUnits = {
+ 'cm': LocaleKeys.cm,
+ 'm': LocaleKeys.m,
+ 'ft': LocaleKeys.ft,
+ 'in': LocaleKeys.inch,
+ };
+
+ final Map _genders = {
+ 'Male': LocaleKeys.malE,
+ 'Female': LocaleKeys.femaleGender,
+ };
+
String selectedHeightUnit = 'cm';
String selectedNeckUnit = 'in';
String selectedWaistUnit = 'in';
@@ -82,6 +94,7 @@ class _BodyFatWidgetState extends State {
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true),
child: Column(
children: [
+ // === GENDER ROW ===
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -95,7 +108,7 @@ class _BodyFatWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.selectGender.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedGender.toText12(isBold: true, color: AppColors.textColor),
+ (_genders[selectedGender] ?? selectedGender).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
],
@@ -105,7 +118,6 @@ class _BodyFatWidgetState extends State {
SizedBox(width: 4.w),
],
).paddingSymmetrical(0.w, 16.w).onPress(() {
- List _genders = ["Male", "Female"];
dialogService.showFamilyBottomSheetWithoutHWithChild(
label: LocaleKeys.selectGender.tr(context: context),
message: "",
@@ -116,7 +128,8 @@ class _BodyFatWidgetState extends State {
shrinkWrap: true,
itemCount: _genders.length,
itemBuilder: (context, index) {
- final unit = _genders[index];
+ final key = _genders.keys.elementAt(index);
+ final localeKey = _genders[key]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@@ -127,7 +140,7 @@ class _BodyFatWidgetState extends State {
spacing: 8.h,
children: [
Radio(
- value: unit,
+ value: key,
groupValue: selectedGender,
activeColor: AppColors.errorColor,
onChanged: (String? value) {
@@ -140,13 +153,13 @@ class _BodyFatWidgetState extends State {
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
- unit.toCamelCase.toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).onPress(() {
setState(() {
- selectedGender = unit;
- _onInputChanged();
+ selectedGender = key;
});
+ _onInputChanged();
Navigator.pop(context);
}),
),
@@ -162,6 +175,7 @@ class _BodyFatWidgetState extends State {
);
}),
Divider(height: 1, color: Color(0xFFEEEEEE)),
+ // === HEIGHT ROW ===
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -208,72 +222,24 @@ class _BodyFatWidgetState extends State {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
- "Unit".toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedHeightUnit.toText12(isBold: true, color: AppColors.textColor),
+ LocaleKeys.unit.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
+ (_heightUnits[selectedHeightUnit] ?? selectedHeightUnit).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
SizedBox(width: 12.w),
Utils.buildSvgWithAssets(icon: AppAssets.arrow_down)
],
).onPress(() {
- dialogService.showFamilyBottomSheetWithoutHWithChild(
- label: LocaleKeys.unit.tr(context: context),
- message: "",
- child: Container(
- padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h),
- decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
- child: ListView.separated(
- shrinkWrap: true,
- itemCount: _heightUnits.length,
- itemBuilder: (context, index) {
- final unit = _heightUnits[index];
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- SizedBox(
- height: 70,
- child: Row(
- spacing: 8.h,
- children: [
- Radio(
- value: unit,
- groupValue: selectedHeightUnit,
- activeColor: AppColors.errorColor,
- onChanged: (String? value) {
- if (value == null) return;
- setState(() {
- selectedHeightUnit = value;
- });
- Navigator.pop(context);
- },
- materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- unit.toUpperCase().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
- ],
- ).onPress(() {
- setState(() {
- selectedHeightUnit = unit;
- _onInputChanged();
- });
- Navigator.pop(context);
- }),
- ),
- ],
- );
- },
- separatorBuilder: (BuildContext context, int index) {
- return Divider(height: 1, color: Color(0xFFEEEEEE));
- },
- ),
- ),
- onOkPressed: () {},
- );
+ _showUnitBottomSheet(context, dialogService, selectedHeightUnit, (value) {
+ setState(() { selectedHeightUnit = value; });
+ _onInputChanged();
+ });
}),
),
],
).paddingSymmetrical(0.w, 16.w),
Divider(height: 1, color: Color(0xFFEEEEEE)),
+ // === NECK ROW ===
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -302,12 +268,7 @@ class _BodyFatWidgetState extends State {
hintText: '7',
hintStyle: TextStyle(color: Colors.grey),
),
- style: const TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.bold,
- color: Colors.black87,
- height: 1.0,
- ),
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0),
),
)
],
@@ -326,71 +287,23 @@ class _BodyFatWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.unit.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedNeckUnit.toText12(isBold: true, color: AppColors.textColor),
+ (_heightUnits[selectedNeckUnit] ?? selectedNeckUnit).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
SizedBox(width: 12.w),
Utils.buildSvgWithAssets(icon: AppAssets.arrow_down)
],
).onPress(() {
- dialogService.showFamilyBottomSheetWithoutHWithChild(
- label: LocaleKeys.unit.tr(context: context),
- message: "",
- child: Container(
- padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h),
- decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
- child: ListView.separated(
- shrinkWrap: true,
- itemCount: _heightUnits.length,
- itemBuilder: (context, index) {
- final unit = _heightUnits[index];
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- SizedBox(
- height: 70,
- child: Row(
- spacing: 8.h,
- children: [
- Radio(
- value: unit,
- groupValue: selectedNeckUnit,
- activeColor: AppColors.errorColor,
- onChanged: (String? value) {
- if (value == null) return;
- setState(() {
- selectedNeckUnit = value;
- });
- Navigator.pop(context);
- },
- materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- unit.toUpperCase().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
- ],
- ).onPress(() {
- setState(() {
- selectedNeckUnit = unit;
- _onInputChanged();
- });
- Navigator.pop(context);
- }),
- ),
- ],
- );
- },
- separatorBuilder: (BuildContext context, int index) {
- return Divider(height: 1, color: Color(0xFFEEEEEE));
- },
- ),
- ),
- onOkPressed: () {},
- );
+ _showUnitBottomSheet(context, dialogService, selectedNeckUnit, (value) {
+ setState(() { selectedNeckUnit = value; });
+ _onInputChanged();
+ });
}),
),
],
).paddingSymmetrical(0.w, 16.w),
Divider(height: 1, color: Color(0xFFEEEEEE)),
+ // === WAIST ROW ===
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -419,12 +332,7 @@ class _BodyFatWidgetState extends State {
hintText: '30',
hintStyle: TextStyle(color: Colors.grey),
),
- style: const TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.bold,
- color: Colors.black87,
- height: 1.0,
- ),
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0),
),
)
],
@@ -442,72 +350,24 @@ class _BodyFatWidgetState extends State {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
- "Unit".toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedWaistUnit.toText12(isBold: true, color: AppColors.textColor),
+ LocaleKeys.unit.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
+ (_heightUnits[selectedWaistUnit] ?? selectedWaistUnit).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
SizedBox(width: 12.w),
Utils.buildSvgWithAssets(icon: AppAssets.arrow_down)
],
).onPress(() {
- dialogService.showFamilyBottomSheetWithoutHWithChild(
- label: LocaleKeys.unit.tr(context: context),
- message: "",
- child: Container(
- padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h),
- decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
- child: ListView.separated(
- shrinkWrap: true,
- itemCount: _heightUnits.length,
- itemBuilder: (context, index) {
- final unit = _heightUnits[index];
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- SizedBox(
- height: 70,
- child: Row(
- spacing: 8.h,
- children: [
- Radio(
- value: unit,
- groupValue: selectedWaistUnit,
- activeColor: AppColors.errorColor,
- onChanged: (String? value) {
- if (value == null) return;
- setState(() {
- selectedWaistUnit = value;
- });
- Navigator.pop(context);
- },
- materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- unit.toUpperCase().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
- ],
- ).onPress(() {
- setState(() {
- selectedWaistUnit = unit;
- _onInputChanged();
- });
- Navigator.pop(context);
- }),
- ),
- ],
- );
- },
- separatorBuilder: (BuildContext context, int index) {
- return Divider(height: 1, color: Color(0xFFEEEEEE));
- },
- ),
- ),
- onOkPressed: () {},
- );
+ _showUnitBottomSheet(context, dialogService, selectedWaistUnit, (value) {
+ setState(() { selectedWaistUnit = value; });
+ _onInputChanged();
+ });
}),
),
],
).paddingSymmetrical(0.w, 16.w),
Divider(height: 1, color: Color(0xFFEEEEEE)),
+ // === HIP ROW ===
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -536,12 +396,7 @@ class _BodyFatWidgetState extends State {
hintText: '0',
hintStyle: TextStyle(color: Colors.grey),
),
- style: const TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.bold,
- color: Colors.black87,
- height: 1.0,
- ),
+ style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.black87, height: 1.0),
),
)
],
@@ -560,66 +415,17 @@ class _BodyFatWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.unit.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedHipUnit.toText12(isBold: true, color: AppColors.textColor),
+ (_heightUnits[selectedHipUnit] ?? selectedHipUnit).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
SizedBox(width: 12.w),
Utils.buildSvgWithAssets(icon: AppAssets.arrow_down)
],
).onPress(() {
- dialogService.showFamilyBottomSheetWithoutHWithChild(
- label: LocaleKeys.unit.tr(context: context),
- message: "",
- child: Container(
- padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h),
- decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
- child: ListView.separated(
- shrinkWrap: true,
- itemCount: _heightUnits.length,
- itemBuilder: (context, index) {
- final unit = _heightUnits[index];
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- SizedBox(
- height: 70,
- child: Row(
- spacing: 8.h,
- children: [
- Radio(
- value: unit,
- groupValue: selectedHipUnit,
- activeColor: AppColors.errorColor,
- onChanged: (String? value) {
- if (value == null) return;
- setState(() {
- selectedHipUnit = value;
- });
- Navigator.pop(context);
- },
- materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- unit.toUpperCase().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
- ],
- ).onPress(() {
- setState(() {
- selectedHipUnit = unit;
- _onInputChanged();
- });
- Navigator.pop(context);
- }),
- ),
- ],
- );
- },
- separatorBuilder: (BuildContext context, int index) {
- return Divider(height: 1, color: Color(0xFFEEEEEE));
- },
- ),
- ),
- onOkPressed: () {},
- );
+ _showUnitBottomSheet(context, dialogService, selectedHipUnit, (value) {
+ setState(() { selectedHipUnit = value; });
+ _onInputChanged();
+ });
}),
),
],
@@ -631,7 +437,7 @@ class _BodyFatWidgetState extends State {
Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w),
SizedBox(width: 12.w),
Expanded(
- child: "Estimate the total body fat based on the size.".toText12(isBold: true, color: AppColors.inputLabelTextColor),
+ child: LocaleKeys.bodyFatAlert.tr().toText12(isBold: true, color: AppColors.inputLabelTextColor),
),
],
).paddingSymmetrical(0.w, 16.w),
@@ -640,4 +446,56 @@ class _BodyFatWidgetState extends State {
);
});
}
+
+ void _showUnitBottomSheet(BuildContext context, DialogService dialogService, String currentValue, Function(String) onSelected) {
+ dialogService.showFamilyBottomSheetWithoutHWithChild(
+ label: LocaleKeys.unit.tr(context: context),
+ message: "",
+ child: Container(
+ padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h),
+ decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
+ child: ListView.separated(
+ shrinkWrap: true,
+ itemCount: _heightUnits.length,
+ itemBuilder: (context, index) {
+ final key = _heightUnits.keys.elementAt(index);
+ final localeKey = _heightUnits[key]!;
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ SizedBox(
+ height: 70,
+ child: Row(
+ spacing: 8.h,
+ children: [
+ Radio(
+ value: key,
+ groupValue: currentValue,
+ activeColor: AppColors.errorColor,
+ onChanged: (String? value) {
+ if (value == null) return;
+ onSelected(value);
+ Navigator.pop(context);
+ },
+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ ),
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ ],
+ ).onPress(() {
+ onSelected(key);
+ Navigator.pop(context);
+ }),
+ ),
+ ],
+ );
+ },
+ separatorBuilder: (BuildContext context, int index) {
+ return Divider(height: 1, color: Color(0xFFEEEEEE));
+ },
+ ),
+ ),
+ onOkPressed: () {},
+ );
+ }
}
diff --git a/lib/presentation/health_calculators_and_converts/widgets/blood_sugar.dart b/lib/presentation/health_calculators_and_converts/widgets/blood_sugar.dart
index f2110646..670236de 100644
--- a/lib/presentation/health_calculators_and_converts/widgets/blood_sugar.dart
+++ b/lib/presentation/health_calculators_and_converts/widgets/blood_sugar.dart
@@ -1,4 +1,6 @@
+import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
+import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:provider/provider.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
@@ -129,7 +131,7 @@ class _BloodSugarWidgetState extends State {
),
SizedBox(width: 12.w),
Expanded(
- child: "Convert blood glucose values between mg/dL and mmol/L. (1 mmol/L ≈ 18.0182 mg/dL)".toText12(
+ child: LocaleKeys.glucoseAlert.tr().toText12(
isBold: true,
color: AppColors.inputLabelTextColor,
),
diff --git a/lib/presentation/health_calculators_and_converts/widgets/bmr.dart b/lib/presentation/health_calculators_and_converts/widgets/bmr.dart
index 003faf06..2b013549 100644
--- a/lib/presentation/health_calculators_and_converts/widgets/bmr.dart
+++ b/lib/presentation/health_calculators_and_converts/widgets/bmr.dart
@@ -26,8 +26,31 @@ class _BMRWidgetState extends State {
final TextEditingController _heightController = TextEditingController();
final TextEditingController _weightController = TextEditingController();
final TextEditingController _ageController = TextEditingController();
- final List _heightUnits = ['cm', 'm', 'ft', 'in'];
- final List _weightUnits = ['kg', 'lb'];
+
+ final Map _heightUnits = {
+ 'cm': LocaleKeys.cm,
+ 'm': LocaleKeys.m,
+ 'ft': LocaleKeys.ft,
+ 'in': LocaleKeys.inch,
+ };
+
+ final Map _weightUnits = {
+ 'kg': LocaleKeys.kg,
+ 'lb': LocaleKeys.lb,
+ };
+
+ final Map _genders = {
+ 'Male': LocaleKeys.malE,
+ 'Female': LocaleKeys.femaleGender,
+ };
+
+ final Map _activityLevels = {
+ 'Almost Inactive (no exercise)': LocaleKeys.almostInactive,
+ 'Lightly active': LocaleKeys.lightlyActive,
+ 'Lightly active (1-3) days per week': LocaleKeys.lightlyActive13Days,
+ 'Super active (very hard exercise)': LocaleKeys.superActive,
+ };
+
String selectedHeightUnit = 'cm';
String selectedWeightUnit = 'kg';
String selectedActivityLevel = 'Lightly active';
@@ -90,7 +113,7 @@ class _BMRWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.selectGender.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedGender.toCamelCase.toText12(isBold: true, color: AppColors.textColor),
+ (_genders[selectedGender] ?? selectedGender).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
],
@@ -100,8 +123,6 @@ class _BMRWidgetState extends State {
SizedBox(width: 4.w),
],
).paddingSymmetrical(0.w, 16.w).onPress(() {
- List _genders = ["Male", "Female"];
-
dialogService.showFamilyBottomSheetWithoutHWithChild(
label: LocaleKeys.selectGender.tr(context: context),
message: "",
@@ -112,7 +133,8 @@ class _BMRWidgetState extends State {
shrinkWrap: true,
itemCount: _genders.length,
itemBuilder: (context, index) {
- final unit = _genders[index];
+ final key = _genders.keys.elementAt(index);
+ final localeKey = _genders[key]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@@ -123,12 +145,11 @@ class _BMRWidgetState extends State {
spacing: 8.h,
children: [
Radio(
- value: unit,
+ value: key,
groupValue: selectedGender,
activeColor: AppColors.errorColor,
onChanged: (String? value) {
if (value == null) return;
- print(value);
setState(() {
selectedGender = value;
});
@@ -137,11 +158,11 @@ class _BMRWidgetState extends State {
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
- unit.toCamelCase.toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).onPress(() {
setState(() {
- selectedGender = unit;
+ selectedGender = key;
});
_onInputChanged();
Navigator.pop(context);
@@ -243,7 +264,7 @@ class _BMRWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.unit.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedHeightUnit.toText12(isBold: true, color: AppColors.textColor),
+ (_heightUnits[selectedHeightUnit] ?? selectedHeightUnit).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
SizedBox(width: 12.w),
@@ -260,7 +281,8 @@ class _BMRWidgetState extends State {
shrinkWrap: true,
itemCount: _heightUnits.length,
itemBuilder: (context, index) {
- final unit = _heightUnits[index];
+ final key = _heightUnits.keys.elementAt(index);
+ final localeKey = _heightUnits[key]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@@ -271,7 +293,7 @@ class _BMRWidgetState extends State {
spacing: 8.h,
children: [
Radio(
- value: unit,
+ value: key,
groupValue: selectedHeightUnit,
activeColor: AppColors.errorColor,
onChanged: (String? value) {
@@ -284,13 +306,13 @@ class _BMRWidgetState extends State {
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
- unit.toUpperCase().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).onPress(() {
setState(() {
- selectedHeightUnit = unit;
- _onInputChanged();
+ selectedHeightUnit = key;
});
+ _onInputChanged();
Navigator.pop(context);
}),
),
@@ -361,7 +383,7 @@ class _BMRWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
"Unit".toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedWeightUnit.toText12(isBold: true, color: AppColors.textColor),
+ (_weightUnits[selectedWeightUnit] ?? selectedWeightUnit).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
SizedBox(width: 12.w),
@@ -378,7 +400,8 @@ class _BMRWidgetState extends State {
shrinkWrap: true,
itemCount: _weightUnits.length,
itemBuilder: (context, index) {
- final unit = _weightUnits[index];
+ final key = _weightUnits.keys.elementAt(index);
+ final localeKey = _weightUnits[key]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@@ -389,7 +412,7 @@ class _BMRWidgetState extends State {
spacing: 8.h,
children: [
Radio(
- value: unit,
+ value: key,
groupValue: selectedWeightUnit,
activeColor: AppColors.errorColor,
onChanged: (String? value) {
@@ -402,13 +425,13 @@ class _BMRWidgetState extends State {
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
- unit.toUpperCase().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).onPress(() {
setState(() {
- selectedWeightUnit = unit;
- _onInputChanged();
+ selectedWeightUnit = key;
});
+ _onInputChanged();
Navigator.pop(context);
}),
),
@@ -440,7 +463,7 @@ class _BMRWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.activityLevel.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedActivityLevel.toText12(isBold: true, color: AppColors.textColor),
+ (_activityLevels[selectedActivityLevel] ?? selectedActivityLevel).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
],
@@ -450,7 +473,6 @@ class _BMRWidgetState extends State {
SizedBox(width: 4.w),
],
).paddingSymmetrical(0.w, 16.w).onPress(() {
- List _activity = ["Almost Inactive (no exercise)", "Lightly active", "Lightly active (1-3) days per week", "Super active (very hard exercise)"];
dialogService.showFamilyBottomSheetWithoutHWithChild(
label: LocaleKeys.selectActivityLevel.tr(context: context),
message: "",
@@ -459,9 +481,10 @@ class _BMRWidgetState extends State {
decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
child: ListView.separated(
shrinkWrap: true,
- itemCount: _activity.length,
+ itemCount: _activityLevels.length,
itemBuilder: (context, index) {
- final unit = _activity[index];
+ final key = _activityLevels.keys.elementAt(index);
+ final localeKey = _activityLevels[key]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@@ -472,7 +495,7 @@ class _BMRWidgetState extends State {
spacing: 8.h,
children: [
Radio(
- value: unit,
+ value: key,
groupValue: selectedActivityLevel,
activeColor: AppColors.errorColor,
onChanged: (String? value) {
@@ -485,13 +508,13 @@ class _BMRWidgetState extends State {
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
- unit.toCamelCase.toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).onPress(() {
setState(() {
- selectedActivityLevel = unit;
- _onInputChanged();
+ selectedActivityLevel = key;
});
+ _onInputChanged();
Navigator.pop(context);
}),
),
diff --git a/lib/presentation/health_calculators_and_converts/widgets/calories.dart b/lib/presentation/health_calculators_and_converts/widgets/calories.dart
index d354ce8e..ad31cd6c 100644
--- a/lib/presentation/health_calculators_and_converts/widgets/calories.dart
+++ b/lib/presentation/health_calculators_and_converts/widgets/calories.dart
@@ -26,8 +26,31 @@ class _CaloriesWidgetState extends State {
final TextEditingController _heightController = TextEditingController();
final TextEditingController _weightController = TextEditingController();
final TextEditingController _ageController = TextEditingController();
- final List _heightUnits = ['cm', 'm', 'ft', 'in'];
- final List _weightUnits = ['kg', 'lb'];
+
+ final Map _heightUnits = {
+ 'cm': LocaleKeys.cm,
+ 'm': LocaleKeys.m,
+ 'ft': LocaleKeys.ft,
+ 'in': LocaleKeys.inch,
+ };
+
+ final Map _weightUnits = {
+ 'kg': LocaleKeys.kg,
+ 'lb': LocaleKeys.lb,
+ };
+
+ final Map _genders = {
+ 'Male': LocaleKeys.malE,
+ 'Female': LocaleKeys.femaleGender,
+ };
+
+ final Map _activityLevels = {
+ 'Almost Inactive (no exercise)': LocaleKeys.almostInactive,
+ 'Lightly active': LocaleKeys.lightlyActive,
+ 'Lightly active (1-3) days per week': LocaleKeys.lightlyActive13Days,
+ 'Super active (very hard exercise)': LocaleKeys.superActive,
+ };
+
String selectedHeightUnit = 'cm';
String selectedWeightUnit = 'kg';
String selectedActivityLevel = 'Lightly active';
@@ -69,7 +92,6 @@ class _CaloriesWidgetState extends State {
@override
Widget build(BuildContext context) {
DialogService dialogService = getIt();
- AppState appState = getIt();
return Consumer(builder: (context, provider, _) {
return Container(
@@ -78,6 +100,7 @@ class _CaloriesWidgetState extends State {
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true),
child: Column(
children: [
+ // === GENDER ROW ===
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -90,8 +113,8 @@ class _CaloriesWidgetState extends State {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
- "Select Gender".toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedGender.toCamelCase.toText12(isBold: true, color: AppColors.textColor),
+ LocaleKeys.selectGender.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
+ (_genders[selectedGender] ?? selectedGender).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
],
@@ -101,8 +124,6 @@ class _CaloriesWidgetState extends State {
SizedBox(width: 4.w),
],
).paddingSymmetrical(0.w, 16.w).onPress(() {
- List _genders = ["Male", "Female"];
-
dialogService.showFamilyBottomSheetWithoutHWithChild(
label: LocaleKeys.selectGender.tr(context: context),
message: "",
@@ -113,7 +134,8 @@ class _CaloriesWidgetState extends State {
shrinkWrap: true,
itemCount: _genders.length,
itemBuilder: (context, index) {
- final unit = _genders[index];
+ final key = _genders.keys.elementAt(index);
+ final localeKey = _genders[key]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@@ -124,7 +146,7 @@ class _CaloriesWidgetState extends State {
spacing: 8.h,
children: [
Radio(
- value: unit,
+ value: key,
groupValue: selectedGender,
activeColor: AppColors.errorColor,
onChanged: (String? value) {
@@ -137,13 +159,13 @@ class _CaloriesWidgetState extends State {
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
- unit.toCamelCase.toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).onPress(() {
setState(() {
- selectedGender = unit;
- _onInputChanged();
+ selectedGender = key;
});
+ _onInputChanged();
Navigator.pop(context);
}),
),
@@ -159,6 +181,7 @@ class _CaloriesWidgetState extends State {
);
}),
Divider(height: 1, color: Color(0xFFEEEEEE)),
+ // === AGE ROW (unchanged) ===
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -196,6 +219,7 @@ class _CaloriesWidgetState extends State {
],
).paddingSymmetrical(0.w, 16.w),
Divider(height: 1, color: Color(0xFFEEEEEE)),
+ // === HEIGHT ROW ===
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -242,72 +266,24 @@ class _CaloriesWidgetState extends State {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
- "Unit".toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedHeightUnit.toText12(isBold: true, color: AppColors.textColor),
+ LocaleKeys.unit.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
+ (_heightUnits[selectedHeightUnit] ?? selectedHeightUnit).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
SizedBox(width: 12.w),
Utils.buildSvgWithAssets(icon: AppAssets.arrow_down)
],
).onPress(() {
- dialogService.showFamilyBottomSheetWithoutHWithChild(
- label: LocaleKeys.unit.tr(context: context),
- message: "",
- child: Container(
- padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h),
- decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
- child: ListView.separated(
- shrinkWrap: true,
- itemCount: _heightUnits.length,
- itemBuilder: (context, index) {
- final unit = _heightUnits[index];
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- SizedBox(
- height: 70,
- child: Row(
- spacing: 8.h,
- children: [
- Radio(
- value: unit,
- groupValue: selectedHeightUnit,
- activeColor: AppColors.errorColor,
- onChanged: (String? value) {
- if (value == null) return;
- setState(() {
- selectedHeightUnit = value;
- });
- Navigator.pop(context);
- },
- materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- unit.toUpperCase().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
- ],
- ).onPress(() {
- setState(() {
- selectedHeightUnit = unit;
- _onInputChanged();
- });
- Navigator.pop(context);
- }),
- ),
- ],
- );
- },
- separatorBuilder: (BuildContext context, int index) {
- return Divider(height: 1, color: Color(0xFFEEEEEE));
- },
- ),
- ),
- onOkPressed: () {},
- );
+ _showUnitBottomSheet(context, dialogService, _heightUnits, selectedHeightUnit, (value) {
+ setState(() { selectedHeightUnit = value; });
+ _onInputChanged();
+ });
}),
),
],
).paddingSymmetrical(0.w, 16.w),
Divider(height: 1, color: Color(0xFFEEEEEE)),
+ // === WEIGHT ROW ===
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -359,73 +335,24 @@ class _CaloriesWidgetState extends State {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
- "Unit".toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedWeightUnit.toText12(isBold: true, color: AppColors.textColor),
+ LocaleKeys.unit.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
+ (_weightUnits[selectedWeightUnit] ?? selectedWeightUnit).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
SizedBox(width: 12.w),
Utils.buildSvgWithAssets(icon: AppAssets.arrow_down)
],
).onPress(() {
- dialogService.showFamilyBottomSheetWithoutHWithChild(
- label: LocaleKeys.unit.tr(context: context),
- message: "",
- child: Container(
- padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h),
- decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
- child: ListView.separated(
- shrinkWrap: true,
- itemCount: _weightUnits.length,
- itemBuilder: (context, index) {
- final unit = _weightUnits[index];
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- SizedBox(
- height: 70,
- child: Row(
- spacing: 8.h,
- children: [
- Radio(
- value: unit,
- groupValue: selectedWeightUnit,
- activeColor: AppColors.errorColor,
- onChanged: (String? value) {
- if (value == null) return;
- setState(() {
- selectedWeightUnit = value;
- });
- _onInputChanged();
- Navigator.pop(context);
- },
- materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
- ),
- unit.toUpperCase().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
- ],
- ).onPress(() {
- setState(() {
- selectedWeightUnit = unit;
- _onInputChanged();
- });
- Navigator.pop(context);
- }),
- ),
- ],
- );
- },
- separatorBuilder: (BuildContext context, int index) {
- return Divider(height: 1, color: Color(0xFFEEEEEE));
- },
- ),
- ),
- onOkPressed: () {},
- );
+ _showUnitBottomSheet(context, dialogService, _weightUnits, selectedWeightUnit, (value) {
+ setState(() { selectedWeightUnit = value; });
+ _onInputChanged();
+ });
}),
),
],
).paddingSymmetrical(0.w, 16.w),
Divider(height: 1, color: Color(0xFFEEEEEE)),
+ // === ACTIVITY LEVEL ROW ===
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -439,7 +366,7 @@ class _CaloriesWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.activityLevel.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedActivityLevel.toText12(isBold: true, color: AppColors.textColor),
+ (_activityLevels[selectedActivityLevel] ?? selectedActivityLevel).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
],
@@ -449,7 +376,6 @@ class _CaloriesWidgetState extends State {
SizedBox(width: 4.w),
],
).paddingSymmetrical(0.w, 16.w).onPress(() {
- List _activity = ["Almost Inactive (no exercise)", "Lightly active", "Lightly active (1-3) days per week", "Super active (very hard exercise)"];
dialogService.showFamilyBottomSheetWithoutHWithChild(
label: LocaleKeys.selectActivityLevel.tr(context: context),
message: "",
@@ -458,9 +384,10 @@ class _CaloriesWidgetState extends State {
decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
child: ListView.separated(
shrinkWrap: true,
- itemCount: _activity.length,
+ itemCount: _activityLevels.length,
itemBuilder: (context, index) {
- final unit = _activity[index];
+ final key = _activityLevels.keys.elementAt(index);
+ final localeKey = _activityLevels[key]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@@ -471,7 +398,7 @@ class _CaloriesWidgetState extends State {
spacing: 8.h,
children: [
Radio(
- value: unit,
+ value: key,
groupValue: selectedActivityLevel,
activeColor: AppColors.errorColor,
onChanged: (String? value) {
@@ -484,13 +411,13 @@ class _CaloriesWidgetState extends State {
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
- unit.toCamelCase.toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).onPress(() {
setState(() {
- selectedActivityLevel = unit;
- _onInputChanged();
+ selectedActivityLevel = key;
});
+ _onInputChanged();
Navigator.pop(context);
}),
),
@@ -522,4 +449,56 @@ class _CaloriesWidgetState extends State {
);
});
}
+
+ void _showUnitBottomSheet(BuildContext context, DialogService dialogService, Map units, String currentValue, Function(String) onSelected) {
+ dialogService.showFamilyBottomSheetWithoutHWithChild(
+ label: LocaleKeys.unit.tr(context: context),
+ message: "",
+ child: Container(
+ padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h),
+ decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
+ child: ListView.separated(
+ shrinkWrap: true,
+ itemCount: units.length,
+ itemBuilder: (context, index) {
+ final key = units.keys.elementAt(index);
+ final localeKey = units[key]!;
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ SizedBox(
+ height: 70,
+ child: Row(
+ spacing: 8.h,
+ children: [
+ Radio(
+ value: key,
+ groupValue: currentValue,
+ activeColor: AppColors.errorColor,
+ onChanged: (String? value) {
+ if (value == null) return;
+ onSelected(value);
+ Navigator.pop(context);
+ },
+ materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
+ ),
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ ],
+ ).onPress(() {
+ onSelected(key);
+ Navigator.pop(context);
+ }),
+ ),
+ ],
+ );
+ },
+ separatorBuilder: (BuildContext context, int index) {
+ return Divider(height: 1, color: Color(0xFFEEEEEE));
+ },
+ ),
+ ),
+ onOkPressed: () {},
+ );
+ }
}
diff --git a/lib/presentation/health_calculators_and_converts/widgets/crabs.dart b/lib/presentation/health_calculators_and_converts/widgets/crabs.dart
index e3e7c1e3..8a2f6343 100644
--- a/lib/presentation/health_calculators_and_converts/widgets/crabs.dart
+++ b/lib/presentation/health_calculators_and_converts/widgets/crabs.dart
@@ -187,7 +187,7 @@ class _CrabsWidgetState extends State {
Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w),
SizedBox(width: 12.w),
Expanded(
- child: "Calculate carbohydrate based protein and fat ration in calories and grams according to a pre set ratio."
+ child: LocaleKeys.carbsAlert.tr()
.toText12(isBold: true, color: AppColors.inputLabelTextColor),
),
],
diff --git a/lib/presentation/health_calculators_and_converts/widgets/ibw.dart b/lib/presentation/health_calculators_and_converts/widgets/ibw.dart
index 070e373e..f9d7e964 100644
--- a/lib/presentation/health_calculators_and_converts/widgets/ibw.dart
+++ b/lib/presentation/health_calculators_and_converts/widgets/ibw.dart
@@ -24,12 +24,24 @@ class IdealBodyWeightWidget extends StatefulWidget {
class _IdealBodyWeightWidgetState extends State {
final TextEditingController _heightController = TextEditingController();
final TextEditingController _weightController = TextEditingController();
- final List _heightUnits = ['cm', 'm', 'ft', 'in'];
- final List _weightUnits = ['kg', 'lb'];
+ final Map _heightUnits = {
+ 'cm': LocaleKeys.cm,
+ 'm': LocaleKeys.m,
+ 'ft': LocaleKeys.ft,
+ 'in': LocaleKeys.inch,
+ };
+ final Map _weightUnits = {
+ 'kg': LocaleKeys.kg,
+ 'lb': LocaleKeys.lb,
+ };
+ final Map _bodyFrameSizes = {
+ 'Small (fingers overlaps)': LocaleKeys.bodyFrameSmall,
+ 'Medium (fingers touch)': LocaleKeys.bodyFrameMedium,
+ "Large (fingers don't touch)": LocaleKeys.bodyFrameLarge,
+ };
String selectedHeightUnit = 'cm';
String selectedWeightUnit = 'kg';
String selectedBodyFrameSize = 'Medium (fingers touch)';
- Function(String)? onUnitSelected;
@override
void initState() {
@@ -117,7 +129,7 @@ class _IdealBodyWeightWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.unit.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedHeightUnit.toText12(isBold: true, color: AppColors.textColor),
+ (_heightUnits[selectedHeightUnit] ?? selectedHeightUnit).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
SizedBox(width: 12.w),
@@ -134,7 +146,8 @@ class _IdealBodyWeightWidgetState extends State {
shrinkWrap: true,
itemCount: _heightUnits.length,
itemBuilder: (context, index) {
- final unit = _heightUnits[index];
+ final key = _heightUnits.keys.elementAt(index);
+ final localeKey = _heightUnits[key]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@@ -145,7 +158,7 @@ class _IdealBodyWeightWidgetState extends State {
spacing: 8.h,
children: [
Radio(
- value: unit,
+ value: key,
groupValue: selectedHeightUnit,
activeColor: AppColors.errorColor,
onChanged: (String? value) {
@@ -153,17 +166,18 @@ class _IdealBodyWeightWidgetState extends State {
setState(() {
selectedHeightUnit = value;
});
+ _onInputChanged();
Navigator.pop(context);
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
- unit.toUpperCase().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).onPress(() {
setState(() {
- selectedHeightUnit = unit;
- _onInputChanged();
+ selectedHeightUnit = key;
});
+ _onInputChanged();
Navigator.pop(context);
}),
),
@@ -234,7 +248,7 @@ class _IdealBodyWeightWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.unit.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedWeightUnit.toText12(isBold: true, color: AppColors.textColor),
+ (_weightUnits[selectedWeightUnit] ?? selectedWeightUnit).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
SizedBox(width: 12.w),
@@ -251,7 +265,8 @@ class _IdealBodyWeightWidgetState extends State {
shrinkWrap: true,
itemCount: _weightUnits.length,
itemBuilder: (context, index) {
- final unit = _weightUnits[index];
+ final key = _weightUnits.keys.elementAt(index);
+ final localeKey = _weightUnits[key]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@@ -262,7 +277,7 @@ class _IdealBodyWeightWidgetState extends State {
spacing: 8.h,
children: [
Radio(
- value: unit,
+ value: key,
groupValue: selectedWeightUnit,
activeColor: AppColors.errorColor,
onChanged: (String? value) {
@@ -270,16 +285,18 @@ class _IdealBodyWeightWidgetState extends State {
setState(() {
selectedWeightUnit = value;
});
+ _onInputChanged();
+ Navigator.pop(context);
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
- unit.toUpperCase().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).onPress(() {
setState(() {
- selectedWeightUnit = unit;
- _onInputChanged();
+ selectedWeightUnit = key;
});
+ _onInputChanged();
Navigator.pop(context);
}),
),
@@ -311,7 +328,7 @@ class _IdealBodyWeightWidgetState extends State {
mainAxisAlignment: MainAxisAlignment.start,
children: [
LocaleKeys.bodyFrameSize.tr(context: context).toText12(isBold: true, color: AppColors.inputLabelTextColor),
- selectedBodyFrameSize.toText12(isBold: true, color: AppColors.textColor),
+ (_bodyFrameSizes[selectedBodyFrameSize] ?? selectedBodyFrameSize).tr().toText12(isBold: true, color: AppColors.textColor),
],
),
],
@@ -321,7 +338,6 @@ class _IdealBodyWeightWidgetState extends State {
SizedBox(width: 4.w),
],
).paddingSymmetrical(0.w, 16.w).onPress(() {
- List _activity = ["Small (fingers overlaps)", "Medium (fingers touch)", "Large (fingers don't touch)"];
dialogService.showFamilyBottomSheetWithoutHWithChild(
label: LocaleKeys.selectBodyFrameSize.tr(context: context),
message: "",
@@ -330,9 +346,10 @@ class _IdealBodyWeightWidgetState extends State {
decoration: BoxDecoration(color: AppColors.whiteColor, borderRadius: BorderRadius.circular(20.r)),
child: ListView.separated(
shrinkWrap: true,
- itemCount: _activity.length,
+ itemCount: _bodyFrameSizes.length,
itemBuilder: (context, index) {
- final unit = _activity[index];
+ final key = _bodyFrameSizes.keys.elementAt(index);
+ final localeKey = _bodyFrameSizes[key]!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@@ -343,7 +360,7 @@ class _IdealBodyWeightWidgetState extends State {
spacing: 8.h,
children: [
Radio(
- value: unit,
+ value: key,
groupValue: selectedBodyFrameSize,
activeColor: AppColors.errorColor,
onChanged: (String? value) {
@@ -351,17 +368,18 @@ class _IdealBodyWeightWidgetState extends State {
setState(() {
selectedBodyFrameSize = value;
});
+ _onInputChanged();
Navigator.pop(context);
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
- unit.toCamelCase.toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
+ localeKey.tr().toText16(isBold: true, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).onPress(() {
setState(() {
- selectedBodyFrameSize = unit;
- _onInputChanged();
+ selectedBodyFrameSize = key;
});
+ _onInputChanged();
Navigator.pop(context);
}),
),
@@ -383,7 +401,7 @@ class _IdealBodyWeightWidgetState extends State {
Utils.buildSvgWithAssets(icon: AppAssets.globe, width: 18.w, height: 18.w),
SizedBox(width: 12.w),
Expanded(
- child: "Calculates the ideal body weight based on height, weight and body size.".toText12(isBold: true, color: AppColors.inputLabelTextColor),
+ child: LocaleKeys.ibwAlert.tr().toText12(isBold: true, color: AppColors.inputLabelTextColor),
),
],
).paddingSymmetrical(0.w, 16.w),
diff --git a/lib/presentation/medical_file/medical_file_page.dart b/lib/presentation/medical_file/medical_file_page.dart
index 89839f0d..d17ba896 100644
--- a/lib/presentation/medical_file/medical_file_page.dart
+++ b/lib/presentation/medical_file/medical_file_page.dart
@@ -27,6 +27,7 @@ import 'package:hmg_patient_app_new/features/insurance/insurance_view_model.dart
import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart';
+import 'package:hmg_patient_app_new/features/medical_file/models/patient_medical_response_model.dart';
import 'package:hmg_patient_app_new/features/medical_file/models/patient_sickleave_response_model.dart';
import 'package:hmg_patient_app_new/features/monthly_report/monthly_report_view_model.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart';
@@ -59,6 +60,7 @@ import 'package:hmg_patient_app_new/presentation/medical_file/widgets/lab_rad_ca
import 'package:hmg_patient_app_new/presentation/medical_file/widgets/health_tracker_menu_card.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/widgets/health_tools_card.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/widgets/medical_file_card.dart';
+import 'package:hmg_patient_app_new/presentation/medical_file/widgets/medical_report_card.dart';
import 'package:hmg_patient_app_new/presentation/medical_file/widgets/patient_sick_leave_card.dart';
import 'package:hmg_patient_app_new/presentation/medical_report/medical_reports_page.dart';
import 'package:hmg_patient_app_new/presentation/monthly_report/monthly_report.dart';
@@ -132,6 +134,8 @@ class _MedicalFilePageState extends State {
medicalFileViewModel.setIsPatientSickLeaveListLoading(true);
medicalFileViewModel.getPatientSickLeaveList();
medicalFileViewModel.onTabChanged(0);
+ medicalFileViewModel.setIsPatientMedicalReportsLoading(true);
+ medicalFileViewModel.getPatientMedicalReportList();
// Load vital signs
hmgServicesViewModel.getPatientVitalSign();
}
@@ -1285,65 +1289,78 @@ class _MedicalFilePageState extends State {
).paddingSymmetrical(0.w, 0.h);
}),
SizedBox(height: 16.h),
- GridView(
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 3,
- crossAxisSpacing: 10.h,
- mainAxisSpacing: 16.w,
- mainAxisExtent: 110.h,
- ),
- physics: NeverScrollableScrollPhysics(),
- padding: EdgeInsets.zero,
- shrinkWrap: true,
- children: [
- // MedicalFileCard(
- // label: LocaleKeys.monthlyReports.tr(context: context),
- // textColor: AppColors.blackColor,
- // backgroundColor: AppColors.whiteColor,
- // svgIcon: AppAssets.monthly_reports_icon,
- // isLargeText: true,
- // iconSize: 36.h,
- // ).onPress(() {
- // monthlyReportViewModel.setHealthSummaryEnabled(cacheService.getBool(key: CacheConst.isMonthlyReportEnabled) ?? false);
- // Navigator.of(context).push(
- // CustomPageRoute(
- // page: MonthlyReport(),
- // ),
- // );
- // }),
- MedicalFileCard(
- label: LocaleKeys.medicalReports.tr(context: context),
- textColor: AppColors.blackColor,
- backgroundColor: AppColors.whiteColor,
- svgIcon: AppAssets.medical_reports_icon,
- isLargeText: true,
- iconSize: 36.w,
- ).onPress(() {
- medicalFileViewModel.setIsPatientMedicalReportsLoading(true);
- medicalFileViewModel.getPatientMedicalReportList();
- Navigator.of(context).push(
- CustomPageRoute(
- page: MedicalReportsPage(),
- ),
- );
- }),
- // MedicalFileCard(
- // label: LocaleKeys.sickLeaveReport.tr(context: context),
- // textColor: AppColors.blackColor,
- // backgroundColor: AppColors.whiteColor,
- // svgIcon: AppAssets.sick_leave_report_icon,
- // isLargeText: true,
- // iconSize: 36.h,
- // ).onPress(() {
- // Navigator.of(context).push(
- // CustomPageRoute(
- // page: PatientSickleavesListPage(),
- // ),
- // );
- // }),
- ],
- ).paddingSymmetrical(0.w, 0.0),
- SizedBox(height: 24.h),
+ Selector listRequest, List listReady})>(
+ selector: (context, vm) => (isLoading: vm.isPatientMedicalReportsListLoading, listRequest: vm.patientMedicalReportRequestedList, listReady: vm.patientMedicalReportReadyList),
+ builder: (context, data, _){
+ print("isloading are ${data.isLoading}");
+ print("listRequest are ${data.listRequest}");
+ print("listReady are ${data.listReady}");
+ return MedicalReportCard(
+ isLoading: data.isLoading, listRequest: data.listRequest, listReady: data.listReady
+ );
+ },
+ )
+ // GridView(
+ // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
+ // crossAxisCount: 3,
+ // crossAxisSpacing: 10.h,
+ // mainAxisSpacing: 16.w,
+ // mainAxisExtent: 110.h,
+ // ),
+ // physics: NeverScrollableScrollPhysics(),
+ // padding: EdgeInsets.zero,
+ // shrinkWrap: true,
+ // children: [
+ // // MedicalFileCard(
+ // // label: LocaleKeys.monthlyReports.tr(context: context),
+ // // textColor: AppColors.blackColor,
+ // // backgroundColor: AppColors.whiteColor,
+ // // svgIcon: AppAssets.monthly_reports_icon,
+ // // isLargeText: true,
+ // // iconSize: 36.h,
+ // // ).onPress(() {
+ // // monthlyReportViewModel.setHealthSummaryEnabled(cacheService.getBool(key: CacheConst.isMonthlyReportEnabled) ?? false);
+ // // Navigator.of(context).push(
+ // // CustomPageRoute(
+ // // page: MonthlyReport(),
+ // // ),
+ // // );
+ // // }),
+ // ///todo te changes of the medical report should be displayed here.
+ // ///
+ //
+ // // MedicalFileCard(
+ // // label: LocaleKeys.medicalReports.tr(context: context),
+ // // textColor: AppColors.blackColor,
+ // // backgroundColor: AppColors.whiteColor,
+ // // svgIcon: AppAssets.medical_reports_icon,
+ // // isLargeText: true,
+ // // iconSize: 36.w,
+ // // ).onPress(() {
+ // //
+ // // Navigator.of(context).push(
+ // // CustomPageRoute(
+ // // page: MedicalReportsPage(),
+ // // ),
+ // // );
+ // // }),
+ // // MedicalFileCard(
+ // // label: LocaleKeys.sickLeaveReport.tr(context: context),
+ // // textColor: AppColors.blackColor,
+ // // backgroundColor: AppColors.whiteColor,
+ // // svgIcon: AppAssets.sick_leave_report_icon,
+ // // isLargeText: true,
+ // // iconSize: 36.h,
+ // // ).onPress(() {
+ // // Navigator.of(context).push(
+ // // CustomPageRoute(
+ // // page: PatientSickleavesListPage(),
+ // // ),
+ // // );
+ // // }),
+ // ],
+ // ).paddingSymmetrical(0.w, 0.0),
+ ,SizedBox(height: 24.h),
],
);
case 3:
diff --git a/lib/presentation/medical_file/widgets/medical_report_card.dart b/lib/presentation/medical_file/widgets/medical_report_card.dart
new file mode 100644
index 00000000..4759a65b
--- /dev/null
+++ b/lib/presentation/medical_file/widgets/medical_report_card.dart
@@ -0,0 +1,101 @@
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/material.dart';
+import 'package:hmg_patient_app_new/core/app_assets.dart';
+import 'package:hmg_patient_app_new/core/app_export.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/features/medical_file/models/patient_medical_response_model.dart';
+import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
+import 'package:hmg_patient_app_new/presentation/medical_report/medical_reports_page.dart';
+import 'package:hmg_patient_app_new/presentation/monthly_report/monthly_report.dart';
+import 'package:hmg_patient_app_new/theme/colors.dart';
+import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
+import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
+import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
+
+class MedicalReportCard extends StatelessWidget {
+ final bool isLoading;
+ final List listRequest;
+ final List listReady;
+ final VoidCallback? onViewDetails;
+
+ const MedicalReportCard({
+ super.key,
+ required this.isLoading,
+ required this.listRequest,
+ required this.listReady,
+ this.onViewDetails,
+ });
+
+
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
+ color: AppColors.whiteColor,
+ borderRadius: 24,
+ hasShadow: true,
+ ),
+ child: Padding(
+ padding: EdgeInsets.all(16.h),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ LocaleKeys.medicalReport.tr().toText18(
+ isBold: true,
+ weight: FontWeight.w700,
+ ).toShimmer2(isShow: isLoading),
+ SizedBox(height: 12.h),
+ Wrap(
+ spacing: 8.w,
+ runSpacing: 8.h,
+ children: [
+ if ( listRequest.isNotEmpty )
+ AppCustomChipWidget(
+ labelText: '${listRequest.length.toString().padLeft(2, '0')} ${LocaleKeys.requested.tr()}',
+ icon: AppAssets.document,
+ iconColor: AppColors.alertColor,
+ textColor: AppColors.alertColor,
+ backgroundColor: AppColors.warningColorYellow.withOpacity(.2),
+ iconSize: 14.w,
+ ),
+ if (listReady.isNotEmpty)
+ AppCustomChipWidget(
+ labelText: '${listRequest.length.toString().padLeft(2, '0')} ${LocaleKeys.readyToDownload.tr()}',
+ icon: AppAssets.sucess,
+ iconColor: AppColors.successColor,
+ textColor: AppColors.successColor,
+ backgroundColor: AppColors.switchBackgroundColor,
+ iconSize: 14.w,
+ ),
+ ],
+ ).toShimmer2(isShow: isLoading),
+ SizedBox(height: 16.h),
+ CustomButton(
+ text: LocaleKeys.viewDetails.tr(),
+ icon: AppAssets.report,
+ borderWidth: 0,
+ isDisabled: false,
+ onPressed: (){
+ Navigator.of(context).push(
+ CustomPageRoute(
+ page: MedicalReportsPage(),
+ ),
+ );
+ },
+ backgroundColor: AppColors.lightRedButtonColor,
+ borderColor: AppColors.lightRedButtonColor,
+ textColor: AppColors.primaryRedColor,
+ iconColor: AppColors.primaryRedColor,
+ fontSize: 14.f,
+ fontWeight: FontWeight.w600,
+ borderRadius: 12.r,
+ height: 48.h,
+ ).toShimmer2(isShow: isLoading),
+ ],
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/presentation/prescriptions/prescription_item_view.dart b/lib/presentation/prescriptions/prescription_item_view.dart
index 086b3f83..66ba13ed 100644
--- a/lib/presentation/prescriptions/prescription_item_view.dart
+++ b/lib/presentation/prescriptions/prescription_item_view.dart
@@ -59,7 +59,7 @@ class PrescriptionItemView extends StatelessWidget {
runSpacing: 6.h,
children: [
AppCustomChipWidget(
- labelText: "${LocaleKeys.route.tr(context: context)}: ${isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].route}",
+ labelText: "${LocaleKeys.routePrescription.tr(context: context)}: ${isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].route}",
).toShimmer2(isShow: isLoading),
AppCustomChipWidget(
labelText: "${LocaleKeys.frequency.tr(context: context)}: ${isLoading ? "" : prescriptionVM.prescriptionDetailsList[index].frequency}",