From 69666a6f6cdf18c7e1a5a24f76f565e7c3ad457f Mon Sep 17 00:00:00 2001 From: "Fatimah.Alshammari" Date: Tue, 13 Jan 2026 12:25:27 +0300 Subject: [PATCH 01/12] fixed button --- lib/core/dependencies.dart | 25 ++++----- lib/presentation/parking/paking_page.dart | 63 +++++++++++++--------- lib/presentation/parking/parking_slot.dart | 44 +++++++++------ pubspec.yaml | 2 +- 4 files changed, 79 insertions(+), 55 deletions(-) diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index e8d3071..f6d5471 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -72,6 +72,7 @@ import 'package:local_auth/local_auth.dart'; import 'package:logger/web.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../features/monthly_reports/monthly_reports_repo.dart'; import '../features/qr_parking/qr_parking_view_model.dart'; import '../presentation/health_calculators_and_converts/health_calculator_view_model.dart'; @@ -290,11 +291,11 @@ class AppDependencies { getIt.registerLazySingleton(() => MyInvoicesViewModel(myInvoicesRepo: getIt(), errorHandlerService: getIt(), navServices: getIt())); getIt.registerLazySingleton(() => MonthlyReportViewModel(errorHandlerService: getIt(), monthlyReportRepo: getIt())); - getIt.registerLazySingleton(() => MyInvoicesViewModel( - myInvoicesRepo: getIt(), - errorHandlerService: getIt(), - navServices: getIt(), - )); + // getIt.registerLazySingleton(() => MyInvoicesViewModel( + // myInvoicesRepo: getIt(), + // errorHandlerService: getIt(), + // navServices: getIt(), + // )); getIt.registerLazySingleton(() => HealthTrackersViewModel(healthTrackersRepo: getIt(), errorHandlerService: getIt())); getIt.registerLazySingleton( () => ActivePrescriptionsViewModel( @@ -302,13 +303,13 @@ class AppDependencies { activePrescriptionsRepo: getIt() ), ); - getIt.registerFactory( - () => QrParkingViewModel( - qrParkingRepo: getIt(), - errorHandlerService: getIt(), - cacheService: getIt(), - ), - ); + // getIt.registerFactory( + // () => QrParkingViewModel( + // qrParkingRepo: getIt(), + // errorHandlerService: getIt(), + // cacheService: getIt(), + // ), + // ); } } diff --git a/lib/presentation/parking/paking_page.dart b/lib/presentation/parking/paking_page.dart index cd1e8bc..f112d51 100644 --- a/lib/presentation/parking/paking_page.dart +++ b/lib/presentation/parking/paking_page.dart @@ -10,6 +10,7 @@ import 'package:provider/provider.dart'; import '../../features/qr_parking/qr_parking_view_model.dart'; import '../../theme/colors.dart'; import '../../widgets/appbar/app_bar_widget.dart'; +import '../../widgets/buttons/custom_button.dart'; import '../../widgets/routes/custom_page_route.dart'; @@ -110,32 +111,42 @@ class _ParkingPageState extends State { child: SizedBox( width: double.infinity, height: 56, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppColors.primaryRedColor, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - ), - onPressed: vm.isLoading ? null : () => _readQR(context), - child: vm.isLoading - ? const SizedBox( - width: 22, - height: 22, - child: CircularProgressIndicator( - strokeWidth: 2, - color: Colors.white, - ), - ) - : const Text( - "Read Barcodes", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: Colors.white, - ), - ), - ), + child: CustomButton( + text: "Read Barcodes".needTranslation, + onPressed: () => _readQR(context), // ALWAYS non-null + isDisabled: vm.isLoading, // control disabled state here + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + fontSize: 18, + fontWeight: FontWeight.bold, + ) + + // ElevatedButton( + // style: ElevatedButton.styleFrom( + // backgroundColor: AppColors.primaryRedColor, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10), + // ), + // ), + // onPressed: vm.isLoading ? null : () => _readQR(context), + // child: vm.isLoading + // ? const SizedBox( + // width: 22, + // height: 22, + // child: CircularProgressIndicator( + // strokeWidth: 2, + // color: Colors.white, + // ), + // ) + // : const Text( + // "Read Barcodes", + // style: TextStyle( + // fontSize: 18, + // fontWeight: FontWeight.bold, + // color: Colors.white, + // ), + // ), + // ), ), ), ), diff --git a/lib/presentation/parking/parking_slot.dart b/lib/presentation/parking/parking_slot.dart index 013bb6f..ce13dad 100644 --- a/lib/presentation/parking/parking_slot.dart +++ b/lib/presentation/parking/parking_slot.dart @@ -9,6 +9,7 @@ import 'package:hmg_patient_app_new/features/qr_parking/models/qr_parking_respon import '../../features/qr_parking/qr_parking_view_model.dart'; import '../../theme/colors.dart'; import '../../widgets/appbar/app_bar_widget.dart'; +import '../../widgets/buttons/custom_button.dart'; import '../../widgets/chip/app_custom_chip_widget.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; @@ -184,23 +185,34 @@ class _ParkingSlotState extends State { SizedBox( width: double.infinity, height: 48.h, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppColors.primaryRedColor, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - ), + child:CustomButton( + text: "Get Direction".needTranslation, onPressed: _openDirection, - child: Text( - "Get Direction".needTranslation, - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.bold, - color: AppColors.whiteColor, - ), - ), - ), + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 18, + fontWeight: FontWeight.bold, + borderRadius: 10, + ) + + // ElevatedButton( + // style: ElevatedButton.styleFrom( + // backgroundColor: AppColors.primaryRedColor, + // shape: RoundedRectangleBorder( + // borderRadius: BorderRadius.circular(10), + // ), + // ), + // onPressed: _openDirection, + // child: Text( + // "Get Direction".needTranslation, + // style: TextStyle( + // fontSize: 18, + // fontWeight: FontWeight.bold, + // color: AppColors.whiteColor, + // ), + // ), + // ), ), // const Spacer(), diff --git a/pubspec.yaml b/pubspec.yaml index 461d3ab..cdad394 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -77,7 +77,7 @@ dependencies: amazon_payfort: ^1.1.4 network_info_plus: ^6.1.4 flutter_nfc_kit: ^3.6.0 - barcode_scan2: ^4.5.1 + barcode_scan2: ^4.6.0 keyboard_actions: ^4.2.0 path_provider: ^2.0.8 open_filex: ^4.7.0 From 8f428297cbd1eda5228c9cc5f02b10731fa82497 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 13 Jan 2026 16:21:13 +0300 Subject: [PATCH 02/12] Arabic translations added --- assets/langs/ar-SA.json | 134 ++++++++++++++++- assets/langs/en-US.json | 136 +++++++++++++++++- lib/generated/locale_keys.g.dart | 132 ++++++++++++++++- .../appointment_details_page.dart | 63 ++++---- .../appointment_payment_page.dart | 23 ++- .../appointments/appointment_queue_page.dart | 50 +++---- .../appointments/my_appointments_page.dart | 12 +- .../appointments/my_doctors_page.dart | 4 +- .../widgets/appointment_card.dart | 14 +- .../appointment_checkin_bottom_sheet.dart | 26 ++-- .../widgets/appointment_doctor_card.dart | 4 +- .../ask_doctor_request_type_select.dart | 2 +- .../facility_type_selection_widget.dart | 4 +- .../hospital_list_items.dart | 6 +- .../type_selection_widget.dart | 6 +- lib/presentation/authentication/login.dart | 2 +- lib/presentation/authentication/register.dart | 2 +- .../book_appointment_page.dart | 52 +++---- .../dental_chief_complaints_page.dart | 4 +- .../doctor_filter/doctors_filter.dart | 2 +- .../book_appointment/doctor_profile_page.dart | 14 +- .../laser/laser_appointment.dart | 4 +- .../immediate_livecare_payment_details.dart | 40 +++--- .../immediate_livecare_payment_page.dart | 30 ++-- ...mediate_livecare_pending_request_page.dart | 8 +- ...select_immediate_livecare_clinic_page.dart | 10 +- .../widgets/livecare_clinic_card.dart | 2 +- .../widgets/select_livecare_call_type.dart | 14 +- .../review_appointment_page.dart | 16 +-- .../search_doctor_by_name.dart | 4 +- .../book_appointment/select_clinic_page.dart | 16 +-- .../book_appointment/select_doctor_page.dart | 8 +- .../select_livecare_clinic_page.dart | 20 +-- .../waiting_appointment_info.dart | 16 +-- ...ting_appointment_online_checkin_sheet.dart | 27 ++-- .../waiting_appointment_payment_page.dart | 36 +++-- .../widgets/appointment_calendar.dart | 8 +- .../book_appointment/widgets/doctor_card.dart | 10 +- .../cmc_order_detail_page.dart | 9 +- .../cmc_hospital_bottom_sheet_body.dart | 4 +- .../widgets/cmc_hospital_list_item.dart | 4 +- .../widgets/cmc_ui_selection_helper.dart | 6 +- 42 files changed, 676 insertions(+), 308 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index b8fc7eb..ee6ac33 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -877,5 +877,137 @@ "walkin": "زيارة بدون موعد", "laserClinic": "عيادة الليزر", "continueString": "يكمل", - "covid_info": "تجري مستشفيات د. سليمان الحبيب فحص فيروس كورونا المستجد وتصدر شهادات السفر على مدار الساعة، طوال أيام الأسبوع، وبسرعة ودقة عالية. يمكن للراغبين في الاستفادة من هذه الخدمة زيارة أحد فروع مستشفيات د. سليمان الحبيب وإجراء فحص كورونا خلال بضع دقائق والحصول على النتائج خلال عدة ساعات خدمة فحص فيروس كورونا Covid 19 بتقنية PCR للكشف عن الفيروس وفقاً لأعلى المعايير العالمية وبأحدث أجهزة RT-PCR عالية الدقة (GeneXpert الأمريكي وغيره)، وهي طرق معتمدة من قبل هيئة الغذاء والدواء وكذلك من قبل المركز السعودي للوقاية من الأمراض المُعدية" + "covid_info": "تجري مستشفيات د. سليمان الحبيب فحص فيروس كورونا المستجد وتصدر شهادات السفر على مدار الساعة، طوال أيام الأسبوع، وبسرعة ودقة عالية. يمكن للراغبين في الاستفادة من هذه الخدمة زيارة أحد فروع مستشفيات د. سليمان الحبيب وإجراء فحص كورونا خلال بضع دقائق والحصول على النتائج خلال عدة ساعات خدمة فحص فيروس كورونا Covid 19 بتقنية PCR للكشف عن الفيروس وفقاً لأعلى المعايير العالمية وبأحدث أجهزة RT-PCR عالية الدقة (GeneXpert الأمريكي وغيره)، وهي طرق معتمدة من قبل هيئة الغذاء والدواء وكذلك من قبل المركز السعودي للوقاية من الأمراض المُعدية", + + "appointmentDetails": "تفاصيل الموعد", + "checkingDoctorAvailability": "جاري التحقق من توفر الطبيب...", + "cancellingAppointmentPleaseWait": "جاري إلغاء الموعد، يرجى الانتظار...", + "appointmentCancelledSuccessfully": "تم إلغاء الموعد بنجاح", + "notConfirmed": "غير مؤكد", + "appointmentStatus": "حالة الموعد", + "doctorWillCallYou": "سيتصل بك الطبيب عندما يقترب موعدك.", + "getDirections": "الحصول على الاتجاهات", + "notifyMeBeforeAppointment": "أبلغني قبل الموعد", + "fetchingLabResults": "جاري جلب نتائج المختبر...", + "fetchingRadiologyResults": "جاري جلب نتائج الأشعة...", + "fetchingAppointmentPrescriptions": "جاري جلب وصفات الموعد...", + "noPrescriptionsForAppointment": "ليس لديك أي وصفات طبية لهذا الموعد.", + "amountBeforeTax": "المبلغ قبل الضريبة", + "rebookAppointment": "إعادة حجز الموعد", + "fetchingDoctorSchedulePleaseWait": "جاري جلب جدول الطبيب، يرجى الانتظار...", + "pickADate": "اختر تاريخاً", + "confirmingAppointmentPleaseWait": "جاري تأكيد الموعد، يرجى الانتظار...", + "appointmentConfirmedSuccessfully": "تم تأكيد الموعد بنجاح", + "appointmentPayment": "دفع الموعد", + "checkingPaymentStatusPleaseWait": "جاري التحقق من حالة الدفع، يرجى الانتظار...", + "paymentFailedPleaseTryAgain": "فشل الدفع! يرجى المحاولة مرة أخرى.", + "appointmentCheckIn": "تسجيل حضور الموعد", + "insuranceExpiredOrInactive": "التأمين منتهي الصلاحية أو غير نشط", + "totalAmountToPay": "المبلغ الإجمالي المستحق", + "vat15": "ضريبة القيمة المضافة 15%", + "general": "عام", + "liveCare": "لايف كير", + "recentVisits": "الزيارات الأخيرة", + "searchByClinic": "البحث حسب العيادة", + "tapToSelectClinic": "انقر لاختيار العيادة", + "searchByDoctor": "البحث حسب الطبيب", + "tapToSelect": "انقر للاختيار", + "searchByRegion": "البحث حسب المنطقة", + "centralRegion": "المنطقة الوسطى", + "immediateConsultation": "استشارة فورية", + "scheduledConsultation": "استشارة مجدولة", + "pharmaLiveCare": "لايف كير الصيدلية", + "notSureHelpMeChooseClinic": "غير متأكد؟ ساعدني في اختيار عيادة!", + "mentionYourSymptomsAndFindDoctors": "اذكر أعراضك واعثر على قائمة الأطباء وفقاً لذلك", + "immediateService": "خدمة فورية", + "noNeedToWaitGetMedicalConsultation": "لا حاجة للانتظار، ستحصل على استشارة طبية فورية عبر مكالمة فيديو", + "noVisitRequired": "لا حاجة للزيارة", + "doctorWillContact": "سيتصل بك الطبيب", + "specialisedDoctorWillContactYou": "سيتصل بك طبيب متخصص وسيكون قادراً على الاطلاع على تاريخك الطبي", + "freeMedicineDelivery": "توصيل مجاني للأدوية", + "offersFreeMedicineDelivery": "يوفر توصيل مجاني للأدوية لموعد لايف كير", + "dentalChiefComplaints": "الشكاوى الرئيسة للأسنان", + "viewAvailableAppointments": "عرض المواعيد المتاحة", + "doctorProfile": "الملف للطبيب", + "waitingAppointment": "موعد الانتظار", + "hospitalInformation": "معلومات المستشفى", + "fetchingAppointmentShare": "جاري جلب تفاصيل الموعد...", + "bookingYourAppointment": "جاري حجز موعدك...", + "selectLiveCareClinic": "اختر عيادة لايف كير", + "checkingForExistingDentalPlan": "جاري التحقق من وجود خطة أسنان حالية، يرجى الانتظار...", + "dentalTreatmentPlan": "خطة علاج الأسنان", + "youHaveExistingTreatmentPlan": "لديك خطة علاج حالية: ", + "mins": "دقيقة", + "totalTimeRequired": "إجمالي الوقت المطلوب", + "wouldYouLikeToContinue": "هل تريد متابعتها؟", + "chooseDoctor": "اختر الطبيب", + "viewNearestAppos": "عرض أقرب المواعيد المتاحة", + "noDoctorFound": "لم يتم العثور على طبيب مطابق للمعايير المحددة...", + "yesPleasImInAHurry": "نعم من فضلك، أنا في عجلة من أمري", + "fetchingFeesPleaseWait": "جاري جلب الرسوم، يرجى الانتظار...", + "noThanksPhysicalVisit": "لا، شكراً. أفضل الزيارة الشخصية", + "offline": "غير متصل", + "videoCall": "مكالمة فيديو", + "liveVideoCallWithHMGDoctors": "مكالمة فيديو مباشرة مع أطباء مجموعة الحبيب الطبية", + "audioCall": "مكالمة صوتية", + "phoneCall": "مكالمة هاتفية", + "livePhoneCallWithHMGDoctors": "مكالمة هاتفية مباشرة مع أطباء مجموعة الحبيب الطبية", + "reviewLiveCareRequest": "مراجعة طلب لايف كير", + "selectedLiveCareType": "نوع لايف كير المحدد", + "selectLiveCareCallType": "اختر نوع مكالمة لايف كير", + "confirmingLiveCareRequest": "جاري تأكيد طلب لايف كير، يرجى الانتظار...", + "unknownErrorOccurred": "حدث خطأ غير معروف...", + "liveCarePermissionsMessage": "يتطلب لايف كير أذونات الكاميرا والميكروفون والموقع والإشعارات لتمكين الاستشارة الافتراضية بين المريض والطبيب، يرجى السماح بهذه الأذونات للمتابعة.", + "liveCarePayment": "دفع لايف كير", + "mada": "مدى", + "visaOrMastercard": "فيزا أو ماستركارد", + "tamara": "تمارا", + "fetchingApplePayDetails": "جاري جلب تفاصيل Apple Pay، يرجى الانتظار...", + "liveCarePendingRequest": "لايف كير حية معلق", + "callLiveCareSupport": "اتصل بدعم لايف كير", + "whatIsWaitingAppointment": "ما هو موعد الانتظار؟", + "waitingAppointmentsFeature": "تتيح لك ميزة مواعيد الانتظار حجز موعد أثناء تواجدك داخل مبنى المستشفى، وفي حال عدم توفر فتحة متاحة في جدول الطبيب.", + "appointmentWithDoctorConfirmed": "الموعد مع الطبيب مؤكد، ولكن وقت الدخول غير محدد.", + "paymentWithinTenMinutes": "ملاحظة: يجب عليك الدفع خلال 10 دقائق من الحجز، وإلا سيتم إلغاء موعدك تلقائياً", + "liveLocation": "الموقع المباشر", + "verifyYourLocationAtHospital": "تحقق من موقعك في المستشفى لتسجيل الحضور", + "error": "خطأ", + "ensureWithinHospitalLocation": "يرجى التأكد من أنك داخل موقع المستشفى لإجراء تسجيل الحضور عبر الإنترنت.", + "nfcNearFieldCommunication": "NFC (الاتصال قريب المدى)", + "scanPhoneViaNFC": "امسح هاتفك عبر لوحة NFC لتسجيل الحضور", + "qrCode": "رمز QR", + "scanQRCodeToCheckIn": "امسح رمز QR بالكاميرا لتسجيل الحضور", + "processingCheckIn": "جاري معالجة تسجيل الحضور...", + "bookingWaitingAppointment": "جاري حجز موعد الانتظار، يرجى الانتظار...", + "enterValidIDorIqama": "يرجى إدخال رقم هوية وطنية أو رقم ملف صالح", + "selectAppointment": "حدد الموعد", + "rebookSameDoctor": "أعد الحجز مع نفس الطبيب", + "queueing": "قائمة الانتظار", + "inQueue": "في قائمة الانتظار", + "yourTurn": "دورك", + "halaFirstName": "هلا {firstName}!!!", + "thankYouForPatience": "شكراً لصبرك، هذا هو رقم قائمة الانتظار الخاص بك.", + "servingNow": "يُخدم الآن", + "callForVitalSigns": "نداء للعلامات الحيوية", + "callForDoctor": "نداء للطبيب", + "thingsToAskDoctor": "أشياء تسأل طبيبك عنها اليوم", + "improveOverallHealth": "ماذا يمكنني أن أفعل لتحسين صحتي العامة؟", + "routineScreenings": "هل هناك أي فحوصات روتينية يجب أن أجريها؟", + "whatIsThisMedicationFor": "لماذا هذا الدواء؟", + "sideEffectsToKnow": "هل هناك أي آثار جانبية يجب أن أعرفها؟", + "whenFollowUp": "متى يجب أن أعود للمتابعة؟", + "goToHomepage": "الذهاب إلى الصفحة الرئيسية", + "appointmentsList": "قائمة المواعيد", + "allAppt": "جميع المواعيد", + "upcoming": "القادمة", + "completed": "المكتملة", + "noAppointmentsYet": "ليس لديك أي مواعيد بعد.", + "viewProfile": "عرض الملف الشخصي", + "choosePreferredHospitalForService": "اختر المستشفى المفضل لديك للخدمة", + "noHospitalsFound": "لم يتم العثور على مستشفيات", + "cancelOrderConfirmation": "هل أنت متأكد أنك تريد إلغاء هذا الطلب؟", + "orderCancelledSuccessfully": "تم إلغاء الطلب بنجاح", + "requestID": "معرف الطلب:", + "noCMCOrdersYet": "ليس لديك أي طلبات فحص شامل بعد.", + "cmcOrders": "طلبات الفحص الشامل" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 7839083..6244157 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -864,7 +864,7 @@ "endDate": "End Date", "hmgHospitals": "HMG Hospitals", "hmcMedicalClinic": "HMC Medical Centers", - "applyFilter": "AppLy Filter", + "applyFilter": "Apply Filter", "facilityAndLocation": "Facility and Location", "regionAndLocation": "Region And Locations", "clearAllFilters": "Clear all filters", @@ -873,5 +873,137 @@ "walkin": "Walk In", "continueString": "Continue", "laserClinic": "Laser Clinic", - "covid_info" :"Dr. Sulaiman Al Habib hospitals are conducting a test for the emerging corona virus and issuing travel certificates 24/7 in a short time and with high accuracy. Those wishing to benefit from this service can visit one of Dr. Sulaiman Al Habib branches to conduct a corona test within few minutes, and obtain the result within several hours. Corona Virus Covid 19 testing service with PCR technology to detect the virus according to the highest international standards and with the latest high-precision RT-PCR devices (American GeneXpert and others), That is approved by the Food and Drug Authority as well as by the Saudi Center for Infectious Diseases Prevention." + "covid_info" :"Dr. Sulaiman Al Habib hospitals are conducting a test for the emerging corona virus and issuing travel certificates 24/7 in a short time and with high accuracy. Those wishing to benefit from this service can visit one of Dr. Sulaiman Al Habib branches to conduct a corona test within few minutes, and obtain the result within several hours. Corona Virus Covid 19 testing service with PCR technology to detect the virus according to the highest international standards and with the latest high-precision RT-PCR devices (American GeneXpert and others), That is approved by the Food and Drug Authority as well as by the Saudi Center for Infectious Diseases Prevention.", + "appointmentDetails": "Appointment Details", + "checkingDoctorAvailability": "Checking doctor availability...", + "cancellingAppointmentPleaseWait": "Cancelling Appointment, Please Wait...", + "appointmentCancelledSuccessfully": "Appointment Cancelled Successfully", + "notConfirmed": "Not Confirmed", + "appointmentStatus": "Appointment Status", + "doctorWillCallYou": "The doctor will call you once the appointment time approaches.", + "getDirections": "Get Directions", + "notifyMeBeforeAppointment": "Notify me before the appointment", + "fetchingLabResults": "Fetching Lab Results...", + "fetchingRadiologyResults": "Fetching Radiology Results...", + "fetchingAppointmentPrescriptions": "Fetching Appointment Prescriptions...", + "noPrescriptionsForAppointment": "You don't have any prescriptions for this appointment.", + "amountBeforeTax": "Amount before tax", + "rebookAppointment": "Re-book Appointment", + "fetchingDoctorSchedulePleaseWait": "Fetching Doctor Schedule, Please Wait...", + "pickADate": "Pick a Date", + "confirmingAppointmentPleaseWait": "Confirming Appointment, Please Wait...", + "appointmentConfirmedSuccessfully": "Appointment Confirmed Successfully", + + "appointmentPayment": "Appointment Payment", + "checkingPaymentStatusPleaseWait": "Checking payment status, Please wait...", + "paymentFailedPleaseTryAgain": "Payment Failed! Please try again.", + "appointmentCheckIn": "Appointment check in", + "insuranceExpiredOrInactive": "Insurance expired or inactive", + "totalAmountToPay": "Total amount to pay", + "vat15": "VAT 15%", + "general": "General", + "liveCare": "LiveCare", + "recentVisits": "Recent Visits", + "searchByClinic": "Search By Clinic", + "tapToSelectClinic": "Tap to select clinic", + "searchByDoctor": "Search By Doctor", + "tapToSelect": "Tap to select", + "searchByRegion": "Search By Region", + "centralRegion": "Central Region", + "immediateConsultation": "Immediate Consultation", + "scheduledConsultation": "Scheduled Consultation", + "pharmaLiveCare": "Pharma LiveCare", + "notSureHelpMeChooseClinic": "Not sure? help me choose a clinic!", + "mentionYourSymptomsAndFindDoctors": "Mention your symptoms and find the list of doctors accordingly", + "immediateService": "Immediate service", + "noNeedToWaitGetMedicalConsultation": "No need to wait, you will get medical consultation immediately via video call", + "noVisitRequired": "No visit required", + "doctorWillContact": "Doctor will contact", + "specialisedDoctorWillContactYou": "A specialised 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", + "dentalChiefComplaints": "Dental Chief Complaints", + "viewAvailableAppointments": "View available appointments", + "doctorProfile": "Doctor Profile", + "waitingAppointment": "Waiting Appointment", + "hospitalInformation": "Hospital Information", + "fetchingAppointmentShare": "Fetching Appointment Share...", + "bookingYourAppointment": "Booking your appointment...", + "selectLiveCareClinic": "Select LiveCare Clinic", + "checkingForExistingDentalPlan": "Checking for an existing dental plan, Please wait...", + "dentalTreatmentPlan": "Dental treatment plan", + "youHaveExistingTreatmentPlan": "You have an existing treatment plan: ", + "mins": "Mins", + "totalTimeRequired": "Total time required", + "wouldYouLikeToContinue": "Would you like to continue it?", + "chooseDoctor": "Choose Doctor", + "viewNearestAppos": "View nearest available appointments", + "noDoctorFound": "No Doctor found for selected criteria...", + "yesPleasImInAHurry": "Yes please, I am in a hurry", + "fetchingFeesPleaseWait": "Fetching fees, Please wait...", + "noThanksPhysicalVisit": "No, Thanks. I would like a physical visit", + "offline": "Offline", + "videoCall": "Video Call", + "liveVideoCallWithHMGDoctors": "Live Video Call with HMG Doctors", + "audioCall": "Audio Call", + "phoneCall": "Phone Call", + "livePhoneCallWithHMGDoctors": "Live Phone Call with HMG Doctors", + "reviewLiveCareRequest": "Review LiveCare Request", + "selectedLiveCareType": "Selected LiveCare Type", + "selectLiveCareCallType": "Select LiveCare call type", + "confirmingLiveCareRequest": "Confirming LiveCare request, Please wait...", + "unknownErrorOccurred": "Unknown error occurred...", + "liveCarePermissionsMessage": "LiveCare requires Camera, Microphone, Location & Notifications permissions to enable virtual consultation between patient & doctor, Please allow these to proceed.", + "liveCarePayment": "LiveCare Payment", + "mada": "Mada", + "visaOrMastercard": "Visa or Mastercard", + "tamara": "Tamara", + "fetchingApplePayDetails": "Fetching Apple Pay details, Please wait...", + "liveCarePendingRequest": "LiveCare Pending Request", + "callLiveCareSupport": "Call LiveCare Support", + "whatIsWaitingAppointment": "What is Waiting Appointment?", + "waitingAppointmentsFeature": "The waiting appointments feature allows you to book an appointment while you are inside the hospital building, and in case there is no available slot in the doctor's schedule.", + "appointmentWithDoctorConfirmed": "The appointment with the doctor is confirmed, but the time of entry is uncertain.", + "paymentWithinTenMinutes": "Note: You must have to pay within 10 minutes of booking, otherwise your appointment will be cancelled automatically", + "liveLocation": "Live Location", + "verifyYourLocationAtHospital": "Verify your location to be at hospital to check in", + "error": "Error", + "ensureWithinHospitalLocation": "Please ensure you're within the hospital location to perform online check-in.", + "nfcNearFieldCommunication": "NFC (Near Field Communication)", + "scanPhoneViaNFC": "Scan your phone via NFC board to check in", + "qrCode": "QR Code", + "scanQRCodeToCheckIn": "Scan QR code with your camera to check in", + "processingCheckIn": "Processing Check-In...", + "bookingWaitingAppointment": "Booking Waiting Appointment, Please wait...", + "enterValidIDorIqama": "Please enter a valid national ID or file number", + "selectAppointment": "Select Appointment", + "rebookSameDoctor": "Rebook with same doctor", + "queueing": "Queueing", + "inQueue": "In Queue", + "yourTurn": "Your Turn", + "halaFirstName": "Hala {firstName}!!!", + "thankYouForPatience": "Thank you for your patience, here is your queue number.", + "servingNow": "Serving Now", + "callForVitalSigns": "Call for vital signs", + "callForDoctor": "Call for Doctor", + "thingsToAskDoctor": "Things to ask your doctor today", + "improveOverallHealth": "What can I do to improve my overall health?", + "routineScreenings": "Are there any routine screenings I should get?", + "whatIsThisMedicationFor": "What is this medication for?", + "sideEffectsToKnow": "Are there any side effects I should know about?", + "whenFollowUp": "When should I come back for a follow-up?", + "goToHomepage": "Go to homepage", + "appointmentsList": "Appointments List", + "allAppt": "All Appt.", + "upcoming": "Upcoming", + "completed": "Completed", + "noAppointmentsYet": "You don't have any appointments yet.", + "viewProfile": "View Profile", + "choosePreferredHospitalForService": "Choose your preferred hospital for the service", + "noHospitalsFound": "No hospitals Found", + "cancelOrderConfirmation": "Are you sure you want to cancel this order?", + "orderCancelledSuccessfully": "Order has been cancelled successfully", + "requestID": "Request ID:", + "noCMCOrdersYet": "You don't have any CMC orders yet.", + "cmcOrders": "CMC Orders" } \ No newline at end of file diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index f550c81..f57a48b 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -475,7 +475,7 @@ abstract class LocaleKeys { static const shareReview = 'shareReview'; static const review = 'review'; static const viewMedicalFile = 'viewMedicalFile'; - static String get viewAllServices => 'viewAllServices'; + static const viewAllServices = 'viewAllServices'; static const medicalFile = 'medicalFile'; static const verified = 'verified'; static const checkup = 'checkup'; @@ -876,5 +876,135 @@ abstract class LocaleKeys { static const laserClinic = 'laserClinic'; static const continueString = 'continueString'; static const covid_info = 'covid_info'; + static const appointmentDetails = 'appointmentDetails'; + static const checkingDoctorAvailability = 'checkingDoctorAvailability'; + static const cancellingAppointmentPleaseWait = 'cancellingAppointmentPleaseWait'; + static const appointmentCancelledSuccessfully = 'appointmentCancelledSuccessfully'; + static const notConfirmed = 'notConfirmed'; + static const appointmentStatus = 'appointmentStatus'; + static const doctorWillCallYou = 'doctorWillCallYou'; + static const getDirections = 'getDirections'; + static const notifyMeBeforeAppointment = 'notifyMeBeforeAppointment'; + static const fetchingLabResults = 'fetchingLabResults'; + static const fetchingRadiologyResults = 'fetchingRadiologyResults'; + static const fetchingAppointmentPrescriptions = 'fetchingAppointmentPrescriptions'; + static const noPrescriptionsForAppointment = 'noPrescriptionsForAppointment'; + static const amountBeforeTax = 'amountBeforeTax'; + static const rebookAppointment = 'rebookAppointment'; + static const fetchingDoctorSchedulePleaseWait = 'fetchingDoctorSchedulePleaseWait'; + static const pickADate = 'pickADate'; + static const confirmingAppointmentPleaseWait = 'confirmingAppointmentPleaseWait'; + static const appointmentConfirmedSuccessfully = 'appointmentConfirmedSuccessfully'; + static const appointmentPayment = 'appointmentPayment'; + static const checkingPaymentStatusPleaseWait = 'checkingPaymentStatusPleaseWait'; + static const paymentFailedPleaseTryAgain = 'paymentFailedPleaseTryAgain'; + static const appointmentCheckIn = 'appointmentCheckIn'; + static const insuranceExpiredOrInactive = 'insuranceExpiredOrInactive'; + static const totalAmountToPay = 'totalAmountToPay'; + static const vat15 = 'vat15'; + static const liveCare = 'liveCare'; + static const recentVisits = 'recentVisits'; + static const searchByClinic = 'searchByClinic'; + static const tapToSelectClinic = 'tapToSelectClinic'; + static const searchByDoctor = 'searchByDoctor'; + static const tapToSelect = 'tapToSelect'; + static const searchByRegion = 'searchByRegion'; + static const centralRegion = 'centralRegion'; + static const immediateConsultation = 'immediateConsultation'; + static const scheduledConsultation = 'scheduledConsultation'; + static const pharmaLiveCare = 'pharmaLiveCare'; + static const notSureHelpMeChooseClinic = 'notSureHelpMeChooseClinic'; + static const mentionYourSymptomsAndFindDoctors = 'mentionYourSymptomsAndFindDoctors'; + static const immediateService = 'immediateService'; + static const noNeedToWaitGetMedicalConsultation = 'noNeedToWaitGetMedicalConsultation'; + static const noVisitRequired = 'noVisitRequired'; + static const doctorWillContact = 'doctorWillContact'; + static const specialisedDoctorWillContactYou = 'specialisedDoctorWillContactYou'; + static const freeMedicineDelivery = 'freeMedicineDelivery'; + static const offersFreeMedicineDelivery = 'offersFreeMedicineDelivery'; + static const dentalChiefComplaints = 'dentalChiefComplaints'; + static const viewAvailableAppointments = 'viewAvailableAppointments'; + static const doctorProfile = 'doctorProfile'; + static const waitingAppointment = 'waitingAppointment'; + static const hospitalInformation = 'hospitalInformation'; + static const fetchingAppointmentShare = 'fetchingAppointmentShare'; + static const bookingYourAppointment = 'bookingYourAppointment'; + static const selectLiveCareClinic = 'selectLiveCareClinic'; + static const checkingForExistingDentalPlan = 'checkingForExistingDentalPlan'; + static const dentalTreatmentPlan = 'dentalTreatmentPlan'; + static const youHaveExistingTreatmentPlan = 'youHaveExistingTreatmentPlan'; + static const mins = 'mins'; + static const totalTimeRequired = 'totalTimeRequired'; + static const wouldYouLikeToContinue = 'wouldYouLikeToContinue'; + static const chooseDoctor = 'chooseDoctor'; + static const viewNearestAppos = 'viewNearestAppos'; + static const noDoctorFound = 'noDoctorFound'; + static const yesPleasImInAHurry = 'yesPleasImInAHurry'; + static const fetchingFeesPleaseWait = 'fetchingFeesPleaseWait'; + static const noThanksPhysicalVisit = 'noThanksPhysicalVisit'; + static const offline = 'offline'; + static const videoCall = 'videoCall'; + static const liveVideoCallWithHMGDoctors = 'liveVideoCallWithHMGDoctors'; + static const audioCall = 'audioCall'; + static const phoneCall = 'phoneCall'; + static const livePhoneCallWithHMGDoctors = 'livePhoneCallWithHMGDoctors'; + static const reviewLiveCareRequest = 'reviewLiveCareRequest'; + static const selectedLiveCareType = 'selectedLiveCareType'; + static const selectLiveCareCallType = 'selectLiveCareCallType'; + static const confirmingLiveCareRequest = 'confirmingLiveCareRequest'; + static const unknownErrorOccurred = 'unknownErrorOccurred'; + static const liveCarePermissionsMessage = 'liveCarePermissionsMessage'; + static const liveCarePayment = 'liveCarePayment'; + static const mada = 'mada'; + static const visaOrMastercard = 'visaOrMastercard'; + static const tamara = 'tamara'; + static const fetchingApplePayDetails = 'fetchingApplePayDetails'; + static const liveCarePendingRequest = 'liveCarePendingRequest'; + static const callLiveCareSupport = 'callLiveCareSupport'; + static const whatIsWaitingAppointment = 'whatIsWaitingAppointment'; + static const waitingAppointmentsFeature = 'waitingAppointmentsFeature'; + static const appointmentWithDoctorConfirmed = 'appointmentWithDoctorConfirmed'; + static const paymentWithinTenMinutes = 'paymentWithinTenMinutes'; + static const liveLocation = 'liveLocation'; + static const verifyYourLocationAtHospital = 'verifyYourLocationAtHospital'; + static const error = 'error'; + static const ensureWithinHospitalLocation = 'ensureWithinHospitalLocation'; + static const nfcNearFieldCommunication = 'nfcNearFieldCommunication'; + static const scanPhoneViaNFC = 'scanPhoneViaNFC'; + static const qrCode = 'qrCode'; + static const scanQRCodeToCheckIn = 'scanQRCodeToCheckIn'; + static const processingCheckIn = 'processingCheckIn'; + static const bookingWaitingAppointment = 'bookingWaitingAppointment'; + static const enterValidIDorIqama = 'enterValidIDorIqama'; + static const selectAppointment = 'selectAppointment'; + static const rebookSameDoctor = 'rebookSameDoctor'; + static const queueing = 'queueing'; + static const inQueue = 'inQueue'; + static const yourTurn = 'yourTurn'; + static const halaFirstName = 'halaFirstName'; + static const thankYouForPatience = 'thankYouForPatience'; + static const servingNow = 'servingNow'; + static const callForVitalSigns = 'callForVitalSigns'; + static const callForDoctor = 'callForDoctor'; + static const thingsToAskDoctor = 'thingsToAskDoctor'; + static const improveOverallHealth = 'improveOverallHealth'; + static const routineScreenings = 'routineScreenings'; + static const whatIsThisMedicationFor = 'whatIsThisMedicationFor'; + static const sideEffectsToKnow = 'sideEffectsToKnow'; + static const whenFollowUp = 'whenFollowUp'; + static const goToHomepage = 'goToHomepage'; + static const appointmentsList = 'appointmentsList'; + static const allAppt = 'allAppt'; + static const upcoming = 'upcoming'; + static const completed = 'completed'; + static const noAppointmentsYet = 'noAppointmentsYet'; + static const viewProfile = 'viewProfile'; + static const choosePreferredHospitalForService = 'choosePreferredHospitalForService'; + static const noHospitalsFound = 'noHospitalsFound'; + static const cancelOrderConfirmation = 'cancelOrderConfirmation'; + static const orderCancelledSuccessfully = 'orderCancelledSuccessfully'; + static const requestID = 'requestID'; + static const noCMCOrdersYet = 'noCMCOrdersYet'; + static const cmcOrders = 'cmcOrders'; } diff --git a/lib/presentation/appointments/appointment_details_page.dart b/lib/presentation/appointments/appointment_details_page.dart index bd81584..0b8066e 100644 --- a/lib/presentation/appointments/appointment_details_page.dart +++ b/lib/presentation/appointments/appointment_details_page.dart @@ -87,7 +87,7 @@ class _AppointmentDetailsPageState extends State { children: [ Expanded( child: CollapsingListView( - title: "Appointment Details".needTranslation, + title: LocaleKeys.appointmentDetails.tr(), report: AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel) ? () { contactUsViewModel.setPatientFeedbackSelectedAppointment(widget.patientAppointmentHistoryResponseModel); @@ -105,14 +105,13 @@ class _AppointmentDetailsPageState extends State { AppointmentDoctorCard( patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, onAskDoctorTap: () async { - LoaderBottomSheet.showLoader(loadingText: "Checking doctor availability...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingDoctorAvailability.tr()); await myAppointmentsViewModel.isDoctorAvailable( projectID: widget.patientAppointmentHistoryResponseModel.projectID, doctorId: widget.patientAppointmentHistoryResponseModel.doctorID, clinicId: widget.patientAppointmentHistoryResponseModel.clinicID, onSuccess: (value) async { if (value) { - print("Doctor is available"); await myAppointmentsViewModel.getAskDoctorRequestTypes(onSuccess: (val) { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( @@ -129,14 +128,14 @@ class _AppointmentDetailsPageState extends State { ); }); } else { - print("Doctor is not available"); + debugPrint("Doctor is not available"); } }); }, onCancelTap: () async { myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true); - LoaderBottomSheet.showLoader(loadingText: "Cancelling Appointment, Please Wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.cancellingAppointmentPleaseWait.tr()); await myAppointmentsViewModel.cancelAppointment( patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, onSuccess: (apiResponse) { @@ -145,7 +144,7 @@ class _AppointmentDetailsPageState extends State { myAppointmentsViewModel.getPatientAppointments(true, false); showCommonBottomSheetWithoutHeight( context, - child: Utils.getSuccessWidget(loadingText: "Appointment Cancelled Successfully".needTranslation), + child: Utils.getSuccessWidget(loadingText: LocaleKeys.appointmentCancelledSuccessfully.tr()), callBackFunc: () { Navigator.of(context).pop(); }, @@ -182,13 +181,13 @@ class _AppointmentDetailsPageState extends State { children: [ Row( children: [ - "Appointment Status".needTranslation.toText16(isBold: true), + LocaleKeys.appointmentStatus.tr().toText16(isBold: true), ], ), SizedBox(height: 4.h), (!AppointmentType.isConfirmed(widget.patientAppointmentHistoryResponseModel) - ? "Not Confirmed".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500) - : "Confirmed".needTranslation.toText12(color: AppColors.successColor, fontWeight: FontWeight.w500)), + ? LocaleKeys.notConfirmed.tr().toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500) + : LocaleKeys.confirmed.tr().toText12(color: AppColors.successColor, fontWeight: FontWeight.w500)), SizedBox(height: 16.h), //TODO Add countdown timer in case of LiveCare Appointment widget.patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false @@ -200,9 +199,7 @@ class _AppointmentDetailsPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "The doctor will call you once the appointment time approaches." - .needTranslation - .toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + LocaleKeys.doctorWillCallYou.tr().toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), ), @@ -224,11 +221,11 @@ class _AppointmentDetailsPageState extends State { child: SizedBox( width: MediaQuery.of(context).size.width * 0.785, child: CustomButton( - text: "Get Directions".needTranslation, onPressed: () { MapsLauncher.launchCoordinates(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), double.parse(widget.patientAppointmentHistoryResponseModel.longitude!), widget.patientAppointmentHistoryResponseModel.projectName); }, + text: LocaleKeys.getDirections.tr(), backgroundColor: AppColors.textColor.withValues(alpha: 0.8), borderColor: AppointmentType.getNextActionButtonColor(widget.patientAppointmentHistoryResponseModel.nextAction).withValues(alpha: 0.01), textColor: AppColors.whiteColor, @@ -283,9 +280,7 @@ class _AppointmentDetailsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ LocaleKeys.setReminder.tr(context: context).toText13(isBold: true), - "Notify me before the appointment" - .needTranslation - .toText11(color: AppColors.textColorLight, weight: FontWeight.w500), + LocaleKeys.notifyMeBeforeAppointment.tr().toText11(color: AppColors.textColorLight, weight: FontWeight.w500), ], ), const Spacer(), @@ -307,8 +302,9 @@ class _AppointmentDetailsPageState extends State { "${widget.patientAppointmentHistoryResponseModel.appointmentNo}"??"", "", "", - title: "Appointment with ${widget.patientAppointmentHistoryResponseModel.doctorNameObj}".needTranslation, - description:"${widget.patientAppointmentHistoryResponseModel.doctorNameObj} will be having an appointment on ${widget.patientAppointmentHistoryResponseModel.appointmentDate}".needTranslation, + title: "Appointment with ${widget.patientAppointmentHistoryResponseModel.doctorNameObj}", + description: + "${widget.patientAppointmentHistoryResponseModel.doctorNameObj} will be having an appointment on ${widget.patientAppointmentHistoryResponseModel.appointmentDate}", onSuccess: () { setState(() { myAppointmentsViewModel.setAppointmentReminder(newValue, widget.patientAppointmentHistoryResponseModel); @@ -318,10 +314,10 @@ class _AppointmentDetailsPageState extends State { onMultiDateSuccess: (int selectedIndex) async { isEventAddedOrRemoved = await calender.createOrUpdateEvent( - title: "Appointment Reminder with ${widget.patientAppointmentHistoryResponseModel.doctorNameObj} on ${DateUtil.convertStringToDate(widget - .patientAppointmentHistoryResponseModel.appointmentDate)}, Appointment #${widget.patientAppointmentHistoryResponseModel.appointmentNo}".needTranslation, - description: "Appointment Reminder with ${widget.patientAppointmentHistoryResponseModel.doctorNameObj} in ${widget - .patientAppointmentHistoryResponseModel.projectName}", + title: + "Appointment Reminder with ${widget.patientAppointmentHistoryResponseModel.doctorNameObj} on ${DateUtil.convertStringToDate(widget.patientAppointmentHistoryResponseModel.appointmentDate)}, Appointment #${widget.patientAppointmentHistoryResponseModel.appointmentNo}", + description: + "Appointment Reminder with ${widget.patientAppointmentHistoryResponseModel.doctorNameObj} in ${widget.patientAppointmentHistoryResponseModel.projectName}", scheduleDateTime: DateUtil.convertStringToDate(widget .patientAppointmentHistoryResponseModel.appointmentDate), eventId: "${widget.patientAppointmentHistoryResponseModel.appointmentNo}", @@ -369,7 +365,7 @@ class _AppointmentDetailsPageState extends State { isLargeText: true, iconSize: 36.w, ).onPress(() async { - LoaderBottomSheet.showLoader(loadingText: "Fetching Lab Results...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingLabResults.tr()); await labViewModel.getLabResultsByAppointmentNo( appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo, projectID: widget.patientAppointmentHistoryResponseModel.projectID, @@ -402,7 +398,7 @@ class _AppointmentDetailsPageState extends State { isLargeText: true, iconSize: 36.w, ).onPress(() async { - LoaderBottomSheet.showLoader(loadingText: "Fetching Radiology Results...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingRadiologyResults.tr()); await radiologyViewModel.getPatientRadiologyOrdersByAppointment( appointmentNo: widget.patientAppointmentHistoryResponseModel.appointmentNo, projectID: widget.patientAppointmentHistoryResponseModel.projectID, @@ -429,7 +425,7 @@ class _AppointmentDetailsPageState extends State { isLargeText: true, iconSize: 36.w, ).onPress(() async { - LoaderBottomSheet.showLoader(loadingText: "Fetching Appointment Prescriptions...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingAppointmentPrescriptions.tr()); await prescriptionsViewModel.getPrescriptionDetails( getPrescriptionRequestModel(), onSuccess: (val) { @@ -457,8 +453,7 @@ class _AppointmentDetailsPageState extends State { } else { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget( - loadingText: "You don't have any prescriptions for this appointment.".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.noPrescriptionsForAppointment.tr()), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -713,7 +708,7 @@ class _AppointmentDetailsPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Amount before tax".needTranslation.toText18(isBold: true), + LocaleKeys.amountBeforeTax.tr().toText18(isBold: true), Utils.getPaymentAmountWithSymbol( widget.patientAppointmentHistoryResponseModel.patientShare!.toString().toText16(isBold: true), AppColors.blackColor, @@ -730,7 +725,6 @@ class _AppointmentDetailsPageState extends State { .tr(context: context) .toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor)), "VAT 15%(${widget.patientAppointmentHistoryResponseModel.patientTaxAmount})" - .needTranslation .toText14(isBold: true, color: AppColors.greyTextColor, letterSpacing: -2), ], ), @@ -758,7 +752,7 @@ class _AppointmentDetailsPageState extends State { ).paddingOnly(left: 16.h, top: 24.h, right: 16.h, bottom: 0.h), AppointmentType.isArrived(widget.patientAppointmentHistoryResponseModel) ? CustomButton( - text: "Re-book Appointment".needTranslation, + text: LocaleKeys.rebookAppointment.tr(), onPressed: () { openDoctorScheduleCalendar(); }, @@ -816,13 +810,13 @@ class _AppointmentDetailsPageState extends State { projectName: widget.patientAppointmentHistoryResponseModel.projectName, ); bookAppointmentsViewModel.setSelectedDoctor(doctor); - LoaderBottomSheet.showLoader(loadingText: "Fetching Doctor Schedule, Please Wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingDoctorSchedulePleaseWait.tr()); await bookAppointmentsViewModel.getDoctorFreeSlots( isBookingForLiveCare: false, onSuccess: (dynamic respData) async { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( - title: "Pick a Date".needTranslation, + title: LocaleKeys.pickADate.tr(), context, child: AppointmentCalendar(), isFullScreen: false, @@ -847,15 +841,14 @@ class _AppointmentDetailsPageState extends State { case 0: break; case 10: - LoaderBottomSheet.showLoader(loadingText: "Confirming Appointment, Please Wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.confirmingAppointmentPleaseWait.tr()); await myAppointmentsViewModel.confirmAppointment( patientAppointmentHistoryResponseModel: widget.patientAppointmentHistoryResponseModel, onSuccess: (apiResponse) { LoaderBottomSheet.hideLoader(); myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true); myAppointmentsViewModel.getPatientAppointments(true, false); - showCommonBottomSheet(context, child: Utils.getSuccessWidget(loadingText: "Appointment Confirmed Successfully".needTranslation), - callBackFunc: (str) { + showCommonBottomSheet(context, child: Utils.getSuccessWidget(loadingText: LocaleKeys.appointmentConfirmedSuccessfully.tr()), callBackFunc: (str) { Navigator.of(context).pop(); }, title: "", diff --git a/lib/presentation/appointments/appointment_payment_page.dart b/lib/presentation/appointments/appointment_payment_page.dart index 475ee70..a38a9f1 100644 --- a/lib/presentation/appointments/appointment_payment_page.dart +++ b/lib/presentation/appointments/appointment_payment_page.dart @@ -90,7 +90,7 @@ class _AppointmentPaymentPageState extends State { children: [ Expanded( child: CollapsingListView( - title: "Appointment Payment".needTranslation, + title: LocaleKeys.appointmentPayment.tr(), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -111,7 +111,7 @@ class _AppointmentPaymentPageState extends State { Image.asset(AppAssets.mada, width: 72.h, height: 25.h) .toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), SizedBox(height: 16.h), - "Mada".needTranslation.toText16(isBold: true).toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), + "Mada".toText16(isBold: true).toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), ], ), SizedBox(width: 8.h), @@ -154,7 +154,6 @@ class _AppointmentPaymentPageState extends State { ).toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), SizedBox(height: 16.h), "Visa or Mastercard" - .needTranslation .toText16(isBold: true) .toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), ], @@ -195,7 +194,6 @@ class _AppointmentPaymentPageState extends State { .toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), SizedBox(height: 16.h), "Tamara" - .needTranslation .toText16(isBold: true) .toShimmer2(isShow: myAppointmentsVM.isAppointmentPatientShareLoading), ], @@ -250,8 +248,7 @@ class _AppointmentPaymentPageState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Insurance expired or inactive" - .needTranslation + LocaleKeys.insuranceExpiredOrInactive.tr() .toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500) .paddingSymmetrical(24.h, 0.h), CustomButton( @@ -277,12 +274,12 @@ class _AppointmentPaymentPageState extends State { ) : const SizedBox(), SizedBox(height: 24.h), - "Total amount to pay".needTranslation.toText18(isBold: true).paddingSymmetrical(24.h, 0.h), + LocaleKeys.totalAmountToPay.tr().toText18(isBold: true).paddingSymmetrical(24.h, 0.h), SizedBox(height: 17.h), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Amount before tax".needTranslation.toText14(isBold: true), + LocaleKeys.amountBeforeTax.tr().toText14(isBold: true), Utils.getPaymentAmountWithSymbol( myAppointmentsVM.patientAppointmentShareResponseModel!.patientShare!.toString().toText16(isBold: true), AppColors.blackColor, @@ -293,7 +290,7 @@ class _AppointmentPaymentPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "VAT 15%".needTranslation.toText14(isBold: true, color: AppColors.greyTextColor), + "VAT 15%".toText14(isBold: true, color: AppColors.greyTextColor), Utils.getPaymentAmountWithSymbol( myAppointmentsVM.patientAppointmentShareResponseModel!.patientTaxAmount! .toString() @@ -307,7 +304,7 @@ class _AppointmentPaymentPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "".needTranslation.toText14(isBold: true), + "".toText14(isBold: true), Utils.getPaymentAmountWithSymbol( myAppointmentsVM.patientAppointmentShareResponseModel!.patientShareWithTax!.toString().toText24(isBold: true), AppColors.blackColor, @@ -383,7 +380,7 @@ class _AppointmentPaymentPageState extends State { } void checkPaymentStatus() async { - LoaderBottomSheet.showLoader(loadingText: "Checking payment status, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr()); if (selectedPaymentMethod == "TAMARA") { await payfortViewModel.checkTamaraPaymentStatus( transactionID: transID, @@ -441,7 +438,7 @@ class _AppointmentPaymentPageState extends State { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.paymentFailedPleaseTryAgain.tr()), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -522,7 +519,7 @@ class _AppointmentPaymentPageState extends State { } else { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.paymentFailedPleaseTryAgain.tr()), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/appointments/appointment_queue_page.dart b/lib/presentation/appointments/appointment_queue_page.dart index 124bf25..f205aeb 100644 --- a/lib/presentation/appointments/appointment_queue_page.dart +++ b/lib/presentation/appointments/appointment_queue_page.dart @@ -1,3 +1,4 @@ +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_state.dart'; @@ -7,6 +8,7 @@ import 'package:hmg_patient_app_new/core/utils/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/features/my_appointments/my_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -30,7 +32,7 @@ class AppointmentQueuePage extends StatelessWidget { children: [ Expanded( child: CollapsingListView( - title: "Queueing".needTranslation, + title: LocaleKeys.queueing.tr(context: context), child: SingleChildScrollView( child: Padding( padding: EdgeInsets.all(24.0), @@ -57,7 +59,7 @@ class AppointmentQueuePage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppCustomChipWidget( - labelText: myAppointmentsVM.currentQueueStatus == 0 ? "In Queue".needTranslation : "Your Turn".needTranslation, + labelText: myAppointmentsVM.currentQueueStatus == 0 ? LocaleKeys.inQueue.tr(context: context) : LocaleKeys.yourTurn.tr(context: context), backgroundColor: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus).withValues(alpha: 0.20), textColor: Utils.getCardBorderColor(myAppointmentsVM.currentQueueStatus), ), @@ -66,12 +68,10 @@ class AppointmentQueuePage extends StatelessWidget { ).toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), SizedBox(height: 10.h), "Hala ${appState!.getAuthenticatedUser()!.firstName}!!!" - .needTranslation .toText16(isBold: true) .toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), SizedBox(height: 8.h), - "Thank you for your patience, here is your queue number." - .needTranslation + LocaleKeys.thankYouForPatience.tr(context: context) .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight) .toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), SizedBox(height: 8.h), @@ -111,8 +111,7 @@ class AppointmentQueuePage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Serving Now" - .needTranslation + LocaleKeys.servingNow.tr(context: context) .toText16(isBold: true) .toShimmer2(isShow: myAppointmentsVM.isAppointmentQueueDetailsLoading), SizedBox(height: 18.h), @@ -138,8 +137,8 @@ class AppointmentQueuePage extends StatelessWidget { ? AppAssets.call_for_vitals : AppAssets.call_for_doctor, labelText: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 - ? "Call for vital signs".needTranslation - : "Call for Doctor".needTranslation, + ? LocaleKeys.callForVitalSigns.tr(context: context) + : LocaleKeys.callForDoctor.tr(context: context), iconColor: myAppointmentsVM.patientQueueDetailsList[index].callType == 1 ? AppColors.primaryRedColor : AppColors.successColor, @@ -180,35 +179,23 @@ class AppointmentQueuePage extends StatelessWidget { children: [ Utils.buildSvgWithAssets(icon: AppAssets.bulb_icon, width: 24.w, height: 24.h), SizedBox(width: 8.w), - "Things to ask your doctor today".needTranslation.toText16(isBold: true), + LocaleKeys.thingsToAskDoctor.tr(context: context).toText16(isBold: true), ], ), SizedBox(height: 8.h), - - // What can I do to improve my overall health? - // Are there any routine screenings I should get? - // What is this medication for? - // Are there any side effects I should know about? - // When should I come back for a follow-up? - - "• ${"What can I do to improve my overall health?"}" - .needTranslation + "• ${LocaleKeys.improveOverallHealth.tr(context: context)}" .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 4.h), - "• ${"Are there any routine screenings I should get?"}" - .needTranslation + "• ${LocaleKeys.routineScreenings.tr(context: context)}" .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 4.h), - "• ${"What is this medication for?"}" - .needTranslation + "• ${LocaleKeys.whatIsThisMedicationFor.tr(context: context)}" .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 4.h), - "• ${"Are there any side effects I should know about?"}" - .needTranslation + "• ${LocaleKeys.sideEffectsToKnow.tr(context: context)}" .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 4.h), - "• ${"When should I come back for a follow-up?"}" - .needTranslation + "• ${LocaleKeys.whenFollowUp.tr(context: context)}" .toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 16.h), @@ -229,7 +216,7 @@ class AppointmentQueuePage extends StatelessWidget { hasShadow: true, ), child: CustomButton( - text: "Go to homepage".needTranslation, + text: LocaleKeys.goToHomepage.tr(context: context), onPressed: () { Navigator.pushAndRemoveUntil( context, @@ -249,11 +236,10 @@ class AppointmentQueuePage extends StatelessWidget { icon: AppAssets.homeBottom, iconColor: AppColors.whiteColor, iconSize: 18.h, - ).paddingSymmetrical(16.h, 24.h), - ) + ).paddingSymmetrical(24.h, 24.h), + ), ], ); - }), - ); + })); } } diff --git a/lib/presentation/appointments/my_appointments_page.dart b/lib/presentation/appointments/my_appointments_page.dart index b4c3630..1209467 100644 --- a/lib/presentation/appointments/my_appointments_page.dart +++ b/lib/presentation/appointments/my_appointments_page.dart @@ -56,7 +56,7 @@ class _MyAppointmentsPageState extends State { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "Appointments List".needTranslation, + title: LocaleKeys.appointmentsList.tr(context: context), child: SingleChildScrollView( child: Column( children: [ @@ -65,9 +65,9 @@ class _MyAppointmentsPageState extends State { activeTextColor: Color(0xffED1C2B), activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), tabs: [ - CustomTabBarModel(null, "All Appt.".needTranslation), - CustomTabBarModel(null, "Upcoming".needTranslation), - CustomTabBarModel(null, "Completed".needTranslation), + CustomTabBarModel(null, LocaleKeys.allAppt.tr(context: context)), + CustomTabBarModel(null, LocaleKeys.upcoming.tr(context: context)), + CustomTabBarModel(null, LocaleKeys.completed.tr(context: context)), ], onTabChange: (index) { setState(() { @@ -248,7 +248,7 @@ class _MyAppointmentsPageState extends State { ) : Utils.getNoDataWidget( context, - noDataText: "You don't have any appointments yet.".needTranslation, + noDataText: LocaleKeys.noAppointmentsYet.tr(context: context), callToActionButton: CustomButton( text: LocaleKeys.bookAppo.tr(context: context), onPressed: () { @@ -296,7 +296,7 @@ class _MyAppointmentsPageState extends State { onClicked: () { if (myAppointmentsVM.availableFilters[index] == AppointmentListingFilters.DATESELECTION) { showCommonBottomSheetWithoutHeight( - title: "Set The Date Range".needTranslation, + title: LocaleKeys.setTheDateRange.tr(context: context), context, child: DateRangeSelector( onRangeSelected: (start, end) { diff --git a/lib/presentation/appointments/my_doctors_page.dart b/lib/presentation/appointments/my_doctors_page.dart index 2c5d1b0..3795ce1 100644 --- a/lib/presentation/appointments/my_doctors_page.dart +++ b/lib/presentation/appointments/my_doctors_page.dart @@ -211,7 +211,7 @@ class _MyDoctorsPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - AppCustomChipWidget(labelText: "${group.length} ${'doctors'.needTranslation}"), + AppCustomChipWidget(labelText: "${group.length} ${'doctors'}"), Icon(isExpanded ? Icons.expand_less : Icons.expand_more), ], ), @@ -284,7 +284,7 @@ class _MyDoctorsPageState extends State { icon: AppAssets.view_report_icon, iconColor: AppColors.primaryRedColor, iconSize: 16.h, - text: "View Profile".needTranslation.tr(context: context), + text: LocaleKeys.viewProfile.tr(context: context), onPressed: () async { bookAppointmentsViewModel.setSelectedDoctor(DoctorsListResponseModel( clinicID: doctor?.clinicID ?? 0, diff --git a/lib/presentation/appointments/widgets/appointment_card.dart b/lib/presentation/appointments/widgets/appointment_card.dart index 39e4e03..6b0439f 100644 --- a/lib/presentation/appointments/widgets/appointment_card.dart +++ b/lib/presentation/appointments/widgets/appointment_card.dart @@ -96,13 +96,13 @@ class AppointmentCard extends StatelessWidget { AppCustomChipWidget( icon: isLoading ? AppAssets.walkin_appointment_icon : (isLiveCare ? AppAssets.small_livecare_icon : AppAssets.walkin_appointment_icon), iconColor: isLoading ? AppColors.textColor : (isLiveCare ? AppColors.whiteColor : AppColors.textColor), - labelText: isLoading ? 'Walk In'.needTranslation : (isLiveCare ? LocaleKeys.livecare.tr(context: context) : 'Walk In'.needTranslation), + labelText: isLoading ? LocaleKeys.walkin.tr(context: context) : (isLiveCare ? LocaleKeys.livecare.tr(context: context) : LocaleKeys.walkin.tr(context: context)), backgroundColor: isLoading ? AppColors.greyColor : (isLiveCare ? AppColors.successColor : AppColors.greyColor), textColor: isLoading ? AppColors.textColor : (isLiveCare ? AppColors.whiteColor : AppColors.textColor), ).toShimmer2(isShow: isLoading), AppCustomChipWidget( labelText: isLoading - ? 'OutPatient'.needTranslation + ? 'OutPatient' : (appState.isArabic() ? patientAppointmentHistoryResponseModel.isInOutPatientDescriptionN! : patientAppointmentHistoryResponseModel.isInOutPatientDescription!), @@ -111,7 +111,7 @@ class AppointmentCard extends StatelessWidget { ).toShimmer2(isShow: isLoading), AppCustomChipWidget( labelText: isLoading - ? 'Booked'.needTranslation + ? 'Booked' : AppointmentType.getAppointmentStatusType(patientAppointmentHistoryResponseModel.patientStatusType!), backgroundColor: AppColors.successColor.withValues(alpha: 0.1), textColor: AppColors.successColor, @@ -229,7 +229,7 @@ class AppointmentCard extends StatelessWidget { return SizedBox.shrink(); } else { return CustomButton( - text: 'Select appointment'.needTranslation, + text: LocaleKeys.selectAppointment.tr(context: context), onPressed: () { if (isForFeedback) { contactUsViewModel!.setPatientFeedbackSelectedAppointment(patientAppointmentHistoryResponseModel); @@ -310,7 +310,7 @@ class AppointmentCard extends StatelessWidget { return CustomButton( text: LocaleKeys.askDoctor.tr(context: context), onPressed: () async { - LoaderBottomSheet.showLoader(loadingText: "Checking doctor availability...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingDoctorAvailability.tr(context: context)); await myAppointmentsViewModel.isDoctorAvailable( projectID: patientAppointmentHistoryResponseModel.projectID, doctorId: patientAppointmentHistoryResponseModel.doctorID, @@ -353,7 +353,7 @@ class AppointmentCard extends StatelessWidget { } return CustomButton( - text: 'Rebook with same doctor'.needTranslation, + text: LocaleKeys.rebookSameDoctor.tr(context: context), onPressed: () => openDoctorScheduleCalendar(context), backgroundColor: AppColors.greyColor, borderColor: AppColors.greyColor, @@ -417,7 +417,7 @@ class AppointmentCard extends StatelessWidget { context, child: AppointmentCalendar(), callBackFunc: () {}, - title: 'Pick a Date'.needTranslation, + title: LocaleKeys.pickADate.tr(context: context), isFullScreen: false, isCloseButtonVisible: true, ); diff --git a/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart b/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart index d118a5e..c5139f1 100644 --- a/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart +++ b/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart @@ -45,8 +45,8 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { children: [ checkInOptionCard( AppAssets.checkin_location_icon, - "Live Location".needTranslation, - "Verify your location to be at hospital to check in".needTranslation, + LocaleKeys.liveLocation.tr(context: context), + LocaleKeys.verifyYourLocationAtHospital.tr(context: context), ).onPress(() { // locationUtils = LocationUtils( // isShowConfirmDialog: false, @@ -61,8 +61,10 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { sendCheckInRequest(projectDetailListModel.checkInQrCode!, 3, context); } else { showCommonBottomSheetWithoutHeight(context, - title: "Error".needTranslation, - child: Utils.getErrorWidget(loadingText: "Please ensure you're within the hospital location to perform online check-in.".needTranslation), callBackFunc: () { + title: LocaleKeys.error.tr(context: context), + child: Utils.getErrorWidget( + loadingText: LocaleKeys.ensureWithinHospitalLocation.tr(context: context), + ), callBackFunc: () { Navigator.of(context).pop(); }, isFullScreen: false); } @@ -71,8 +73,8 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { SizedBox(height: 16.h), checkInOptionCard( AppAssets.checkin_nfc_icon, - "NFC (Near Field Communication)".needTranslation, - "Scan your phone via NFC board to check in".needTranslation, + LocaleKeys.nfcNearFieldCommunication.tr(context: context), + LocaleKeys.scanPhoneViaNFC.tr(context: context), ).onPress(() { Future.delayed(const Duration(milliseconds: 500), () { showNfcReader(context, onNcfScan: (String nfcId) { @@ -85,8 +87,8 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { SizedBox(height: 16.h), checkInOptionCard( AppAssets.checkin_qr_icon, - "QR Code".needTranslation, - "Scan QR code with your camera to check in".needTranslation, + LocaleKeys.qrCode.tr(context: context), + LocaleKeys.scanQRCodeToCheckIn.tr(context: context), ).onPress(() async { String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent)); if (onlineCheckInQRCode != "") { @@ -139,14 +141,16 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { } void sendCheckInRequest(String scannedCode, int checkInType, BuildContext context) async { - LoaderBottomSheet.showLoader(loadingText: "Processing Check-In...".needTranslation); + LoaderBottomSheet.showLoader( + loadingText: LocaleKeys.processingCheckIn.tr(context: context), + ); await myAppointmentsViewModel.sendCheckInNfcRequest( patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel, scannedCode: scannedCode, checkInType: checkInType, onSuccess: (apiResponse) { LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight(context, title: "Success".needTranslation, child: Utils.getSuccessWidget(loadingText: LocaleKeys.success.tr()), callBackFunc: () async { + showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.success.tr(context: context), child: Utils.getSuccessWidget(loadingText: LocaleKeys.success.tr()), callBackFunc: () async { await myAppointmentsViewModel.getPatientAppointmentQueueDetails(); Navigator.of(context).pop(); Navigator.pushAndRemoveUntil( @@ -164,7 +168,7 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { }, onError: (error) { LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight(context, title: "Error".needTranslation, child: Utils.getErrorWidget(loadingText: error), callBackFunc: () { + showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.error.tr(context: context), child: Utils.getErrorWidget(loadingText: error), callBackFunc: () { Navigator.of(context).pop(); }, isFullScreen: false); }, diff --git a/lib/presentation/appointments/widgets/appointment_doctor_card.dart b/lib/presentation/appointments/widgets/appointment_doctor_card.dart index ccf6674..0c4aec1 100644 --- a/lib/presentation/appointments/widgets/appointment_doctor_card.dart +++ b/lib/presentation/appointments/widgets/appointment_doctor_card.dart @@ -114,7 +114,7 @@ class AppointmentDoctorCard extends StatelessWidget { iconColor: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.textColor : AppColors.whiteColor, labelText: patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? LocaleKeys.livecare.tr(context: context) - : "Walk In".needTranslation, + : LocaleKeys.walkin.tr(context: context), backgroundColor: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.greyColor : AppColors.successColor, textColor: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.textColor : AppColors.whiteColor, @@ -160,7 +160,7 @@ class AppointmentDoctorCard extends StatelessWidget { iconColor: AppColors.primaryRedColor, ) : CustomButton( - text: "Rebook with same doctor".needTranslation, + text: LocaleKeys.rebookSameDoctor.tr(), onPressed: () { onRescheduleTap(); }, diff --git a/lib/presentation/appointments/widgets/ask_doctor_request_type_select.dart b/lib/presentation/appointments/widgets/ask_doctor_request_type_select.dart index 01aab4e..376c27a 100644 --- a/lib/presentation/appointments/widgets/ask_doctor_request_type_select.dart +++ b/lib/presentation/appointments/widgets/ask_doctor_request_type_select.dart @@ -105,7 +105,7 @@ class AskDoctorRequestTypeSelect extends StatelessWidget { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getSuccessWidget(loadingText: "Request has been sent successfully, you will be contacted soon.".needTranslation), + child: Utils.getSuccessWidget(loadingText: "Request has been sent successfully, you will be contacted soon."), callBackFunc: () { Navigator.of(context).pop(); }, diff --git a/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart b/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart index cb27f9f..b6366db 100644 --- a/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart +++ b/lib/presentation/appointments/widgets/faculity_selection/facility_type_selection_widget.dart @@ -46,7 +46,7 @@ class FacilityTypeSelectionWidget extends StatelessWidget { SizedBox(height: 24.h), FacilitySelectionItem( svgPath: AppAssets.hmg, - title: "HMG".needTranslation, + title: "HMG", subTitle: LocaleKeys.hospitalsWithCount.tr(namedArgs: { 'count': "${bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmgSize ?? 0}" @@ -63,7 +63,7 @@ class FacilityTypeSelectionWidget extends StatelessWidget { SizedBox(height: 16.h), FacilitySelectionItem( svgPath: AppAssets.hmc, - title: "HMC".needTranslation, + title: "HMC", subTitle: LocaleKeys.medicalCentersWithCount.tr(namedArgs: { 'count': "${bookAppointmentViewModel.hospitalList?.registeredDoctorMap?[selectedRegion]?.hmcSize ?? 0}" diff --git a/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart b/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart index b01b541..5d9ed8d 100644 --- a/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart +++ b/lib/presentation/appointments/widgets/hospital_bottom_sheet/hospital_list_items.dart @@ -76,7 +76,7 @@ class HospitalListItem extends StatelessWidget { Visibility( visible: (hospitalData?.distanceInKMs != "0"), child: AppCustomChipWidget( - labelText: "${hospitalData?.distanceInKMs ?? ""} km".needTranslation, + labelText: "${hospitalData?.distanceInKMs ?? ""} km", deleteIcon: AppAssets.location_red, deleteIconSize: Size(9, 12), backgroundColor: AppColors.secondaryLightRedColor, @@ -88,7 +88,7 @@ class HospitalListItem extends StatelessWidget { child: Row( children: [ AppCustomChipWidget( - labelText: "Distance not available".needTranslation, + labelText: "Distance not available", textColor: AppColors.blackColor, ), // SizedBox( @@ -99,7 +99,7 @@ class HospitalListItem extends StatelessWidget { Visibility( visible: !isLocationEnabled, child: AppCustomChipWidget( - labelText: "Location turned off".needTranslation, + labelText: "Location turned off", deleteIcon: AppAssets.location_unavailable, deleteIconSize: Size(9.w, 12.h), textColor: AppColors.blackColor, diff --git a/lib/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart b/lib/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart index cbf68f6..e9a5e36 100644 --- a/lib/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart +++ b/lib/presentation/appointments/widgets/hospital_bottom_sheet/type_selection_widget.dart @@ -23,7 +23,7 @@ class TypeSelectionWidget extends StatelessWidget { mainAxisSize: MainAxisSize.max, children: [ AppCustomChipWidget( - labelText: "All Facilities".needTranslation, + labelText: "All Facilities", shape: RoundedRectangleBorder( side: BorderSide( color: data.currentlySelectedFacility == FacilitySelection.ALL @@ -45,7 +45,7 @@ class TypeSelectionWidget extends StatelessWidget { AppCustomChipWidget( icon: AppAssets.hmg, iconHasColor: false, - labelText: "Hospitals".needTranslation, + labelText: "Hospitals", shape: RoundedRectangleBorder( side: BorderSide( color: data.currentlySelectedFacility == FacilitySelection.HMG @@ -67,7 +67,7 @@ class TypeSelectionWidget extends StatelessWidget { AppCustomChipWidget( icon: AppAssets.hmc, iconHasColor: false, - labelText: "Medical Centers".needTranslation, + labelText: "Medical Centers", shape: RoundedRectangleBorder( side: BorderSide( color: data.currentlySelectedFacility == FacilitySelection.HMC diff --git a/lib/presentation/authentication/login.dart b/lib/presentation/authentication/login.dart index c14e957..a59062d 100644 --- a/lib/presentation/authentication/login.dart +++ b/lib/presentation/authentication/login.dart @@ -87,7 +87,7 @@ class LoginScreenState extends State { isAllowLeadingIcon: true, padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 10.h), leadingIcon: AppAssets.student_card, - errorMessage: "Please enter a valid national ID or file number".needTranslation, + errorMessage: LocaleKeys.enterValidIDorIqama.tr(), hasError: false, ), SizedBox(height: 16.h), diff --git a/lib/presentation/authentication/register.dart b/lib/presentation/authentication/register.dart index f04f7dd..fa10b95 100644 --- a/lib/presentation/authentication/register.dart +++ b/lib/presentation/authentication/register.dart @@ -112,7 +112,7 @@ class _RegisterNew extends State { Divider(height: 1), TextInputWidget( labelText: LocaleKeys.dob.tr(), - hintText: "11 July, 1994".needTranslation, + hintText: "11 July, 1994", controller: authVm.dobController, focusNode: _dobFocusNode, isEnable: true, diff --git a/lib/presentation/book_appointment/book_appointment_page.dart b/lib/presentation/book_appointment/book_appointment_page.dart index bcb2131..39d5eee 100644 --- a/lib/presentation/book_appointment/book_appointment_page.dart +++ b/lib/presentation/book_appointment/book_appointment_page.dart @@ -89,8 +89,8 @@ class _BookAppointmentPageState extends State { activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), initialIndex: bookAppointmentsVM.selectedTabIndex, tabs: [ - CustomTabBarModel(null, "General".needTranslation), - CustomTabBarModel(null, "LiveCare".needTranslation), + CustomTabBarModel(null, LocaleKeys.general.tr()), + CustomTabBarModel(null, LocaleKeys.liveCare.tr()), ], onTabChange: (index) { bookAppointmentsVM.onTabChanged(index); @@ -121,7 +121,7 @@ class _BookAppointmentPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ if (appState.isAuthenticated) ...[], - "Recent Visits".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0.h), + LocaleKeys.recentVisits.tr().toText18(isBold: true).paddingSymmetrical(24.w, 0.h), SizedBox(height: 16.h), SizedBox( height: 110.h, @@ -232,8 +232,8 @@ class _BookAppointmentPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Search By Clinic".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w500), - "Tap to select clinic".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), + LocaleKeys.searchByClinic.tr().toText14(color: AppColors.textColor, weight: FontWeight.w500), + LocaleKeys.tapToSelectClinic.tr().toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), ], ), ], @@ -264,8 +264,8 @@ class _BookAppointmentPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Search By Doctor".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w500), - "Tap to select".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), + LocaleKeys.searchByDoctor.tr().toText14(color: AppColors.textColor, weight: FontWeight.w500), + LocaleKeys.tapToSelect.tr().toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), ], ), ], @@ -294,8 +294,8 @@ class _BookAppointmentPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Search By Region".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w500), - "Central Region".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), + LocaleKeys.searchByRegion.tr().toText14(color: AppColors.textColor, weight: FontWeight.w500), + LocaleKeys.centralRegion.tr().toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), ], ), ], @@ -340,8 +340,8 @@ class _BookAppointmentPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Immediate Consultation".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w500), - "Tap to select clinic".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), + LocaleKeys.immediateConsultation.tr().toText14(color: AppColors.textColor, weight: FontWeight.w500), + LocaleKeys.tapToSelectClinic.tr().toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), ], ), ], @@ -382,8 +382,8 @@ class _BookAppointmentPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Scheduled Consultation".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w500), - "Tap to select clinic".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), + LocaleKeys.scheduledConsultation.tr().toText14(color: AppColors.textColor, weight: FontWeight.w500), + LocaleKeys.tapToSelectClinic.tr().toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), ], ), ], @@ -412,8 +412,8 @@ class _BookAppointmentPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Pharma LiveCare".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w500), - "".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), + LocaleKeys.pharmaLiveCare.tr().toText14(color: AppColors.textColor, weight: FontWeight.w500), + "".toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), ], ), ], @@ -447,9 +447,9 @@ class _BookAppointmentPageState extends State { mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Not sure? help me choose a clinic!".needTranslation.toText16(weight: FontWeight.w600, color: AppColors.textColor), - SizedBox(height: 4.h), - "Mention your symptoms and find the list of doctors accordingly".needTranslation.toText12( + LocaleKeys.notSureHelpMeChooseClinic.tr().toText16(weight: FontWeight.w600, color: AppColors.textColor), + SizedBox(height: 8.h), + LocaleKeys.mentionYourSymptomsAndFindDoctors.tr().toText12( fontWeight: FontWeight.w500, color: AppColors.greyTextColor, ), @@ -558,8 +558,8 @@ class _BookAppointmentPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Immediate service".needTranslation.toText18(color: AppColors.textColor, isBold: true), - "No need to wait, you will get medical consultation immediately via video call".needTranslation.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + LocaleKeys.immediateService.tr().toText18(color: AppColors.textColor, isBold: true), + LocaleKeys.noNeedToWaitGetMedicalConsultation.tr().toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), ), @@ -574,7 +574,7 @@ class _BookAppointmentPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "No visit required".needTranslation.toText18(color: AppColors.textColor, isBold: true), + LocaleKeys.noVisitRequired.tr().toText18(color: AppColors.textColor, isBold: true), LocaleKeys.livecarePoint5.tr(context: context).toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), @@ -590,8 +590,8 @@ class _BookAppointmentPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Doctor will contact".needTranslation.toText18(color: AppColors.textColor, isBold: true), - "A specialised doctor will contact you and will be able to view your medical history".needTranslation.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + LocaleKeys.doctorWillContact.tr().toText18(color: AppColors.textColor, isBold: true), + LocaleKeys.specialisedDoctorWillContactYou.tr().toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), ), @@ -606,8 +606,8 @@ class _BookAppointmentPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Free medicine delivery".needTranslation.toText18(color: AppColors.textColor, isBold: true), - "Offers free medicine delivery for the LiveCare appointment".needTranslation.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + LocaleKeys.freeMedicineDelivery.tr().toText18(color: AppColors.textColor, isBold: true), + LocaleKeys.offersFreeMedicineDelivery.tr().toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), ), @@ -615,7 +615,7 @@ class _BookAppointmentPageState extends State { ), SizedBox(height: 36.h), CustomButton( - text: "Login to use this service".needTranslation, + text: "Login to use this service", onPressed: () async { await authVM.onLoginPressed(); }, diff --git a/lib/presentation/book_appointment/dental_chief_complaints_page.dart b/lib/presentation/book_appointment/dental_chief_complaints_page.dart index 4dc3881..d2f2239 100644 --- a/lib/presentation/book_appointment/dental_chief_complaints_page.dart +++ b/lib/presentation/book_appointment/dental_chief_complaints_page.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; @@ -9,6 +10,7 @@ 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/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/dental_chief_complaints_response_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/select_doctor_page.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/chief_complaint_card.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -40,7 +42,7 @@ class _DentalChiefComplaintsPageState extends State { bookAppointmentsViewModel = Provider.of(context, listen: false); appState = getIt.get(); return CollapsingListView( - title: "Dental Chief Complaints".needTranslation, + title: LocaleKeys.dentalChiefComplaints.tr(), child: SingleChildScrollView( child: Padding( padding: EdgeInsets.symmetric(horizontal: 24.h), diff --git a/lib/presentation/book_appointment/doctor_filter/doctors_filter.dart b/lib/presentation/book_appointment/doctor_filter/doctors_filter.dart index e4d11bd..d9aa9e5 100644 --- a/lib/presentation/book_appointment/doctor_filter/doctors_filter.dart +++ b/lib/presentation/book_appointment/doctor_filter/doctors_filter.dart @@ -128,7 +128,7 @@ class DoctorsFilters extends StatelessWidget{ TextInputWidget( controller: TextEditingController()..text =context.watch().selectedClinicForFilters ??'', labelText: LocaleKeys.clinicName.tr(context: context), - hintText: LocaleKeys.searchClinic.tr().needTranslation, + hintText: LocaleKeys.searchClinic.tr(), isEnable: false, prefix: null, autoFocus: false, diff --git a/lib/presentation/book_appointment/doctor_profile_page.dart b/lib/presentation/book_appointment/doctor_profile_page.dart index 5ce7fac..72f242d 100644 --- a/lib/presentation/book_appointment/doctor_profile_page.dart +++ b/lib/presentation/book_appointment/doctor_profile_page.dart @@ -1,4 +1,5 @@ +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_state.dart'; @@ -8,6 +9,7 @@ import 'package:hmg_patient_app_new/core/utils/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/features/book_appointments/book_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/appointment_calendar.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -33,7 +35,7 @@ class DoctorProfilePage extends StatelessWidget { children: [ Expanded( child: CollapsingListView( - title: "Doctor Profile".needTranslation, + title: LocaleKeys.doctorProfile.tr(), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -84,11 +86,11 @@ class DoctorProfilePage extends StatelessWidget { children: [ AppCustomChipWidget( iconColor: AppColors.ratingColorYellow, - labelText: "Branch: ${bookAppointmentsViewModel.doctorsProfileResponseModel.projectName}".needTranslation, + labelText: "${bookAppointmentsViewModel.doctorsProfileResponseModel.projectName}", ), AppCustomChipWidget( iconColor: AppColors.ratingColorYellow, - labelText: "Clinic: ${bookAppointmentsViewModel.doctorsProfileResponseModel.clinicDescription}".needTranslation, + labelText: "${bookAppointmentsViewModel.doctorsProfileResponseModel.clinicDescription}", ), ], ), @@ -142,7 +144,7 @@ class DoctorProfilePage extends StatelessWidget { hasShadow: true, ), child: CustomButton( - text: "View available appointments".needTranslation, + text: LocaleKeys.viewAvailableAppointments.tr(), onPressed: () async { LoaderBottomSheet.showLoader(); bookAppointmentsViewModel.isLiveCareSchedule @@ -151,7 +153,7 @@ class DoctorProfilePage extends StatelessWidget { onSuccess: (dynamic respData) async { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( - title: "Pick a Date".needTranslation, + title: LocaleKeys.pickADate.tr(), context, child: AppointmentCalendar(), isFullScreen: false, @@ -174,7 +176,7 @@ class DoctorProfilePage extends StatelessWidget { onSuccess: (dynamic respData) async { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( - title: "Pick a Date".needTranslation, + title: LocaleKeys.pickADate.tr(), context, child: AppointmentCalendar(), isFullScreen: false, diff --git a/lib/presentation/book_appointment/laser/laser_appointment.dart b/lib/presentation/book_appointment/laser/laser_appointment.dart index aae7990..3b94b0e 100644 --- a/lib/presentation/book_appointment/laser/laser_appointment.dart +++ b/lib/presentation/book_appointment/laser/laser_appointment.dart @@ -83,8 +83,8 @@ class LaserAppointment extends StatelessWidget { activeTextColor: Color(0xffED1C2B), activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), tabs: [ - CustomTabBarModel(null,LocaleKeys.malE.tr()), - CustomTabBarModel(null, "Female".needTranslation), + CustomTabBarModel(null, LocaleKeys.malE.tr()), + CustomTabBarModel(null, "Female"), ], onTabChange: (index) { var viewmodel = context.read(); diff --git a/lib/presentation/book_appointment/livecare/immediate_livecare_payment_details.dart b/lib/presentation/book_appointment/livecare/immediate_livecare_payment_details.dart index 2371f4a..3e48f8b 100644 --- a/lib/presentation/book_appointment/livecare/immediate_livecare_payment_details.dart +++ b/lib/presentation/book_appointment/livecare/immediate_livecare_payment_details.dart @@ -45,7 +45,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { children: [ Expanded( child: CollapsingListView( - title: "Review LiveCare Request".needTranslation, + title: LocaleKeys.reviewLiveCareRequest.tr(context: context), child: SingleChildScrollView( padding: EdgeInsets.symmetric(horizontal: 24.h), child: Column( @@ -80,7 +80,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { spacing: 3.h, runSpacing: 4.h, children: [ - AppCustomChipWidget(labelText: "${appState.getAuthenticatedUser()!.age} Years Old".needTranslation), + AppCustomChipWidget(labelText: "${appState.getAuthenticatedUser()!.age} ${LocaleKeys.yearsOld.tr(context: context)}"), AppCustomChipWidget( labelText: "${LocaleKeys.clinic.tr()}: ${(appState.isArabic() ? immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceNameN : immediateLiveCareViewModel.immediateLiveCareSelectedClinic.serviceName)!}"), @@ -93,7 +93,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { ), ), SizedBox(height: 24.h), - "Selected LiveCare Type".needTranslation.toText16(isBold: true), + LocaleKeys.selectedLiveCareType.tr(context: context).toText16(isBold: true), SizedBox(height: 16.h), Consumer(builder: (context, bookAppointmentsVM, child) { return Container( @@ -111,7 +111,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { children: [ Utils.buildSvgWithAssets(icon: AppAssets.livecare_clinic_icon, width: 32.h, height: 32.h, fit: BoxFit.contain), SizedBox(width: 8.h), - getLiveCareType(immediateLiveCareViewModel.liveCareSelectedCallType).toText16(isBold: true), + getLiveCareType(context, immediateLiveCareViewModel.liveCareSelectedCallType).toText16(isBold: true), ], ), Utils.buildSvgWithAssets(icon: AppAssets.edit_icon, width: 24.h, height: 24.h, fit: BoxFit.contain), @@ -121,7 +121,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { ).onPress(() { showCommonBottomSheetWithoutHeight(context, child: SelectLiveCareCallType(immediateLiveCareViewModel: immediateLiveCareViewModel), callBackFunc: () async { debugPrint("Selected Call Type: ${immediateLiveCareViewModel.liveCareSelectedCallType}"); - }, title: "Select LiveCare call type".needTranslation, isCloseButtonVisible: true, isFullScreen: false); + }, title: LocaleKeys.selectLiveCareCallType.tr(context: context), isCloseButtonVisible: true, isFullScreen: false); }); }), SizedBox(height: 24.h) @@ -152,7 +152,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Insurance expired or inactive".needTranslation.toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500).paddingSymmetrical(24.h, 0.h), + LocaleKeys.insuranceExpiredOrInactive.tr(context: context).toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500).paddingSymmetrical(24.h, 0.h), CustomButton( text: LocaleKeys.updateInsurance.tr(context: context), onPressed: () { @@ -176,12 +176,12 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { ) : const SizedBox(), SizedBox(height: 24.h), - "Total amount to pay".needTranslation.toText18(isBold: true).paddingSymmetrical(24.h, 0.h), + LocaleKeys.totalAmountToPay.tr(context: context).toText18(isBold: true).paddingSymmetrical(24.h, 0.h), SizedBox(height: 17.h), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Amount before tax".needTranslation.toText14(isBold: true), + LocaleKeys.amountBeforeTax.tr(context: context).toText14(isBold: true), Utils.getPaymentAmountWithSymbol(immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.amount!.toText16(isBold: true), AppColors.blackColor, 13, isSaudiCurrency: immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.currency!.toLowerCase() == "sar"), ], @@ -189,7 +189,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "VAT 15%".needTranslation.toText14(isBold: true, color: AppColors.greyTextColor), + LocaleKeys.vat15.tr(context: context).toText14(isBold: true, color: AppColors.greyTextColor), Utils.getPaymentAmountWithSymbol( immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.tax!.toText14(isBold: true, color: AppColors.greyTextColor), AppColors.greyTextColor, 13, isSaudiCurrency: immediateLiveCareViewModel.liveCareImmediateAppointmentFeesList.currency!.toLowerCase() == "sar"), @@ -210,7 +210,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { onPressed: () async { await askVideoCallPermission().then((val) async { if (val) { - LoaderBottomSheet.showLoader(loadingText: "Confirming LiveCare request, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.confirmingLiveCareRequest.tr(context: context)); await immediateLiveCareViewModel.addNewCallRequestForImmediateLiveCare("${appState.getAuthenticatedUser()!.patientId}${DateTime.now().millisecondsSinceEpoch}"); await immediateLiveCareViewModel.getPatientLiveCareHistory(); @@ -230,7 +230,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { } else { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Unknown error occurred...".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.unknownErrorOccurred.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -241,9 +241,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: - "LiveCare requires Camera, Microphone, Location & Notifications permissions to enable virtual consultation between patient & doctor, Please allow these to proceed." - .needTranslation, + loadingText: LocaleKeys.liveCarePermissionsMessage.tr(context: context), isShowActionButtons: true, onCancelTap: () { Navigator.pop(context); @@ -285,9 +283,7 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: - "LiveCare requires Camera, Microphone, Location & Notifications permissions to enable virtual consultation between patient & doctor, Please allow these to proceed." - .needTranslation, + loadingText: LocaleKeys.liveCarePermissionsMessage.tr(context: context), isShowActionButtons: true, onCancelTap: () { Navigator.pop(context); @@ -351,16 +347,16 @@ class ImmediateLiveCarePaymentDetails extends StatelessWidget { // } } - String getLiveCareType(int callType) { + String getLiveCareType(BuildContext context, int callType) { switch (callType) { case 1: - return "Video Call".needTranslation; + return LocaleKeys.videoCall.tr(context: context); case 2: - return "Audio Call".needTranslation; + return LocaleKeys.audioCall.tr(context: context); case 3: - return "Phone Call".needTranslation; + return LocaleKeys.phoneCall.tr(context: context); default: - return "Video Call".needTranslation; + return LocaleKeys.videoCall.tr(context: context); } } } diff --git a/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart b/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart index 48e79b1..9ae7ee3 100644 --- a/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart +++ b/lib/presentation/book_appointment/livecare/immediate_livecare_payment_page.dart @@ -84,7 +84,7 @@ class _ImmediateLiveCarePaymentPageState extends State { runSpacing: 8.h, children: [ AppCustomChipWidget( - labelText: "${LocaleKeys.clinic.tr(context: context)}: ${bookAppointmentsViewModel.selectedDoctor.clinicName}".needTranslation, + labelText: "${LocaleKeys.clinic.tr(context: context)}: ${bookAppointmentsViewModel.selectedDoctor.clinicName}", ), AppCustomChipWidget( - labelText: "${LocaleKeys.branch.tr(context: context)} ${bookAppointmentsViewModel.selectedDoctor.projectName}".needTranslation, + labelText: "${LocaleKeys.branch.tr(context: context)} ${bookAppointmentsViewModel.selectedDoctor.projectName}", ), AppCustomChipWidget( labelText: - "${LocaleKeys.date.tr(context: context)}: ${bookAppointmentsViewModel.isWaitingAppointmentSelected ? DateUtil.formatDateToDate(DateTime.now(), false) : bookAppointmentsViewModel.selectedAppointmentDate}" - .needTranslation, + "${LocaleKeys.date.tr(context: context)}: ${bookAppointmentsViewModel.isWaitingAppointmentSelected ? DateUtil.formatDateToDate(DateTime.now(), false) : bookAppointmentsViewModel.selectedAppointmentDate}", ), AppCustomChipWidget( labelText: - "${LocaleKeys.time.tr(context: context)}: ${bookAppointmentsViewModel.isWaitingAppointmentSelected ? "Waiting Appointment".needTranslation : bookAppointmentsViewModel.selectedAppointmentTime}" - .needTranslation, + "${LocaleKeys.time.tr(context: context)}: ${bookAppointmentsViewModel.isWaitingAppointmentSelected ? LocaleKeys.waitingAppointment.tr(context: context) : bookAppointmentsViewModel.selectedAppointmentTime}", ), ], ), @@ -166,7 +164,7 @@ class _ReviewAppointmentPageState extends State { ), ), SizedBox(height: 24.h), - "Hospital Information".needTranslation.toText16(isBold: true), + LocaleKeys.hospitalInformation.tr(context: context).toText16(isBold: true), SizedBox(height: 16.h), Container( width: double.infinity, @@ -241,7 +239,7 @@ class _ReviewAppointmentPageState extends State { } void getWalkInAppointmentPatientShare() async { - LoaderBottomSheet.showLoader(loadingText: "Fetching Appointment Share...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingAppointmentShare.tr(context: context)); await bookAppointmentsViewModel.getWalkInPatientShareAppointment(onSuccess: (val) { LoaderBottomSheet.hideLoader(); Navigator.of(context).push( @@ -262,7 +260,7 @@ class _ReviewAppointmentPageState extends State { } void initiateBookAppointment() async { - LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation); + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: LocaleKeys.bookingYourAppointment.tr(context: context)); myAppointmentsViewModel.setIsAppointmentDataToBeLoaded(true); if (bookAppointmentsViewModel.isLiveCareSchedule) { diff --git a/lib/presentation/book_appointment/search_doctor_by_name.dart b/lib/presentation/book_appointment/search_doctor_by_name.dart index 9f2da16..fa871f5 100644 --- a/lib/presentation/book_appointment/search_doctor_by_name.dart +++ b/lib/presentation/book_appointment/search_doctor_by_name.dart @@ -52,7 +52,7 @@ class _SearchDoctorByNameState extends State { children: [ Expanded( child: CollapsingListView( - title: "Choose Doctor".needTranslation, + title: LocaleKeys.chooseDoctor.tr(), child: SingleChildScrollView( child: Padding( padding: EdgeInsets.symmetric(horizontal: 24.h), @@ -228,7 +228,7 @@ class _SearchDoctorByNameState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ CustomButton( - text: "${groupedDoctors[index].length} ${'doctors'.needTranslation}", + text: "${groupedDoctors[index].length} ${'doctors'}", onPressed: () {}, backgroundColor: AppColors.greyColor, borderColor: AppColors.greyColor, diff --git a/lib/presentation/book_appointment/select_clinic_page.dart b/lib/presentation/book_appointment/select_clinic_page.dart index 15c8654..e76e1c9 100644 --- a/lib/presentation/book_appointment/select_clinic_page.dart +++ b/lib/presentation/book_appointment/select_clinic_page.dart @@ -103,7 +103,7 @@ class _SelectClinicPageState extends State { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: bookAppointmentsViewModel.isLiveCareSchedule ? "Select LiveCare Clinic".needTranslation : LocaleKeys.selectClinic.tr(context: context), + title: bookAppointmentsViewModel.isLiveCareSchedule ? LocaleKeys.selectLiveCareClinic.tr(context: context) : LocaleKeys.selectClinic.tr(context: context), child: SingleChildScrollView( child: Padding( padding: EdgeInsets.symmetric(horizontal: 24.h), @@ -1114,18 +1114,18 @@ class _SelectClinicPageState extends State { void initDentalAppointmentBookingFlow(int projectID) async { bookAppointmentsViewModel.setProjectID(projectID.toString()); - LoaderBottomSheet.showLoader(loadingText: "Checking for an existing dental plan, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingForExistingDentalPlan.tr(context: context)); await bookAppointmentsViewModel.getPatientDentalEstimation(projectID: projectID).then((value) { LoaderBottomSheet.hideLoader(); if (bookAppointmentsViewModel.patientDentalPlanEstimationList.isNotEmpty) { showCommonBottomSheetWithoutHeight( // title: LocaleKeys.notice.tr(context: context), - title: "Dental treatment plan".needTranslation, + title: LocaleKeys.dentalTreatmentPlan.tr(context: context), context, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "You have an existing treatment plan: ".needTranslation.toText14(weight: FontWeight.w500), + LocaleKeys.youHaveExistingTreatmentPlan.tr(context: context).toText14(weight: FontWeight.w500), SizedBox(height: 8.h), Container( width: double.infinity, @@ -1156,7 +1156,7 @@ class _SelectClinicPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ bookAppointmentsViewModel.patientDentalPlanEstimationList[index].procedureName!.toText12(isBold: true), - AppCustomChipWidget(icon: AppAssets.appointment_time_icon, labelText: "${bookAppointmentsViewModel.totalTimeNeededForDentalProcedure} Mins".needTranslation), + AppCustomChipWidget(icon: AppAssets.appointment_time_icon, labelText: "${bookAppointmentsViewModel.totalTimeNeededForDentalProcedure} ${LocaleKeys.mins.tr(context: context)}"), ], ); }, @@ -1171,15 +1171,15 @@ class _SelectClinicPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Total time required".needTranslation.toText14(isBold: true), - AppCustomChipWidget(icon: AppAssets.appointment_time_icon, labelText: "30 Mins".needTranslation), + LocaleKeys.totalTimeRequired.tr(context: context).toText14(isBold: true), + AppCustomChipWidget(icon: AppAssets.appointment_time_icon, labelText: "30 ${LocaleKeys.mins.tr(context: context)}"), ], ) ], ), ), SizedBox(height: 16.h), - "Would you like to continue it?".needTranslation.toText14(weight: FontWeight.w500), + LocaleKeys.wouldYouLikeToContinue.tr(context: context).toText14(weight: FontWeight.w500), SizedBox(height: 16.h), Row( children: [ diff --git a/lib/presentation/book_appointment/select_doctor_page.dart b/lib/presentation/book_appointment/select_doctor_page.dart index 2f8747d..e57ed51 100644 --- a/lib/presentation/book_appointment/select_doctor_page.dart +++ b/lib/presentation/book_appointment/select_doctor_page.dart @@ -75,7 +75,7 @@ class _SelectDoctorPageState extends State { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "Choose Doctor".needTranslation, + title: LocaleKeys.chooseDoctor.tr(), // 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), @@ -178,7 +178,7 @@ class _SelectDoctorPageState extends State { children: [ LocaleKeys.nearestAppo.tr(context: context).toText13(isBold: true), SizedBox(height: 4.h), - "View nearest available appointments".needTranslation.toText11(color: AppColors.textColorLight, weight: FontWeight.w500), + LocaleKeys.viewNearestAppos.toText11(color: AppColors.textColorLight, weight: FontWeight.w500), ], ), const Spacer(), @@ -207,7 +207,7 @@ class _SelectDoctorPageState extends State { bookAppointmentsViewModel: bookAppointmentsViewModel, ) : bookAppointmentsVM.doctorsListGrouped.isEmpty - ? Utils.getNoDataWidget(context, noDataText: "No Doctor found for selected criteria...".needTranslation) + ? Utils.getNoDataWidget(context, noDataText: LocaleKeys.noDoctorFound.tr()) : AnimationConfiguration.staggeredList( position: index, duration: const Duration(milliseconds: 500), @@ -245,7 +245,7 @@ class _SelectDoctorPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ CustomButton( - text: "${bookAppointmentsVM.doctorsListGrouped[index].length} ${'doctors'.needTranslation}", + text: "${bookAppointmentsVM.doctorsListGrouped[index].length} ${'doctors'}", onPressed: () {}, backgroundColor: AppColors.greyColor, borderColor: AppColors.greyColor, diff --git a/lib/presentation/book_appointment/select_livecare_clinic_page.dart b/lib/presentation/book_appointment/select_livecare_clinic_page.dart index 502e38d..87ab0eb 100644 --- a/lib/presentation/book_appointment/select_livecare_clinic_page.dart +++ b/lib/presentation/book_appointment/select_livecare_clinic_page.dart @@ -54,8 +54,8 @@ class SelectLivecareClinicPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Immediate service".needTranslation.toText18(color: AppColors.textColor, isBold: true), - "No need to wait, you will get medical consultation immediately via video call".needTranslation.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + LocaleKeys.immediateService.tr(context: context).toText18(color: AppColors.textColor, isBold: true), + LocaleKeys.noNeedToWaitGetMedicalConsultation.tr(context: context).toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), ), @@ -70,7 +70,7 @@ class SelectLivecareClinicPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "No visit required".needTranslation.toText18(color: AppColors.textColor, isBold: true), + LocaleKeys.noVisitRequired.tr(context: context).toText18(color: AppColors.textColor, isBold: true), LocaleKeys.livecarePoint5.tr(context: context).toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), @@ -86,8 +86,8 @@ class SelectLivecareClinicPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Doctor will contact".needTranslation.toText18(color: AppColors.textColor, isBold: true), - "A specialised doctor will contact you and will be able to view your medical history".needTranslation.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + LocaleKeys.doctorWillContact.tr(context: context).toText18(color: AppColors.textColor, isBold: true), + LocaleKeys.specialisedDoctorWillContactYou.tr(context: context).toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), ), @@ -102,8 +102,8 @@ class SelectLivecareClinicPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Free medicine delivery".needTranslation.toText18(color: AppColors.textColor, isBold: true), - "Offers free medicine delivery for the LiveCare appointment".needTranslation.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + LocaleKeys.freeMedicineDelivery.tr(context: context).toText18(color: AppColors.textColor, isBold: true), + LocaleKeys.offersFreeMedicineDelivery.tr(context: context).toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), ), @@ -117,7 +117,7 @@ class SelectLivecareClinicPage extends StatelessWidget { Column( children: [ CustomButton( - text: "Yes please, I am in a hurry".needTranslation, + text: LocaleKeys.yesPleasImInAHurry.tr(context: context), onPressed: () async { Navigator.pop(context); GetLiveCareClinicListResponseModel liveCareClinic = GetLiveCareClinicListResponseModel( @@ -129,7 +129,7 @@ class SelectLivecareClinicPage extends StatelessWidget { immediateLiveCareViewModel.setLiveCareSelectedCallType(1); immediateLiveCareViewModel.setImmediateLiveCareSelectedClinic(liveCareClinic); - LoaderBottomSheet.showLoader(loadingText: "Fetching fees, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingFeesPleaseWait.tr(context: context)); await immediateLiveCareViewModel.getLiveCareImmediateAppointmentFees(onSuccess: (val) { LoaderBottomSheet.hideLoader(); Navigator.of(getIt.get().navigatorKey.currentContext!).push( @@ -162,7 +162,7 @@ class SelectLivecareClinicPage extends StatelessWidget { ).paddingSymmetrical(24.h, 0.h), SizedBox(height: 16.h), CustomButton( - text: "No, Thanks. I would like a physical visit".needTranslation, + text: LocaleKeys.noThanksPhysicalVisit.tr(context: context), onPressed: () { Navigator.of(context).pop(); onNegativeClicked?.call(); diff --git a/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_info.dart b/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_info.dart index f832db6..19d0fb4 100644 --- a/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_info.dart +++ b/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_info.dart @@ -28,7 +28,7 @@ class WaitingAppointmentInfo extends StatelessWidget { children: [ Expanded( child: CollapsingListView( - title: "Waiting Appointment".needTranslation, + title: LocaleKeys.waitingAppointment.tr(), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -47,13 +47,11 @@ class WaitingAppointmentInfo extends StatelessWidget { children: [ Utils.buildSvgWithAssets(icon: AppAssets.waiting_appointment_icon, width: 48.h, height: 48.h, fit: BoxFit.contain), SizedBox(height: 16.h), - "What is Waiting Appointment?".needTranslation.toText16(isBold: true), + LocaleKeys.whatIsWaitingAppointment.tr(context: context).toText16(isBold: true), SizedBox(height: 16.h), - "The waiting appointments feature allows you to book an appointment while you are inside the hospital building, and in case there is no available slot in the doctor’s schedule." - .needTranslation - .toText14(isBold: false), + LocaleKeys.waitingAppointmentsFeature.tr(context: context).toText14(isBold: false), SizedBox(height: 16.h), - "The appointment with the doctor is confirmed, but the time of entry is uncertain.".needTranslation.toText14(isBold: false), + LocaleKeys.appointmentWithDoctorConfirmed.tr(context: context).toText14(isBold: false), SizedBox(height: 24.h), Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -66,9 +64,7 @@ class WaitingAppointmentInfo extends StatelessWidget { SizedBox(width: 10.w), SizedBox( width: MediaQuery.of(context).size.width * 0.7, - child: "Note: You must have to pay within 10 minutes of booking, otherwise your appointment will be cancelled automatically" - .needTranslation - .toText14(isBold: true, color: AppColors.warningColorYellow), + child: LocaleKeys.paymentWithinTenMinutes.tr(context: context).toText14(isBold: true, color: AppColors.warningColorYellow), ), ], ), @@ -88,7 +84,7 @@ class WaitingAppointmentInfo extends StatelessWidget { hasShadow: true, ), child: CustomButton( - text: "Continue".needTranslation, + text: LocaleKeys.continueString.tr(), onPressed: () async { showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.onlineCheckIn.tr(), diff --git a/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_online_checkin_sheet.dart b/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_online_checkin_sheet.dart index 4a2a304..6f3a773 100644 --- a/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_online_checkin_sheet.dart +++ b/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_online_checkin_sheet.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_nfc_kit/flutter_nfc_kit.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -10,6 +11,7 @@ import 'package:hmg_patient_app_new/core/utils/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/features/book_appointments/book_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/book_appointment/review_appointment_page.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:barcode_scan2/barcode_scan2.dart'; @@ -42,14 +44,9 @@ class WaitingAppointmentOnlineCheckinSheet extends StatelessWidget { children: [ checkInOptionCard( AppAssets.checkin_location_icon, - "Live Location".needTranslation, - "Verify your location to be at hospital to check in".needTranslation, + LocaleKeys.liveLocation.tr(), + LocaleKeys.verifyYourLocationAtHospital.tr(), ).onPress(() { - // locationUtils = LocationUtils( - // isShowConfirmDialog: false, - // navigationService: myAppointmentsViewModel.navigationService, - // appState: myAppointmentsViewModel.appState, - // ); locationUtils.getCurrentLocation(onSuccess: (value) { projectDetailListModel = Utils.getProjectDetailObj(appState, bookAppointmentsViewModel.waitingAppointmentProjectID); double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000; @@ -58,8 +55,8 @@ class WaitingAppointmentOnlineCheckinSheet extends StatelessWidget { checkScannedNFCAndQRCode(projectDetailListModel.checkInQrCode!, context); } else { showCommonBottomSheetWithoutHeight(context, - title: "Error".needTranslation, - child: Utils.getErrorWidget(loadingText: "Please ensure you're within the hospital location to perform online check-in.".needTranslation), callBackFunc: () { + title: LocaleKeys.error.tr(), + child: Utils.getErrorWidget(loadingText: LocaleKeys.ensureWithinHospitalLocation.tr()), callBackFunc: () { Navigator.of(context).pop(); }, isFullScreen: false); } @@ -68,8 +65,8 @@ class WaitingAppointmentOnlineCheckinSheet extends StatelessWidget { SizedBox(height: 16.h), checkInOptionCard( AppAssets.checkin_nfc_icon, - "NFC (Near Field Communication)".needTranslation, - "Scan your phone via NFC board to check in".needTranslation, + LocaleKeys.nfcNearFieldCommunication.tr(), + LocaleKeys.scanPhoneViaNFC.tr(), ).onPress(() { Future.delayed(const Duration(milliseconds: 500), () { showNfcReader(context, onNcfScan: (String nfcId) { @@ -82,8 +79,8 @@ class WaitingAppointmentOnlineCheckinSheet extends StatelessWidget { SizedBox(height: 16.h), checkInOptionCard( AppAssets.checkin_qr_icon, - "QR Code".needTranslation, - "Scan QR code with your camera to check in".needTranslation, + LocaleKeys.qrCode.tr(), + LocaleKeys.scanQRCodeToCheckIn.tr() ).onPress(() async { String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent)); if (onlineCheckInQRCode != "") { @@ -136,7 +133,7 @@ class WaitingAppointmentOnlineCheckinSheet extends StatelessWidget { } void checkScannedNFCAndQRCode(String scannedCode, BuildContext context) async { - LoaderBottomSheet.showLoader(loadingText: "Processing Check-In...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.processingCheckIn.tr()); bookAppointmentsViewModel.checkScannedNFCAndQRCode( scannedCode, bookAppointmentsViewModel.waitingAppointmentProjectID, @@ -152,7 +149,7 @@ class WaitingAppointmentOnlineCheckinSheet extends StatelessWidget { }, onError: (err) { LoaderBottomSheet.hideLoader(); - showCommonBottomSheetWithoutHeight(context, title: "Error".needTranslation, child: Utils.getErrorWidget(loadingText: err), callBackFunc: () { + showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.error.tr(), child: Utils.getErrorWidget(loadingText: err), callBackFunc: () { // Navigator.of(context).pop(); }, isFullScreen: false); }, diff --git a/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_payment_page.dart b/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_payment_page.dart index 8cfe6dd..ca60e9e 100644 --- a/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_payment_page.dart +++ b/lib/presentation/book_appointment/waiting_appointment/waiting_appointment_payment_page.dart @@ -94,7 +94,7 @@ class _WaitingAppointmentPaymentPageState extends State { ), SizedBox(height: 16.h), CustomButton( - text: "Select".needTranslation, + text: LocaleKeys.select.tr(context: context), onPressed: () async { if (appState.isAuthenticated) { - if(selectedTime == "Waiting Appointment".needTranslation){ + if(selectedTime == LocaleKeys.waitingAppointment.tr(context: context)){ bookAppointmentsViewModel.setWaitingAppointmentProjectID(bookAppointmentsViewModel.selectedDoctor.projectID!); bookAppointmentsViewModel.setWaitingAppointmentDoctor(bookAppointmentsViewModel.selectedDoctor); @@ -293,7 +293,7 @@ class _AppointmentCalendarState extends State { dayEvents.clear(); DateTime dateStartObj = new DateTime(dateStart.year, dateStart.month, dateStart.day, 0, 0, 0, 0, 0); if (bookAppointmentsViewModel.isWaitingAppointmentAvailable && DateUtils.isSameDay(dateStart, DateTime.now())) { - dayEvents.add(TimeSlot(isoTime: "Waiting Appointment".needTranslation, start: DateTime.now(), end: DateTime.now(), vidaDate: "")); + dayEvents.add(TimeSlot(isoTime: LocaleKeys.waitingAppointment.tr(context: context), start: DateTime.now(), end: DateTime.now(), vidaDate: "")); } freeSlots.forEach((v) { if (v.start == dateStartObj) dayEvents.add(v); @@ -332,7 +332,7 @@ class TimeSlotChip extends StatelessWidget { Widget build(BuildContext context) { return GestureDetector( onTap: onTap, - child: label == "Waiting Appointment".needTranslation + child: label == LocaleKeys.waitingAppointment.tr(context: context) ? Container( padding: EdgeInsets.symmetric(horizontal: 14.h, vertical: 8.h), decoration: ShapeDecoration( diff --git a/lib/presentation/book_appointment/widgets/doctor_card.dart b/lib/presentation/book_appointment/widgets/doctor_card.dart index d2e1c0b..97a941d 100644 --- a/lib/presentation/book_appointment/widgets/doctor_card.dart +++ b/lib/presentation/book_appointment/widgets/doctor_card.dart @@ -137,15 +137,15 @@ class DoctorCard extends StatelessWidget { runSpacing: 4.h, children: [ AppCustomChipWidget( - labelText: "${isLoading ? "Cardiologist" : doctorsListResponseModel.clinicName}".needTranslation, + labelText: "${isLoading ? "Cardiologist" : doctorsListResponseModel.clinicName}", ).toShimmer2(isShow: isLoading), AppCustomChipWidget( - labelText: "${isLoading ? "Olaya Hospital" : doctorsListResponseModel.projectName}".needTranslation, + labelText: "${isLoading ? "Olaya Hospital" : doctorsListResponseModel.projectName}", ).toShimmer2(isShow: isLoading), bookAppointmentsViewModel.isNearestAppointmentSelected ? doctorsListResponseModel.nearestFreeSlot != null ? AppCustomChipWidget( - labelText: (isLoading ? "Cardiologist" : DateUtil.getDateStringForNearestSlot(doctorsListResponseModel.nearestFreeSlot)).needTranslation, + labelText: (isLoading ? "Cardiologist" : DateUtil.getDateStringForNearestSlot(doctorsListResponseModel.nearestFreeSlot)), backgroundColor: AppColors.successColor, textColor: AppColors.whiteColor, ).toShimmer2(isShow: isLoading) @@ -165,7 +165,7 @@ class DoctorCard extends StatelessWidget { onSuccess: (dynamic respData) async { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( - title: "Pick a Date".needTranslation, + title: LocaleKeys.pickADate.tr(context: context), context, child: AppointmentCalendar(), isFullScreen: false, @@ -188,7 +188,7 @@ class DoctorCard extends StatelessWidget { onSuccess: (dynamic respData) async { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( - title: "Pick a Date".needTranslation, + title: LocaleKeys.pickADate.tr(context: context), context, child: AppointmentCalendar(), isFullScreen: false, diff --git a/lib/presentation/comprehensive_checkup/cmc_order_detail_page.dart b/lib/presentation/comprehensive_checkup/cmc_order_detail_page.dart index 7547fd0..dd836a6 100644 --- a/lib/presentation/comprehensive_checkup/cmc_order_detail_page.dart +++ b/lib/presentation/comprehensive_checkup/cmc_order_detail_page.dart @@ -10,6 +10,7 @@ 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/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_all_orders_resp_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/comprehensive_checkup/widgets/cmc_ui_selection_helper.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -124,7 +125,7 @@ class _CmcOrderDetailPageState extends State { Row( children: [ if (!isLoading) ...[ - "Request ID:".needTranslation.toText14( + LocaleKeys.requestID.tr(context: context).toText14( color: AppColors.textColorLight, weight: FontWeight.w500, ), @@ -164,7 +165,7 @@ class _CmcOrderDetailPageState extends State { children: [ Expanded( child: CustomButton( - text: "Cancel Order".needTranslation, + text: LocaleKeys.cancelOrder.tr(context: context), onPressed: isLoading ? () {} : () => CmcUiSelectionHelper.showCancelConfirmationDialog(context: context, order: order), backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, @@ -196,7 +197,7 @@ class _CmcOrderDetailPageState extends State { ), child: Utils.getNoDataWidget( context, - noDataText: "You don't have any CMC orders yet.".needTranslation, + noDataText: LocaleKeys.noCMCOrdersYet.tr(context: context), isSmallWidget: true, width: 62.w, height: 62.h, @@ -209,7 +210,7 @@ class _CmcOrderDetailPageState extends State { @override Widget build(BuildContext context) { return CollapsingListView( - title: "CMC Orders".needTranslation, + title: LocaleKeys.cmcOrders.tr(context: context), isLeading: true, child: SingleChildScrollView( child: Column( diff --git a/lib/presentation/comprehensive_checkup/widgets/cmc_hospital_bottom_sheet_body.dart b/lib/presentation/comprehensive_checkup/widgets/cmc_hospital_bottom_sheet_body.dart index 98e91b8..93c8d5f 100644 --- a/lib/presentation/comprehensive_checkup/widgets/cmc_hospital_bottom_sheet_body.dart +++ b/lib/presentation/comprehensive_checkup/widgets/cmc_hospital_bottom_sheet_body.dart @@ -55,7 +55,7 @@ class CmcHospitalBottomSheetBody extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Choose your preferred hospital for the service".needTranslation.toText14( + LocaleKeys.choosePreferredHospitalForService.tr(context: context).toText14( weight: FontWeight.w400, color: AppColors.greyTextColor, letterSpacing: -0.4, @@ -85,7 +85,7 @@ class CmcHospitalBottomSheetBody extends StatelessWidget { ? _buildLoadingShimmer() : hmgServicesViewModel.filteredHospitalsList.isEmpty ? Center( - child: "No hospitals Found".needTranslation.toText16(weight: FontWeight.w500, color: AppColors.greyTextColor), + child: LocaleKeys.noHospitalsFound.tr(context: context).toText16(weight: FontWeight.w500, color: AppColors.greyTextColor), ) : ListView.separated( itemCount: hmgServicesViewModel.filteredHospitalsList.length, diff --git a/lib/presentation/comprehensive_checkup/widgets/cmc_hospital_list_item.dart b/lib/presentation/comprehensive_checkup/widgets/cmc_hospital_list_item.dart index 39d6d7c..25cd506 100644 --- a/lib/presentation/comprehensive_checkup/widgets/cmc_hospital_list_item.dart +++ b/lib/presentation/comprehensive_checkup/widgets/cmc_hospital_list_item.dart @@ -97,7 +97,7 @@ class CmcHospitalListItem extends StatelessWidget { Visibility( visible: (hospital.distanceInKilometers != null && hospital.distanceInKilometers! > 0), child: AppCustomChipWidget( - labelText: "$distanceText km".needTranslation, + labelText: "$distanceText km", icon: AppAssets.location_red, iconColor: AppColors.errorColor, backgroundColor: AppColors.secondaryLightRedColor, @@ -107,7 +107,7 @@ class CmcHospitalListItem extends StatelessWidget { Visibility( visible: (hospital.distanceInKilometers == null || hospital.distanceInKilometers == 0), child: AppCustomChipWidget( - labelText: " Distance not available".needTranslation, + labelText: " Distance not available", textColor: AppColors.blackColor, ), ), diff --git a/lib/presentation/comprehensive_checkup/widgets/cmc_ui_selection_helper.dart b/lib/presentation/comprehensive_checkup/widgets/cmc_ui_selection_helper.dart index 908aac9..fcce480 100644 --- a/lib/presentation/comprehensive_checkup/widgets/cmc_ui_selection_helper.dart +++ b/lib/presentation/comprehensive_checkup/widgets/cmc_ui_selection_helper.dart @@ -24,7 +24,7 @@ class CmcUiSelectionHelper { showCommonBottomSheetWithoutHeight( context, - title: "Select Hospital".needTranslation, + title: LocaleKeys.selectHospital.tr(context: context), child: CmcHospitalBottomSheetBody( onHospitalSelected: (hospital) { hmgServicesViewModel.setSelectedHospitalForOrder(hospital); @@ -44,7 +44,7 @@ class CmcUiSelectionHelper { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: "Are you sure you want to cancel this order?".needTranslation, + loadingText: LocaleKeys.cancelOrderConfirmation.tr(context: context), isShowActionButtons: true, onCancelTap: () { Navigator.pop(context); @@ -70,7 +70,7 @@ class CmcUiSelectionHelper { padding: EdgeInsets.all(16.w), child: Column( children: [ - Utils.getSuccessWidget(loadingText: "Order has been cancelled successfully".needTranslation), + Utils.getSuccessWidget(loadingText: LocaleKeys.orderCancelledSuccessfully.tr(context: context)), SizedBox(height: 24.h), Row( children: [ From 8c92df8648f001add6b70acfb10bc06f909352ca Mon Sep 17 00:00:00 2001 From: Sultan khan Date: Wed, 14 Jan 2026 09:56:25 +0300 Subject: [PATCH 03/12] contact us page fix --- lib/core/api_consts.dart | 3 +- lib/core/dependencies.dart | 15 +++---- lib/features/contact_us/contact_us_repo.dart | 41 +++++++++++++++++++ .../contact_us/contact_us_view_model.dart | 28 +++++++++++++ .../hmg_services/hmg_services_repo.dart | 28 ++++++++++++- .../contact_us/live_chat_page.dart | 36 +++++++++++++--- lib/routes/app_routes.dart | 35 ++++++++++------ 7 files changed, 160 insertions(+), 26 deletions(-) diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index fe0b4d5..4acf486 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -151,6 +151,7 @@ var GET_FINDUS_REQUEST = 'Services/Lists.svc/REST/Get_HMG_Locations'; ///LiveChat var GET_LIVECHAT_REQUEST = 'Services/Patients.svc/REST/GetPatientICProjects'; +var GET_LIVECHAT_REQUEST_ID = 'Services/Patients.svc/REST/Patient_ICChatRequest_Insert'; ///babyInformation var GET_BABYINFORMATION_REQUEST = 'Services/Community.svc/REST/GetBabyByUserID'; @@ -661,7 +662,7 @@ var GET_PRESCRIPTION_INSTRUCTIONS_PDF = 'Services/ChatBot_Service.svc/REST/Chatb class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index bfbccfc..bdcc818 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -35,6 +35,7 @@ import 'package:hmg_patient_app_new/features/medical_file/medical_file_repo.dart import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/monthly_report/monthly_report_repo.dart'; import 'package:hmg_patient_app_new/features/monthly_report/monthly_report_view_model.dart'; +import 'package:hmg_patient_app_new/features/monthly_reports/monthly_reports_repo.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_rating_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/appointment_via_region_viewmodel.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_repo.dart'; @@ -162,13 +163,13 @@ class AppDependencies { ),); getIt.registerLazySingleton(() => MonthlyReportsRepoImp(loggerService: getIt(), apiClient: getIt())); getIt.registerLazySingleton(() => QrParkingRepoImp(loggerService: getIt(), apiClient: getIt())); - getIt.registerFactory( - () => QrParkingViewModel( - qrParkingRepo: getIt(), - errorHandlerService: getIt(), - cacheService: getIt(), - ), - ); + // getIt.registerFactory( + // () => QrParkingViewModel( + // qrParkingRepo: getIt(), + // errorHandlerService: getIt(), + // cacheService: getIt(), + // ), + // ); // ViewModels // Global/shared VMs → LazySingleton diff --git a/lib/features/contact_us/contact_us_repo.dart b/lib/features/contact_us/contact_us_repo.dart index 3e96f91..5b9057b 100644 --- a/lib/features/contact_us/contact_us_repo.dart +++ b/lib/features/contact_us/contact_us_repo.dart @@ -14,6 +14,8 @@ abstract class ContactUsRepo { Future>>> getLiveChatProjectsList(); + Future>> getChatRequestID({required String name, required String mobileNo, required String workGroup}); + Future>> insertCOCItem({required RequestInsertCOCItem requestInsertCOCItem, PatientAppointmentHistoryResponseModel? patientSelectedAppointment}); } @@ -97,6 +99,45 @@ class ContactUsRepoImp implements ContactUsRepo { } } + @override + Future>> getChatRequestID({required String name, required String mobileNo, required String workGroup}) async { + Map body = {}; + body['Name'] = name; + body['MobileNo'] = mobileNo; + body['WorkGroup'] = workGroup; + + try { + GenericApiModel? apiResponse; + Failure? failure; + await apiClient.post( + GET_LIVECHAT_REQUEST_ID, + body: body, + onFailure: (error, statusCode, {messageStatus, failureType}) { + failure = failureType; + }, + onSuccess: (response, statusCode, {messageStatus, errorMessage}) { + try { + final requestId = response['RequestId'] as String; + + apiResponse = GenericApiModel( + messageStatus: messageStatus, + statusCode: statusCode, + errorMessage: null, + data: requestId, + ); + } catch (e) { + failure = DataParsingFailure(e.toString()); + } + }, + ); + if (failure != null) return Left(failure!); + if (apiResponse == null) return Left(ServerFailure("Unknown error")); + return Right(apiResponse!); + } catch (e) { + return Left(UnknownFailure(e.toString())); + } + } + @override Future>> insertCOCItem({required RequestInsertCOCItem requestInsertCOCItem, PatientAppointmentHistoryResponseModel? patientSelectedAppointment}) async { final Map body = requestInsertCOCItem.toJson(); diff --git a/lib/features/contact_us/contact_us_view_model.dart b/lib/features/contact_us/contact_us_view_model.dart index 1185700..1029802 100644 --- a/lib/features/contact_us/contact_us_view_model.dart +++ b/lib/features/contact_us/contact_us_view_model.dart @@ -29,6 +29,8 @@ class ContactUsViewModel extends ChangeNotifier { int selectedLiveChatProjectIndex = -1; + String? chatRequestID; + List feedbackAttachmentList = []; PatientAppointmentHistoryResponseModel? patientFeedbackSelectedAppointment; @@ -153,6 +155,32 @@ class ContactUsViewModel extends ChangeNotifier { ); } + Future getChatRequestID({required String name, required String mobileNo, required String workGroup, Function(dynamic)? onSuccess, Function(String)? onError}) async { + final result = await contactUsRepo.getChatRequestID(name: name, mobileNo: mobileNo, workGroup: workGroup); + + result.fold( + (failure) async { + await errorHandlerService.handleError(failure: failure); + if (onError != null) { + onError(failure.toString()); + } + }, + (apiResponse) { + if (apiResponse.messageStatus == 2) { + if (onError != null) { + onError(apiResponse.errorMessage ?? 'Unknown error'); + } + } else if (apiResponse.messageStatus == 1) { + chatRequestID = apiResponse.data; + notifyListeners(); + if (onSuccess != null) { + onSuccess(apiResponse); + } + } + }, + ); + } + Future insertCOCItem({required String subject, required String message, Function(dynamic)? onSuccess, Function(String)? onError}) async { RequestInsertCOCItem requestInsertCOCItem = RequestInsertCOCItem(); requestInsertCOCItem.attachment = feedbackAttachmentList.isNotEmpty ? feedbackAttachmentList.first : ""; diff --git a/lib/features/hmg_services/hmg_services_repo.dart b/lib/features/hmg_services/hmg_services_repo.dart index 85e6018..e4b9a03 100644 --- a/lib/features/hmg_services/hmg_services_repo.dart +++ b/lib/features/hmg_services/hmg_services_repo.dart @@ -940,7 +940,16 @@ class HmgServicesRepoImp implements HmgServicesRepo { for (var vitalSignJson in vitalSignsList) { if (vitalSignJson is Map) { - vitalSignList.add(VitalSignResModel.fromJson(vitalSignJson)); + final vitalSign = VitalSignResModel.fromJson(vitalSignJson); + + // Only add records where BOTH height AND weight are greater than 0 + final hasValidWeight = _isValidValue(vitalSign.weightKg); + final hasValidHeight = _isValidValue(vitalSign.heightCm); + + // Only add if both height and weight are valid (> 0) + if (hasValidWeight && hasValidHeight) { + vitalSignList.add(vitalSign); + } } } } @@ -967,5 +976,22 @@ class HmgServicesRepoImp implements HmgServicesRepo { } } + /// Helper method to check if a value is valid (greater than 0) + bool _isValidValue(dynamic value) { + if (value == null) return false; + + if (value is num) { + return value > 0; + } + + if (value is String) { + if (value.trim().isEmpty) return false; + final parsed = double.tryParse(value); + return parsed != null && parsed > 0; + } + + return false; + } + } diff --git a/lib/presentation/contact_us/live_chat_page.dart b/lib/presentation/contact_us/live_chat_page.dart index 7cbdee3..3602c98 100644 --- a/lib/presentation/contact_us/live_chat_page.dart +++ b/lib/presentation/contact_us/live_chat_page.dart @@ -130,9 +130,13 @@ class LiveChatPage extends StatelessWidget { ).paddingSymmetrical(16.h, 16.h), ).onPress(() { contactUsVM.setSelectedLiveChatProjectIndex(index); - chatURL = - "https://chat.hmg.com/Index.aspx?Name=${appState.getAuthenticatedUser()!.firstName}&PatientID=${appState.getAuthenticatedUser()!.patientId}&MobileNo=${appState.getAuthenticatedUser()!.mobileNumber}&Language=${appState.isArabic() ? 'ar' : 'en'}&WorkGroup=${contactUsVM.liveChatProjectsList[index].value}"; - debugPrint("Chat URL: $chatURL"); + _getChatRequestID( + context, + contactUsVM, + name: appState.getAuthenticatedUser()!.firstName ?? '', + mobileNo: appState.getAuthenticatedUser()!.mobileNumber ?? '', + workGroup: contactUsVM.liveChatProjectsList[index].value ?? '', + ); }), ).paddingSymmetrical(24.h, 0.h), ), @@ -155,8 +159,14 @@ class LiveChatPage extends StatelessWidget { child: CustomButton( text: LocaleKeys.liveChat.tr(context: context), onPressed: () async { - Uri uri = Uri.parse(chatURL); - launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: ""); + if (contactUsVM.chatRequestID != null) { + chatURL = "https://chat.hmg.com/Index.aspx?RequestedId=${contactUsVM.chatRequestID}"; + debugPrint("Chat URL: $chatURL"); + Uri uri = Uri.parse(chatURL); + launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: ""); + } else { + debugPrint("Chat Request ID is null"); + } }, backgroundColor: contactUsVM.selectedLiveChatProjectIndex == -1 ? AppColors.greyColor : AppColors.primaryRedColor, borderColor: contactUsVM.selectedLiveChatProjectIndex == -1 ? AppColors.greyColor : AppColors.primaryRedColor, @@ -173,4 +183,20 @@ class LiveChatPage extends StatelessWidget { }), ); } + + void _getChatRequestID(BuildContext context, ContactUsViewModel contactUsVM, {required String name, required String mobileNo, required String workGroup}) { + contactUsVM.getChatRequestID( + name: name, + mobileNo: mobileNo, + workGroup: workGroup, + onSuccess: (response) { + debugPrint("Chat Request ID received: ${contactUsVM.chatRequestID}"); + chatURL = "https://chat.hmg.com/Index.aspx?RequestedId=${contactUsVM.chatRequestID}"; + debugPrint("Chat URL: $chatURL"); + }, + onError: (error) { + debugPrint("Error getting chat request ID: $error"); + }, + ); + } } diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index 059969c..d183d02 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -85,7 +85,8 @@ class AppRoutes { static const String addHealthTrackerEntryPage = '/addHealthTrackerEntryPage'; static const String healthTrackerDetailPage = '/healthTrackerDetailPage'; - static Map get routes => { + static Map get routes => + { initialRoute: (context) => SplashPage(), loginScreen: (context) => LoginScreen(), landingScreen: (context) => LandingNavigation(), @@ -116,27 +117,37 @@ class AppRoutes { healthTrackersPage: (context) => HealthTrackersPage(), vitalSign: (context) => VitalSignPage(), addHealthTrackerEntryPage: (context) { - final args = ModalRoute.of(context)?.settings.arguments as HealthTrackerTypeEnum?; + final args = ModalRoute + .of(context) + ?.settings + .arguments as HealthTrackerTypeEnum?; return AddHealthTrackerEntryPage( trackerType: args ?? HealthTrackerTypeEnum.bloodSugar, ); }, healthTrackerDetailPage: (context) { - final args = ModalRoute.of(context)?.settings.arguments as HealthTrackerTypeEnum?; + final args = ModalRoute + .of(context) + ?.settings + .arguments as HealthTrackerTypeEnum?; return HealthTrackerDetailPage( trackerType: args ?? HealthTrackerTypeEnum.bloodSugar, ); - - monthlyReports: (context) => ChangeNotifierProvider( - create: (_) => MonthlyReportsViewModel( - monthlyReportsRepo: getIt(), - errorHandlerService: getIt(), + }, + monthlyReports: (context) => + ChangeNotifierProvider( + create: (_) => + MonthlyReportsViewModel( + monthlyReportsRepo: getIt(), + errorHandlerService: getIt(), + ), + child: const MonthlyReportsPage(), ), - child: const MonthlyReportsPage(), - ), + qrParking: (context) => ChangeNotifierProvider( create: (_) => getIt(), child: const ParkingPage(), - }, - }; + ) + }; + } From 287e2b956289e5d86e46c6d879f6a6e75b92a318 Mon Sep 17 00:00:00 2001 From: "Fatimah.Alshammari" Date: Wed, 14 Jan 2026 10:42:50 +0300 Subject: [PATCH 04/12] fixed QR --- lib/core/api/api_client.dart | 2 +- lib/core/dependencies.dart | 10 +++++----- lib/routes/app_routes.dart | 23 ++++++++++++----------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/core/api/api_client.dart b/lib/core/api/api_client.dart index 039787b..722a45e 100644 --- a/lib/core/api/api_client.dart +++ b/lib/core/api/api_client.dart @@ -19,7 +19,7 @@ abstract class ApiClient { Future post( String endPoint, { - required dynamic body, + required Map body, required Function(dynamic response, int statusCode, {int? messageStatus, String? errorMessage}) onSuccess, required Function(String error, int statusCode, {int? messageStatus, Failure? failureType}) onFailure, bool isAllowAny, diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index d70191b..5f2444f 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -292,11 +292,11 @@ class AppDependencies { // getIt.registerLazySingleton(() => MyInvoicesViewModel(myInvoicesRepo: getIt(), errorHandlerService: getIt(), navServices: getIt())); getIt.registerLazySingleton(() => MonthlyReportViewModel(errorHandlerService: getIt(), monthlyReportRepo: getIt())); - // getIt.registerLazySingleton(() => MyInvoicesViewModel( - // myInvoicesRepo: getIt(), - // errorHandlerService: getIt(), - // navServices: getIt(), - // )); + getIt.registerLazySingleton(() => MyInvoicesViewModel( + myInvoicesRepo: getIt(), + errorHandlerService: getIt(), + navServices: getIt(), + )); getIt.registerLazySingleton(() => HealthTrackersViewModel(healthTrackersRepo: getIt(), errorHandlerService: getIt())); getIt.registerLazySingleton( () => ActivePrescriptionsViewModel( diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index 059969c..632463f 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -126,17 +126,18 @@ class AppRoutes { return HealthTrackerDetailPage( trackerType: args ?? HealthTrackerTypeEnum.bloodSugar, ); - - monthlyReports: (context) => ChangeNotifierProvider( - create: (_) => MonthlyReportsViewModel( - monthlyReportsRepo: getIt(), - errorHandlerService: getIt(), - ), - child: const MonthlyReportsPage(), - ), - qrParking: (context) => ChangeNotifierProvider( - create: (_) => getIt(), - child: const ParkingPage(), }, + + monthlyReports: (context) => ChangeNotifierProvider( + create: (_) => MonthlyReportsViewModel( + monthlyReportsRepo: getIt(), + errorHandlerService: getIt(), + ), + child: const MonthlyReportsPage(), + ), + qrParking: (context) => ChangeNotifierProvider( + create: (_) => getIt(), + child: const ParkingPage(), + ), }; } From 169215fd7b04f84163e6787a6a256cc02a9971cb Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 14 Jan 2026 11:10:12 +0300 Subject: [PATCH 05/12] translation changes --- assets/langs/ar-SA.json | 96 ++++++++++++++++++- assets/langs/en-US.json | 96 ++++++++++++++++++- lib/extensions/string_extensions.dart | 2 +- lib/generated/locale_keys.g.dart | 94 +++++++++++++++++- .../cmc_selection_review_page.dart | 26 ++--- .../comprehensive_checkup_page.dart | 15 +-- lib/presentation/contact_us/contact_us.dart | 6 +- .../contact_us/feedback_page.dart | 22 ++--- .../contact_us/live_chat_page.dart | 1 - .../contact_us/widgets/find_us_item_card.dart | 4 +- .../covid19test/covid19_landing_page.dart | 6 +- .../covid19test/covid_19_questionnaire.dart | 4 +- .../covid19test/covid_payment_screen.dart | 22 ++--- .../covid19test/covid_review_screen.dart | 10 +- .../e_referral/e-referral_validator.dart | 31 +++--- .../e_referral/e_referral_search_result.dart | 9 +- .../e_referral/new_e_referral.dart | 12 +-- .../e_referral/search_e_referral.dart | 4 +- .../widget/e_referral_other_details.dart | 22 +++-- .../widget/e_referral_patient_info.dart | 20 ++-- .../widget/e_referral_requester_form.dart | 26 ++--- .../call_ambulance/call_ambulance_page.dart | 41 ++++---- .../requesting_services_page.dart | 5 +- .../call_ambulance/tracking_screen.dart | 43 +++++---- .../widgets/pickup_location.dart | 21 ++-- .../widgets/type_selection_widget.dart | 8 +- 26 files changed, 454 insertions(+), 192 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index ee6ac33..da245da 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -694,11 +694,7 @@ "bikini": "بيكيني", "totalMinutes": "إجمالي الدقائق", "feedback": "ملاحظات", - "send": "أرسل", - "status": "الحالة", "likeToHear": "نود سماع ملاحظاتك، ومخاوفك بشأن خدمات الرعاية الصحية وتجربة الخدمات الإلكترونية. يرجى استخدام النموذج أدناه", - "subject": "الموضوع", - "message": "رسالة", "emptySubject": "يرجى إدخال الموضوع", "emptyMessage": "يرجى إدخال الرسالة", "selectAttachment": "اختر المرفق", @@ -1009,5 +1005,95 @@ "orderCancelledSuccessfully": "تم إلغاء الطلب بنجاح", "requestID": "معرف الطلب:", "noCMCOrdersYet": "ليس لديك أي طلبات فحص شامل بعد.", - "cmcOrders": "طلبات الفحص الشامل" + "cmcOrders": "طلبات الفحص الشامل", + "summary": "الملخص", + "selectedService": "الخدمة المحددة", + "requestSubmittedSuccessfully": "تم إرسال طلبك بنجاح.", + "hereIsYourRequestNumber": "هذا هو رقم طلبك #: ", + "pleaseSelectHospitalToContinue": "يرجى اختيار مستشفى للمتابعة", + "confirmSubmitRequest": "هل أنت متأكد أنك تريد إرسال هذا الطلب؟", + "pendingOrderWait": "لديك طلب معلق. يرجى الانتظار حتى تتم معالجته.", + "noServicesAvailable": "لا توجد خدمات متاحة", + "selectAService": "اختر خدمة", + "comprehensiveCheckup": "الفحص الشامل", + "viewNearestHMGLocations": "عرض أقرب مواقع مجموعة الحبيب الطبية", + "provideFeedbackOnServices": "قدم ملاحظاتك على خدماتنا", + "liveChatWithHMG": "خيار الدردشة المباشرة مع مجموعة الحبيب الطبية", + "send": "إرسال", + "status": "الحالة", + "sendingFeedback": "جاري إرسال الملاحظات...", + "selectFeedbackType": "اختر نوع الملاحظات", + "loadingAppointmentsList": "جاري تحميل قائمة المواعيد...", + "noAppointmentsForFeedback": "ليس لديك أي مواعيد لتقديم ملاحظات عنها.", + "selectedAppointment": "الموعد المحدد:", + "subject": "الموضوع", + "enterSubjectHere": "أدخل الموضوع هنا", + "message": "الرسالة", + "enterMessageHere": "أدخل الرسالة هنا", + "filesSelected": "تم تحديد {count} ملف(ات)", + "otherDetails": "تفاصيل أخرى", + "medicalReport": "التقرير الطبي", + "medicalReportNumber": "التقرير الطبي {number}", + "patientIsInsured": "المريض مؤمن عليه", + "insuranceDocument": "وثيقة التأمين", + "selectBranch": "اختر الفرع", + "patientInformation": "معلومات المريض", + "patientLocation": "أين يتواجد المريض", + "identificationNumber": "رقم الهوية", + "enterIdentificationNumber": "أدخل رقم الهوية*", + "patientName": "اسم المريض*", + "referralRequesterInformation": "معلومات مقدم طلب الإحالة", + "enterReferralRequesterName": "أدخل اسم مقدم طلب الإحالة*", + "requesterName": "اسم مقدم الطلب", + "relationship": "العلاقة", + "selectRelation": "اختر العلاقة", + "otherName": "اسم آخر", + "otherNameHint": "اسم آخر*", + "requesterNameRequired": "اسم مقدم طلب الإحالة مطلوب", + "selectRelationshipRequired": "يرجى اختيار العلاقة", + "otherRelationshipNameRequired": "اسم العلاقة الأخرى مطلوب", + "identificationNumberRequired": "رقم الهوية مطلوب", + "patientNameRequired": "اسم المريض مطلوب", + "enterPatientPhoneRequired": "يرجى إدخال رقم هاتف المريض", + "selectPatientCityRequired": "يرجى اختيار مدينة المريض", + "medicalReportRequired": "مطلوب تقرير طبي واحد على الأقل", + "selectBranchRequired": "يرجى اختيار الفرع", + "insuranceDocumentRequired": "وثيقة التأمين مطلوبة للمرضى المؤمن عليهم", + "searchResult": "نتيجة البحث", + "referralNo": "رقم الإحالة {number}", + "eReferral": "الإحالة الإلكترونية", + "referralCreatedSuccessfully": "تم إنشاء إحالتك بنجاح.", + "hereIsYourReferralNumber": "هذا هو رقم الإحالة الخاص بك #: ", + "searchEReferral": "البحث عن إحالة إلكترونية", + "enterRequiredInfoToSearch": "يرجى إدخال المعلومات المطلوبة للبحث عن إحالة إلكترونية", + "selectPickupDirection": "اختر اتجاه الاستلام", + "selectDirection": "اختر الاتجاه", + "toHospital": "إلى المستشفى", + "fromHospital": "من المستشفى", + "selectWay": "اختر الطريقة", + "oneWay": "اتجاه واحد", + "twoWay": "اتجاهين", + "selectPickupDetails": "اختر تفاصيل الاستلام", + "pleaseSelectDetailsOfPickup": " يرجى تحديد تفاصيل الاستلام", + "selectDetails": "اختر التفاصيل", + "work": "العمل", + "pick": "استلام", + "insideTheHome": "داخل المنزل", + "haveAnyAppointment": "هل لديك أي موعد", + "amountPaidAtHospital": "سيتم دفع المبلغ في المستشفى", + "submitRequest": "إرسال الطلب", + "enterPickupLocationManually": "أدخل موقع الاستلام يدوياً", + "enterPickupLocation": "أدخل موقع الاستلام", + "trackingDetails": "تفاصيل التتبع", + "cancelRequest": "إلغاء الطلب", + "shareLocationWhatsapp": "مشاركة موقعك المباشر على واتساب", + "pleaseWaitForCall": "يرجى انتظار المكالمة", + "toHospitalLower": "إلى المستشفى", + "contact": "اتصال", + "failed": "فشل", + "confirmationCall": "مكالمة التأكيد", + "pickupFromHome": "الاستلام من المنزل", + "onTheWayToHospital": " في الطريق إلى المستشفى", + "arrivedAtHospital": "وصل إلى المستشفى", + "orderCancel": "إلغاء الطلب" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 6244157..f6500dc 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -689,11 +689,7 @@ "bikini": "Bikini", "totalMinutes": "Total Minutes", "feedback": "Feedback", - "send": "أرسل", - "status": "الحالة", "likeToHear": "We would love to hear the feedback, concerns on healthcare services and eServices experience. Please use the below form", - "subject": "الموضوع", - "message": "رسالة", "emptySubject": "Please enter the subject", "emptyMessage": "Please enter message", "selectAttachment": "Select Attachment", @@ -1005,5 +1001,95 @@ "orderCancelledSuccessfully": "Order has been cancelled successfully", "requestID": "Request ID:", "noCMCOrdersYet": "You don't have any CMC orders yet.", - "cmcOrders": "CMC Orders" + "cmcOrders": "CMC Orders", + "summary": "Summary", + "selectedService": "Selected Service", + "requestSubmittedSuccessfully": "Your request has been successfully submitted.", + "hereIsYourRequestNumber": "Here is your request #: ", + "pleaseSelectHospitalToContinue": "Please select a hospital to continue", + "confirmSubmitRequest": "Are you sure you want to submit this request?", + "pendingOrderWait": "You have a pending order. Please wait for it to be processed.", + "noServicesAvailable": "No services available", + "selectAService": "Select a Service", + "comprehensiveCheckup": "Comprehensive Checkup", + "viewNearestHMGLocations": "View your nearest HMG locations", + "provideFeedbackOnServices": "Provide your feedback on our services", + "liveChatWithHMG": "Live chat option with HMG", + "send": "Send", + "status": "Status", + "sendingFeedback": "Sending Feedback...", + "selectFeedbackType": "Select Feedback Type", + "loadingAppointmentsList": "Loading appointments list...", + "noAppointmentsForFeedback": "You do not have any appointments to submit a feedback.", + "selectedAppointment": "Selected Appointment:", + "subject": "Subject", + "enterSubjectHere": "Enter subject here", + "message": "Message", + "enterMessageHere": "Enter message here", + "filesSelected": "{count} file(s) selected", + "otherDetails": "Other Details", + "medicalReport": "Medical Report", + "medicalReportNumber": "Medical Report {number}", + "patientIsInsured": "Patient is Insured", + "insuranceDocument": "Insurance Document", + "selectBranch": "Select Branch", + "patientInformation": "Patient information", + "patientLocation": "Where the patient located", + "identificationNumber": "Identification Number", + "enterIdentificationNumber": "Enter Identification Number*", + "patientName": "Patient Name*", + "referralRequesterInformation": "Referral requester information", + "enterReferralRequesterName": "Enter Referral Requester Name*", + "requesterName": "Requester Name", + "relationship": "Relationship", + "selectRelation": "Select Relation", + "otherName": "Other Name", + "otherNameHint": "Other Name*", + "requesterNameRequired": "Referral requester name is required", + "selectRelationshipRequired": "Please select a relationship", + "otherRelationshipNameRequired": "Other relationship name is required", + "identificationNumberRequired": "Identification number is required", + "patientNameRequired": "Patient name is required", + "enterPatientPhoneRequired": "Please Enter patient phone number", + "selectPatientCityRequired": "Please select patient city", + "medicalReportRequired": "At least one medical report is required", + "selectBranchRequired": "Please select a branch", + "insuranceDocumentRequired": "Insurance document is required for insured patients", + "searchResult": "Search Result", + "referralNo": "Referral No {number}", + "eReferral": "E Referral", + "referralCreatedSuccessfully": "Your Referral has been created Successfully.", + "hereIsYourReferralNumber": "Here is your Referral #: ", + "searchEReferral": "Search E-Referral", + "enterRequiredInfoToSearch": "Please enter the required information to search for an e-referral", + "selectPickupDirection": "Select Pickup Direction", + "selectDirection": "Select Direction", + "toHospital": "To Hospital", + "fromHospital": "From Hospital", + "selectWay": "Select Way", + "oneWay": "One Way", + "twoWay": "Two Way", + "selectPickupDetails": "Select Pickup Details", + "pleaseSelectDetailsOfPickup": " Please select the details of pickup", + "selectDetails": "Select Details", + "work": "Work", + "pick": "Pick", + "insideTheHome": "Inside the home", + "haveAnyAppointment": "Have any appointment", + "amountPaidAtHospital": "Amount will be paid at the hospital", + "submitRequest": "Submit Request", + "enterPickupLocationManually": "Enter Pickup Location Manually", + "enterPickupLocation": "Enter Pickup Location", + "trackingDetails": "Tracking Details", + "cancelRequest": "Cancel Request", + "shareLocationWhatsapp": "Share Your Live Location on Whatsapp", + "pleaseWaitForCall": "Please wait for the call", + "toHospitalLower": "to hospital", + "contact": "Contact", + "failed": "Failed", + "confirmationCall": "Confirmation Call", + "pickupFromHome": "Pickup Up from Home", + "onTheWayToHospital": " On The Way To Hospital", + "arrivedAtHospital": "Arrived at Hospital", + "orderCancel": "Order Cancel" } \ No newline at end of file diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 309dde1..947bff4 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -15,7 +15,7 @@ extension CapExtension on String { String get allInCaps => toUpperCase(); - String get needTranslation => this; + // String get needTranslation => this; String get capitalizeFirstofEach => trim().isNotEmpty ? trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : ""; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index f57a48b..fcc0257 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -693,11 +693,7 @@ abstract class LocaleKeys { static const bikini = 'bikini'; static const totalMinutes = 'totalMinutes'; static const feedback = 'feedback'; - static const send = 'send'; - static const status = 'status'; static const likeToHear = 'likeToHear'; - static const subject = 'subject'; - static const message = 'message'; static const emptySubject = 'emptySubject'; static const emptyMessage = 'emptyMessage'; static const selectAttachment = 'selectAttachment'; @@ -1006,5 +1002,95 @@ abstract class LocaleKeys { static const requestID = 'requestID'; static const noCMCOrdersYet = 'noCMCOrdersYet'; static const cmcOrders = 'cmcOrders'; + static const summary = 'summary'; + static const selectedService = 'selectedService'; + static const requestSubmittedSuccessfully = 'requestSubmittedSuccessfully'; + static const hereIsYourRequestNumber = 'hereIsYourRequestNumber'; + static const pleaseSelectHospitalToContinue = 'pleaseSelectHospitalToContinue'; + static const confirmSubmitRequest = 'confirmSubmitRequest'; + static const pendingOrderWait = 'pendingOrderWait'; + static const noServicesAvailable = 'noServicesAvailable'; + static const selectAService = 'selectAService'; + static const comprehensiveCheckup = 'comprehensiveCheckup'; + static const viewNearestHMGLocations = 'viewNearestHMGLocations'; + static const provideFeedbackOnServices = 'provideFeedbackOnServices'; + static const liveChatWithHMG = 'liveChatWithHMG'; + static const send = 'send'; + static const status = 'status'; + static const sendingFeedback = 'sendingFeedback'; + static const selectFeedbackType = 'selectFeedbackType'; + static const loadingAppointmentsList = 'loadingAppointmentsList'; + static const noAppointmentsForFeedback = 'noAppointmentsForFeedback'; + static const selectedAppointment = 'selectedAppointment'; + static const subject = 'subject'; + static const enterSubjectHere = 'enterSubjectHere'; + static const message = 'message'; + static const enterMessageHere = 'enterMessageHere'; + static const filesSelected = 'filesSelected'; + static const otherDetails = 'otherDetails'; + static const medicalReport = 'medicalReport'; + static const medicalReportNumber = 'medicalReportNumber'; + static const patientIsInsured = 'patientIsInsured'; + static const insuranceDocument = 'insuranceDocument'; + static const selectBranch = 'selectBranch'; + static const patientInformation = 'patientInformation'; + static const patientLocation = 'patientLocation'; + static const identificationNumber = 'identificationNumber'; + static const enterIdentificationNumber = 'enterIdentificationNumber'; + static const patientName = 'patientName'; + static const referralRequesterInformation = 'referralRequesterInformation'; + static const enterReferralRequesterName = 'enterReferralRequesterName'; + static const requesterName = 'requesterName'; + static const relationship = 'relationship'; + static const selectRelation = 'selectRelation'; + static const otherName = 'otherName'; + static const otherNameHint = 'otherNameHint'; + static const requesterNameRequired = 'requesterNameRequired'; + static const selectRelationshipRequired = 'selectRelationshipRequired'; + static const otherRelationshipNameRequired = 'otherRelationshipNameRequired'; + static const identificationNumberRequired = 'identificationNumberRequired'; + static const patientNameRequired = 'patientNameRequired'; + static const enterPatientPhoneRequired = 'enterPatientPhoneRequired'; + static const selectPatientCityRequired = 'selectPatientCityRequired'; + static const medicalReportRequired = 'medicalReportRequired'; + static const selectBranchRequired = 'selectBranchRequired'; + static const insuranceDocumentRequired = 'insuranceDocumentRequired'; + static const searchResult = 'searchResult'; + static const referralNo = 'referralNo'; + static const eReferral = 'eReferral'; + static const referralCreatedSuccessfully = 'referralCreatedSuccessfully'; + static const hereIsYourReferralNumber = 'hereIsYourReferralNumber'; + static const searchEReferral = 'searchEReferral'; + static const enterRequiredInfoToSearch = 'enterRequiredInfoToSearch'; + static const selectPickupDirection = 'selectPickupDirection'; + static const selectDirection = 'selectDirection'; + static const toHospital = 'toHospital'; + static const fromHospital = 'fromHospital'; + static const selectWay = 'selectWay'; + static const oneWay = 'oneWay'; + static const twoWay = 'twoWay'; + static const selectPickupDetails = 'selectPickupDetails'; + static const pleaseSelectDetailsOfPickup = 'pleaseSelectDetailsOfPickup'; + static const selectDetails = 'selectDetails'; + static const work = 'work'; + static const pick = 'pick'; + static const insideTheHome = 'insideTheHome'; + static const haveAnyAppointment = 'haveAnyAppointment'; + static const amountPaidAtHospital = 'amountPaidAtHospital'; + static const submitRequest = 'submitRequest'; + static const enterPickupLocationManually = 'enterPickupLocationManually'; + static const enterPickupLocation = 'enterPickupLocation'; + static const trackingDetails = 'trackingDetails'; + static const cancelRequest = 'cancelRequest'; + static const shareLocationWhatsapp = 'shareLocationWhatsapp'; + static const pleaseWaitForCall = 'pleaseWaitForCall'; + static const toHospitalLower = 'toHospitalLower'; + static const contact = 'contact'; + static const failed = 'failed'; + static const confirmationCall = 'confirmationCall'; + static const pickupFromHome = 'pickupFromHome'; + static const onTheWayToHospital = 'onTheWayToHospital'; + static const arrivedAtHospital = 'arrivedAtHospital'; + static const orderCancel = 'orderCancel'; } diff --git a/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart b/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart index 18b656c..9b78eca 100644 --- a/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart +++ b/lib/presentation/comprehensive_checkup/cmc_selection_review_page.dart @@ -55,7 +55,7 @@ class _CmcSelectionReviewPageState extends State { final isArabic = appState.isArabic(); return CollapsingListView( - title: "Summary".needTranslation, + title: LocaleKeys.summary.tr(context: context), bottomChild: _buildBottomButton(), child: SingleChildScrollView( padding: EdgeInsets.all(16.w), @@ -89,7 +89,7 @@ class _CmcSelectionReviewPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Select Hospital".needTranslation, + LocaleKeys.selectHospital.tr(context: context), style: TextStyle( fontSize: 16.f, fontWeight: FontWeight.w700, @@ -132,7 +132,7 @@ class _CmcSelectionReviewPageState extends State { Text( isLocationSelected && selectedHospital != null ? (isArabic ? (selectedHospital.nameN ?? selectedHospital.name ?? '') : (selectedHospital.name ?? '')) - : "Select Hospital".needTranslation, + : LocaleKeys.selectHospital.tr(context: context), style: TextStyle( fontSize: 14.f, fontWeight: isLocationSelected ? FontWeight.w600 : FontWeight.w400, @@ -189,7 +189,7 @@ class _CmcSelectionReviewPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Selected Service".needTranslation.toText14( + LocaleKeys.selectedService.tr(context: context).toText14( weight: FontWeight.w600, color: AppColors.greyTextColor, letterSpacing: -0.4, @@ -226,14 +226,14 @@ class _CmcSelectionReviewPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 24.h), - "Total amount to pay".needTranslation.toText18(isBold: true).paddingSymmetrical(24.h, 0.h), + LocaleKeys.totalAmountToPay.tr(context: context).toText18(isBold: true).paddingSymmetrical(24.h, 0.h), SizedBox(height: 17.h), // Amount before tax Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Amount before tax".needTranslation.toText14(isBold: true), + LocaleKeys.amountBeforeTax.tr(context: context).toText14(isBold: true), Utils.getPaymentAmountWithSymbol( amountBeforeTax.toString().toText16(isBold: true), AppColors.blackColor, @@ -247,7 +247,7 @@ class _CmcSelectionReviewPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "VAT 15%".needTranslation.toText14(isBold: true, color: AppColors.greyTextColor), + LocaleKeys.vat15.tr(context: context).toText14(isBold: true, color: AppColors.greyTextColor), Utils.getPaymentAmountWithSymbol( taxAmount.toString().toText14(isBold: true, color: AppColors.greyTextColor), AppColors.greyTextColor, @@ -261,7 +261,7 @@ class _CmcSelectionReviewPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "".needTranslation.toText14(isBold: true), + "".toText14(isBold: true), Utils.getPaymentAmountWithSymbol( totalAmount.toString().toText24(isBold: true), AppColors.blackColor, @@ -298,7 +298,7 @@ class _CmcSelectionReviewPageState extends State { ], ), child: CustomButton( - text: "Confirm".needTranslation, + text: LocaleKeys.confirm.tr(context: context), onPressed: () { isLocationSelected ? _handleConfirm() : null; }, @@ -339,10 +339,10 @@ class _CmcSelectionReviewPageState extends State { padding: EdgeInsets.all(16.w), child: Column( children: [ - Utils.getSuccessWidget(loadingText: "Your request has been successfully submitted.".needTranslation), + Utils.getSuccessWidget(loadingText: LocaleKeys.requestSubmittedSuccessfully.tr(context: context)), Row( children: [ - "Here is your request #: ".needTranslation.toText14( + LocaleKeys.hereIsYourRequestNumber.tr(context: context).toText14( color: AppColors.textColorLight, weight: FontWeight.w500, ), @@ -383,7 +383,7 @@ class _CmcSelectionReviewPageState extends State { if (selectedHospital == null) { ScaffoldMessenger.of(context).showSnackBar( SnackBar( - content: Text("Please select a hospital to continue".needTranslation), + content: Text(LocaleKeys.pleaseSelectHospitalToContinue.tr(context: context)), backgroundColor: AppColors.errorColor, ), ); @@ -395,7 +395,7 @@ class _CmcSelectionReviewPageState extends State { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: "Are you sure you want to submit this request?".needTranslation, + loadingText: LocaleKeys.confirmSubmitRequest.tr(context: context), isShowActionButtons: true, onCancelTap: () { Navigator.pop(context); diff --git a/lib/presentation/comprehensive_checkup/comprehensive_checkup_page.dart b/lib/presentation/comprehensive_checkup/comprehensive_checkup_page.dart index 8b9ad89..da926cd 100644 --- a/lib/presentation/comprehensive_checkup/comprehensive_checkup_page.dart +++ b/lib/presentation/comprehensive_checkup/comprehensive_checkup_page.dart @@ -12,6 +12,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_all_orders_resp_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_services_resp_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/comprehensive_checkup/cmc_order_detail_page.dart'; import 'package:hmg_patient_app_new/presentation/comprehensive_checkup/cmc_selection_review_page.dart'; import 'package:hmg_patient_app_new/presentation/comprehensive_checkup/widgets/cmc_ui_selection_helper.dart'; @@ -128,7 +129,7 @@ class _ComprehensiveCheckupPageState extends State { // Request ID Row( children: [ - "Request ID:".needTranslation.toText14(color: AppColors.textColorLight, weight: FontWeight.w500), + LocaleKeys.requestID.tr(context: context).toText14(color: AppColors.textColorLight, weight: FontWeight.w500), SizedBox(width: 4.w), "${order.iD ?? '-'}".toText16(isBold: true), ], @@ -179,7 +180,7 @@ class _ComprehensiveCheckupPageState extends State { ), SizedBox(width: 8.w), Expanded( - child: "You have a pending order. Please wait for it to be processed.".needTranslation.toText12( + child: LocaleKeys.pendingOrderWait.tr(context: context).toText12( color: AppColors.infoBannerTextColor, fontWeight: FontWeight.w500, ), @@ -193,7 +194,7 @@ class _ComprehensiveCheckupPageState extends State { children: [ Expanded( child: CustomButton( - text: "Cancel Order".needTranslation, + text: LocaleKeys.cancelOrder.tr(context: context), onPressed: () => CmcUiSelectionHelper.showCancelConfirmationDialog(context: context, order: order), backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, @@ -219,7 +220,7 @@ class _ComprehensiveCheckupPageState extends State { child: Padding( padding: EdgeInsets.all(24.h), child: Text( - 'No services available'.needTranslation, + LocaleKeys.noServicesAvailable.tr(context: context), style: TextStyle( fontSize: 16.h, color: AppColors.greyTextColor, @@ -234,7 +235,7 @@ class _ComprehensiveCheckupPageState extends State { children: [ SizedBox(height: 16.h), Text( - 'Select a Service'.needTranslation, + LocaleKeys.selectAService.tr(context: context), style: TextStyle( fontSize: 20.h, fontWeight: FontWeight.w700, @@ -357,7 +358,7 @@ class _ComprehensiveCheckupPageState extends State { @override Widget build(BuildContext context) { return CollapsingListView( - title: "Comprehensive Checkup".needTranslation, + title: LocaleKeys.comprehensiveCheckup.tr(context: context), history: () => Navigator.of(context).push(CustomPageRoute(page: CmcOrderDetailPage(), direction: AxisDirection.up)), bottomChild: Consumer( builder: (context, hmgServicesViewModel, child) { @@ -375,7 +376,7 @@ class _ComprehensiveCheckupPageState extends State { padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 12.h), child: CustomButton( borderWidth: 0, - text: "Next".needTranslation, + text: LocaleKeys.next.tr(context: context), onPressed: _proceedWithSelectedService, textColor: AppColors.whiteColor, borderRadius: 12.r, diff --git a/lib/presentation/contact_us/contact_us.dart b/lib/presentation/contact_us/contact_us.dart index d7ea9c5..40d42d5 100644 --- a/lib/presentation/contact_us/contact_us.dart +++ b/lib/presentation/contact_us/contact_us.dart @@ -36,7 +36,7 @@ class ContactUs extends StatelessWidget { checkInOptionCard( AppAssets.checkin_location_icon, LocaleKeys.findUs.tr(), - "View your nearest HMG locations".needTranslation, + LocaleKeys.viewNearestHMGLocations.tr(), ).onPress(() { locationUtils.getCurrentLocation(onSuccess: (value) { contactUsViewModel.initContactUsViewModel(); @@ -52,7 +52,7 @@ class ContactUs extends StatelessWidget { checkInOptionCard( AppAssets.checkin_location_icon, LocaleKeys.feedback.tr(), - "Provide your feedback on our services".needTranslation, + LocaleKeys.provideFeedbackOnServices.tr(), ).onPress(() { contactUsViewModel.setSelectedFeedbackType( FeedbackType(id: 5, nameEN: "Not classified", nameAR: 'غير محدد'), @@ -68,7 +68,7 @@ class ContactUs extends StatelessWidget { checkInOptionCard( AppAssets.checkin_location_icon, LocaleKeys.liveChat.tr(), - "Live chat option with HMG".needTranslation, + LocaleKeys.liveChatWithHMG.tr(), ).onPress(() { locationUtils.getCurrentLocation(onSuccess: (value) { contactUsViewModel.getLiveChatProjectsList(); diff --git a/lib/presentation/contact_us/feedback_page.dart b/lib/presentation/contact_us/feedback_page.dart index 078b3a1..62ae1d3 100644 --- a/lib/presentation/contact_us/feedback_page.dart +++ b/lib/presentation/contact_us/feedback_page.dart @@ -55,8 +55,8 @@ class FeedbackPage extends StatelessWidget { activeTextColor: AppColors.primaryRedColor, activeBackgroundColor: AppColors.primaryRedColor.withValues(alpha: .1), tabs: [ - CustomTabBarModel(null, "Send".needTranslation), - CustomTabBarModel(null, "Status".needTranslation), + CustomTabBarModel(null, LocaleKeys.send.tr(context: context)), + CustomTabBarModel(null, LocaleKeys.status.tr(context: context)), ], onTabChange: (index) { contactUsViewModel.setIsSendFeedbackTabSelected(index == 0); @@ -93,7 +93,7 @@ class FeedbackPage extends StatelessWidget { ); return; } - LoaderBottomSheet.showLoader(loadingText: "Sending Feedback...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.sendingFeedback.tr(context: context)); contactUsViewModel.insertCOCItem( subject: subjectTextController.text, message: messageTextController.text, @@ -172,7 +172,7 @@ class FeedbackPage extends StatelessWidget { ], ).onPress(() { showCommonBottomSheetWithoutHeight(context, - title: "Select Feedback Type".needTranslation, + title: LocaleKeys.selectFeedbackType.tr(context: context), child: Container( width: double.infinity, decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24), @@ -207,7 +207,7 @@ class FeedbackPage extends StatelessWidget { Navigator.pop(context); contactUsViewModel.setSelectedFeedbackType(newValue!); if (contactUsViewModel.selectedFeedbackType.id == 1) { - LoaderBottomSheet.showLoader(loadingText: "Loading appointments list...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.loadingAppointmentsList.tr(context: context)); await medicalFileViewModel.getPatientMedicalReportAppointmentsList(onSuccess: (val) async { LoaderBottomSheet.hideLoader(); bool? value = await Navigator.of(context).push( @@ -224,7 +224,7 @@ class FeedbackPage extends StatelessWidget { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "You do not have any appointments to submit a feedback.".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.noAppointmentsForFeedback.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -248,7 +248,7 @@ class FeedbackPage extends StatelessWidget { ), if (contactUsViewModel.patientFeedbackSelectedAppointment != null) ...[ SizedBox(height: 16.h), - "Selected Appointment:".needTranslation.toText16(isBold: true), + LocaleKeys.selectedAppointment.tr(context: context).toText16(isBold: true), SizedBox(height: 8.h), Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( @@ -295,8 +295,8 @@ class FeedbackPage extends StatelessWidget { ], SizedBox(height: 16.h), TextInputWidget( - labelText: "Subject".needTranslation, - hintText: "Enter subject here".needTranslation, + labelText: LocaleKeys.subject.tr(context: context), + hintText: LocaleKeys.enterSubjectHere.tr(context: context), controller: subjectTextController, isEnable: true, prefix: null, @@ -310,8 +310,8 @@ class FeedbackPage extends StatelessWidget { ), SizedBox(height: 16.h), TextInputWidget( - labelText: "Message".needTranslation, - hintText: "Enter message here".needTranslation, + labelText: LocaleKeys.message.tr(context: context), + hintText: LocaleKeys.enterMessageHere.tr(context: context), controller: messageTextController, isEnable: true, prefix: null, diff --git a/lib/presentation/contact_us/live_chat_page.dart b/lib/presentation/contact_us/live_chat_page.dart index 7cbdee3..ac511f3 100644 --- a/lib/presentation/contact_us/live_chat_page.dart +++ b/lib/presentation/contact_us/live_chat_page.dart @@ -114,7 +114,6 @@ class LiveChatPage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ ("${appState.isArabic() ? contactUsVM.liveChatProjectsList[index].projectNameN! : contactUsVM.liveChatProjectsList[index].projectName!}\n${contactUsVM.liveChatProjectsList[index].distanceInKilometers!} KM") - .needTranslation .toText14(isBold: true, color: contactUsVM.selectedLiveChatProjectIndex == index ? AppColors.whiteColor : AppColors.textColor), Transform.flip( flipX: getIt.get().isArabic(), diff --git a/lib/presentation/contact_us/widgets/find_us_item_card.dart b/lib/presentation/contact_us/widgets/find_us_item_card.dart index 96375c0..6e295e0 100644 --- a/lib/presentation/contact_us/widgets/find_us_item_card.dart +++ b/lib/presentation/contact_us/widgets/find_us_item_card.dart @@ -68,7 +68,7 @@ class FindUsItemCard extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppCustomChipWidget( - labelText: "${getHMGLocationsModel.distanceInKilometers ?? ""} km".needTranslation, + labelText: "${getHMGLocationsModel.distanceInKilometers ?? ""} km", icon: AppAssets.location_red, iconColor: AppColors.primaryRedColor, backgroundColor: AppColors.secondaryLightRedColor, @@ -77,7 +77,7 @@ class FindUsItemCard extends StatelessWidget { Row( children: [ AppCustomChipWidget( - labelText: "Get Directions".needTranslation, + labelText: LocaleKeys.getDirections.tr(), icon: AppAssets.directions_icon, iconColor: AppColors.whiteColor, backgroundColor: AppColors.textColor.withValues(alpha: 0.8), diff --git a/lib/presentation/covid19test/covid19_landing_page.dart b/lib/presentation/covid19test/covid19_landing_page.dart index 62bd651..a241da6 100644 --- a/lib/presentation/covid19test/covid19_landing_page.dart +++ b/lib/presentation/covid19test/covid19_landing_page.dart @@ -94,7 +94,7 @@ class _Covid19LandingPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ CustomButton( - text: "SelectLocation".needTranslation, + text: "Select Location", onPressed: () { _showBranchBottomSheet(context); }, @@ -124,7 +124,7 @@ class _Covid19LandingPageState extends State { showCommonBottomSheet( context, - title: "Select Branch".needTranslation, + title: "Select Branch", height: ResponsiveExtension.screenHeight * 0.651, child: StatefulBuilder( builder: (context, setBottomSheetState) { @@ -240,7 +240,7 @@ class _Covid19LandingPageState extends State { child: SafeArea( top: false, child: CustomButton( - text: "Next".needTranslation, + text: LocaleKeys.next.tr(context: context), onPressed: (){ Navigator.of(context) diff --git a/lib/presentation/covid19test/covid_19_questionnaire.dart b/lib/presentation/covid19test/covid_19_questionnaire.dart index 8608d80..f7b1f4c 100644 --- a/lib/presentation/covid19test/covid_19_questionnaire.dart +++ b/lib/presentation/covid19test/covid_19_questionnaire.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -7,6 +8,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/covid_questionnare_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/covid19test/covid_review_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -61,7 +63,7 @@ class _Covid19QuestionnaireState extends State { topRight: Radius.circular(24.r), ), ),child: CustomButton( - text: "Next".needTranslation, + text: LocaleKeys.next.tr(context: context), onPressed: () { moveToNextPage(context); }, diff --git a/lib/presentation/covid19test/covid_payment_screen.dart b/lib/presentation/covid19test/covid_payment_screen.dart index 42e7736..e395a42 100644 --- a/lib/presentation/covid19test/covid_payment_screen.dart +++ b/lib/presentation/covid19test/covid_payment_screen.dart @@ -89,7 +89,7 @@ class _CovidPaymentScreenState extends State { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: widget.title.needTranslation, + title: widget.title, bottomChild: Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, @@ -100,19 +100,19 @@ class _CovidPaymentScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 24.h), - "Total amount to pay".needTranslation.toText18(isBold: true).paddingSymmetrical(24.h, 0.h), + LocaleKeys.totalAmountToPay.tr(context: context).toText18(isBold: true).paddingSymmetrical(24.h, 0.h), SizedBox(height: 17.h), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Amount before tax".needTranslation.toText14(isBold: true), + LocaleKeys.amountBeforeTax.tr(context: context).toText14(isBold: true), Utils.getPaymentAmountWithSymbol(( (widget.amount - widget.taxAmount).toString()).toText16(isBold: true), AppColors.blackColor, 13, isSaudiCurrency: true), ], ).paddingSymmetrical(24.h, 0.h), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "VAT 15%".needTranslation.toText14(isBold: true, color: AppColors.greyTextColor), + LocaleKeys.vat15.tr(context: context).toText14(isBold: true, color: AppColors.greyTextColor), // Show VAT amount passed from review screen Utils.getPaymentAmountWithSymbol((widget.taxAmount.toString()).toText14(isBold: true, color: AppColors.greyTextColor), AppColors.greyTextColor, 13, isSaudiCurrency: true), ], @@ -121,7 +121,7 @@ class _CovidPaymentScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "".needTranslation.toText14(isBold: true), + "".toText14(isBold: true), Utils.getPaymentAmountWithSymbol(widget.amount.toString().toText24(isBold: true), AppColors.blackColor, 17, isSaudiCurrency: true), ], ).paddingSymmetrical(24.h, 0.h), @@ -212,7 +212,7 @@ class _CovidPaymentScreenState extends State { children: [ Image.asset(AppAssets.mada, width: 72.h, height: 25.h), SizedBox(height: 16.h), - "Mada".needTranslation.toText16(isBold: true), + LocaleKeys.mada.tr(context: context).toText16(isBold: true), ], ), SizedBox(width: 8.h), @@ -257,7 +257,7 @@ class _CovidPaymentScreenState extends State { ], ), SizedBox(height: 16.h), - "Visa or Mastercard".needTranslation.toText16(isBold: true), + LocaleKeys.visaOrMastercard.tr(context: context).toText16(isBold: true), ], ), SizedBox(width: 8.h), @@ -312,7 +312,7 @@ class _CovidPaymentScreenState extends State { }, ), SizedBox(height: 16.h), - "Tamara".needTranslation.toText16(isBold: true), + LocaleKeys.tamara.tr(context: context).toText16(isBold: true), ], ), SizedBox(width: 8.h), @@ -387,7 +387,7 @@ class _CovidPaymentScreenState extends State { } Future checkPaymentStatus() async { - LoaderBottomSheet.showLoader(loadingText: "Checking payment status, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context)); try { await payfortViewModel.checkPaymentStatus(transactionID: transID, onSuccess: (apiResponse) async { // treat any successful responseMessage as success; otherwise show generic error @@ -396,7 +396,7 @@ class _CovidPaymentScreenState extends State { if (success) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getSuccessWidget(loadingText: "Payment successful".needTranslation), + child: Utils.getSuccessWidget(loadingText: "Payment successful"), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -404,7 +404,7 @@ class _CovidPaymentScreenState extends State { } else { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.paymentFailedPleaseTryAgain.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/covid19test/covid_review_screen.dart b/lib/presentation/covid19test/covid_review_screen.dart index 7ccbb02..3440129 100644 --- a/lib/presentation/covid19test/covid_review_screen.dart +++ b/lib/presentation/covid19test/covid_review_screen.dart @@ -75,7 +75,7 @@ class _CovidReviewScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Amount before tax".needTranslation.toText18(isBold: true), + LocaleKeys.amountBeforeTax.tr(context: context).toText18(isBold: true), Utils.getPaymentAmountWithSymbol( (info.patientShareField ?? 0).toString().toText16(isBold: true), AppColors.blackColor, @@ -87,7 +87,7 @@ class _CovidReviewScreenState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Tax Amount".needTranslation.toText14(isBold: true), + LocaleKeys.vat15.tr(context: context).toText14(isBold: true), Utils.getPaymentAmountWithSymbol( (info.patientTaxAmountField ?? 0).toString().toText16(isBold: true), AppColors.blackColor, @@ -208,13 +208,13 @@ class _CovidReviewScreenState extends State { Expanded( child: CustomButton( height: 56.h, - text: "Next".needTranslation, + text: LocaleKeys.next.tr(context: context), onPressed: () async { // Validate selection and payment info if (_selectedProcedure == null) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Please select a procedure".needTranslation), + child: Utils.getErrorWidget(loadingText: "Please select a procedure"), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -236,7 +236,7 @@ class _CovidReviewScreenState extends State { if (hmgServicesViewModel.covidPaymentInfo == null) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Payment information not available".needTranslation), + child: Utils.getErrorWidget(loadingText: "Payment information not available"), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/e_referral/e-referral_validator.dart b/lib/presentation/e_referral/e-referral_validator.dart index e0a8006..b662122 100644 --- a/lib/presentation/e_referral/e-referral_validator.dart +++ b/lib/presentation/e_referral/e-referral_validator.dart @@ -1,64 +1,65 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/e_referral_form_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; class ReferralValidator { - static FormValidationErrors validateStep1(ReferralFormData formData) { + static FormValidationErrors validateStep1(ReferralFormData formData, BuildContext context) { final errors = FormValidationErrors(); if (formData.requesterName.trim().isEmpty) { - errors.requesterName = 'Referral requester name is required'.needTranslation; + errors.requesterName = LocaleKeys.requesterNameRequired.tr(context: context); } - - if (formData.relationship == null) { - errors.relationship = 'Please select a relationship'.needTranslation; + errors.relationship = LocaleKeys.selectRelationshipRequired.tr(context: context); } if (formData.relationship != null && formData.relationship?.iD == 5 && formData.otherRelationshipName.trim().isEmpty) { - errors.otherRelationshipName = 'Other relationship name is required'.needTranslation; + errors.otherRelationshipName = LocaleKeys.otherRelationshipNameRequired.tr(context: context); } return errors; } - static FormValidationErrors validateStep2(ReferralFormData formData) { + static FormValidationErrors validateStep2(ReferralFormData formData, BuildContext context) { final errors = FormValidationErrors(); if (formData.patientIdentification.trim().isEmpty) { - errors.patientIdentification = 'Identification number is required'.needTranslation; + errors.patientIdentification = LocaleKeys.identificationNumberRequired.tr(context: context); } if (formData.patientName.trim().isEmpty) { - errors.patientName = 'Patient name is required'.needTranslation; + errors.patientName = LocaleKeys.patientNameRequired.tr(context: context); } if (formData.patientPhone == null) { - errors.patientPhone = 'Please Enter patient phone number'.needTranslation; + errors.patientPhone = LocaleKeys.enterPatientPhoneRequired.tr(context: context); } if (formData.patientCity == null) { - errors.patientCity = 'Please select patient city'.needTranslation; + errors.patientCity = LocaleKeys.selectPatientCityRequired.tr(context: context); } return errors; } - static FormValidationErrors validateStep3(ReferralFormData formData) { + static FormValidationErrors validateStep3(ReferralFormData formData, BuildContext context) { final errors = FormValidationErrors(); if (formData.medicalReportImages.isEmpty) { - errors.medicalReport = 'At least one medical report is required'.needTranslation; + errors.medicalReport = LocaleKeys.medicalReportRequired.tr(context: context); } if (formData.branch == null) { - errors.branch = 'Please select a branch'.needTranslation; + errors.branch = LocaleKeys.selectBranchRequired.tr(context: context); } if (formData.isPatientInsured && formData.insuredPatientImages.isEmpty) { - errors.insuredDocument = 'Insurance document is required for insured patients'.needTranslation; + errors.insuredDocument = LocaleKeys.insuranceDocumentRequired.tr(context: context); } return errors; diff --git a/lib/presentation/e_referral/e_referral_search_result.dart b/lib/presentation/e_referral/e_referral_search_result.dart index 8702d5a..6a4b831 100644 --- a/lib/presentation/e_referral/e_referral_search_result.dart +++ b/lib/presentation/e_referral/e_referral_search_result.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; @@ -5,6 +6,7 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/search_e_referral_resp_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:provider/provider.dart'; @@ -31,7 +33,7 @@ class _SearchResultPageState extends State { @override Widget build(BuildContext context) { return CollapsingListView( - title: "Search Result".needTranslation, + title: LocaleKeys.searchResult.tr(context: context), child: Column( children: [ // List of referrals @@ -61,10 +63,7 @@ class _SearchResultPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - - 'Referral No ${referral.referralNumber}'.needTranslation.toText18(isBold: true, color: AppColors.textColor), - - + LocaleKeys.referralNo.tr(context: context, namedArgs: {'number': '${referral.referralNumber}'}).toText18(isBold: true, color: AppColors.textColor), Container( padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6), decoration: BoxDecoration( diff --git a/lib/presentation/e_referral/new_e_referral.dart b/lib/presentation/e_referral/new_e_referral.dart index 3083de1..0288173 100644 --- a/lib/presentation/e_referral/new_e_referral.dart +++ b/lib/presentation/e_referral/new_e_referral.dart @@ -81,13 +81,13 @@ class _NewReferralPageState extends State { switch (_currentStep) { case 0: - stepErrors = ReferralValidator.validateStep1(_formManager.formData); + stepErrors = ReferralValidator.validateStep1(_formManager.formData, context); break; case 1: - stepErrors = ReferralValidator.validateStep2(_formManager.formData); + stepErrors = ReferralValidator.validateStep2(_formManager.formData, context); break; case 2: - stepErrors = ReferralValidator.validateStep3(_formManager.formData); + stepErrors = ReferralValidator.validateStep3(_formManager.formData, context); break; default: stepErrors = FormValidationErrors(); @@ -159,7 +159,7 @@ class _NewReferralPageState extends State { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "E Referral".needTranslation, + title: LocaleKeys.eReferral.tr(context: context), isClose: false, search: () async { await Navigator.of(context).push( @@ -222,10 +222,10 @@ class _NewReferralPageState extends State { padding: EdgeInsets.all(16.w), child: Column( children: [ - Utils.getSuccessWidget(loadingText: "Your Referral has been created Successfully.".needTranslation), + Utils.getSuccessWidget(loadingText: LocaleKeys.referralCreatedSuccessfully.tr(context: context)), Row( children: [ - "Here is your Referral #: ".needTranslation.toText14( + LocaleKeys.hereIsYourReferralNumber.tr(context: context).toText14( color: AppColors.textColorLight, weight: FontWeight.w500, ), diff --git a/lib/presentation/e_referral/search_e_referral.dart b/lib/presentation/e_referral/search_e_referral.dart index 1a243da..b9bf592 100644 --- a/lib/presentation/e_referral/search_e_referral.dart +++ b/lib/presentation/e_referral/search_e_referral.dart @@ -80,7 +80,7 @@ class _SearchEReferralPageState extends State { @override Widget build(BuildContext context) { return CollapsingListView( - title: "Search E-Referral".needTranslation, + title: LocaleKeys.searchEReferral.tr(context: context), isClose: true, bottomChild: Container( color: Colors.white, @@ -111,7 +111,7 @@ class _SearchEReferralPageState extends State { padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [SizedBox(height: 8), 'Please enter the required information to search for an e-referral'.needTranslation.toText12()], + children: [SizedBox(height: 8), LocaleKeys.enterRequiredInfoToSearch.tr(context: context).toText12()], ), ); } diff --git a/lib/presentation/e_referral/widget/e_referral_other_details.dart b/lib/presentation/e_referral/widget/e_referral_other_details.dart index 6efd063..da955f8 100644 --- a/lib/presentation/e_referral/widget/e_referral_other_details.dart +++ b/lib/presentation/e_referral/widget/e_referral_other_details.dart @@ -1,10 +1,12 @@ import 'dart:io'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/utils/validation_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/features/hmg_services/models/req_models/create_e_referral_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/e_referral/e_referral_form_manager.dart'; import 'package:provider/provider.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -46,14 +48,14 @@ class _OtherDetailsStepState extends State { void _updateMedicalReportText() { final hasMedicalReports = _formManager.formData.medicalReportImages.isNotEmpty; _medicalReportController.text = hasMedicalReports - ? '${_formManager.formData.medicalReportImages.length} file(s) selected'.needTranslation + ? '${_formManager.formData.medicalReportImages.length} file(s) selected' : ''; } void _updateInsuranceText() { final hasInsuranceDocs = _formManager.formData.insuredPatientImages.isNotEmpty; _insuranceController.text = hasInsuranceDocs - ? '${_formManager.formData.insuredPatientImages.length} file(s) selected'.needTranslation + ? '${_formManager.formData.insuredPatientImages.length} file(s) selected' : ''; } @@ -68,7 +70,7 @@ class _OtherDetailsStepState extends State { physics: const BouncingScrollPhysics(), children: [ const SizedBox(height: 12), - _buildSectionTitle('Other Details'.needTranslation), + _buildSectionTitle(LocaleKeys.otherDetails.tr(context: context)), const SizedBox(height: 12), _buildMedicalReportField(formManager), _buildBranchField(context, formManager), @@ -96,8 +98,8 @@ class _OtherDetailsStepState extends State { child: TextInputWidget( controller: _medicalReportController, padding: const EdgeInsets.symmetric(horizontal: 16.0), - hintText: 'Medical Report'.needTranslation, - labelText: 'Select Attachment'.needTranslation, + hintText: LocaleKeys.medicalReport.tr(context: context), + labelText: LocaleKeys.selectAttachment.tr(context: context), suffix: const Icon(Icons.attachment), isReadOnly: true, errorMessage: formManager.errors.medicalReport, @@ -121,7 +123,7 @@ class _OtherDetailsStepState extends State { children: formManager.formData.medicalReportImages.asMap().entries.map((entry) { final index = entry.key; return Chip( - label: Text('Medical Report ${index + 1}'.needTranslation), + label: Text(LocaleKeys.medicalReportNumber.tr(context: context, namedArgs: {'number': '${index + 1}'})), deleteIcon: const Icon(Icons.close, size: 16), onDeleted: () { _removeMedicalReport(index, formManager); @@ -172,7 +174,7 @@ class _OtherDetailsStepState extends State { Padding( padding: EdgeInsets.all(5.0), child: - "Patient is Insured".needTranslation.toText14( + LocaleKeys.patientIsInsured.tr(context: context).toText14( color: Colors.black, weight: FontWeight.w600, ), @@ -193,8 +195,8 @@ class _OtherDetailsStepState extends State { child: TextInputWidget( controller: _insuranceController, padding: const EdgeInsets.symmetric(horizontal: 16.0), - hintText: 'Insurance Document'.needTranslation, - labelText: 'Select Attachment'.needTranslation, + hintText: LocaleKeys.insuranceDocument.tr(context: context), + labelText: LocaleKeys.selectAttachment.tr(context: context), suffix: const Icon(Icons.attachment), isReadOnly: true, errorMessage: formManager.errors.insuredDocument, @@ -235,7 +237,7 @@ class _OtherDetailsStepState extends State { showCommonBottomSheetWithoutHeight( context, - title: "Select Branch".needTranslation, + title: LocaleKeys.selectBranch.tr(context: context), child: Consumer( builder: (context, habibWalletVM, child) { final hospitals = habibWalletVM.advancePaymentHospitals; diff --git a/lib/presentation/e_referral/widget/e_referral_patient_info.dart b/lib/presentation/e_referral/widget/e_referral_patient_info.dart index 469755c..0cc5c7e 100644 --- a/lib/presentation/e_referral/widget/e_referral_patient_info.dart +++ b/lib/presentation/e_referral/widget/e_referral_patient_info.dart @@ -1,8 +1,10 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/utils/validation_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/e_referral/e_referral_form_manager.dart'; import 'package:provider/provider.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -65,14 +67,14 @@ class PatientInformationStepState extends State { physics: const BouncingScrollPhysics(), children: [ const SizedBox(height: 12), - _buildSectionTitle('Patient information'.needTranslation), + _buildSectionTitle(LocaleKeys.patientInfo.tr(context: context)), const SizedBox(height: 12), _buildIdentificationField(formManager), _buildPatientNameField(formManager), // _buildPatientCountryField(context, formManager), _buildPatientPhoneField(formManager), const SizedBox(height: 20), - _buildSectionTitle('Where the patient located'.needTranslation), + _buildSectionTitle(LocaleKeys.patientLocation.tr(context: context)), _buildPatientCityField(context, formManager), ], ), @@ -94,8 +96,8 @@ class PatientInformationStepState extends State { child: TextInputWidget( controller: _identificationController, padding: const EdgeInsets.symmetric(horizontal: 16.0), - hintText: 'Enter Identification Number*'.needTranslation, - labelText: 'Identification Number'.needTranslation, + hintText: LocaleKeys.enterIdentificationNumber.tr(context: context), + labelText: LocaleKeys.identificationNumber.tr(context: context), errorMessage: formManager.errors.patientIdentification, hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientIdentification), onChange: (value) { @@ -114,8 +116,8 @@ class PatientInformationStepState extends State { child: TextInputWidget( controller: _nameController, padding: const EdgeInsets.symmetric(horizontal: 16.0), - hintText: 'Patient Name*'.needTranslation, - labelText: 'Name'.needTranslation, + hintText: LocaleKeys.patientName.tr(context: context), + labelText: LocaleKeys.name.tr(context: context), keyboardType: TextInputType.text, errorMessage: formManager.errors.patientName, hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.patientName), @@ -133,7 +135,7 @@ class PatientInformationStepState extends State { return Focus( focusNode: _phoneFocusNode, child: TextInputWidget( - labelText: 'Phone Number'.needTranslation, + labelText: LocaleKeys.phoneNumber.tr(context: context), hintText: "5xxxxxxxx", controller: _phoneController, padding: const EdgeInsets.all(8), @@ -159,7 +161,7 @@ class PatientInformationStepState extends State { Widget _buildPatientCityField(BuildContext context, ReferralFormManager formManager) { return DropdownWidget( labelText: 'City', - hintText: formManager.formData.patientCity?.description ?? "Select City".needTranslation, + hintText: formManager.formData.patientCity?.description ?? LocaleKeys.selectCity.tr(context: context), isEnable: false, hasSelectionCustomIcon: true, labelColor: Colors.black, @@ -179,7 +181,7 @@ class PatientInformationStepState extends State { showCommonBottomSheetWithoutHeight( context, - title: "Select City".needTranslation, + title: LocaleKeys.selectCity.tr(context: context), child: Consumer( builder: (context, hmgServicesVM, child) { final cities = hmgServicesVM.getAllCitiesList; diff --git a/lib/presentation/e_referral/widget/e_referral_requester_form.dart b/lib/presentation/e_referral/widget/e_referral_requester_form.dart index cc981a9..d2b75cc 100644 --- a/lib/presentation/e_referral/widget/e_referral_requester_form.dart +++ b/lib/presentation/e_referral/widget/e_referral_requester_form.dart @@ -1,8 +1,10 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/utils/validation_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/e_referral/e_referral_form_manager.dart'; import 'package:provider/provider.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -67,8 +69,8 @@ class RequesterFormStepState extends State { physics: const BouncingScrollPhysics(), children: [ // const SizedBox(height: 12), - _buildSectionTitle('Referral requester information'.needTranslation), - const SizedBox(height: 12), + _buildSectionTitle(LocaleKeys.referralRequesterInformation.tr(context: context)), + const SizedBox(height: 12), _buildNameField(formManager), // _buildPhoneField(formManager), _buildRelationshipField(context, formManager), @@ -93,8 +95,8 @@ class RequesterFormStepState extends State { child: TextInputWidget( controller: _nameController, padding: const EdgeInsets.symmetric(horizontal: 16.0), - hintText: 'Enter Referral Requester Name*'.needTranslation, - labelText: 'Requester Name'.needTranslation, + hintText: LocaleKeys.enterReferralRequesterName.tr(context: context), + labelText: LocaleKeys.requesterName.tr(context: context), keyboardType: TextInputType.text, errorMessage: formManager.errors.requesterName, isAllowLeadingIcon: true, @@ -109,10 +111,10 @@ class RequesterFormStepState extends State { } Widget _buildRelationshipField(BuildContext context, ReferralFormManager formManager) { return DropdownWidget( - labelText: "Relationship".needTranslation, - hintText: formManager.formData.relationship?.textEn ?? "Select Relation".needTranslation, + labelText: LocaleKeys.relationship.tr(context: context), + hintText: formManager.formData.relationship?.textEn ?? LocaleKeys.selectRelation.tr(context: context), isEnable: false, - selectedValue: formManager.formData.relationship?.textEn ?? "Select Relation".needTranslation, + selectedValue: formManager.formData.relationship?.textEn ?? LocaleKeys.selectRelation.tr(context: context), errorMessage: formManager.errors.relationship, hasError: !ValidationUtils.isNullOrEmpty(formManager.errors.relationship), hasSelectionCustomIcon: false, @@ -132,8 +134,8 @@ class RequesterFormStepState extends State { controller: _otherNameController, keyboardType: TextInputType.text, padding: const EdgeInsets.symmetric(horizontal: 16.0), - hintText: 'Other Name*'.needTranslation, - labelText: 'Other Name'.needTranslation, + hintText: LocaleKeys.otherNameHint.tr(context: context), + labelText: LocaleKeys.otherName.tr(context: context), errorMessage: formManager.errors.otherRelationshipName, onChange: (value) { formManager.updateOtherRelationshipName(value ?? ''); @@ -152,7 +154,7 @@ class RequesterFormStepState extends State { showCommonBottomSheetWithoutHeight( context, - title: "Select Relation".needTranslation, + title: LocaleKeys.selectRelation.tr(context: context), child: Consumer( builder: (context, hmgServicesVM, child) { if (hmgServicesVM.relationTypes.isEmpty) { @@ -164,8 +166,8 @@ class RequesterFormStepState extends State { ); } - return DecoratedBox( - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + return DecoratedBox( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: Colors.white, customBorder: BorderRadius.all(Radius.circular(24.h)) , diff --git a/lib/presentation/emergency_services/call_ambulance/call_ambulance_page.dart b/lib/presentation/emergency_services/call_ambulance/call_ambulance_page.dart index 043c231..e86104b 100644 --- a/lib/presentation/emergency_services/call_ambulance/call_ambulance_page.dart +++ b/lib/presentation/emergency_services/call_ambulance/call_ambulance_page.dart @@ -156,18 +156,18 @@ class CallAmbulancePage extends StatelessWidget { Column( spacing: 4.h, children: [ - "Select Pickup Details".needTranslation.toText21( + LocaleKeys.selectPickupDetails.tr(context: context).toText21( weight: FontWeight.w600, color: AppColors.textColor, ), - " Please select the details of pickup".needTranslation.toText12( + LocaleKeys.pleaseSelectDetailsOfPickup.tr(context: context).toText12( fontWeight: FontWeight.w500, color: AppColors.greyTextColor, ) ], ), CustomButton( - text: "Select Details".needTranslation, + text: LocaleKeys.selectDetails.tr(context: context), onPressed: () { context.read().updateBottomSheetState(BottomSheetType.EXPANDED); }) @@ -256,7 +256,7 @@ class CallAmbulancePage extends StatelessWidget { height: 40.h, backgroundColor: AppColors.lightRedButtonColor, borderColor: Colors.transparent, - text: "Add new address".needTranslation, + text: LocaleKeys.addNewAddress.tr(context: context), textColor: AppColors.primaryRedColor, iconColor: AppColors.primaryRedColor, onPressed: () {}, @@ -265,7 +265,7 @@ class CallAmbulancePage extends StatelessWidget { return AddressItem( isSelected: index == 0, address: "Flat No 301, Building No 12, Palm Spring Apartment, Sector 45, Gurugram, Haryana 122003", - title: index == 0 ? "Home".needTranslation : "Work".needTranslation, + title: index == 0 ? LocaleKeys.home.tr(context: context) : LocaleKeys.work.tr(context: context), onTap: () {}, ); } @@ -309,8 +309,8 @@ class CallAmbulancePage extends StatelessWidget { Row( children: [ hospitalAndPickUpItemContent( - title: "Pick".needTranslation, - subTitle: "Inside the home".needTranslation, + title: LocaleKeys.pick.tr(context: context), + subTitle: LocaleKeys.insideTheHome.tr(context: context), leadingIcon: AppAssets.pickup_bed, ), CustomSwitch( @@ -325,8 +325,8 @@ class CallAmbulancePage extends StatelessWidget { Row( children: [ hospitalAndPickUpItemContent( - title: 'Appointment', - subTitle: "Have any appointment".needTranslation, + title: LocaleKeys.appointment.tr(context: context), + subTitle: LocaleKeys.haveAnyAppointment.tr(context: context), leadingIcon: AppAssets.appointment_calendar_icon, ), CustomSwitch( @@ -426,7 +426,7 @@ class CallAmbulancePage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 4.h, children: [ - "Total amount to pay".needTranslation.toText18( + LocaleKeys.totalAmountToPay.tr(context: context).toText18( weight: FontWeight.w600, color: AppColors.textColor, ), @@ -436,7 +436,7 @@ class CallAmbulancePage extends StatelessWidget { SizedBox( width: 4.h, ), - "Amount will be paid at the hospital".needTranslation.toText12( + LocaleKeys.amountPaidAtHospital.tr(context: context).toText12( fontWeight: FontWeight.w500, color: AppColors.greyTextColor, ), @@ -455,7 +455,7 @@ class CallAmbulancePage extends StatelessWidget { ], ), CustomButton( - text: "Submit Request".needTranslation, + text: LocaleKeys.submitRequest.tr(context: context), onPressed: () { LocationViewModel locationViewModel = context.read(); GeocodeResponse? response = locationViewModel.geocodeResponse; @@ -530,8 +530,8 @@ class CallAmbulancePage extends StatelessWidget { return SizedBox( width: MediaQuery.sizeOf(context).width, child: TextInputWidget( - labelText: "Enter Pickup Location Manually".needTranslation, - hintText: "Enter Pickup Location".needTranslation, + labelText: LocaleKeys.enterPickupLocationManually.tr(context: context), + hintText: LocaleKeys.enterPickupLocation.tr(context: context), controller: TextEditingController( text: vm.geocodeResponse?.results.first.formattedAddress ?? vm.selectedPrediction?.description, ), @@ -563,7 +563,7 @@ class CallAmbulancePage extends StatelessWidget { openLocationInputBottomSheet(BuildContext context) { context.read().flushSearchPredictions(); showCommonBottomSheetWithoutHeight( - title: "".needTranslation, + title: "", context, child: SizedBox( height: MediaQuery.sizeOf(context).height * .8, @@ -583,25 +583,22 @@ class CallAmbulancePage extends StatelessWidget { child: Row( children: [ hospitalAndPickUpItemContent( - title: "Select Hospital".needTranslation, - subTitle: context.read().getSelectedHospitalName() ?? "Select Hospital".needTranslation, + title: LocaleKeys.selectHospital.tr(context: context), + subTitle: context.read().getSelectedHospitalName() ?? LocaleKeys.selectHospital.tr(context: context), leadingIcon: AppAssets.hospital, ), Utils.buildSvgWithAssets(icon: AppAssets.down_cheveron, width: 24.h, height: 24.h).paddingAll(16.h) ], ).onPress(() { - print("the item is clicked"); showHospitalBottomSheet(context); }).paddingSymmetrical( - 10.w, - 12.h, - ), + 10.w, 12.h), ); } void openAppointmentList(BuildContext context) { showCommonBottomSheetWithoutHeight( - title: "Select Appointment".needTranslation, + title: LocaleKeys.selectAppointment.tr(context: context), context, child: SizedBox( height: MediaQuery.sizeOf(context).height * .5, diff --git a/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart b/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart index 396e509..bc6d9b0 100644 --- a/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart +++ b/lib/presentation/emergency_services/call_ambulance/requesting_services_page.dart @@ -1,9 +1,11 @@ +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/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:lottie/lottie.dart'; @@ -27,8 +29,7 @@ class RequestingServicesPage extends StatelessWidget { .center, Positioned( bottom: 1, - child: "Submitting your request. \nPlease wait for a moment" - .needTranslation + child: LocaleKeys.submitRequest.tr(context: context) .toText16(color: AppColors.textColor, weight: FontWeight.w500) .paddingOnly(bottom: 100.h, left: 100.h, right: 100.h)) ], diff --git a/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart b/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart index e5dc0b9..9a49dd0 100644 --- a/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart +++ b/lib/presentation/emergency_services/call_ambulance/tracking_screen.dart @@ -1,5 +1,6 @@ import 'dart:io'; +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/utils/size_utils.dart'; @@ -9,6 +10,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/AmbulanceRequestOrdersModel.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/RRTServiceData.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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'; @@ -60,14 +62,14 @@ class TrackingScreen extends StatelessWidget { iconSize: 18.w, backgroundColor: AppColors.bgGreenColor, borderColor: Colors.transparent, - text: "Close".needTranslation, + text: LocaleKeys.close.tr(context: context), textColor: AppColors.whiteColor, onPressed: () {}, ).paddingOnly(left: 16.h, right: 16.h), ), ), body: CollapsingListView( - title: "Tracking Details".needTranslation, + title: LocaleKeys.trackingDetails.tr(context: context), child: SingleChildScrollView( child: Column( children: [ @@ -136,7 +138,7 @@ class TrackingScreen extends StatelessWidget { height: 16, ), CustomButton( - text: "Cancel Request".needTranslation, + text: LocaleKeys.cancelRequest.tr(context: context), onPressed: () async { openCancelOrderBottomSheet(context); }, @@ -162,7 +164,7 @@ class TrackingScreen extends StatelessWidget { iconSize: 18.w, backgroundColor: AppColors.lightRedButtonColor, borderColor: Colors.transparent, - text: "Share Your Live Location on Whatsapp".needTranslation, + text: LocaleKeys.shareLocationWhatsapp.tr(context: context), fontSize: 12.f, textColor: AppColors.primaryRedColor, iconColor: AppColors.primaryRedColor, @@ -280,7 +282,7 @@ class TrackingScreen extends StatelessWidget { return RichText( text: TextSpan(children: [ TextSpan( - text: "Please wait for the call".needTranslation, + text: LocaleKeys.pleaseWaitForCall.tr(), style: TextStyle( fontSize: 21.f, fontWeight: FontWeight.w600, @@ -288,7 +290,7 @@ class TrackingScreen extends StatelessWidget { ), ), TextSpan( - text: "...".needTranslation, + text: "...", style: TextStyle( fontSize: 21.f, fontWeight: FontWeight.w600, @@ -301,7 +303,7 @@ class TrackingScreen extends StatelessWidget { return RichText( text: TextSpan(children: [ TextSpan( - text: "15:30".needTranslation, + text: "15:30", style: TextStyle( fontSize: 21.f, fontWeight: FontWeight.w600, @@ -309,7 +311,7 @@ class TrackingScreen extends StatelessWidget { ), ), TextSpan( - text: " mins ".needTranslation, + text: LocaleKeys.mins.tr(), style: TextStyle( fontSize: 21.f, fontWeight: FontWeight.w600, @@ -317,7 +319,7 @@ class TrackingScreen extends StatelessWidget { ), ), TextSpan( - text: "to hospital".needTranslation, + text: LocaleKeys.toHospitalLower.tr(), style: TextStyle( fontSize: 21.f, fontWeight: FontWeight.w600, @@ -328,7 +330,7 @@ class TrackingScreen extends StatelessWidget { ); case OrderTrackingState.ended: - return "Arrived".needTranslation.toText21(color: AppColors.textColor, weight: FontWeight.w600); + return LocaleKeys.arrived.tr().toText21(color: AppColors.textColor, weight: FontWeight.w600); case OrderTrackingState.failed: case OrderTrackingState.cancel: return SizedBox.shrink(); @@ -386,8 +388,8 @@ class TrackingScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 4.h, children: [ - "Contact".needTranslation.toText14(color: AppColors.textColor, weight: FontWeight.w600), - "0115259555".needTranslation.toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500).onPress((){ + LocaleKeys.contact.tr().toText14(color: AppColors.textColor, weight: FontWeight.w600), + "0115259555".toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500).onPress((){ launchUrl( Uri.parse("tel://0115259555"), ); @@ -429,23 +431,24 @@ class TrackingScreen extends StatelessWidget { // } getTitle(OrderTrackingState? state) { - if(state == null) - return "Failed".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); + if(state == null) { + return LocaleKeys.failed.tr().toText16(color: AppColors.textColor, weight: FontWeight.w600); + } switch (state) { case OrderTrackingState.waitingForCall: - return "Confirmation Call".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); + return LocaleKeys.confirmationCall.tr().toText16(color: AppColors.textColor, weight: FontWeight.w600); case OrderTrackingState.dispactched: - return "Pickup Up from Home".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); + return LocaleKeys.pickupFromHome.tr().toText16(color: AppColors.textColor, weight: FontWeight.w600); case OrderTrackingState.returning: - return " On The Way To Hospital".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); + return LocaleKeys.onTheWayToHospital.tr().toText16(color: AppColors.textColor, weight: FontWeight.w600); case OrderTrackingState.ended: - return "Arrived at Hospital".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); + return LocaleKeys.arrivedAtHospital.tr().toText16(color: AppColors.textColor, weight: FontWeight.w600); case OrderTrackingState.failed: - return "Failed".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); + return LocaleKeys.failed.tr().toText16(color: AppColors.textColor, weight: FontWeight.w600); case OrderTrackingState.cancel: - return "Order Cancel".needTranslation.toText16(color: AppColors.textColor, weight: FontWeight.w600); + return LocaleKeys.orderCancel.tr().toText16(color: AppColors.textColor, weight: FontWeight.w600); } } diff --git a/lib/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart b/lib/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart index 051c850..56a94e0 100644 --- a/lib/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart +++ b/lib/presentation/emergency_services/call_ambulance/widgets/pickup_location.dart @@ -21,14 +21,12 @@ class PickupLocation extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Select Pickup Direction" - .needTranslation + LocaleKeys.selectPickupDirection.tr(context: context) .toText24(color: AppColors.textColor, isBold: true), SizedBox( height: 16.h, ), - "Select Direction" - .needTranslation + LocaleKeys.selectDirection.tr(context: context) .toText16(color: AppColors.textColor, weight: FontWeight.w600), SizedBox( height: 12.h, @@ -58,8 +56,7 @@ class PickupLocation extends StatelessWidget { activeColor: AppColors.primaryRedColor, fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), ), - "To Hospital" - .needTranslation + LocaleKeys.toHospital.tr(context: context) .toText14(color: AppColors.textColor, weight: FontWeight.w500) ], ).onPress(() { @@ -84,8 +81,7 @@ class PickupLocation extends StatelessWidget { activeColor: AppColors.primaryRedColor, fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), ), - "From Hospital" - .needTranslation + LocaleKeys.fromHospital.tr(context: context) .toText14(color: AppColors.textColor, weight: FontWeight.w500) ], ).onPress(() { @@ -105,8 +101,7 @@ class PickupLocation extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 16.h), - "Select Way" - .needTranslation + LocaleKeys.selectWay.tr(context: context) .toText16(color: AppColors.textColor, weight: FontWeight.w600), SizedBox(height: 12.h), Row( @@ -128,8 +123,7 @@ class PickupLocation extends StatelessWidget { activeColor: AppColors.primaryRedColor, fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), ), - "One Way" - .needTranslation + LocaleKeys.oneWay.tr(context: context) .toText12(color: AppColors.textColor, fontWeight: FontWeight.w500) ], ).onPress(() { @@ -154,8 +148,7 @@ class PickupLocation extends StatelessWidget { activeColor: AppColors.primaryRedColor, fillColor: MaterialStateProperty.all(AppColors.primaryRedColor), ), - "Two Way" - .needTranslation + LocaleKeys.twoWay.tr(context: context) .toText14(color: AppColors.textColor, weight: FontWeight.w500) ], ).onPress(() { diff --git a/lib/presentation/emergency_services/call_ambulance/widgets/type_selection_widget.dart b/lib/presentation/emergency_services/call_ambulance/widgets/type_selection_widget.dart index 1b85165..3ae93d0 100644 --- a/lib/presentation/emergency_services/call_ambulance/widgets/type_selection_widget.dart +++ b/lib/presentation/emergency_services/call_ambulance/widgets/type_selection_widget.dart @@ -1,8 +1,10 @@ +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/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/facility_selection.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; @@ -27,7 +29,7 @@ class TypeSelectionWidget extends StatelessWidget { mainAxisSize: MainAxisSize.max, children: [ AppCustomChipWidget( - labelText: "All Facilities".needTranslation, + labelText: LocaleKeys.all.tr(context: context), shape: RoundedRectangleBorder( side: BorderSide( color: selectedFacility == FacilitySelection.ALL @@ -50,7 +52,7 @@ class TypeSelectionWidget extends StatelessWidget { child: AppCustomChipWidget( icon: AppAssets.hmg, iconHasColor: false, - labelText: "Hospitals".needTranslation, + labelText: LocaleKeys.hmgHospitals.tr(context: context), shape: RoundedRectangleBorder( side: BorderSide( color: selectedFacility == FacilitySelection.HMG @@ -74,7 +76,7 @@ class TypeSelectionWidget extends StatelessWidget { child: AppCustomChipWidget( icon: AppAssets.hmc, iconHasColor: false, - labelText: "Medical Centers".needTranslation, + labelText: LocaleKeys.hmcMedicalClinic.tr(context: context), shape: RoundedRectangleBorder( side: BorderSide( color: selectedFacility == FacilitySelection.HMC From 9795276ef9f493afa20925288d53adbe59b8b9d5 Mon Sep 17 00:00:00 2001 From: "Fatimah.Alshammari" Date: Wed, 14 Jan 2026 12:56:45 +0300 Subject: [PATCH 06/12] fixed errors --- lib/core/dependencies.dart | 14 +-- lib/presentation/parking/paking_page.dart | 69 ++++++----- lib/presentation/parking/parking_slot.dart | 127 +++++++++------------ lib/routes/app_routes.dart | 2 +- 4 files changed, 97 insertions(+), 115 deletions(-) diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index 0763e8e..be0ef7e 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -306,13 +306,13 @@ class AppDependencies { activePrescriptionsRepo: getIt() ), ); - getIt.registerFactory( - () => QrParkingViewModel( - qrParkingRepo: getIt(), - errorHandlerService: getIt(), - cacheService: getIt(), - ), - ); + // getIt.registerFactory( + // () => QrParkingViewModel( + // qrParkingRepo: getIt(), + // errorHandlerService: getIt(), + // cacheService: getIt(), + // ), + // ); } } diff --git a/lib/presentation/parking/paking_page.dart b/lib/presentation/parking/paking_page.dart index ca72c6e..d9cc1d8 100644 --- a/lib/presentation/parking/paking_page.dart +++ b/lib/presentation/parking/paking_page.dart @@ -14,6 +14,7 @@ import '../../widgets/buttons/custom_button.dart'; import '../../widgets/routes/custom_page_route.dart'; + class ParkingPage extends StatefulWidget { const ParkingPage({super.key}); @@ -22,11 +23,11 @@ class ParkingPage extends StatefulWidget { } class _ParkingPageState extends State { + + Future _readQR(BuildContext context) async { final vm = context.read(); - final model = await vm.scanAndGetParking(); - if (model == null) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text(vm.error ?? "Invalid Qr Code")), @@ -36,15 +37,38 @@ class _ParkingPageState extends State { Navigator.of(context).push( CustomPageRoute( - page: ParkingSlot(model: model), + page: ChangeNotifierProvider.value( + value: vm, + child: ParkingSlot(model: model), + ), ), ); } @override - Widget build(BuildContext context) { - final vm = context.watch(); // عشان loading + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) async { + final vm = context.read(); + await vm.getIsSaveParking(); + if (!mounted) return; + if (vm.isSavePark && vm.qrParkingModel != null) { + Navigator.of(context).push( + CustomPageRoute( + page: ChangeNotifierProvider.value( + value: vm, + child: ParkingSlot(model: vm.qrParkingModel!), + ), + ), + ); + } + }); + } + + @override + Widget build(BuildContext context) { + final vm = context.watch(); return Scaffold( backgroundColor: AppColors.scaffoldBgColor, appBar: CustomAppBar( @@ -98,7 +122,6 @@ class _ParkingPageState extends State { ), ), - /// Bottom button Container( decoration: RoundedRectangleBorder() .toSmoothCornerDecoration( @@ -113,40 +136,13 @@ class _ParkingPageState extends State { height: 56, child: CustomButton( text: "Read Barcodes".needTranslation, - onPressed: () => _readQR(context), // ALWAYS non-null - isDisabled: vm.isLoading, // control disabled state here + onPressed: () => _readQR(context), // always non-null + isDisabled: vm.isLoading, backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, fontSize: 18, fontWeight: FontWeight.bold, - ) - - // ElevatedButton( - // style: ElevatedButton.styleFrom( - // backgroundColor: AppColors.primaryRedColor, - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10), - // ), - // ), - // onPressed: vm.isLoading ? null : () => _readQR(context), - // child: vm.isLoading - // ? const SizedBox( - // width: 22, - // height: 22, - // child: CircularProgressIndicator( - // strokeWidth: 2, - // color: Colors.white, - // ), - // ) - // : const Text( - // "Read Barcodes", - // style: TextStyle( - // fontSize: 18, - // fontWeight: FontWeight.bold, - // color: Colors.white, - // ), - // ), - // ), + ), ), ), ), @@ -156,3 +152,4 @@ class _ParkingPageState extends State { } } + diff --git a/lib/presentation/parking/parking_slot.dart b/lib/presentation/parking/parking_slot.dart index ce13dad..0eb3718 100644 --- a/lib/presentation/parking/parking_slot.dart +++ b/lib/presentation/parking/parking_slot.dart @@ -5,7 +5,6 @@ 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/qr_parking/models/qr_parking_response_model.dart'; - import '../../features/qr_parking/qr_parking_view_model.dart'; import '../../theme/colors.dart'; import '../../widgets/appbar/app_bar_widget.dart'; @@ -13,7 +12,7 @@ import '../../widgets/buttons/custom_button.dart'; import '../../widgets/chip/app_custom_chip_widget.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:provider/provider.dart'; - +import '../../widgets/routes/custom_page_route.dart'; class ParkingSlot extends StatefulWidget { final QrParkingResponseModel model; @@ -28,7 +27,6 @@ class ParkingSlot extends StatefulWidget { } class _ParkingSlotState extends State { - void _openDirection() { final lat = widget.model.latitude; final lng = widget.model.longitude; @@ -36,8 +34,10 @@ class _ParkingSlotState extends State { final valid = lat != null && lng != null && !(lat == 0.0 && lng == 0.0) && - lat >= -90 && lat <= 90 && - lng >= -180 && lng <= 180; + lat >= -90 && + lat <= 90 && + lng >= -180 && + lng <= 180; if (!valid) { ScaffoldMessenger.of(context).showSnackBar( @@ -49,12 +49,33 @@ class _ParkingSlotState extends State { MapsLauncher.launchCoordinates(lat, lng); } + Future _resetDirection() async { final vm = context.read(); await vm.clearParking(); - Navigator.of(context).popUntil((route) => route.isFirst); + final model = await vm.scanAndGetParking(); + if (model == null) { + if (!mounted) return; + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(vm.error ?? "Scan cancelled")), + ); + + Navigator.of(context).pop(); + return; + } + + if (!mounted) return; + Navigator.of(context).pushReplacement( + CustomPageRoute( + page: ChangeNotifierProvider.value( + value: vm, + child: ParkingSlot(model: model), + ), + ), + ); } + DateTime? _parseDotNetDate(String? value) { if (value == null || value.isEmpty) return null; @@ -65,11 +86,9 @@ class _ParkingSlotState extends State { final milliseconds = int.tryParse(match.group(1)!); if (milliseconds == null) return null; - return DateTime.fromMillisecondsSinceEpoch(milliseconds, isUtc: true) - .toLocal(); + return DateTime.fromMillisecondsSinceEpoch(milliseconds, isUtc: true).toLocal(); } - String _formatPrettyDate(String? value) { final date = _parseDotNetDate(value); if (date == null) return '-'; @@ -79,14 +98,13 @@ class _ParkingSlotState extends State { 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]; - final day = date.day; + final day = date.day.toString().padLeft(2, '0'); final month = months[date.month - 1]; final year = date.year; - return "$day $month $year"; + return "$day $month $year"; // ✅ 15 Dec 2025 } - String _formatPrettyTime(String? value) { final date = _parseDotNetDate(value); if (date == null) return '-'; @@ -100,7 +118,7 @@ class _ParkingSlotState extends State { hour = hour % 12; if (hour == 0) hour = 12; - return "${hour.toString().padLeft(2, '0')}:$minute $period"; + return "${hour.toString().padLeft(2, '0')}:$minute $period"; // ✅ 03:05 PM } @override @@ -126,11 +144,9 @@ class _ParkingSlotState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Container( width: double.infinity, - decoration: RoundedRectangleBorder() - .toSmoothCornerDecoration( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true, @@ -154,24 +170,16 @@ class _ParkingSlotState extends State { runSpacing: 4, children: [ AppCustomChipWidget( - labelText: - "Slot: ${widget.model.qRParkingCode ?? '-'}" - .needTranslation, + labelText: "Slot: ${widget.model.qRParkingCode ?? '-'}".needTranslation, ), AppCustomChipWidget( - labelText: - "Basement: ${widget.model.floorDescription ?? '-'}" - .needTranslation, + labelText: "Basement: ${widget.model.floorDescription ?? '-'}".needTranslation, ), AppCustomChipWidget( - labelText: - "Date: ${_formatPrettyDate(widget.model.createdOn)}" - .needTranslation, + labelText: "Date: ${_formatPrettyDate(widget.model.createdOn)}".needTranslation, ), AppCustomChipWidget( - labelText: - "Parked Since: ${_formatPrettyTime(widget.model.createdOn)}" - .needTranslation, + labelText: "Parked Since: ${_formatPrettyTime(widget.model.createdOn)}".needTranslation, ), ], ), @@ -179,13 +187,12 @@ class _ParkingSlotState extends State { ), ), ), - SizedBox(height: 24.h), SizedBox( width: double.infinity, height: 48.h, - child:CustomButton( + child: CustomButton( text: "Get Direction".needTranslation, onPressed: _openDirection, backgroundColor: AppColors.primaryRedColor, @@ -194,49 +201,25 @@ class _ParkingSlotState extends State { fontSize: 18, fontWeight: FontWeight.bold, borderRadius: 10, - ) - - // ElevatedButton( - // style: ElevatedButton.styleFrom( - // backgroundColor: AppColors.primaryRedColor, - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10), - // ), - // ), - // onPressed: _openDirection, - // child: Text( - // "Get Direction".needTranslation, - // style: TextStyle( - // fontSize: 18, - // fontWeight: FontWeight.bold, - // color: AppColors.whiteColor, - // ), - // ), - // ), + ), ), - // const Spacer(), - // SizedBox( - // width: double.infinity, - // height: 48.h, - // child: OutlinedButton( - // style: OutlinedButton.styleFrom( - // side: BorderSide(color: AppColors.primaryRedColor), - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.circular(10), - // ), - // ), - // onPressed: _resetDirection, - // child: Text( - // "Reset Direction".needTranslation, - // style: TextStyle( - // fontSize: 16, - // fontWeight: FontWeight.w600, - // color: AppColors.primaryRedColor, - // ), - // ), - // ), - // ), + const Spacer(), + + SizedBox( + width: double.infinity, + height: 48.h, + child: CustomButton( + text: "Reset Direction".needTranslation, + onPressed: _resetDirection, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 18, + fontWeight: FontWeight.bold, + borderRadius: 10, + ), + ), ], ), ), @@ -249,3 +232,5 @@ class _ParkingSlotState extends State { } + + diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index 778757d..632463f 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -138,6 +138,6 @@ class AppRoutes { qrParking: (context) => ChangeNotifierProvider( create: (_) => getIt(), child: const ParkingPage(), - ),} + ), }; } From 87422e8e05ce1bab49c13aa973c6ed6ce74d76b6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 14 Jan 2026 22:26:02 +0300 Subject: [PATCH 07/12] translation updates --- assets/langs/ar-SA.json | 122 ++++++++++++++- assets/langs/en-US.json | 118 ++++++++++++++- lib/core/api_consts.dart | 2 +- lib/core/dependencies.dart | 7 - lib/extensions/string_extensions.dart | 2 +- .../my_appointments_view_model.dart | 6 +- lib/generated/locale_keys.g.dart | 116 ++++++++++++++ .../RRT/rrt_map_screen.dart | 44 +++--- .../RRT/rrt_request_type_select.dart | 13 +- .../RRT/terms_and_condition.dart | 4 +- .../emergency_services_page.dart | 31 ++-- .../er_online_checkin_home.dart | 16 +- ...r_online_checkin_payment_details_page.dart | 12 +- .../er_online_checkin_payment_page.dart | 26 ++-- ...e_checkin_select_checkin_bottom_sheet.dart | 18 ++- .../history/er_history_listing.dart | 22 +-- .../history/widget/RequestStatus.dart | 12 +- .../widget/ambulance_history_item.dart | 6 +- .../history/widget/rrt_item.dart | 6 +- .../emergency_services/nearest_er_page.dart | 6 +- .../widgets/location_input_bottom_sheet.dart | 2 +- .../widgets/nearestERItem.dart | 8 +- .../habib_wallet/habib_wallet_page.dart | 2 +- .../habib_wallet/recharge_wallet_page.dart | 12 +- .../wallet_payment_confirm_page.dart | 12 +- .../widgets/select-medical_file.dart | 8 +- .../widgets/select_hospital_bottom_sheet.dart | 4 +- .../health_calculator_detailed_page.dart | 6 +- .../health_calculators_page.dart | 46 +++--- .../widgets/bf.dart | 18 ++- .../widgets/bmi.dart | 7 +- .../widgets/bmr.dart | 18 ++- .../widgets/calories.dart | 14 +- .../widgets/crabs.dart | 8 +- .../widgets/dduedate.dart | 2 +- .../widgets/ibw.dart | 14 +- .../widgets/ovulation.dart | 8 +- .../add_health_tracker_entry_page.dart | 48 +++--- .../health_tracker_detail_page.dart | 42 +++--- .../health_trackers/health_trackers_page.dart | 16 +- .../widgets/tracker_last_value_card.dart | 25 +-- .../hmg_services/services_page.dart | 76 +++++----- lib/presentation/home/landing_page.dart | 2 +- .../profile_settings/profile_settings.dart | 11 +- lib/routes/app_routes.dart | 2 +- pubspec.lock | 142 ++++++++++++++---- 46 files changed, 797 insertions(+), 345 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index da245da..19db982 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -525,7 +525,7 @@ "payOnline": "الدفع عبر الإنترنت", "cancelOrder": "إلغاء الطلب", "confirmAddress": "تأكيد العنوان ", - "confirmLocation": "��أكيد الموقع ", + "confirmLocation": "أكيد الموقع ", "conditionsHMG": "الشروط والأحكام ", "conditions": "الشروط والأحكام لكوم", "confirmDeleteMsg": "هل أنت متأكد! تريد الحذف ", @@ -1095,5 +1095,123 @@ "pickupFromHome": "الاستلام من المنزل", "onTheWayToHospital": " في الطريق إلى المستشفى", "arrivedAtHospital": "وصل إلى المستشفى", - "orderCancel": "إلغاء الطلب" + "orderCancel": "إلغاء الطلب", + "emergencyCheckIn": "تسجيل الطوارئ الإلكتروني", + "erOnlineCheckInDescription": "تتيح هذه الخدمة للمرضى تسجيل موعد الطوارئ قبل الوصول.", + "erOnlineCheckInSuccess": "تم تسجيل وصول الطوارئ بنجاح. الرجاء التوجه إلى منطقة الانتظار.", + "erOnlineCheckInError": "حدث خطأ غير متوقع أثناء عملية التسجيل. يرجى التواصل مع الدعم.", + "fetchingHospitalsList": "جاري جلب قائمة المستشفيات...", + "fetchingPaymentInformation": "جاري جلب معلومات الدفع...", + "erVisitDetails": "تفاصيل زيارة الطوارئ", + "erClinic": "عيادة الطوارئ", + "vatWithAmount": "الضريبة 15% ({amount})", + "erAppointmentBookedSuccess": "تم حجز موعدك بنجاح. يرجى إتمام إجراءات تسجيل الوصول عند وصولك إلى المستشفى.", + "underProcessing": "قيد المعالجة", + "canceledByPatient": "ملغى بواسطة المريض", + "rapidResponseTeam": "فريق الاستجابة السريع", + "allFacilities": "جميع المرافق", + "selectLocation": "اختر الموقع", + "pleaseSelectTheLocation": "يرجى اختيار الموقع", + "viewLocationGoogleMaps": "عرض الموقع على خرائط جوجل", + "callAmbulance": "استدعاء سيارة إسعاف", + "requestAmbulanceInEmergency": "طلب سيارة إسعاف في حالة الطوارئ من المنزل أو المستشفى", + "confirmation": "تأكيد", + "areYouSureYouWantToCallAmbulance": "هل أنت متأكد أنك تريد استدعاء سيارة إسعاف؟", + "getDetailsOfNearestBranch": "احصل على تفاصيل أقرب فرع بما في ذلك الاتجاهات", + "areYouSureYouWantToCallRRT": "هل أنت متأكد أنك تريد استدعاء فريق الاستجابة السريعة (RRT)؟", + "priorERCheckInToSkipLine": "تسجيل الوصول المسبق في الطوارئ لتجاوز الطابور والدفع في الاستقبال.", + "areYouSureYouWantToMakeERCheckIn": "هل أنت متأكد أنك تريد إجراء تسجيل وصول الطوارئ؟", + "checkingYourERAppointmentStatus": "جاري التحقق من حالة موعد الطوارئ الخاص بك...", + "transportOptions": "خيارات النقل", + "selectHospitalForAdvancePayment": "يرجى اختيار المستشفى الذي ترغب في دفع مبلغ مقدم له.", + "recharge": "إعادة الشحن", + "activityLevel": "مستوى النشاط", + "selectActivityLevel": "حدد مستوى النشاط", + "caloriesPerDay": "السعرات الحرارية في اليوم الواحد", + "dietType": "نوع النظام الغذائي", + "selectDietType": "حدد نوع النظام الغذائي", + "bodyFrameSize": "حجم إطار الجسم", + "selectBodyFrameSize": "حدد حجم إطار الجسم", + "averageCycleLength": "متوسط طول الدورة الشهرية (عادةً 28 يومًا)", + "averageLutealPhase": "متوسط طول المرحلة الأصفرية (عادةً 14 يومًا)", + "convert": "يتحول", + "calculate": "احسب", + "healthCalculators": "حاسبات الصحة", + "healthConverters": "محولات الصحة", + "generalHealth": "الصحة العامة", + "relatedToBMICalories": "متعلق بمؤشر كتلة الجسم والسعرات الحرارية ودهون الجسم وما إلى ذلك للبقاء على اطلاع دائم بصحتك.", + "selectCalculator": "اختر الآلة الحاسبة", + "womensHealth": "صحة المرأة", + "relatedToPeriodsOvulation": "متعلق بالدورة الشهرية والإباضة والحمل ومواضيع أخرى.", + "bloodSugar": "سكر الدم", + "trackYourGlucoseLevels": "تتبع مستويات الجلوكوز لديك، وفهم الاتجاهات، واحصل على رؤى مخصصة لصحة أفضل.", + "bloodCholesterol": "كوليسترول الدم", + "monitorCholesterolLevels": "راقب مستويات الكوليسترول، وقيّم مخاطر صحة القلب، واتخذ خطوات استباقية للرفاهية.", + "triglyceridesFatBlood": "الدهون الثلاثية في الدم", + "understandTriglyceridesImpact": "افهم تأثير الدهون الثلاثية على صحة القلب مع رؤى مخصصة وتوصيات الخبراء.", + "bmiCalculator": "حاسبة\nمؤشر كتلة الجسم", + "caloriesCalculator": "حاسبة\nالسعرات الحرارية", + "bmrCalculator": "حاسبة\nمعدل الأيض الأساسي", + "idealBodyWeight": "الوزن المثالي\nللجسم", + "bodyFatCalculator": "حاسبة\nدهون الجسم", + "carbsProteinFat": "الكربوهيدرات\nالبروتين والدهون", + "ovulationPeriod": "فترة\nالإباضة", + "deliveryDueDate": "تاريخ الولادة\nالمتوقع", + "low": "منخفض", + "preDiabetic": "ما قبل السكري", + "high": "مرتفع", + "elevated": "مرتفع قليلاً", + "recorded": "مسجل", + "noRecordsYet": "لا توجد سجلات بعد", + "lastRecord": "آخر سجل", + "addBloodSugar": "إضافة سكر الدم", + "addBloodPressure": "إضافة ضغط الدم", + "addWeight": "إضافة الوزن", + "bloodSugarDataSavedSuccessfully": "تم حفظ بيانات سكر الدم بنجاح", + "bloodPressureDataSavedSuccessfully": "تم حفظ بيانات ضغط الدم بنجاح", + "weightDataSavedSuccessfully": "تم حفظ بيانات الوزن بنجاح", + "pleaseWait": "يرجى الانتظار", + "selectUnit": "اختر الوحدة", + "selectMeasureTime": "اختر وقت القياس", + "selectArm": "اختر الذراع", + "enterBloodSugar": "أدخل سكر الدم", + "enterSystolicValue": "أدخل القيمة الانقباضية", + "enterDiastolicValue": "أدخل القيمة الانبساطية", + "enterWeight": "أدخل الوزن", + "selectDuration": "اختر المدة", + "systolic": "الانقباضي", + "diastolic": "الانبساطي", + "sendReportByEmail": "إرسال التقرير عبر البريد الإلكتروني", + "enterYourEmailToReceiveReport": "أدخل عنوان بريدك الإلكتروني لاستلام التقرير", + "addNewRecord": "إضافة سجل جديد", + "healthTrackers": "متتبعات الصحة", + "monitorBloodPressureLevels": "راقب مستويات ضغط الدم لديك، وتتبع القراءات الانقباضية والانبساطية، وحافظ على صحة قلبك.", + "trackWeightProgress": "تتبع تقدم وزنك، وضع الأهداف، وحافظ على كتلة جسم صحية من أجل العافية الشاملة.", + "bookAppointment": "حجز\nموعد", + "completeCheckup": "الفحص الشامل", + "indoorNavigation": "الملاحة الداخلية", + "eReferralServices": "خدمات الإحالة الإلكترونية", + "bloodDonation": "التبرع بالدم", + "dailyWaterMonitor": "مراقب الماء اليومي", + "fetchingYourWaterIntakeDetails": "جاري جلب تفاصيل استهلاك الماء الخاص بك.", + "healthCalculatorsServices": "حاسبات\nالصحة", + "healthConvertersServices": "محولات\nالصحة", + "smartWatchesServices": "الساعات\nالذكية", + "exploreServices": "استكشف الخدمات", + "medicalAndCareServices": "الخدمات الطبية والرعاية", + "hmgServices": "خدمات مجموعة الحبيب الطبية", + "personalServices": "الخدمات الشخصية", + "habibWallet": "محفظة الحبيب", + "loginToViewWalletBalance": "سجل الدخول لعرض رصيد محفظتك", + "recharge": "إعادة الشحن", + "loginToViewMedicalFile": "سجل الدخول لعرض ملفك الطبي", + "addMember": "إضافة عضو", + "addFamilyMember": "إضافة فرد من العائلة", + "pleaseFillBelowFieldToAddNewFamilyMember": "يرجى ملء الحقل أدناه لإضافة فرد جديد من العائلة إلى ملفك الشخصي", + "healthTools": "أدوات الصحة", + "supportServices": "خدمات الدعم", + "virtualTour": "جولة افتراضية", + "carParking": "موقف السيارات", + "latestNews": "آخر الأخبار", + "hmgContact": "اتصل بمجموعة الحبيب الطبية" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index f6500dc..ee489f5 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -1091,5 +1091,121 @@ "pickupFromHome": "Pickup Up from Home", "onTheWayToHospital": " On The Way To Hospital", "arrivedAtHospital": "Arrived at Hospital", - "orderCancel": "Order Cancel" + "orderCancel": "Order Cancel", + "emergencyCheckIn": "Emergency Check-In", + "erOnlineCheckInDescription": "This service lets patients register their ER appointment prior to arrival.", + "erOnlineCheckInSuccess": "Your ER Online Check-In has been successfully done. Please proceed to the waiting area.", + "erOnlineCheckInError": "Unexpected error occurred during check-in. Please contact support.", + "fetchingHospitalsList": "Fetching hospitals list...", + "fetchingPaymentInformation": "Fetching payment information...", + "erVisitDetails": "ER Visit Details", + "erClinic": "ER Clinic", + "vatWithAmount": "VAT 15% ({amount})", + "erAppointmentBookedSuccess": "Your appointment has been booked successfully. Please perform Check-In once you arrive at the hospital.", + "underProcessing": "Under processing", + "canceledByPatient": "Cancelled by patient", + "rapidResponseTeam": "Rapid Response Team", + "allFacilities": "All Facilities", + "selectLocation": "Select Location", + "pleaseSelectTheLocation": "Please select the location", + "viewLocationGoogleMaps": "View Location on Google Maps", + "callAmbulance": "Call Ambulance", + "requestAmbulanceInEmergency": "Request an ambulance in emergency from home or hospital", + "confirmation": "Confirmation", + "areYouSureYouWantToCallAmbulance": "Are you sure you want to call an ambulance?", + "getDetailsOfNearestBranch": "Get the details of nearest branch including 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.", + "areYouSureYouWantToMakeERCheckIn": "Are you sure you want to make ER Check-In?", + "checkingYourERAppointmentStatus": "Checking your ER Appointment status...", + "transportOptions": "Transport Options", + "selectHospitalForAdvancePayment": "Please select the hospital you want to make an advance payment for.", + "recharge": "Recharge", + "activityLevel": "Activity Level", + "selectActivityLevel": "Select Activity Level", + "caloriesPerDay": "Calories Per Day", + "dietType": "Diet Type", + "selectDietType": "Select Diet Type", + "bodyFrameSize": "Body Frame Size", + "selectBodyFrameSize": "Select Body Frame Size", + "averageCycleLength": "Average Cycle Length (Usually 28 days)", + "averageLutealPhase": "Average Luteal Phase Length(Usually 14 days)", + "convert": "Convert", + "calculate": "Calculate", + "healthCalculators": "Health Calculators", + "healthConverters": "Health Converters", + "generalHealth": "General Health", + "relatedToBMICalories": "Related To BMI, calories, body fat, etc to stay updated with your health.", + "selectCalculator": "Select Calculator", + "womensHealth": "Women's Health", + "relatedToPeriodsOvulation": "Related To periods, ovulation, pregnancy, and other topics.", + "bloodSugar": "Blood Sugar", + "trackYourGlucoseLevels": "Track your glucose levels, understand trends, and get personalized insights for better health.", + "bloodCholesterol": "Blood Cholesterol", + "monitorCholesterolLevels": "Monitor cholesterol levels, assess heart health risks, and take proactive steps for well-being.", + "triglyceridesFatBlood": "Triglycerides Fat Blood", + "understandTriglyceridesImpact": "Understand triglycerides' impact on heart health with personalized insights and expert recommendations.", + "bmiCalculator": "BMI\nCalculator", + "caloriesCalculator": "Calories\nCalculator", + "bmrCalculator": "BMR\nCalculator", + "idealBodyWeight": "Ideal Body\nWeight", + "bodyFatCalculator": "Body Fat\nCalculator", + "carbsProteinFat": "Carbs\nProtein & Fat", + "ovulationPeriod": "Ovulation\nPeriod", + "deliveryDueDate": "Delivery\nDue Date", + "low": "Low", + "preDiabetic": "Pre-diabetic", + "high": "High", + "elevated": "Elevated", + "recorded": "Recorded", + "noRecordsYet": "No records yet", + "lastRecord": "Last Record", + "addBloodSugar": "Add Blood Sugar", + "addBloodPressure": "Add Blood Pressure", + "addWeight": "Add Weight", + "bloodSugarDataSavedSuccessfully": "Blood Sugar Data saved successfully", + "bloodPressureDataSavedSuccessfully": "Blood Pressure Data saved successfully", + "weightDataSavedSuccessfully": "Weight Data saved successfully", + "pleaseWait": "Please wait", + "selectUnit": "Select Unit", + "selectMeasureTime": "Select Measure Time", + "selectArm": "Select Arm", + "enterBloodSugar": "Enter Blood Sugar", + "enterSystolicValue": "Enter Systolic Value", + "enterDiastolicValue": "Enter Diastolic Value", + "enterWeight": "Enter Weight", + "selectDuration": "Select Duration", + "systolic": "Systolic", + "diastolic": "Diastolic", + "sendReportByEmail": "Send Report by Email", + "enterYourEmailToReceiveReport": "Enter your email address to receive the report", + "addNewRecord": "Add new Record", + "healthTrackers": "Health Trackers", + "monitorBloodPressureLevels": "Monitor your blood pressure levels, track systolic and diastolic readings, and maintain a healthy heart.", + "trackWeightProgress": "Track your weight progress, set goals, and maintain a healthy body mass for overall wellness.", + "bookAppointment": "Book\nAppointment", + "completeCheckup": "Complete Checkup", + "indoorNavigation": "Indoor Navigation", + "eReferralServices": "E-Referral Services", + "dailyWaterMonitor": "Daily Water Monitor", + "fetchingYourWaterIntakeDetails": "Fetching your water intake details.", + "healthCalculatorsServices": "Health\nCalculators", + "healthConvertersServices": "Health\nConverters", + "smartWatchesServices": "Smart\nWatches", + "exploreServices": "Explore Services", + "medicalAndCareServices": "Medical & Care Services", + "hmgServices": "HMG Services", + "personalServices": "Personal Services", + "habibWallet": "Habib Wallet", + "loginToViewWalletBalance": "Login to view your wallet balance", + "loginToViewMedicalFile": "Login to view your medical file", + "addMember": "Add Member", + "addFamilyMember": "Add Family Member", + "pleaseFillBelowFieldToAddNewFamilyMember": "Please fill the below field to add a new family member to your profile", + "healthTools": "Health Tools", + "supportServices": "Support Services", + "virtualTour": "Virtual Tour", + "carParking": "Car Parking", + "latestNews": "Latest News", + "hmgContact": "HMG Contact" } \ No newline at end of file diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index 50be532..bdd7984 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -679,7 +679,7 @@ const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard'; class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index 0763e8e..a1a04b5 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -166,13 +166,6 @@ class AppDependencies { ),); getIt.registerLazySingleton(() => MonthlyReportsRepoImp(loggerService: getIt(), apiClient: getIt())); getIt.registerLazySingleton(() => QrParkingRepoImp(loggerService: getIt(), apiClient: getIt())); - getIt.registerFactory( - () => QrParkingViewModel( - qrParkingRepo: getIt(), - errorHandlerService: getIt(), - cacheService: getIt(), - ), - ); getIt.registerLazySingleton(() => NotificationsRepoImp(loggerService: getIt(), apiClient: getIt())); // ViewModels diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 947bff4..309dde1 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -15,7 +15,7 @@ extension CapExtension on String { String get allInCaps => toUpperCase(); - // String get needTranslation => this; + String get needTranslation => this; String get capitalizeFirstofEach => trim().isNotEmpty ? trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : ""; } diff --git a/lib/features/my_appointments/my_appointments_view_model.dart b/lib/features/my_appointments/my_appointments_view_model.dart index 3934bf7..96340a7 100644 --- a/lib/features/my_appointments/my_appointments_view_model.dart +++ b/lib/features/my_appointments/my_appointments_view_model.dart @@ -281,9 +281,9 @@ class MyAppointmentsViewModel extends ChangeNotifier { } } - print('Upcoming Appointments: ${patientUpcomingAppointmentsHistoryList.length}'); - print('Arrived Appointments: ${patientArrivedAppointmentsHistoryList.length}'); - print('All Appointments: ${patientAppointmentsHistoryList.length}'); + debugPrint('Upcoming Appointments: ${patientUpcomingAppointmentsHistoryList.length}'); + debugPrint('Arrived Appointments: ${patientArrivedAppointmentsHistoryList.length}'); + debugPrint('All Appointments: ${patientAppointmentsHistoryList.length}'); getFiltersForSelectedAppointmentList(filteredAppointmentList); notifyListeners(); } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index fcc0257..689587c 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1092,5 +1092,121 @@ abstract class LocaleKeys { static const onTheWayToHospital = 'onTheWayToHospital'; static const arrivedAtHospital = 'arrivedAtHospital'; static const orderCancel = 'orderCancel'; + static const emergencyCheckIn = 'emergencyCheckIn'; + static const erOnlineCheckInDescription = 'erOnlineCheckInDescription'; + static const erOnlineCheckInSuccess = 'erOnlineCheckInSuccess'; + static const erOnlineCheckInError = 'erOnlineCheckInError'; + static const fetchingHospitalsList = 'fetchingHospitalsList'; + static const fetchingPaymentInformation = 'fetchingPaymentInformation'; + static const erVisitDetails = 'erVisitDetails'; + static const erClinic = 'erClinic'; + static const vatWithAmount = 'vatWithAmount'; + static const erAppointmentBookedSuccess = 'erAppointmentBookedSuccess'; + static const underProcessing = 'underProcessing'; + static const canceledByPatient = 'canceledByPatient'; + static const rapidResponseTeam = 'rapidResponseTeam'; + static const allFacilities = 'allFacilities'; + static const selectLocation = 'selectLocation'; + static const pleaseSelectTheLocation = 'pleaseSelectTheLocation'; + static const viewLocationGoogleMaps = 'viewLocationGoogleMaps'; + static const callAmbulance = 'callAmbulance'; + static const requestAmbulanceInEmergency = 'requestAmbulanceInEmergency'; + static const confirmation = 'confirmation'; + static const areYouSureYouWantToCallAmbulance = 'areYouSureYouWantToCallAmbulance'; + static const getDetailsOfNearestBranch = 'getDetailsOfNearestBranch'; + static const areYouSureYouWantToCallRRT = 'areYouSureYouWantToCallRRT'; + static const priorERCheckInToSkipLine = 'priorERCheckInToSkipLine'; + static const areYouSureYouWantToMakeERCheckIn = 'areYouSureYouWantToMakeERCheckIn'; + static const checkingYourERAppointmentStatus = 'checkingYourERAppointmentStatus'; + static const transportOptions = 'transportOptions'; + static const selectHospitalForAdvancePayment = 'selectHospitalForAdvancePayment'; + static const recharge = 'recharge'; + static const activityLevel = 'activityLevel'; + static const selectActivityLevel = 'selectActivityLevel'; + static const caloriesPerDay = 'caloriesPerDay'; + static const dietType = 'dietType'; + static const selectDietType = 'selectDietType'; + static const bodyFrameSize = 'bodyFrameSize'; + static const selectBodyFrameSize = 'selectBodyFrameSize'; + static const averageCycleLength = 'averageCycleLength'; + static const averageLutealPhase = 'averageLutealPhase'; + static const convert = 'convert'; + static const calculate = 'calculate'; + static const healthCalculators = 'healthCalculators'; + static const healthConverters = 'healthConverters'; + static const generalHealth = 'generalHealth'; + static const relatedToBMICalories = 'relatedToBMICalories'; + static const selectCalculator = 'selectCalculator'; + static const womensHealth = 'womensHealth'; + static const relatedToPeriodsOvulation = 'relatedToPeriodsOvulation'; + static const bloodSugar = 'bloodSugar'; + static const trackYourGlucoseLevels = 'trackYourGlucoseLevels'; + static const bloodCholesterol = 'bloodCholesterol'; + static const monitorCholesterolLevels = 'monitorCholesterolLevels'; + static const triglyceridesFatBlood = 'triglyceridesFatBlood'; + static const understandTriglyceridesImpact = 'understandTriglyceridesImpact'; + static const bmiCalculator = 'bmiCalculator'; + static const caloriesCalculator = 'caloriesCalculator'; + static const bmrCalculator = 'bmrCalculator'; + static const idealBodyWeight = 'idealBodyWeight'; + static const bodyFatCalculator = 'bodyFatCalculator'; + static const carbsProteinFat = 'carbsProteinFat'; + static const ovulationPeriod = 'ovulationPeriod'; + static const deliveryDueDate = 'deliveryDueDate'; + static const low = 'low'; + static const preDiabetic = 'preDiabetic'; + static const high = 'high'; + static const elevated = 'elevated'; + static const recorded = 'recorded'; + static const noRecordsYet = 'noRecordsYet'; + static const lastRecord = 'lastRecord'; + static const addBloodSugar = 'addBloodSugar'; + static const addBloodPressure = 'addBloodPressure'; + static const addWeight = 'addWeight'; + static const bloodSugarDataSavedSuccessfully = 'bloodSugarDataSavedSuccessfully'; + static const bloodPressureDataSavedSuccessfully = 'bloodPressureDataSavedSuccessfully'; + static const weightDataSavedSuccessfully = 'weightDataSavedSuccessfully'; + static const pleaseWait = 'pleaseWait'; + static const selectUnit = 'selectUnit'; + static const selectMeasureTime = 'selectMeasureTime'; + static const selectArm = 'selectArm'; + static const enterBloodSugar = 'enterBloodSugar'; + static const enterSystolicValue = 'enterSystolicValue'; + static const enterDiastolicValue = 'enterDiastolicValue'; + static const enterWeight = 'enterWeight'; + static const selectDuration = 'selectDuration'; + static const systolic = 'systolic'; + static const diastolic = 'diastolic'; + static const sendReportByEmail = 'sendReportByEmail'; + static const enterYourEmailToReceiveReport = 'enterYourEmailToReceiveReport'; + static const addNewRecord = 'addNewRecord'; + static const healthTrackers = 'healthTrackers'; + static const monitorBloodPressureLevels = 'monitorBloodPressureLevels'; + static const trackWeightProgress = 'trackWeightProgress'; + static const bookAppointment = 'bookAppointment'; + static const completeCheckup = 'completeCheckup'; + static const indoorNavigation = 'indoorNavigation'; + static const eReferralServices = 'eReferralServices'; + static const dailyWaterMonitor = 'dailyWaterMonitor'; + static const fetchingYourWaterIntakeDetails = 'fetchingYourWaterIntakeDetails'; + static const healthCalculatorsServices = 'healthCalculatorsServices'; + static const healthConvertersServices = 'healthConvertersServices'; + static const smartWatchesServices = 'smartWatchesServices'; + static const exploreServices = 'exploreServices'; + static const medicalAndCareServices = 'medicalAndCareServices'; + static const hmgServices = 'hmgServices'; + static const personalServices = 'personalServices'; + static const habibWallet = 'habibWallet'; + static const loginToViewWalletBalance = 'loginToViewWalletBalance'; + static const loginToViewMedicalFile = 'loginToViewMedicalFile'; + static const addMember = 'addMember'; + static const addFamilyMember = 'addFamilyMember'; + static const pleaseFillBelowFieldToAddNewFamilyMember = 'pleaseFillBelowFieldToAddNewFamilyMember'; + static const healthTools = 'healthTools'; + static const supportServices = 'supportServices'; + static const virtualTour = 'virtualTour'; + static const carParking = 'carParking'; + static const latestNews = 'latestNews'; + static const hmgContact = 'hmgContact'; } diff --git a/lib/presentation/emergency_services/RRT/rrt_map_screen.dart b/lib/presentation/emergency_services/RRT/rrt_map_screen.dart index afe68b6..530152b 100644 --- a/lib/presentation/emergency_services/RRT/rrt_map_screen.dart +++ b/lib/presentation/emergency_services/RRT/rrt_map_screen.dart @@ -1,4 +1,3 @@ - import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -135,19 +134,19 @@ class RrtMapScreen extends StatelessWidget { Column( spacing: 4.h, children: [ - "Select Location".needTranslation.toText21( + LocaleKeys.selectLocation.tr().toText21( weight: FontWeight.w600, color: AppColors.textColor, ), - "Please select the location".needTranslation.toText12( + LocaleKeys.pleaseSelectTheLocation.tr().toText12( fontWeight: FontWeight.w500, color: AppColors.greyTextColor, ) ], ), CustomButton( - text: "Submit Request".needTranslation, - onPressed: () { + text: LocaleKeys.submitRequest.tr(), + onPressed: () { LocationViewModel locationViewModel = context.read(); GeocodeResponse? response = locationViewModel.geocodeResponse; PlaceDetails? placeDetails = locationViewModel.placeDetails; @@ -235,7 +234,7 @@ class RrtMapScreen extends StatelessWidget { height: 40.h, backgroundColor: AppColors.lightRedButtonColor, borderColor: Colors.transparent, - text: "Add new address".needTranslation, + text: LocaleKeys.addNewAddress.tr(), textColor: AppColors.primaryRedColor, iconColor: AppColors.primaryRedColor, onPressed: () {}, @@ -245,9 +244,7 @@ class RrtMapScreen extends StatelessWidget { isSelected: index == 0, address: "Flat No 301, Building No 12, Palm Spring Apartment, Sector 45, Gurugram, Haryana 122003", - title: index == 0 - ? "Home".needTranslation - : "Work".needTranslation, + title: index == 0 ? LocaleKeys.home.tr() : LocaleKeys.work.tr(), onTap: () {}, ); } @@ -291,8 +288,8 @@ class RrtMapScreen extends StatelessWidget { Row( children: [ hospitalAndPickUpItemContent( - title: "Pick".needTranslation, - subTitle: "Inside the home".needTranslation, + title: LocaleKeys.pick.tr(), + subTitle: LocaleKeys.insideTheHome.tr(), leadingIcon: AppAssets.pickup_bed, ), CustomSwitch( @@ -312,7 +309,7 @@ class RrtMapScreen extends StatelessWidget { children: [ hospitalAndPickUpItemContent( title: '', - subTitle: "Have any appointment".needTranslation, + subTitle: LocaleKeys.haveAnyAppointment.tr(), leadingIcon: AppAssets.appointment_checkin_icon, ), CustomSwitch( @@ -416,8 +413,8 @@ class RrtMapScreen extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 4.h, children: [ - "Total amount to pay".needTranslation.toText18( - weight: FontWeight.w600, + LocaleKeys.totalAmountToPay.tr().toText18( + weight: FontWeight.w600, color: AppColors.textColor, ), Row( @@ -425,9 +422,7 @@ class RrtMapScreen extends StatelessWidget { Utils.buildSvgWithAssets(icon: AppAssets.warning, height: 18.h, width: 18.h), SizedBox(width: 4.h,), - "Amount will be paid at the hospital" - .needTranslation - .toText12( + LocaleKeys.amountPaidAtHospital.tr().toText12( fontWeight: FontWeight.w500, color: AppColors.greyTextColor, ), @@ -452,7 +447,7 @@ class RrtMapScreen extends StatelessWidget { ], ), CustomButton( - text: "Submit Request".needTranslation, + text: LocaleKeys.submitRequest.tr(), onPressed: () { LocationViewModel locationViewModel = context.read(); GeocodeResponse? response = locationViewModel.geocodeResponse; @@ -530,8 +525,8 @@ class RrtMapScreen extends StatelessWidget { return SizedBox( width: MediaQuery.sizeOf(context).width, child: TextInputWidget( - labelText: "Enter Pickup Location Manually".needTranslation, - hintText: "Enter Pickup Location".needTranslation, + labelText: LocaleKeys.enterPickupLocationManually.tr(), + hintText: LocaleKeys.enterPickupLocation.tr(), controller: TextEditingController( text: vm.geocodeResponse?.results.first.formattedAddress ?? vm.selectedPrediction?.description, @@ -562,7 +557,7 @@ class RrtMapScreen extends StatelessWidget { openLocationInputBottomSheet(BuildContext context) { context.read().flushSearchPredictions(); showCommonBottomSheetWithoutHeight( - title: "".needTranslation, + title: "", context, child: SizedBox( height: MediaQuery.sizeOf(context).height * .8, @@ -583,11 +578,10 @@ class RrtMapScreen extends StatelessWidget { child: Row( children: [ hospitalAndPickUpItemContent( - title: "Select Hospital".needTranslation, + title: "Select Hospital".tr(), subTitle: context .read() - .getSelectedHospitalName() ?? - "Select Hospital".needTranslation, + .getSelectedHospitalName() ?? "Select Hospital".tr(), leadingIcon: AppAssets.hospital, ), Utils.buildSvgWithAssets( @@ -606,7 +600,7 @@ class RrtMapScreen extends StatelessWidget { void openAppointmentList(BuildContext context) { showCommonBottomSheetWithoutHeight( - title: "Select Appointment".needTranslation, + title: LocaleKeys.selectAppointment.tr(), context, child: SizedBox( height: MediaQuery.sizeOf(context).height * .5, diff --git a/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart b/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart index 13e0106..91db0de 100644 --- a/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart +++ b/lib/presentation/emergency_services/RRT/rrt_request_type_select.dart @@ -18,12 +18,11 @@ class RrtRequestTypeSelect extends StatelessWidget { @override Widget build(BuildContext context) { return Consumer(builder: (context, emergencyServicesVM, child) { - print("the checkbox is ${emergencyServicesVM.agreedToTermsAndCondition}"); return Column( children: [ Column( children: [ - "Rapid Response Team (RRT) options".needTranslation.toText20(color: AppColors.textColor, isBold: true), + LocaleKeys.rapidResponseTeam.tr(context: context).toText20(color: AppColors.textColor, isBold: true), SizedBox( height: 16.h, ), @@ -74,7 +73,7 @@ class RrtRequestTypeSelect extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Total amount to pay".needTranslation.toText18( + LocaleKeys.totalAmountToPay.tr(context: context).toText18( weight: FontWeight.w600, color: AppColors.textColor, ), @@ -94,19 +93,19 @@ class RrtRequestTypeSelect extends StatelessWidget { SizedBox( width: 4.h, ), - "Amount will be paid at the hospital".needTranslation.toText11( + LocaleKeys.amountPaidAtHospital.tr(context: context).toText11( color: AppColors.greyTextColor, ), ], ), Row( children: [ - "+ VAT 15%(".needTranslation.toText12( + LocaleKeys.vat15.tr(context: context).toText12( fontWeight: FontWeight.w500, color: AppColors.greyTextColor, ), - "${emergencyServicesVM.selectedRRTProcedure?.patientTaxAmount})".needTranslation.toText14( - weight: FontWeight.w600, + "${emergencyServicesVM.selectedRRTProcedure?.patientTaxAmount})".toText14( + weight: FontWeight.w600, color: AppColors.greyTextColor, ), ], diff --git a/lib/presentation/emergency_services/RRT/terms_and_condition.dart b/lib/presentation/emergency_services/RRT/terms_and_condition.dart index 1d1dac1..bd0d6fd 100644 --- a/lib/presentation/emergency_services/RRT/terms_and_condition.dart +++ b/lib/presentation/emergency_services/RRT/terms_and_condition.dart @@ -1,8 +1,10 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.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/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -18,7 +20,7 @@ class TermsAndCondition extends StatelessWidget { Expanded( child: CollapsingListView( - title: "Terms And Condition".needTranslation, + title: LocaleKeys.termsConditoins.tr(context: context), child:DecoratedBox(decoration:RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 20.h, diff --git a/lib/presentation/emergency_services/emergency_services_page.dart b/lib/presentation/emergency_services/emergency_services_page.dart index 3833d32..a5281ca 100644 --- a/lib/presentation/emergency_services/emergency_services_page.dart +++ b/lib/presentation/emergency_services/emergency_services_page.dart @@ -59,9 +59,8 @@ class EmergencyServicesPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Call Ambulance".needTranslation.toText16(isBold: true, color: AppColors.blackColor), - "Request an ambulance in emergency from home or hospital" - .needTranslation + LocaleKeys.callAmbulance.tr().toText16(isBold: true, color: AppColors.blackColor), + LocaleKeys.requestAmbulanceInEmergency.tr() .toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500), ], ), @@ -100,10 +99,9 @@ class EmergencyServicesPage extends StatelessWidget { Lottie.asset(AppAnimations.ambulanceAlert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 120.h, height: 120.h, fit: BoxFit.contain), SizedBox(height: 8.h), - "Confirmation".needTranslation.toText28(color: AppColors.whiteColor, isBold: true), + LocaleKeys.confirmation.tr().toText28(color: AppColors.whiteColor, isBold: true), SizedBox(height: 8.h), - "Are you sure you want to call an ambulance?" - .needTranslation + LocaleKeys.areYouSureYouWantToCallAmbulance.tr() .toText14(color: AppColors.whiteColor, weight: FontWeight.w500), SizedBox(height: 24.h), CustomButton( @@ -148,9 +146,8 @@ class EmergencyServicesPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Nearest ER Location".needTranslation.toText16(isBold: true, color: AppColors.blackColor), - "Get the details of nearest branch including directions" - .needTranslation + LocaleKeys.nearester.tr(context: context).toText16(isBold: true, color: AppColors.blackColor), + LocaleKeys.getDetailsOfNearestBranch.tr() .toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500), ], ), @@ -178,7 +175,7 @@ class EmergencyServicesPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Rapid Response Team (RRT)".toText16(isBold: true, color: AppColors.blackColor), + LocaleKeys.rapidResponseTeam.tr(context: context).toText16(isBold: true, color: AppColors.blackColor), "Comprehensive medical service for all sorts of urgent and stable cases" .toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500), ], @@ -204,8 +201,7 @@ class EmergencyServicesPage extends StatelessWidget { SizedBox(height: 8.h), LocaleKeys.confirm.tr().toText28(color: AppColors.whiteColor, isBold: true), SizedBox(height: 8.h), - "Are you sure you want to call Rapid Response Team (RRT)?" - .needTranslation + LocaleKeys.areYouSureYouWantToCallRRT.tr() .toText14(color: AppColors.whiteColor, weight: FontWeight.w500), SizedBox(height: 24.h), CustomButton( @@ -278,9 +274,8 @@ class EmergencyServicesPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Emergency Check-In".needTranslation.toText16(isBold: true, color: AppColors.blackColor), - "Prior ER Check-In to skip the line & payment at the reception." - .needTranslation + LocaleKeys.emergencyCheckIn.tr(context: context).toText16(isBold: true, color: AppColors.blackColor), + LocaleKeys.priorERCheckInToSkipLine.tr() .toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500), ], ), @@ -318,13 +313,13 @@ class EmergencyServicesPage extends StatelessWidget { SizedBox(height: 8.h), LocaleKeys.confirm.tr().toText28(color: AppColors.whiteColor, isBold: true), SizedBox(height: 8.h), - "Are you sure you want to make ER Check-In?".needTranslation.toText14(color: AppColors.whiteColor, weight: FontWeight.w500), + LocaleKeys.areYouSureYouWantToMakeERCheckIn.tr().toText14(color: AppColors.whiteColor, weight: FontWeight.w500), SizedBox(height: 24.h), CustomButton( text: LocaleKeys.confirm.tr(context: context), onPressed: () async { Navigator.of(context).pop(); - LoaderBottomSheet.showLoader(loadingText: "Checking your ER Appointment status...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingYourERAppointmentStatus.tr()); await context.read().checkPatientERAdvanceBalance(onSuccess: (dynamic response) { LoaderBottomSheet.hideLoader(); context.read().navigateToEROnlineCheckIn(); @@ -389,7 +384,7 @@ class EmergencyServicesPage extends StatelessWidget { void openTranportationSelectionBottomSheet(BuildContext context) { if (emergencyServicesViewModel.transportationOptions.isNotEmpty) { showCommonBottomSheetWithoutHeight( - title: "Transport Options".needTranslation, + title: LocaleKeys.transportOptions.tr(), context, child: SizedBox( height: 400.h, diff --git a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart index ee061b7..3850c1f 100644 --- a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart +++ b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_home.dart @@ -38,7 +38,7 @@ class ErOnlineCheckinHome extends StatelessWidget { children: [ Expanded( child: CollapsingListView( - title: "Emergency Check-In".needTranslation, + title: LocaleKeys.emergencyCheckIn.tr(context: context), child: SingleChildScrollView( child: Padding( padding: EdgeInsets.all(24.h), @@ -53,8 +53,8 @@ class ErOnlineCheckinHome extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Online Check-In".needTranslation.toText18(color: AppColors.textColor, isBold: true), - "This service lets patients to register their ER appointment prior to arrival.".needTranslation.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + LocaleKeys.onlineCheckIn.tr().toText18(color: AppColors.textColor, isBold: true), + LocaleKeys.erOnlineCheckInDescription.tr().toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), ), @@ -74,7 +74,7 @@ class ErOnlineCheckinHome extends StatelessWidget { showNfcReader(context, onNcfScan: (String nfcId) { Future.delayed(const Duration(milliseconds: 100), () async { print(nfcId); - LoaderBottomSheet.showLoader(loadingText: "Processing check-in...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.processingCheckIn.tr()); await emergencyServicesViewModel.getProjectIDFromNFC( nfcCode: nfcId, onSuccess: (value) async { @@ -84,7 +84,7 @@ class ErOnlineCheckinHome extends StatelessWidget { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.onlineCheckIn.tr(), - child: Utils.getSuccessWidget(loadingText: "Your ER Online Check-In has been successfully done. Please proceed to the waiting area.".needTranslation), + child: Utils.getSuccessWidget(loadingText: LocaleKeys.erOnlineCheckInSuccess.tr()), callBackFunc: () { Navigator.pushAndRemoveUntil( context, @@ -98,7 +98,7 @@ class ErOnlineCheckinHome extends StatelessWidget { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Unexpected error occurred during check-in. Please contact support.".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.erOnlineCheckInError.tr()), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -117,7 +117,7 @@ class ErOnlineCheckinHome extends StatelessWidget { // callBackFunc: () {}, // isFullScreen: false); } else { - LoaderBottomSheet.showLoader(loadingText: "Fetching hospitals list...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingHospitalsList.tr()); await context.read().getProjects(); LoaderBottomSheet.hideLoader(); //Project Selection Dropdown @@ -155,7 +155,7 @@ class ErOnlineCheckinHome extends StatelessWidget { onHospitalClicked: (hospital) async { Navigator.pop(context); vm.setSelectedHospital(hospital); - LoaderBottomSheet.showLoader(loadingText: "Fetching payment information...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPaymentInformation.tr(context: context)); await vm.getPatientERPaymentInformation(onSuccess: (response) { LoaderBottomSheet.hideLoader(); vm.navigateToEROnlineCheckInPaymentPage(); diff --git a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart index f48efe7..0534854 100644 --- a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart +++ b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_details_page.dart @@ -34,7 +34,7 @@ class ErOnlineCheckinPaymentDetailsPage extends StatelessWidget { children: [ Expanded( child: CollapsingListView( - title: "Emergency Check-In".needTranslation, + title: LocaleKeys.emergencyCheckIn.tr(context: context), child: SingleChildScrollView( child: Padding( padding: EdgeInsets.all(24.h), @@ -52,7 +52,7 @@ class ErOnlineCheckinPaymentDetailsPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "ER Visit Details".needTranslation.toText18(color: AppColors.textColor, isBold: true), + LocaleKeys.erVisitDetails.tr().toText18(color: AppColors.textColor, isBold: true), SizedBox(height: 24.h), Row( children: [ @@ -70,7 +70,7 @@ class ErOnlineCheckinPaymentDetailsPage extends StatelessWidget { labelPadding: EdgeInsetsDirectional.only(start: 4.w, end: 4.w), ), AppCustomChipWidget( - labelText: "ER Clinic".needTranslation, + labelText: LocaleKeys.erClinic.tr(), labelPadding: EdgeInsetsDirectional.only(start: 4.w, end: 4.w), ), AppCustomChipWidget( @@ -111,7 +111,7 @@ class ErOnlineCheckinPaymentDetailsPage extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Amount before tax".needTranslation.toText18(isBold: true), + LocaleKeys.amountBeforeTax.tr().toText18(isBold: true), Utils.getPaymentAmountWithSymbol(emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShare.toString().toText16(isBold: true), AppColors.blackColor, 13, isSaudiCurrency: true), ], @@ -121,8 +121,8 @@ class ErOnlineCheckinPaymentDetailsPage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded(child: "".toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor)), - "VAT 15% (${emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientTaxAmount})" - .needTranslation + LocaleKeys.vatWithAmount + .tr(namedArgs: {"amount": emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientTaxAmount.toString()}) .toText14(isBold: true, color: AppColors.greyTextColor, letterSpacing: -1), ], ), diff --git a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_page.dart b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_page.dart index 8de7518..70a5b08 100644 --- a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_page.dart +++ b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_payment_page.dart @@ -80,7 +80,7 @@ class _ErOnlineCheckinPaymentPageState extends State children: [ Expanded( child: CollapsingListView( - title: "Emergency Check-In".needTranslation, + title: LocaleKeys.emergencyCheckIn.tr(context: context), child: SingleChildScrollView( child: Column( children: [ @@ -99,7 +99,7 @@ class _ErOnlineCheckinPaymentPageState extends State children: [ Image.asset(AppAssets.mada, width: 72.h, height: 25.h), SizedBox(height: 16.h), - "Mada".needTranslation.toText16(isBold: true), + LocaleKeys.mada.tr(context: context).toText16(isBold: true), ], ), SizedBox(width: 8.h), @@ -141,7 +141,7 @@ class _ErOnlineCheckinPaymentPageState extends State ], ), SizedBox(height: 16.h), - "Visa or Mastercard".needTranslation.toText16(isBold: true), + LocaleKeys.visaOrMastercard.tr(context: context).toText16(isBold: true), ], ), SizedBox(width: 8.h), @@ -178,7 +178,7 @@ class _ErOnlineCheckinPaymentPageState extends State children: [ Image.asset(AppAssets.tamaraEng, width: 72.h, height: 25.h), SizedBox(height: 16.h), - "Tamara".needTranslation.toText16(isBold: true), + LocaleKeys.tamara.tr(context: context).toText16(isBold: true), ], ), SizedBox(width: 8.h), @@ -229,8 +229,8 @@ class _ErOnlineCheckinPaymentPageState extends State child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Insurance expired or inactive".needTranslation.toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500).paddingSymmetrical(24.h, 0.h), - CustomButton( + LocaleKeys.insuranceExpiredOrInactive.tr(context: context).toText14(color: AppColors.primaryRedColor, weight: FontWeight.w500).paddingSymmetrical(24.h, 0.h), + CustomButton( text: LocaleKeys.updateInsurance.tr(context: context), onPressed: () { Navigator.of(context).push( @@ -253,12 +253,12 @@ class _ErOnlineCheckinPaymentPageState extends State ) : const SizedBox(), SizedBox(height: 24.h), - "Total amount to pay".needTranslation.toText18(isBold: true).paddingSymmetrical(24.h, 0.h), + LocaleKeys.totalAmountToPay.tr(context: context).toText18(isBold: true).paddingSymmetrical(24.h, 0.h), SizedBox(height: 17.h), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Amount before tax".needTranslation.toText14(isBold: true), + LocaleKeys.amountBeforeTax.tr(context: context).toText14(isBold: true), Utils.getPaymentAmountWithSymbol(emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShare.toString().toText16(isBold: true), AppColors.blackColor, 13, isSaudiCurrency: true), ], @@ -266,7 +266,7 @@ class _ErOnlineCheckinPaymentPageState extends State Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "VAT 15%".needTranslation.toText14(isBold: true, color: AppColors.greyTextColor), + LocaleKeys.vat15.tr(context: context).toText14(isBold: true, color: AppColors.greyTextColor), Utils.getPaymentAmountWithSymbol( emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientTaxAmount.toString().toText14(isBold: true, color: AppColors.greyTextColor), AppColors.greyTextColor, 13, isSaudiCurrency: true), @@ -276,7 +276,7 @@ class _ErOnlineCheckinPaymentPageState extends State Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "".needTranslation.toText14(isBold: true), + "".toText14(isBold: true), Utils.getPaymentAmountWithSymbol(emergencyServicesViewModel.erOnlineCheckInPaymentDetailsResponse.patientShareWithTax.toString().toText24(isBold: true), AppColors.blackColor, 17, isSaudiCurrency: true), ], @@ -425,7 +425,7 @@ class _ErOnlineCheckinPaymentPageState extends State } void checkPaymentStatus() async { - LoaderBottomSheet.showLoader(loadingText: "Checking payment status, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context)); await payfortViewModel.checkPaymentStatus( transactionID: transID, onSuccess: (apiResponse) async { @@ -445,7 +445,7 @@ class _ErOnlineCheckinPaymentPageState extends State if (emergencyServicesViewModel.isERBookAppointment) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getSuccessWidget(loadingText: "Your appointment has been booked successfully. Please perform Check-In once you arrive at the hospital.".needTranslation), + child: Utils.getSuccessWidget(loadingText: LocaleKeys.erAppointmentBookedSuccess.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -458,7 +458,7 @@ class _ErOnlineCheckinPaymentPageState extends State LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.paymentFailedPleaseTryAgain.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_select_checkin_bottom_sheet.dart b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_select_checkin_bottom_sheet.dart index d44686c..3b2dc8a 100644 --- a/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_select_checkin_bottom_sheet.dart +++ b/lib/presentation/emergency_services/er_online_checkin/er_online_checkin_select_checkin_bottom_sheet.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_nfc_kit/flutter_nfc_kit.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -9,6 +10,7 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/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/theme/colors.dart'; import 'package:barcode_scan2/barcode_scan2.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; @@ -35,8 +37,8 @@ class ErOnlineCheckinSelectCheckinBottomSheet extends StatelessWidget { children: [ checkInOptionCard( AppAssets.checkin_location_icon, - "Live Location".needTranslation, - "Verify your location to be at hospital to check in".needTranslation, + LocaleKeys.liveLocation.tr(context: context), + LocaleKeys.verifyYourLocationAtHospital.tr(context: context), ).onPress(() { // locationUtils = LocationUtils( // isShowConfirmDialog: false, @@ -51,8 +53,8 @@ class ErOnlineCheckinSelectCheckinBottomSheet extends StatelessWidget { sendCheckInRequest(projectDetailListModel.checkInQrCode!, context); } else { showCommonBottomSheetWithoutHeight(context, - title: "Error".needTranslation, - child: Utils.getErrorWidget(loadingText: "Please ensure you're within the hospital location to perform online check-in.".needTranslation), callBackFunc: () { + title: LocaleKeys.error.tr(context: context), + child: Utils.getErrorWidget(loadingText: LocaleKeys.ensureWithinHospitalLocation.tr(context: context),), callBackFunc: () { Navigator.of(context).pop(); }, isFullScreen: false); } @@ -61,8 +63,8 @@ class ErOnlineCheckinSelectCheckinBottomSheet extends StatelessWidget { SizedBox(height: 16.h), checkInOptionCard( AppAssets.checkin_nfc_icon, - "NFC (Near Field Communication)".needTranslation, - "Scan your phone via NFC board to check in".needTranslation, + LocaleKeys.nfcNearFieldCommunication.tr(context: context), + LocaleKeys.scanPhoneViaNFC.tr(context: context), ).onPress(() { Future.delayed(const Duration(milliseconds: 500), () { showNfcReader(context, onNcfScan: (String nfcId) { @@ -75,8 +77,8 @@ class ErOnlineCheckinSelectCheckinBottomSheet extends StatelessWidget { SizedBox(height: 16.h), checkInOptionCard( AppAssets.checkin_qr_icon, - "QR Code".needTranslation, - "Scan QR code with your camera to check in".needTranslation, + LocaleKeys.qrCode.tr(context: context), + LocaleKeys.scanQRCodeToCheckIn.tr(context: context), ).onPress(() async { String onlineCheckInQRCode = (await BarcodeScanner.scan().then((value) => value.rawContent)); if (onlineCheckInQRCode != "") { diff --git a/lib/presentation/emergency_services/history/er_history_listing.dart b/lib/presentation/emergency_services/history/er_history_listing.dart index fe1ed31..a60d455 100644 --- a/lib/presentation/emergency_services/history/er_history_listing.dart +++ b/lib/presentation/emergency_services/history/er_history_listing.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart' show AppAssets; import 'package:hmg_patient_app_new/core/app_export.dart'; @@ -8,6 +9,7 @@ import 'package:hmg_patient_app_new/features/emergency_services/emergency_servic import 'package:hmg_patient_app_new/features/emergency_services/models/OrderDisplay.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/AmbulanceRequestOrdersModel.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/RRTServiceData.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/history/widget/ambulance_history_item.dart' show AmbulanceHistoryItem; import 'package:hmg_patient_app_new/presentation/emergency_services/history/widget/rrt_item.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -24,7 +26,7 @@ class ErHistoryListing extends StatelessWidget { Expanded( child: CollapsingListView( - title: "History Log".needTranslation, + title: LocaleKeys.history.tr(context: context), child: SingleChildScrollView( physics: NeverScrollableScrollPhysics(), child: Column( @@ -55,12 +57,10 @@ class ErHistoryListing extends StatelessWidget { }), ), Visibility( - visible: data.$1 - ?.isEmpty == true, child: Center( - child: Utils.getNoDataWidget(context, - noDataText: "You don't have any history" - .needTranslation), - )), + visible: data.$1.isEmpty == true, + child: Center( + child: Utils.getNoDataWidget(context, noDataText: LocaleKeys.noDataAvailable.tr(context: context)), + )), ], ); } @@ -92,9 +92,9 @@ class ErHistoryListing extends StatelessWidget { return Row( spacing: 8.h, children: [ - if(dataList?.isNotEmpty == true) + if(dataList.isNotEmpty == true) AppCustomChipWidget( - labelText: "All Facilities".needTranslation, + labelText: LocaleKeys.allFacilities.tr(context: context), shape: RoundedRectangleBorder( side: BorderSide( color: value == OrderDislpay.ALL ? AppColors.errorColor : AppColors.chipBorderColorOpacity20, @@ -111,7 +111,7 @@ class ErHistoryListing extends StatelessWidget { .ambulanceOrders ?.isNotEmpty == true) AppCustomChipWidget( - labelText: "Ambulance".needTranslation, + labelText: LocaleKeys.ambulancerequest.tr(context: context), icon: AppAssets.ambulance, shape: RoundedRectangleBorder( side: BorderSide( @@ -130,7 +130,7 @@ class ErHistoryListing extends StatelessWidget { ?.completedOrders .isNotEmpty == true) AppCustomChipWidget( - labelText: "Rapid Response Team".needTranslation, + labelText: LocaleKeys.rapidResponseTeam.tr(context: context), icon: AppAssets.ic_rrt_vehicle, shape: RoundedRectangleBorder( side: BorderSide( diff --git a/lib/presentation/emergency_services/history/widget/RequestStatus.dart b/lib/presentation/emergency_services/history/widget/RequestStatus.dart index 4f39a49..849565a 100644 --- a/lib/presentation/emergency_services/history/widget/RequestStatus.dart +++ b/lib/presentation/emergency_services/history/widget/RequestStatus.dart @@ -1,8 +1,9 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; - class RequestStatus extends StatelessWidget { final int status; @@ -21,14 +22,13 @@ class RequestStatus extends StatelessWidget { switch (status) { case 1: //pending case 2: //processing - return "Under Processing".needTranslation; - case 3: //completed - return "Completed".needTranslation; - break; + return LocaleKeys.underProcessing.tr(); + case 3: + return LocaleKeys.completed.tr(); case 4: //cancel case 6: case 7: - return "Canceled by patient".needTranslation; + return LocaleKeys.canceledByPatient.tr(); break; } return null; diff --git a/lib/presentation/emergency_services/history/widget/ambulance_history_item.dart b/lib/presentation/emergency_services/history/widget/ambulance_history_item.dart index f3ec388..7b17eab 100644 --- a/lib/presentation/emergency_services/history/widget/ambulance_history_item.dart +++ b/lib/presentation/emergency_services/history/widget/ambulance_history_item.dart @@ -1,3 +1,4 @@ +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'; @@ -6,6 +7,7 @@ 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/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/AmbulanceRequestOrdersModel.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/history/widget/RequestStatus.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -40,7 +42,7 @@ class AmbulanceHistoryItem extends StatelessWidget { spacing: 4.w, children: [ chip( Utils.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.time)), AppAssets.calendar, AppColors.blackBgColor), - chip("Ambulance".needTranslation, AppAssets.ambulance, AppColors.blackBgColor), + chip(LocaleKeys.ambulancerequest.tr(context: context), AppAssets.ambulance, AppColors.blackBgColor), ], ), Row( @@ -52,7 +54,7 @@ class AmbulanceHistoryItem extends StatelessWidget { ), if (order.statusId == 1 || order.statusId == 2) CustomButton( - text: "Cancel Request".needTranslation, + text: LocaleKeys.cancelRequest.tr(context: context), onPressed: () async { openCancelOrderBottomSheet(context); }, diff --git a/lib/presentation/emergency_services/history/widget/rrt_item.dart b/lib/presentation/emergency_services/history/widget/rrt_item.dart index dfb6e79..d345e2d 100644 --- a/lib/presentation/emergency_services/history/widget/rrt_item.dart +++ b/lib/presentation/emergency_services/history/widget/rrt_item.dart @@ -1,3 +1,4 @@ +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'; @@ -6,6 +7,7 @@ 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/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/RRTServiceData.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/history/widget/RequestStatus.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -40,13 +42,13 @@ class RRTItem extends StatelessWidget { spacing: 4.w, children: [ chip( Utils.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(order.time)), AppAssets.calendar, AppColors.blackBgColor), - chip("Rapid Response Team(RRT)".needTranslation, AppAssets.ic_rrt_vehicle, AppColors.blackBgColor), + chip(LocaleKeys.rapidResponseTeam.tr(context: context), AppAssets.ic_rrt_vehicle, AppColors.blackBgColor), ], ), SizedBox(height: 4.h), if (order.statusId == 1 || order.statusId == 2) CustomButton( - text: "Cancel Request".needTranslation, + text: LocaleKeys.cancelRequest.tr(context: context), onPressed: () async { openCancelOrderBottomSheet(context); }, diff --git a/lib/presentation/emergency_services/nearest_er_page.dart b/lib/presentation/emergency_services/nearest_er_page.dart index 16863bf..0ea3ab8 100644 --- a/lib/presentation/emergency_services/nearest_er_page.dart +++ b/lib/presentation/emergency_services/nearest_er_page.dart @@ -36,7 +36,7 @@ class _NearestErPageState extends State { @override Widget build(BuildContext context) { return CollapsingListView( - title: "Nearest ER".needTranslation, + title: LocaleKeys.nearester.tr(context: context), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -44,7 +44,7 @@ class _NearestErPageState extends State { children: [ TextInputWidget( labelText: LocaleKeys.search.tr(), - hintText: 'Type any facility name'.needTranslation, + hintText: 'Type any facility name', controller: searchText, onChange: (value) { debouncer.run(() { @@ -92,7 +92,7 @@ class _NearestErPageState extends State { }, ); } else { - return Center(child: Utils.getNoDataWidget(context, noDataText: "No nearest Er Arround you".needTranslation)); + return Center(child: Utils.getNoDataWidget(context, noDataText: "No nearest Er Around you")); } }), ), diff --git a/lib/presentation/emergency_services/widgets/location_input_bottom_sheet.dart b/lib/presentation/emergency_services/widgets/location_input_bottom_sheet.dart index c5301ea..db45654 100644 --- a/lib/presentation/emergency_services/widgets/location_input_bottom_sheet.dart +++ b/lib/presentation/emergency_services/widgets/location_input_bottom_sheet.dart @@ -31,7 +31,7 @@ class LocationInputBottomSheet extends StatelessWidget { children: [ TextInputWidget( labelText: LocaleKeys.search.tr(), - hintText: "Search Location".needTranslation, + hintText: LocaleKeys.selectLocation.tr(context: context), controller: TextEditingController(), onChange: (value){ debouncer.run(() { diff --git a/lib/presentation/emergency_services/widgets/nearestERItem.dart b/lib/presentation/emergency_services/widgets/nearestERItem.dart index bbce56a..2226f82 100644 --- a/lib/presentation/emergency_services/widgets/nearestERItem.dart +++ b/lib/presentation/emergency_services/widgets/nearestERItem.dart @@ -1,3 +1,4 @@ +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'; @@ -6,6 +7,7 @@ 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/emergency_services/emergency_services_view_model.dart'; import 'package:hmg_patient_app_new/features/emergency_services/models/resp_model/ProjectAvgERWaitingTime.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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'; @@ -67,14 +69,14 @@ class NearestERItem extends StatelessWidget { spacing: 8.h, children: [ AppCustomChipWidget( - labelText: "${nearestERItem.distanceInKilometers} km".needTranslation, + labelText: "${nearestERItem.distanceInKilometers} km", icon: AppAssets.location, iconHasColor: false, labelPadding: EdgeInsetsDirectional.only(start: 4.h, end: 0.h), padding: EdgeInsets.all(8.h), ).toShimmer2(isShow: isLoading), AppCustomChipWidget( - labelText: "Expected waiting time: ${nearestERItem.getTime()} mins".needTranslation, + labelText: "Expected waiting time: ${nearestERItem.getTime()} mins", icon: AppAssets.waiting_time_clock, iconHasColor: false, labelPadding: EdgeInsetsDirectional.only(start: 4.h, end: 0.h), @@ -87,7 +89,7 @@ class NearestERItem extends StatelessWidget { children: [ Expanded( child: CustomButton( - text: "View Location on Google Maps".needTranslation, + text: LocaleKeys.viewLocationGoogleMaps.tr(context: context), iconSize: 18.h, icon: AppAssets.location, onPressed: () { diff --git a/lib/presentation/habib_wallet/habib_wallet_page.dart b/lib/presentation/habib_wallet/habib_wallet_page.dart index a7ec23d..b096e94 100644 --- a/lib/presentation/habib_wallet/habib_wallet_page.dart +++ b/lib/presentation/habib_wallet/habib_wallet_page.dart @@ -84,7 +84,7 @@ class _HabibWalletState extends State { CustomButton( icon: AppAssets.recharge_icon, iconSize: 21.h, - text: "Recharge".needTranslation, + text: LocaleKeys.recharge.tr(context: context), onPressed: () { Navigator.of(context) .push( diff --git a/lib/presentation/habib_wallet/recharge_wallet_page.dart b/lib/presentation/habib_wallet/recharge_wallet_page.dart index 74eebec..33de5e6 100644 --- a/lib/presentation/habib_wallet/recharge_wallet_page.dart +++ b/lib/presentation/habib_wallet/recharge_wallet_page.dart @@ -80,7 +80,7 @@ class _RechargeWalletPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ //TODO: Check with hussain to show AED or SAR - "Enter an amount".needTranslation.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + LocaleKeys.amount.tr(context: context).toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), Spacer(), Row( crossAxisAlignment: CrossAxisAlignment.end, @@ -110,7 +110,7 @@ class _RechargeWalletPageState extends State { 13.h, isExpanded: false), const Spacer(), - "SAR".needTranslation.toText20(color: AppColors.greyTextColor, weight: FontWeight.w500), + LocaleKeys.sar.tr(context: context).toText20(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), ], @@ -151,7 +151,7 @@ class _RechargeWalletPageState extends State { ], ).onPress(() async { habibWalletVM.setCurrentIndex(0); - showCommonBottomSheetWithoutHeight(context, title: "Select Medical File".needTranslation, + showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.medicalFile.tr(context: context), titleWidget: Consumer(builder: (context, habibWalletVM, child) { return habibWalletVM.currentIndex != 0 ? IconButton( @@ -160,7 +160,7 @@ class _RechargeWalletPageState extends State { onPressed: () => habibWalletVM.setCurrentIndex(0), highlightColor: Colors.transparent, ) - : "Select Medical File".needTranslation.toText20(weight: FontWeight.w600); + : LocaleKeys.medicalFile.tr(context: context).toText20(weight: FontWeight.w600); }), child: Consumer(builder: (context, habibWalletVM, child) { return MultiPageBottomSheet(); }), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true); @@ -261,7 +261,7 @@ class _RechargeWalletPageState extends State { if (amountTextController.text.isEmpty) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Please enter amount to continue.".needTranslation), + child: Utils.getErrorWidget(loadingText: "Please enter amount to continue."), callBackFunc: () { textFocusNode.requestFocus(); }, @@ -271,7 +271,7 @@ class _RechargeWalletPageState extends State { } else if (habibWalletVM.selectedHospital == null) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Please select hospital to continue.".needTranslation), + child: Utils.getErrorWidget(loadingText: "Please select hospital to continue."), callBackFunc: () { textFocusNode.requestFocus(); }, diff --git a/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart b/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart index 1341af7..3dec5aa 100644 --- a/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart +++ b/lib/presentation/habib_wallet/wallet_payment_confirm_page.dart @@ -82,7 +82,7 @@ class _WalletPaymentConfirmPageState extends State { children: [ Image.asset(AppAssets.mada, width: 72.h, height: 25.h).toShimmer2(isShow: false), SizedBox(height: 16.h), - "Mada".needTranslation.toText16(isBold: true).toShimmer2(isShow: false), + LocaleKeys.mada.tr(context: context).toText16(isBold: true).toShimmer2(isShow: false), ], ), SizedBox(width: 8.h), @@ -124,7 +124,7 @@ class _WalletPaymentConfirmPageState extends State { ], ).toShimmer2(isShow: false), SizedBox(height: 16.h), - "Visa or Mastercard".needTranslation.toText16(isBold: true).toShimmer2(isShow: false), + LocaleKeys.visaOrMastercard.tr(context: context).toText16(isBold: true).toShimmer2(isShow: false), ], ), SizedBox(width: 8.h), @@ -180,7 +180,7 @@ class _WalletPaymentConfirmPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Total amount to pay".needTranslation.toText16(isBold: true), + LocaleKeys.totalAmountToPay.tr(context: context).toText16(isBold: true), Utils.getPaymentAmountWithSymbol(habibWalletVM.walletRechargeAmount.toString().toText24(isBold: true), AppColors.blackColor, 15.h, isSaudiCurrency: true), ], ).paddingSymmetrical(24.h, 0.h), @@ -314,7 +314,7 @@ class _WalletPaymentConfirmPageState extends State { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getSuccessWidget(loadingText: "Payment Successful!".needTranslation), + child: Utils.getSuccessWidget(loadingText: "Payment Successful!"), callBackFunc: () { Navigator.of(context).pop(); Navigator.of(context).pop(); @@ -327,7 +327,7 @@ class _WalletPaymentConfirmPageState extends State { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Payment Failed - ${err}".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.paymentFailedPleaseTryAgain.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -339,7 +339,7 @@ class _WalletPaymentConfirmPageState extends State { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Payment Failed! Please try again.".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.paymentFailedPleaseTryAgain.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/habib_wallet/widgets/select-medical_file.dart b/lib/presentation/habib_wallet/widgets/select-medical_file.dart index 73a7dfe..aaa0036 100644 --- a/lib/presentation/habib_wallet/widgets/select-medical_file.dart +++ b/lib/presentation/habib_wallet/widgets/select-medical_file.dart @@ -76,7 +76,7 @@ class _MultiPageBottomSheetState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Enter File Number".needTranslation.toText20(weight: FontWeight.w600), + "Enter File Number".toText20(weight: FontWeight.w600), SizedBox(height: 12.h), TextInputWidget( labelText: LocaleKeys.fileNumber.tr(), @@ -98,9 +98,9 @@ class _MultiPageBottomSheetState extends State { await habibWalletVM.getPatientInfoByPatientID( patientID: fileNumberEditingController.text, onSuccess: (response) async { - print(response.data["GetPatientInfoByPatientIDList"][0]["FullName"]); + debugPrint(response.data["GetPatientInfoByPatientIDList"][0]["FullName"]); await _dialogService.showCommonBottomSheetWithoutH( - message: "A file was found with name: ${response.data["GetPatientInfoByPatientIDList"][0]["FullName"]}, Would you like to recharge wallet for this file number?".needTranslation, + message: "A file was found with name: ${response.data["GetPatientInfoByPatientIDList"][0]["FullName"]}, Would you like to recharge wallet for this file number?", label: LocaleKeys.notice.tr(), onOkPressed: () { habibWalletVM.setSelectedRechargeType(3); @@ -161,7 +161,7 @@ class _MultiPageBottomSheetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ LocaleKeys.familyTitle.tr(context: context).toText16(color: AppColors.textColor, weight: FontWeight.w500), - "Select a medical file from your family".needTranslation.toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), + "Select a medical file from your family".toText14(color: AppColors.greyTextColor, weight: FontWeight.w500), ], ), Utils.buildSvgWithAssets(icon: AppAssets.forward_chevron_icon, iconColor: AppColors.textColor, width: 15.h, height: 15.h), diff --git a/lib/presentation/habib_wallet/widgets/select_hospital_bottom_sheet.dart b/lib/presentation/habib_wallet/widgets/select_hospital_bottom_sheet.dart index 086e0da..da374a0 100644 --- a/lib/presentation/habib_wallet/widgets/select_hospital_bottom_sheet.dart +++ b/lib/presentation/habib_wallet/widgets/select_hospital_bottom_sheet.dart @@ -1,8 +1,10 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.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/features/habib_wallet/habib_wallet_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/habib_wallet/widgets/hospital_list_item.dart'; import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors; import 'package:provider/provider.dart'; @@ -28,7 +30,7 @@ class SelectHospitalBottomSheet extends StatelessWidget { // ), // ), Text( - "Please select the hospital you want to make an advance payment for.".needTranslation, + LocaleKeys.selectHospitalForAdvancePayment.tr(context: context), style: TextStyle( fontSize: 16, fontWeight: FontWeight.w500, diff --git a/lib/presentation/health_calculators_and_converts/health_calculator_detailed_page.dart b/lib/presentation/health_calculators_and_converts/health_calculator_detailed_page.dart index 42cba5d..4a83f51 100644 --- a/lib/presentation/health_calculators_and_converts/health_calculator_detailed_page.dart +++ b/lib/presentation/health_calculators_and_converts/health_calculator_detailed_page.dart @@ -1,9 +1,11 @@ +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'; import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; import 'package:hmg_patient_app_new/presentation/health_calculators_and_converts/widgets/bf.dart'; @@ -57,8 +59,8 @@ class _HealthCalculatorDetailedPageState extends State { Widget build(BuildContext context) { DialogService dialogService = getIt.get(); return CollapsingListView( - title: widget.type == HealthCalConEnum.calculator ? "Health Calculators".needTranslation : "Health Converters".needTranslation, + title: widget.type == HealthCalConEnum.calculator ? LocaleKeys.healthCalculators.tr(context: context) : LocaleKeys.healthConverters.tr(), child: widget.type == HealthCalConEnum.calculator ? Column( children: [ @@ -47,8 +49,8 @@ class _HealthCalculatorsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - "General Health".needTranslation.toText16(weight: FontWeight.w600), - "Related To BMI, calories, body fat, etc to stay updated with your health.".needTranslation.toText12(fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3)) + LocaleKeys.generalHealth.tr().toText16(weight: FontWeight.w600), + LocaleKeys.relatedToBMICalories.tr().toText12(fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3)) ], ), ), @@ -60,7 +62,7 @@ class _HealthCalculatorsPageState extends State { ).paddingAll(16.w)) .onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Calculator".needTranslation, + label: LocaleKeys.selectCalculator.tr(), message: "", child: showCalculatorsItems(type: HealthCalculatorEnum.general), onOkPressed: () {}, @@ -78,8 +80,8 @@ class _HealthCalculatorsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - "Women's Health".needTranslation.toText16(weight: FontWeight.w600), - "Related To periods, ovulation, pregnancy, and other topics.".needTranslation.toText12(fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3)) + LocaleKeys.womensHealth.tr().toText16(weight: FontWeight.w600), + LocaleKeys.relatedToPeriodsOvulation.tr().toText12(fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3)) ], ), ), @@ -89,7 +91,7 @@ class _HealthCalculatorsPageState extends State { ).paddingAll(16.w)) .onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Calculator".needTranslation, + label: LocaleKeys.selectCalculator.tr(), message: "", child: showCalculatorsItems(type: HealthCalculatorEnum.women), onOkPressed: () {}, @@ -111,8 +113,8 @@ class _HealthCalculatorsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - "Blood Sugar".needTranslation.toText16(weight: FontWeight.w600), - "Track your glucose levels, understand trends, and get personalized insights for better health.".needTranslation.toText12( + LocaleKeys.bloodSugar.tr().toText16(weight: FontWeight.w600), + LocaleKeys.trackYourGlucoseLevels.tr().toText12( fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3), ) @@ -145,9 +147,8 @@ class _HealthCalculatorsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - "Blood Cholesterol".needTranslation.toText16(weight: FontWeight.w600), - "Monitor your cholesterol levels, track your LDL, HDL, and triglycerides. Get personalized recommendations for a healthy heart." - .needTranslation + LocaleKeys.bloodCholesterol.tr().toText16(weight: FontWeight.w600), + LocaleKeys.monitorCholesterolLevels.tr() .toText12(fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3)) ], ), @@ -176,9 +177,8 @@ class _HealthCalculatorsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, children: [ - "Triglycerides Fat Blood".needTranslation.toText16(weight: FontWeight.w600), - "Manage triglycerides, a key blood fat. Understand levels, diet impacts, and heart health strategies." - .needTranslation + LocaleKeys.triglyceridesFatBlood.tr().toText16(weight: FontWeight.w600), + LocaleKeys.understandTriglyceridesImpact.tr() .toText12(fontWeight: FontWeight.w500, color: Color(0xFF8F9AA3)) ], ), @@ -230,17 +230,17 @@ class _HealthCalculatorsPageState extends State { } final List generalHealthServices = [ - HealthComponentModel(title: "BMI\nCalculator".needTranslation, icon: AppAssets.bmi, type: HealthCalculatorsTypeEnum.bmi, clinicID: 108, calculationID: null), - HealthComponentModel(title: "Calories\nCalculator".needTranslation, icon: AppAssets.calories, type: HealthCalculatorsTypeEnum.calories, clinicID: null, calculationID: 2), - HealthComponentModel(title: "BMR\nCalculator".needTranslation, icon: AppAssets.bmr, type: HealthCalculatorsTypeEnum.bmr, clinicID: null, calculationID: 3), - HealthComponentModel(title: "Ideal Body\nWeight".needTranslation, icon: AppAssets.ibw, type: HealthCalculatorsTypeEnum.idealBodyWeight, clinicID: null, calculationID: 4), - HealthComponentModel(title: "Body Fat\nCalculator".needTranslation, icon: AppAssets.ibw, type: HealthCalculatorsTypeEnum.bodyFat, clinicID: null, calculationID: 5), - HealthComponentModel(title: "Carbs\nProtein & Fat".needTranslation, icon: AppAssets.ibw, type: HealthCalculatorsTypeEnum.crabsProteinFat, clinicID: null, calculationID: 11), + HealthComponentModel(title: LocaleKeys.bmiCalculator.tr(), icon: AppAssets.bmi, type: HealthCalculatorsTypeEnum.bmi, clinicID: 108, calculationID: null), + HealthComponentModel(title: LocaleKeys.caloriesCalculator.tr(), icon: AppAssets.calories, type: HealthCalculatorsTypeEnum.calories, clinicID: null, calculationID: 2), + HealthComponentModel(title: LocaleKeys.bmrCalculator.tr(), icon: AppAssets.bmr, type: HealthCalculatorsTypeEnum.bmr, clinicID: null, calculationID: 3), + HealthComponentModel(title: LocaleKeys.idealBodyWeight.tr(), icon: AppAssets.ibw, type: HealthCalculatorsTypeEnum.idealBodyWeight, clinicID: null, calculationID: 4), + HealthComponentModel(title: LocaleKeys.bodyFatCalculator.tr(), icon: AppAssets.ibw, type: HealthCalculatorsTypeEnum.bodyFat, clinicID: null, calculationID: 5), + HealthComponentModel(title: LocaleKeys.carbsProteinFat.tr(), icon: AppAssets.ibw, type: HealthCalculatorsTypeEnum.crabsProteinFat, clinicID: null, calculationID: 11), ]; final List womenHealthServices = [ - HealthComponentModel(title: "Ovulation\nPeriod".needTranslation, icon: AppAssets.locate_me, type: HealthCalculatorsTypeEnum.ovulation, clinicID: null, calculationID: 6 ), - HealthComponentModel(title: "Delivery\nDue Date".needTranslation, icon: AppAssets.activeCheck, type: HealthCalculatorsTypeEnum.deliveryDueDate, clinicID: null, calculationID: 6), + HealthComponentModel(title: LocaleKeys.ovulationPeriod.tr(), icon: AppAssets.locate_me, type: HealthCalculatorsTypeEnum.ovulation, clinicID: null, calculationID: 6 ), + HealthComponentModel(title: LocaleKeys.deliveryDueDate.tr(), icon: AppAssets.activeCheck, type: HealthCalculatorsTypeEnum.deliveryDueDate, clinicID: null, calculationID: 6), ]; } diff --git a/lib/presentation/health_calculators_and_converts/widgets/bf.dart b/lib/presentation/health_calculators_and_converts/widgets/bf.dart index 3a88eb3..b00846b 100644 --- a/lib/presentation/health_calculators_and_converts/widgets/bf.dart +++ b/lib/presentation/health_calculators_and_converts/widgets/bf.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:hmg_patient_app_new/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; import 'package:provider/provider.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -92,7 +94,7 @@ class _BodyFatWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Select Gender".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.selectGender.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedGender.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -105,7 +107,7 @@ class _BodyFatWidgetState extends State { ).paddingSymmetrical(0.w, 16.w).onPress(() { List _genders = ["Male", "Female"]; dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Gender".needTranslation, + label: LocaleKeys.selectGender.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -215,7 +217,7 @@ class _BodyFatWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -323,7 +325,7 @@ class _BodyFatWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.unit.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedNeckUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -332,7 +334,7 @@ class _BodyFatWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -449,7 +451,7 @@ class _BodyFatWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -557,7 +559,7 @@ class _BodyFatWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.unit.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedHipUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -566,7 +568,7 @@ class _BodyFatWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), diff --git a/lib/presentation/health_calculators_and_converts/widgets/bmi.dart b/lib/presentation/health_calculators_and_converts/widgets/bmi.dart index 49b77c0..3969db4 100644 --- a/lib/presentation/health_calculators_and_converts/widgets/bmi.dart +++ b/lib/presentation/health_calculators_and_converts/widgets/bmi.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -10,6 +11,8 @@ 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/presentation/health_calculators_and_converts/health_calculator_view_model.dart'; +import '../../../generated/locale_keys.g.dart'; + class BMIWidget extends StatefulWidget { Function(dynamic result)? onChange; @@ -116,7 +119,7 @@ class _BMIWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -233,7 +236,7 @@ class _BMIWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), diff --git a/lib/presentation/health_calculators_and_converts/widgets/bmr.dart b/lib/presentation/health_calculators_and_converts/widgets/bmr.dart index 5f429ff..f19c6b5 100644 --- a/lib/presentation/health_calculators_and_converts/widgets/bmr.dart +++ b/lib/presentation/health_calculators_and_converts/widgets/bmr.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/app_state.dart'; @@ -87,7 +89,7 @@ class _BMRWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Select Gender".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.selectGender.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedGender.toCamelCase.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -101,7 +103,7 @@ class _BMRWidgetState extends State { List _genders = ["Male", "Female"]; dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Gender".needTranslation, + label: LocaleKeys.selectGender.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -168,7 +170,7 @@ class _BMRWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Age (11-120) yrs".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + "Age (11-120) yrs".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), Container( height: 20.w, alignment: Alignment.centerLeft, @@ -240,7 +242,7 @@ class _BMRWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.unit.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedHeightUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -249,7 +251,7 @@ class _BMRWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -367,7 +369,7 @@ class _BMRWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -437,7 +439,7 @@ class _BMRWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Activity Level".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.activityLevel.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedActivityLevel.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -450,7 +452,7 @@ class _BMRWidgetState extends State { ).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: "Select Activity Level".needTranslation, + label: LocaleKeys.selectActivityLevel.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), diff --git a/lib/presentation/health_calculators_and_converts/widgets/calories.dart b/lib/presentation/health_calculators_and_converts/widgets/calories.dart index fbe15a6..b1a4b77 100644 --- a/lib/presentation/health_calculators_and_converts/widgets/calories.dart +++ b/lib/presentation/health_calculators_and_converts/widgets/calories.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/app_state.dart'; @@ -102,7 +104,7 @@ class _CaloriesWidgetState extends State { List _genders = ["Male", "Female"]; dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Gender".needTranslation, + label: LocaleKeys.selectGender.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -168,7 +170,7 @@ class _CaloriesWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Age (11-120) yrs".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + "Age (11-120) yrs".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), Container( height: 20.w, alignment: Alignment.centerLeft, @@ -249,7 +251,7 @@ class _CaloriesWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -366,7 +368,7 @@ class _CaloriesWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -436,7 +438,7 @@ class _CaloriesWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Activity Level".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.activityLevel.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedActivityLevel.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -449,7 +451,7 @@ class _CaloriesWidgetState extends State { ).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: "Select Activity Level".needTranslation, + label: LocaleKeys.selectActivityLevel.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), diff --git a/lib/presentation/health_calculators_and_converts/widgets/crabs.dart b/lib/presentation/health_calculators_and_converts/widgets/crabs.dart index 5fe1215..83130fe 100644 --- a/lib/presentation/health_calculators_and_converts/widgets/crabs.dart +++ b/lib/presentation/health_calculators_and_converts/widgets/crabs.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/dependencies.dart'; @@ -68,7 +70,7 @@ class _CrabsWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Calories Per Day".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.caloriesPerDay.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), Container( height: 20.w, alignment: Alignment.centerLeft, @@ -111,7 +113,7 @@ class _CrabsWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Diet Type".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.dietType.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedDietType.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -124,7 +126,7 @@ class _CrabsWidgetState extends State { ).paddingSymmetrical(0.w, 16.w).onPress(() { List _activity = ["Very Low Crabs", "Low Crabs", "Moderate Crabs", "USDA Guidelines ", "Zone Diet"]; dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Diet Type".needTranslation, + label: LocaleKeys.selectDietType.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), diff --git a/lib/presentation/health_calculators_and_converts/widgets/dduedate.dart b/lib/presentation/health_calculators_and_converts/widgets/dduedate.dart index 15c0a0c..3ecf2a5 100644 --- a/lib/presentation/health_calculators_and_converts/widgets/dduedate.dart +++ b/lib/presentation/health_calculators_and_converts/widgets/dduedate.dart @@ -36,7 +36,7 @@ class _DeliveryDueDWidgetState extends State { children: [ TextInputWidget( labelText: "Last Period Date", - hintText: "11 July, 1994".needTranslation, + hintText: "11 July, 1994", controller: _date, focusNode: FocusNode(), isEnable: true, diff --git a/lib/presentation/health_calculators_and_converts/widgets/ibw.dart b/lib/presentation/health_calculators_and_converts/widgets/ibw.dart index 5f67511..1665ccd 100644 --- a/lib/presentation/health_calculators_and_converts/widgets/ibw.dart +++ b/lib/presentation/health_calculators_and_converts/widgets/ibw.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/dependencies.dart'; @@ -114,7 +116,7 @@ class _IdealBodyWeightWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.unit.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedHeightUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -123,7 +125,7 @@ class _IdealBodyWeightWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -231,7 +233,7 @@ class _IdealBodyWeightWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Unit".toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.unit.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedWeightUnit.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -240,7 +242,7 @@ class _IdealBodyWeightWidgetState extends State { ], ).onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Unit".needTranslation, + label: LocaleKeys.unit.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -308,7 +310,7 @@ class _IdealBodyWeightWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Body Frame Size".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.bodyFrameSize.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), selectedBodyFrameSize.toText12(fontWeight: FontWeight.w500, color: AppColors.textColor), ], ), @@ -321,7 +323,7 @@ class _IdealBodyWeightWidgetState extends State { ).paddingSymmetrical(0.w, 16.w).onPress(() { List _activity = ["Small (fingers overlaps)", "Medium (fingers touch)", "Large (fingers don't touch)"]; dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Select Body Frame Size".needTranslation, + label: LocaleKeys.selectBodyFrameSize.tr(context: context), message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), diff --git a/lib/presentation/health_calculators_and_converts/widgets/ovulation.dart b/lib/presentation/health_calculators_and_converts/widgets/ovulation.dart index de209cb..8d7591e 100644 --- a/lib/presentation/health_calculators_and_converts/widgets/ovulation.dart +++ b/lib/presentation/health_calculators_and_converts/widgets/ovulation.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/enums.dart'; @@ -63,7 +65,7 @@ class _OvulationWidgetState extends State { children: [ TextInputWidget( labelText: "Date", - hintText: "11 July, 1994".needTranslation, + hintText: "11 July, 1994", controller: _ageController, isEnable: true, prefix: null, @@ -95,7 +97,7 @@ class _OvulationWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Average Cycle Length (Usually 28 days)".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.averageCycleLength.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), Container( height: 20.w, alignment: Alignment.centerLeft, @@ -132,7 +134,7 @@ class _OvulationWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - "Average Luteal Phase Length(Usually 14 days)".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), + LocaleKeys.averageLutealPhase.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.inputLabelTextColor), Container( height: 20.w, alignment: Alignment.centerLeft, diff --git a/lib/presentation/health_trackers/add_health_tracker_entry_page.dart b/lib/presentation/health_trackers/add_health_tracker_entry_page.dart index 56f82fc..cf92c9b 100644 --- a/lib/presentation/health_trackers/add_health_tracker_entry_page.dart +++ b/lib/presentation/health_trackers/add_health_tracker_entry_page.dart @@ -1,5 +1,6 @@ import 'dart:developer'; +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'; @@ -8,6 +9,7 @@ import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/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/health_trackers/health_trackers_view_model.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -55,11 +57,11 @@ class _AddHealthTrackerEntryPageState extends State { String _getPageTitle() { switch (widget.trackerType) { case HealthTrackerTypeEnum.bloodSugar: - return "Add Blood Sugar".needTranslation; + return LocaleKeys.addBloodSugar.tr(context: context); case HealthTrackerTypeEnum.bloodPressure: - return "Add Blood Pressure".needTranslation; + return LocaleKeys.addBloodPressure.tr(context: context); case HealthTrackerTypeEnum.weightTracker: - return "Add Weight".needTranslation; + return LocaleKeys.addWeight.tr(context: context); } } @@ -67,11 +69,11 @@ class _AddHealthTrackerEntryPageState extends State { String _getSuccessMessage() { switch (widget.trackerType) { case HealthTrackerTypeEnum.bloodSugar: - return "Blood Sugar Data saved successfully".needTranslation; + return LocaleKeys.bloodSugarDataSavedSuccessfully.tr(context: context); case HealthTrackerTypeEnum.bloodPressure: - return "Blood Pressure Data saved successfully".needTranslation; + return LocaleKeys.bloodPressureDataSavedSuccessfully.tr(context: context); case HealthTrackerTypeEnum.weightTracker: - return "Weight Data saved successfully".needTranslation; + return LocaleKeys.weightDataSavedSuccessfully.tr(context: context); } } @@ -92,7 +94,7 @@ class _AddHealthTrackerEntryPageState extends State { // Save Blood Sugar entry Future _saveBloodSugarEntry(HealthTrackersViewModel viewModel) async { - LoaderBottomSheet.showLoader(loadingText: "Please wait".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.pleaseWait.tr(context: context)); // Combine date and time final dateTime = "${dateController.text} ${timeController.text}"; @@ -113,7 +115,7 @@ class _AddHealthTrackerEntryPageState extends State { // Save Weight entry Future _saveWeightEntry(HealthTrackersViewModel viewModel) async { - LoaderBottomSheet.showLoader(loadingText: "Please wait".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.pleaseWait.tr(context: context)); // Combine date and time final dateTime = "${dateController.text} ${timeController.text}"; @@ -133,7 +135,7 @@ class _AddHealthTrackerEntryPageState extends State { // Save Blood Pressure entry Future _saveBloodPressureEntry(HealthTrackersViewModel viewModel) async { - LoaderBottomSheet.showLoader(loadingText: "Please wait".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.pleaseWait.tr(context: context)); // Combine date and time final dateTime = "${dateController.text} ${timeController.text}"; @@ -204,7 +206,7 @@ class _AddHealthTrackerEntryPageState extends State { bool useUpperCase = false, }) { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: title.needTranslation, + label: title, message: "", child: Container( constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.7), @@ -237,7 +239,7 @@ class _AddHealthTrackerEntryPageState extends State { FocusScope.of(context).unfocus(); _showSelectionBottomSheet( context: context, - title: "Select Unit".needTranslation, + title: LocaleKeys.selectUnit.tr(context: context), items: viewModel.bloodSugarUnit, selectedValue: viewModel.selectedBloodSugarUnit, onSelected: viewModel.setBloodSugarUnit, @@ -250,7 +252,7 @@ class _AddHealthTrackerEntryPageState extends State { FocusScope.of(context).unfocus(); _showSelectionBottomSheet( context: context, - title: "Select Measure Time".needTranslation, + title: LocaleKeys.selectMeasureTime.tr(context: context), items: viewModel.bloodSugarMeasureTimeEnList, selectedValue: viewModel.selectedBloodSugarMeasureTime, onSelected: viewModel.setBloodSugarMeasureTime, @@ -263,7 +265,7 @@ class _AddHealthTrackerEntryPageState extends State { FocusScope.of(context).unfocus(); _showSelectionBottomSheet( context: context, - title: "Select Unit".needTranslation, + title: LocaleKeys.selectUnit.tr(context: context), items: viewModel.weightUnits, selectedValue: viewModel.selectedWeightUnit, onSelected: viewModel.setWeightUnit, @@ -276,7 +278,7 @@ class _AddHealthTrackerEntryPageState extends State { FocusScope.of(context).unfocus(); _showSelectionBottomSheet( context: context, - title: "Select Arm".needTranslation, + title: LocaleKeys.selectArm.tr(context: context), items: viewModel.measuredArmList, selectedValue: viewModel.selectedMeasuredArm, onSelected: viewModel.setMeasuredArm, @@ -404,7 +406,7 @@ class _AddHealthTrackerEntryPageState extends State { children: [ _buildSettingsRow( icon: AppAssets.heightIcon, - label: "Enter Blood Sugar".needTranslation, + label: LocaleKeys.enterBloodSugar.tr(context: context), inputField: _buildTextField(viewModel.bloodSugarController, '', keyboardType: TextInputType.number), unit: viewModel.selectedBloodSugarUnit, onUnitTap: () => _showBloodSugarUnitSelectionBottomSheet(context, viewModel), @@ -413,7 +415,7 @@ class _AddHealthTrackerEntryPageState extends State { Divider(height: 1, color: AppColors.dividerColor), _buildSettingsRow( icon: AppAssets.weight_tracker_icon, - label: "Select Measure Time".needTranslation, + label: LocaleKeys.selectMeasureTime.tr(context: context), value: viewModel.selectedBloodSugarMeasureTime, onRowTap: () => _showBloodSugarEntryTimeBottomSheet(context, viewModel), ), @@ -428,19 +430,19 @@ class _AddHealthTrackerEntryPageState extends State { _buildSettingsRow( icon: AppAssets.bloodPressureIcon, iconColor: AppColors.greyTextColor, - label: "Enter Systolic Value".needTranslation, + label: LocaleKeys.enterSystolicValue.tr(context: context), inputField: _buildTextField(viewModel.systolicController, '', keyboardType: TextInputType.number), ), _buildSettingsRow( icon: AppAssets.bloodPressureIcon, iconColor: AppColors.greyTextColor, - label: "Enter Diastolic Value".needTranslation, + label: LocaleKeys.enterDiastolicValue.tr(context: context), inputField: _buildTextField(viewModel.diastolicController, '', keyboardType: TextInputType.number), ), _buildSettingsRow( icon: AppAssets.bodyIcon, iconColor: AppColors.greyTextColor, - label: "Select Arm".needTranslation, + label: LocaleKeys.selectArm.tr(context: context), value: viewModel.selectedMeasuredArm, onRowTap: () => _showMeasuredArmSelectionBottomSheet(context, viewModel), ), @@ -455,7 +457,7 @@ class _AddHealthTrackerEntryPageState extends State { children: [ _buildSettingsRow( icon: AppAssets.weightScale, - label: "Enter Weight".needTranslation, + label: LocaleKeys.enterWeight.tr(context: context), inputField: _buildTextField(viewModel.weightController, '', keyboardType: TextInputType.number), unit: viewModel.selectedWeightUnit, onUnitTap: () => _showWeightUnitSelectionBottomSheet(context, viewModel), @@ -474,7 +476,7 @@ class _AddHealthTrackerEntryPageState extends State { isReadOnly: true, isArrowTrailing: true, labelText: "Date", - hintText: "Select date".needTranslation, + hintText: LocaleKeys.pickADate.tr(context: context), focusNode: FocusNode(), isEnable: true, prefix: null, @@ -504,7 +506,7 @@ class _AddHealthTrackerEntryPageState extends State { isReadOnly: true, isArrowTrailing: true, labelText: "Time", - hintText: "Select time".needTranslation, + hintText: LocaleKeys.selectMeasureTime.tr(context: context), focusNode: FocusNode(), isEnable: true, prefix: null, @@ -547,7 +549,7 @@ class _AddHealthTrackerEntryPageState extends State { child: Padding( padding: EdgeInsets.all(24.w), child: CustomButton( - text: "Save".needTranslation, + text: LocaleKeys.save.tr(context: context), onPressed: () async => await _saveEntry(viewModel), borderRadius: 12.r, padding: EdgeInsets.symmetric(vertical: 14.h), diff --git a/lib/presentation/health_trackers/health_tracker_detail_page.dart b/lib/presentation/health_trackers/health_tracker_detail_page.dart index 9443f12..83b37f6 100644 --- a/lib/presentation/health_trackers/health_tracker_detail_page.dart +++ b/lib/presentation/health_trackers/health_tracker_detail_page.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -14,6 +15,7 @@ import 'package:hmg_patient_app_new/features/health_trackers/models/blood_sugar/ import 'package:hmg_patient_app_new/features/health_trackers/models/blood_sugar/year_diabetic_result_average.dart'; import 'package:hmg_patient_app_new/features/health_trackers/models/weight/week_weight_measurement_result_average.dart'; import 'package:hmg_patient_app_new/features/health_trackers/models/weight/year_weight_measurement_result_average.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/health_trackers/health_trackers_view_model.dart'; import 'package:hmg_patient_app_new/presentation/health_trackers/widgets/tracker_last_value_card.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; @@ -67,11 +69,11 @@ class _HealthTrackerDetailPageState extends State { String _getPageTitle() { switch (widget.trackerType) { case HealthTrackerTypeEnum.bloodSugar: - return "Blood Sugar".needTranslation; + return LocaleKeys.bloodSugar.tr(context: context); case HealthTrackerTypeEnum.bloodPressure: - return "Blood Pressure".needTranslation; + return LocaleKeys.bloodPressure.tr(context: context); case HealthTrackerTypeEnum.weightTracker: - return "Weight".needTranslation; + return LocaleKeys.weight.tr(context: context); } } @@ -153,7 +155,7 @@ class _HealthTrackerDetailPageState extends State { final dialogService = getIt.get(); dialogService.showFamilyBottomSheetWithoutHWithChild( - label: title.needTranslation, + label: title, message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -183,7 +185,7 @@ class _HealthTrackerDetailPageState extends State { void _showHistoryDurationBottomsheet(BuildContext context, HealthTrackersViewModel viewModel) { _showSelectionBottomSheet( context: context, - title: "Select Duration".needTranslation, + title: LocaleKeys.selectDuration.tr(), items: viewModel.durationFilters, selectedValue: viewModel.selectedDurationFilter, onSelected: viewModel.setFilterDuration, @@ -286,7 +288,7 @@ class _HealthTrackerDetailPageState extends State { children: [ Row( children: [ - "History".needTranslation.toText16(isBold: true), + LocaleKeys.history.tr(context: context).toText16(isBold: true), if (viewModel.isGraphView) ...[ SizedBox(width: 12.w), InkWell( @@ -661,9 +663,9 @@ class _HealthTrackerDetailPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - _buildLegendItem(AppColors.errorColor, "Systolic".needTranslation), + _buildLegendItem(AppColors.errorColor, LocaleKeys.systolic.tr()), SizedBox(width: 24.w), - _buildLegendItem(AppColors.blueColor, "Diastolic".needTranslation), + _buildLegendItem(AppColors.blueColor, LocaleKeys.diastolic.tr()), ], ), SizedBox(height: 12.h), @@ -1046,7 +1048,7 @@ class _HealthTrackerDetailPageState extends State { final emailController = TextEditingController(text: userEmail); dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Send Report by Email".needTranslation, + label: LocaleKeys.sendReportByEmail.tr(), message: "", child: _buildEmailInputContent( context: context, @@ -1068,7 +1070,7 @@ class _HealthTrackerDetailPageState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Enter your email address to receive the report".needTranslation.toText14( + LocaleKeys.enterYourEmailToReceiveReport.tr().toText14( color: AppColors.textColor, weight: FontWeight.w400, ), @@ -1077,8 +1079,8 @@ class _HealthTrackerDetailPageState extends State { // Email Input Field using TextInputWidget TextInputWidget( padding: EdgeInsets.symmetric(horizontal: 8.w), - labelText: "Email Address".needTranslation, - hintText: "Enter email address".needTranslation, + labelText: LocaleKeys.email.tr(context: context), + hintText: LocaleKeys.enterEmail.tr(context: context), controller: emailController, keyboardType: TextInputType.emailAddress, isEnable: true, @@ -1094,7 +1096,7 @@ class _HealthTrackerDetailPageState extends State { Expanded( child: CustomButton( height: 56.h, - text: "Send Report".needTranslation, + text: LocaleKeys.send.tr(context: context), onPressed: () { _sendEmailReport( context: context, @@ -1122,7 +1124,7 @@ class _HealthTrackerDetailPageState extends State { // Validate email if (email.isEmpty) { dialogService.showErrorBottomSheet( - message: "Please enter your email address".needTranslation, + message: LocaleKeys.enterEmail.tr(context: context), ); return; } @@ -1131,7 +1133,7 @@ class _HealthTrackerDetailPageState extends State { final emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$'); if (!emailRegex.hasMatch(email)) { dialogService.showErrorBottomSheet( - message: "Please enter a valid email address".needTranslation, + message: LocaleKeys.pleaseEnterAValidEmail.tr(context: context), ); return; } @@ -1142,7 +1144,7 @@ class _HealthTrackerDetailPageState extends State { // Call appropriate email function based on tracker type switch (widget.trackerType) { case HealthTrackerTypeEnum.bloodSugar: - LoaderBottomSheet.showLoader(loadingText: "Please wait".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.pleaseWait.tr(context: context)); await viewModel.sendBloodSugarReportByEmail( email: email, onSuccess: () { @@ -1158,7 +1160,7 @@ class _HealthTrackerDetailPageState extends State { break; case HealthTrackerTypeEnum.bloodPressure: - LoaderBottomSheet.showLoader(loadingText: "Please wait".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.pleaseWait.tr(context: context)); await viewModel.sendBloodPressureReportByEmail( email: email, @@ -1176,7 +1178,7 @@ class _HealthTrackerDetailPageState extends State { break; case HealthTrackerTypeEnum.weightTracker: - LoaderBottomSheet.showLoader(loadingText: "Please wait".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.pleaseWait.tr(context: context)); await viewModel.sendWeightReportByEmail( email: email, onSuccess: () { @@ -1199,7 +1201,7 @@ class _HealthTrackerDetailPageState extends State { showCommonBottomSheetWithoutHeight( context, child: Utils.getSuccessWidget( - loadingText: "Report has been sent to your email successfully".needTranslation, + loadingText: LocaleKeys.emailSentSuccessfully.tr(context: context), ), callBackFunc: () {}, isCloseButtonVisible: false, @@ -1261,7 +1263,7 @@ class _HealthTrackerDetailPageState extends State { child: Padding( padding: EdgeInsets.all(24.w), child: CustomButton( - text: "Add new Record".needTranslation, + text: LocaleKeys.addNewRecord.tr(), onPressed: () { if (!viewModel.isLoading) { context.navigateWithName(AppRoutes.addHealthTrackerEntryPage, arguments: widget.trackerType); diff --git a/lib/presentation/health_trackers/health_trackers_page.dart b/lib/presentation/health_trackers/health_trackers_page.dart index c55e8b4..9c68281 100644 --- a/lib/presentation/health_trackers/health_trackers_page.dart +++ b/lib/presentation/health_trackers/health_trackers_page.dart @@ -1,3 +1,4 @@ +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'; @@ -6,6 +7,7 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/route_extensions.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/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -70,14 +72,14 @@ class _HealthTrackersPageState extends State { @override Widget build(BuildContext context) { return CollapsingListView( - title: "Health Trackers".needTranslation, + title: LocaleKeys.healthTrackers.tr(context: context), child: Column( children: [ buildHealthTrackerCard( iconBgColor: AppColors.primaryRedColor, icon: AppAssets.bloodSugarOnlyIcon, - title: "Blood Sugar".needTranslation, - description: "Track your glucose levels, understand trends, and get personalized insights for better health.".needTranslation, + title: LocaleKeys.bloodSugar.tr(context: context), + description: "Track your glucose levels, understand trends, and get personalized insights for better health.", onTap: () { context.navigateWithName( AppRoutes.healthTrackerDetailPage, @@ -89,8 +91,8 @@ class _HealthTrackersPageState extends State { buildHealthTrackerCard( iconBgColor: AppColors.infoColor, icon: AppAssets.bloodPressureIcon, - title: "Blood Pressure".needTranslation, - description: "Monitor your blood pressure levels, track systolic and diastolic readings, and maintain a healthy heart.".needTranslation, + title: LocaleKeys.bloodPressure.tr(context: context), + description: LocaleKeys.monitorBloodPressureLevels.tr(context: context), onTap: () { context.navigateWithName( AppRoutes.healthTrackerDetailPage, @@ -102,8 +104,8 @@ class _HealthTrackersPageState extends State { buildHealthTrackerCard( iconBgColor: AppColors.successColor, icon: AppAssets.weightIcon, - title: "Weight".needTranslation, - description: "Track your weight progress, set goals, and maintain a healthy body mass for overall wellness.".needTranslation, + title: LocaleKeys.weight.tr(context: context), + description: LocaleKeys.trackWeightProgress.tr(context: context), onTap: () { context.navigateWithName( AppRoutes.healthTrackerDetailPage, diff --git a/lib/presentation/health_trackers/widgets/tracker_last_value_card.dart b/lib/presentation/health_trackers/widgets/tracker_last_value_card.dart index 542baa5..570005b 100644 --- a/lib/presentation/health_trackers/widgets/tracker_last_value_card.dart +++ b/lib/presentation/health_trackers/widgets/tracker_last_value_card.dart @@ -5,6 +5,7 @@ import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/enums.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/health_trackers/health_trackers_view_model.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; @@ -19,32 +20,32 @@ class TrackerLastValueCard extends StatelessWidget { /// Get status text and color based on blood sugar value (String status, Color color, Color bgColor) _getBloodSugarStatus(double value) { if (value < 70) { - return ('Low'.needTranslation, AppColors.errorColor, AppColors.errorColor.withValues(alpha: 0.5)); + return (LocaleKeys.low.tr(), AppColors.errorColor, AppColors.errorColor.withValues(alpha: 0.5)); } else if (value <= 100) { - return ('Normal'.needTranslation, AppColors.successColor, AppColors.successLightBgColor); + return (LocaleKeys.normal.tr(), AppColors.successColor, AppColors.successLightBgColor); } else if (value <= 125) { - return ('Pre-diabetic'.needTranslation, AppColors.ratingColorYellow, AppColors.errorColor.withValues(alpha: 0.4)); + return (LocaleKeys.preDiabetic.tr(), AppColors.ratingColorYellow, AppColors.errorColor.withValues(alpha: 0.4)); } else { - return ('High'.needTranslation, AppColors.errorColor, AppColors.errorColor.withValues(alpha: 0.4)); + return (LocaleKeys.high.tr(), AppColors.errorColor, AppColors.errorColor.withValues(alpha: 0.4)); } } /// Get status text and color based on blood pressure value (systolic) (String status, Color color, Color bgColor) _getBloodPressureStatus(int systolic) { if (systolic < 90) { - return ('Low'.needTranslation, AppColors.errorColor, AppColors.errorColor.withValues(alpha: 0.5)); + return (LocaleKeys.low.tr(), AppColors.errorColor, AppColors.errorColor.withValues(alpha: 0.5)); } else if (systolic <= 120) { - return ('Normal'.needTranslation, AppColors.successColor, AppColors.successLightBgColor); + return (LocaleKeys.normal.tr(), AppColors.successColor, AppColors.successLightBgColor); } else if (systolic <= 140) { - return ('Elevated'.needTranslation, AppColors.ratingColorYellow, AppColors.errorColor.withValues(alpha: 0.4)); + return (LocaleKeys.elevated.tr(), AppColors.ratingColorYellow, AppColors.errorColor.withValues(alpha: 0.4)); } else { - return ('High'.needTranslation, AppColors.errorColor, AppColors.errorColor.withValues(alpha: 0.4)); + return (LocaleKeys.high.tr(), AppColors.errorColor, AppColors.errorColor.withValues(alpha: 0.4)); } } /// Get status for weight (neutral - no good/bad status) (String status, Color color, Color bgColor) _getWeightStatus() { - return ('Recorded'.needTranslation, AppColors.successColor, AppColors.successLightBgColor); + return (LocaleKeys.recorded.tr(), AppColors.successColor, AppColors.successLightBgColor); } /// Get default unit based on tracker type @@ -219,7 +220,7 @@ class TrackerLastValueCard extends StatelessWidget { ), SizedBox(height: 8.h), AppCustomChipWidget( - labelText: "No records yet".needTranslation, + labelText: LocaleKeys.noRecordsYet.tr(), icon: AppAssets.doctor_calendar_icon, ), ], @@ -249,13 +250,13 @@ class TrackerLastValueCard extends StatelessWidget { Row( children: [ AppCustomChipWidget( - labelText: "${"Last Record".needTranslation}: $formattedDate", + labelText: "${LocaleKeys.lastRecord.tr()}: $formattedDate", icon: AppAssets.doctor_calendar_icon, ), SizedBox(width: 8.w), if (trackerType != HealthTrackerTypeEnum.weightTracker) ...[ AppCustomChipWidget( - labelText: status.needTranslation, + labelText: status, icon: AppAssets.normalStatusGreenIcon, iconColor: statusColor, ), diff --git a/lib/presentation/hmg_services/services_page.dart b/lib/presentation/hmg_services/services_page.dart index 5c028db..0b37a4d 100644 --- a/lib/presentation/hmg_services/services_page.dart +++ b/lib/presentation/hmg_services/services_page.dart @@ -50,7 +50,7 @@ class ServicesPage extends StatelessWidget { late MedicalFileViewModel medicalFileViewModel; late final List hmgServices = [ - HmgServicesComponentModel(11, "Emergency Services".needTranslation, "".needTranslation, AppAssets.emergency_services_icon, bgColor: AppColors.primaryRedColor, true, route: null, onTap: () async { + HmgServicesComponentModel(11, LocaleKeys.emergencyServices.tr(), "", AppAssets.emergency_services_icon, bgColor: AppColors.primaryRedColor, true, route: null, onTap: () async { if (getIt.get().isAuthenticated) { getIt.get().flushData(); getIt.get().getTransportationOrders( @@ -71,14 +71,14 @@ class ServicesPage extends StatelessWidget { }), HmgServicesComponentModel( 11, - "Book\nAppointment".needTranslation, - "".needTranslation, + LocaleKeys.bookAppointment.tr(), + "", AppAssets.appointment_calendar_icon, bgColor: AppColors.bookAppointment, true, route: AppRoutes.bookAppointmentPage, ), - HmgServicesComponentModel(5, "Complete Checkup".needTranslation, "".needTranslation, AppAssets.comprehensiveCheckup, bgColor: AppColors.bgGreenColor, true, route: null, onTap: () async { + HmgServicesComponentModel(5, LocaleKeys.completeCheckup.tr(), "", AppAssets.comprehensiveCheckup, bgColor: AppColors.bgGreenColor, true, route: null, onTap: () async { if (getIt.get().isAuthenticated) { getIt.get().pushPageRoute(AppRoutes.comprehensiveCheckupPage); } else { @@ -87,8 +87,8 @@ class ServicesPage extends StatelessWidget { }), HmgServicesComponentModel( 11, - "Indoor Navigation".needTranslation, - "".needTranslation, + LocaleKeys.indoorNavigation.tr(), + "", AppAssets.indoor_nav_icon, bgColor: Color(0xff45A2F8), true, @@ -131,7 +131,7 @@ class ServicesPage extends StatelessWidget { }, ), HmgServicesComponentModel( - 11, "E-Referral Services".needTranslation, "".needTranslation, AppAssets.eReferral, bgColor: AppColors.eReferralCardColor, true, route: null, onTap: () async { + 11, LocaleKeys.eReferralServices.tr(), "", AppAssets.eReferral, bgColor: AppColors.eReferralCardColor, true, route: null, onTap: () async { if (getIt.get().isAuthenticated) { getIt.get().pushPageRoute(AppRoutes.eReferralPage); } else { @@ -140,13 +140,13 @@ class ServicesPage extends StatelessWidget { }), HmgServicesComponentModel( 3, - "Blood Donation".needTranslation, - "".needTranslation, + LocaleKeys.bloodDonation.tr(), + "", AppAssets.blood_donation_icon, bgColor: AppColors.bloodDonationCardColor, true, route: null, onTap: () async { - LoaderBottomSheet.showLoader(loadingText: "Fetching Data..."); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.pleaseWait.tr()); await bloodDonationViewModel.getRegionSelectedClinics(onSuccess: (val) async { // await bloodDonationViewModel.getPatientBloodGroupDetails(onSuccess: (val) { LoaderBottomSheet.hideLoader(); @@ -210,8 +210,8 @@ class ServicesPage extends StatelessWidget { late final List hmgHealthToolServices = [ HmgServicesComponentModel( 11, - "Health Trackers".needTranslation, - "".needTranslation, + LocaleKeys.healthTrackers.tr(), + "", AppAssets.general_health, bgColor: AppColors.whiteColor, true, @@ -226,15 +226,15 @@ class ServicesPage extends StatelessWidget { ), HmgServicesComponentModel( 11, - "Daily Water Monitor".needTranslation, - "".needTranslation, + LocaleKeys.dailyWaterMonitor.tr(), + "", AppAssets.daily_water_monitor_icon, bgColor: AppColors.whiteColor, true, route: null, // Set to null since we handle navigation in onTap onTap: () async { if (getIt.get().isAuthenticated) { - LoaderBottomSheet.showLoader(loadingText: "Fetching your water intake details.".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingYourWaterIntakeDetails.tr()); final waterMonitorVM = getIt.get(); final context = getIt.get().navigatorKey.currentContext!; await waterMonitorVM.fetchUserDetailsForMonitoring( @@ -259,8 +259,8 @@ class ServicesPage extends StatelessWidget { ), HmgServicesComponentModel( 11, - "Health\nCalculators".needTranslation, - "".needTranslation, + LocaleKeys.healthCalculatorsServices.tr(), + "", AppAssets.health_calculators_services_icon, bgColor: AppColors.whiteColor, true, @@ -268,8 +268,8 @@ class ServicesPage extends StatelessWidget { ), HmgServicesComponentModel( 5, - "Health\nConverters".needTranslation, - "".needTranslation, + LocaleKeys.healthConvertersServices.tr(), + "", AppAssets.health_converters_icon, bgColor: AppColors.whiteColor, true, @@ -277,8 +277,8 @@ class ServicesPage extends StatelessWidget { ), HmgServicesComponentModel( 11, - "Smart\nWatches".needTranslation, - "".needTranslation, + LocaleKeys.smartWatchesServices.tr(), + "", AppAssets.smartwatch_icon, bgColor: AppColors.whiteColor, true, @@ -301,13 +301,13 @@ class ServicesPage extends StatelessWidget { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "Explore Services".needTranslation, + title: LocaleKeys.exploreServices.tr(), isLeading: false, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 16.h), - "Medical & Care Services".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0), + LocaleKeys.medicalAndCareServices.tr().toText18(isBold: true).paddingSymmetrical(24.w, 0), SizedBox(height: 16.h), GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -325,7 +325,7 @@ class ServicesPage extends StatelessWidget { }, ).paddingSymmetrical(24.w, 0), SizedBox(height: 24.h), - "HMG Services".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0), + LocaleKeys.hmgServices.tr().toText18(isBold: true).paddingSymmetrical(24.w, 0), SizedBox(height: 16.h), SizedBox( height: 350.h, @@ -356,7 +356,7 @@ class ServicesPage extends StatelessWidget { ), ), SizedBox(height: 24.h), - "Personal Services".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0), + LocaleKeys.personalServices.tr().toText18(isBold: true).paddingSymmetrical(24.w, 0), SizedBox(height: 16.h), Row( children: [ @@ -377,7 +377,7 @@ class ServicesPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Utils.buildSvgWithAssets(icon: AppAssets.wallet, width: 30.w, height: 30.h), - "Habib Wallet".needTranslation.toText14(weight: FontWeight.w600, maxlines: 2).expanded, + LocaleKeys.habibWallet.tr().toText14(weight: FontWeight.w600, maxlines: 2).expanded, Utils.buildSvgWithAssets(icon: AppAssets.arrow_forward), ], ), @@ -387,7 +387,7 @@ class ServicesPage extends StatelessWidget { return Utils.getPaymentAmountWithSymbol2(habibWalletVM.habibWalletAmount, isExpanded: false) .toShimmer2(isShow: habibWalletVM.isWalletAmountLoading, radius: 12.r, width: 80.w, height: 24.h); }) - : "Login to view your wallet balance".needTranslation.toText12(fontWeight: FontWeight.w500, maxLine: 2), + : LocaleKeys.loginToViewWalletBalance.tr().toText12(fontWeight: FontWeight.w500, maxLine: 2), Spacer(), getIt.get().isAuthenticated ? CustomButton( @@ -396,7 +396,7 @@ class ServicesPage extends StatelessWidget { iconSize: 16.w, iconColor: AppColors.infoColor, textColor: AppColors.infoColor, - text: "Recharge".needTranslation, + text: LocaleKeys.recharge.tr(), borderWidth: 0.w, fontWeight: FontWeight.w500, borderColor: Colors.transparent, @@ -472,7 +472,7 @@ class ServicesPage extends StatelessWidget { ), ], ) - : "Login to view your medical file".needTranslation.toText12(fontWeight: FontWeight.w500, maxLine: 2), + : LocaleKeys.loginToViewMedicalFile.tr().toText12(fontWeight: FontWeight.w500, maxLine: 2), Spacer(), getIt.get().isAuthenticated ? CustomButton( @@ -481,7 +481,7 @@ class ServicesPage extends StatelessWidget { iconSize: 16.w, iconColor: AppColors.primaryRedColor, textColor: AppColors.primaryRedColor, - text: "Add Member".needTranslation, + text: LocaleKeys.addMember.tr(), borderWidth: 0.w, fontWeight: FontWeight.w500, borderColor: Colors.transparent, @@ -492,8 +492,8 @@ class ServicesPage extends StatelessWidget { DialogService dialogService = getIt.get(); medicalFileViewModel.clearAuthValues(); dialogService.showAddFamilyFileSheet( - label: "Add Family Member".needTranslation, - message: "Please fill the below field to add a new family member to your profile".needTranslation, + label: LocaleKeys.addFamilyMember.tr(), + message: LocaleKeys.pleaseFillBelowFieldToAddNewFamilyMember.tr(), onVerificationPress: () { medicalFileViewModel.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); }); @@ -517,7 +517,7 @@ class ServicesPage extends StatelessWidget { ], ).paddingSymmetrical(24.w, 0), SizedBox(height: 24.h), - "Health Tools".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0), + LocaleKeys.healthTools.tr().toText18(isBold: true).paddingSymmetrical(24.w, 0), SizedBox(height: 16.h), GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -540,7 +540,7 @@ class ServicesPage extends StatelessWidget { }, ).paddingSymmetrical(24.w, 0), SizedBox(height: 24.h), - "Support Services".needTranslation.toText18(isBold: true).paddingSymmetrical(24.w, 0), + LocaleKeys.supportServices.tr().toText18(isBold: true).paddingSymmetrical(24.w, 0), SizedBox(height: 16.h), Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -565,7 +565,7 @@ class ServicesPage extends StatelessWidget { fit: BoxFit.contain, ), SizedBox(width: 8.w), - "Virtual Tour".needTranslation.toText12(fontWeight: FontWeight.w500) + LocaleKeys.virtualTour.tr().toText12(fontWeight: FontWeight.w500) ], ), ), @@ -594,7 +594,7 @@ class ServicesPage extends StatelessWidget { fit: BoxFit.contain, ), SizedBox(width: 8.w), - "Car Parking".needTranslation.toText12(fontWeight: FontWeight.w500) + LocaleKeys.carParking.tr().toText12(fontWeight: FontWeight.w500) ], ).onPress(() { Navigator.push( @@ -633,7 +633,7 @@ class ServicesPage extends StatelessWidget { fit: BoxFit.contain, ), SizedBox(width: 8.w), - "Latest News".needTranslation.toText12(fontWeight: FontWeight.w500) + LocaleKeys.latestNews.tr().toText12(fontWeight: FontWeight.w500) ], ), ), @@ -662,7 +662,7 @@ class ServicesPage extends StatelessWidget { fit: BoxFit.contain, ), SizedBox(width: 8.w), - "HMG Contact".needTranslation.toText12(fontWeight: FontWeight.w500) + LocaleKeys.hmgContact.tr().toText12(fontWeight: FontWeight.w500) ], ), ), diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index 789bc4d..f336c5b 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -113,7 +113,7 @@ class _LandingPageState extends State { myAppointmentsViewModel.initAppointmentsViewModel(); myAppointmentsViewModel.getPatientAppointments(true, false); emergencyServicesViewModel.checkPatientERAdvanceBalance(); - myAppointmentsViewModel.getPatientAppointmentQueueDetails(); + // myAppointmentsViewModel.getPatientAppointmentQueueDetails(); notificationsViewModel.initNotificationsViewModel(); // Commented as per new requirement to remove rating popup from the app diff --git a/lib/presentation/profile_settings/profile_settings.dart b/lib/presentation/profile_settings/profile_settings.dart index 62f090e..1c16439 100644 --- a/lib/presentation/profile_settings/profile_settings.dart +++ b/lib/presentation/profile_settings/profile_settings.dart @@ -150,7 +150,7 @@ class ProfileSettingsState extends State { children: [ Utils.buildSvgWithAssets(icon: AppAssets.wallet, width: 40.w, height: 40.h), "Habib Wallet".needTranslation.toText16(weight: FontWeight.w600, maxlines: 2).expanded, - Utils.buildSvgWithAssets(icon: AppAssets.arrow_forward), + Utils.buildSvgWithAssets(icon: getIt.get().isArabic() ? AppAssets.arrow_back : AppAssets.arrow_forward), ], ), Spacer(), @@ -193,13 +193,10 @@ class ProfileSettingsState extends State { decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), child: Column( children: [ - actionItem(AppAssets.language_change, "Language".needTranslation, () { - showCommonBottomSheetWithoutHeight(context, - title: "Application Language".needTranslation, child: AppLanguageChange(), callBackFunc: () {}, isFullScreen: false); + actionItem(AppAssets.language_change, LocaleKeys.language.tr(context: context), () { + showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.language.tr(context: context), child: AppLanguageChange(), callBackFunc: () {}, isFullScreen: false); }, trailingLabel: Utils.appState.isArabic() ? "العربية".needTranslation : "English".needTranslation), 1.divider, - actionItem(AppAssets.accessibility, "Accessibility".needTranslation, () {}), - 1.divider, actionItem(AppAssets.bell, "Notifications Settings".needTranslation, () {}), 1.divider, actionItem(AppAssets.touch_face_id, "Touch ID / Face ID Services".needTranslation, () {}, switchValue: true), @@ -236,7 +233,7 @@ class ProfileSettingsState extends State { decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), child: Column( children: [ - actionItem(AppAssets.call_fill, "Contact Us".needTranslation, () { + actionItem(AppAssets.call_fill, LocaleKeys.contactUs.tr(context: context), () { launchUrl(Uri.parse("tel://" + "+966 11 525 9999")); }, trailingLabel: "011 525 9999"), 1.divider, diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index 778757d..fc6fed8 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -138,6 +138,6 @@ class AppRoutes { qrParking: (context) => ChangeNotifierProvider( create: (_) => getIt(), child: const ParkingPage(), - ),} + ) }; } diff --git a/pubspec.lock b/pubspec.lock index 42b828d..7e5aaf5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -9,6 +9,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.59" + adaptive_number: + dependency: transitive + description: + name: adaptive_number + sha256: "3a567544e9b5c9c803006f51140ad544aedc79604fd4f3f2c1380003f97c1d77" + url: "https://pub.dev" + source: hosted + version: "1.0.0" amazon_payfort: dependency: "direct main" description: @@ -61,10 +69,10 @@ packages: dependency: "direct main" description: name: barcode_scan2 - sha256: "0f3eb7c0a0c80a0f65d3fa88737544fdb6d27127a4fad566e980e626f3fb76e1" + sha256: "50b286021c644deee71e20a06c1709adc6594e39d65024ced0458cc1e3ff298e" url: "https://pub.dev" source: hosted - version: "4.5.1" + version: "4.6.0" boolean_selector: dependency: transitive description: @@ -193,6 +201,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.8" + dart_jsonwebtoken: + dependency: "direct main" + description: + name: dart_jsonwebtoken + sha256: "0de65691c1d736e9459f22f654ddd6fd8368a271d4e41aa07e53e6301eff5075" + url: "https://pub.dev" + source: hosted + version: "3.3.1" dartz: dependency: "direct main" description: @@ -218,6 +234,38 @@ packages: url: "https://github.com/bardram/device_calendar" source: git version: "4.3.1" + device_calendar_plus: + dependency: "direct main" + description: + name: device_calendar_plus + sha256: d11a70d98eb123e8eb09fdcfaf220ca4f1aa65a1512e12092f176f4b54983507 + url: "https://pub.dev" + source: hosted + version: "0.3.3" + device_calendar_plus_android: + dependency: transitive + description: + name: device_calendar_plus_android + sha256: a341ef29fa0251251287d63c1d009dfd35c1459dc6a129fd5e03f5ac92d8d7ff + url: "https://pub.dev" + source: hosted + version: "0.3.3" + device_calendar_plus_ios: + dependency: transitive + description: + name: device_calendar_plus_ios + sha256: "3b2f84ce1ed002be8460e214a3229e66748bbaad4077603f2c734d67c42033ff" + url: "https://pub.dev" + source: hosted + version: "0.3.3" + device_calendar_plus_platform_interface: + dependency: transitive + description: + name: device_calendar_plus_platform_interface + sha256: "0ce7511c094ca256831a48e16efe8f1e97e7bd00a5ff3936296ffd650a1d76b5" + url: "https://pub.dev" + source: hosted + version: "0.3.3" device_info_plus: dependency: "direct main" description: @@ -258,6 +306,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.0.2" + ed25519_edwards: + dependency: transitive + description: + name: ed25519_edwards + sha256: "6ce0112d131327ec6d42beede1e5dfd526069b18ad45dcf654f15074ad9276cd" + url: "https://pub.dev" + source: hosted + version: "0.3.1" equatable: dependency: "direct main" description: @@ -431,6 +487,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.4.1" + flutter_callkit_incoming: + dependency: "direct main" + description: + name: flutter_callkit_incoming + sha256: "3589deb8b71e43f2d520a9c8a5240243f611062a8b246cdca4b1fda01fbbf9b8" + url: "https://pub.dev" + source: hosted + version: "3.0.0" flutter_hooks: dependency: transitive description: @@ -634,10 +698,10 @@ packages: dependency: "direct main" description: name: flutter_zoom_videosdk - sha256: "22731485fe48472a34ff0c7e787a382f5e1ec662fd89186e58e760974fc2a0cb" + sha256: "46a4dea664b1c969099328a499c198a1755adf9ac333dea28bea5187910b3bf9" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.1.10" fluttertoast: dependency: "direct main" description: @@ -894,6 +958,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.2" + huawei_health: + dependency: "direct main" + description: + name: huawei_health + sha256: "52fb9990e1fc857e2fa1b1251dde63b2146086a13b2d9c50bdfc3c4f715c8a12" + url: "https://pub.dev" + source: hosted + version: "6.16.0+300" huawei_location: dependency: "direct main" description: @@ -923,10 +995,10 @@ packages: dependency: transitive description: name: image_picker_android - sha256: "8dfe08ea7fcf7467dbaf6889e72eebd5e0d6711caae201fdac780eb45232cd02" + sha256: "28f3987ca0ec702d346eae1d90eda59603a2101b52f1e234ded62cff1d5cfa6e" url: "https://pub.dev" source: hosted - version: "0.8.13+3" + version: "0.8.13+1" image_picker_for_web: dependency: transitive description: @@ -1075,18 +1147,18 @@ packages: dependency: transitive description: name: local_auth_android - sha256: "1ee0e63fb8b5c6fa286796b5fb1570d256857c2f4a262127e728b36b80a570cf" + sha256: "48924f4a8b3cc45994ad5993e2e232d3b00788a305c1bf1c7db32cef281ce9a3" url: "https://pub.dev" source: hosted - version: "1.0.53" + version: "1.0.52" local_auth_darwin: dependency: transitive description: name: local_auth_darwin - sha256: "699873970067a40ef2f2c09b4c72eb1cfef64224ef041b3df9fdc5c4c1f91f49" + sha256: "0e9706a8543a4a2eee60346294d6a633dd7c3ee60fae6b752570457c4ff32055" url: "https://pub.dev" source: hosted - version: "1.6.1" + version: "1.6.0" local_auth_platform_interface: dependency: transitive description: @@ -1147,10 +1219,10 @@ packages: dependency: "direct main" description: name: lottie - sha256: "8ae0be46dbd9e19641791dc12ee480d34e1fd3f84c749adc05f3ad9342b71b95" + sha256: c5fa04a80a620066c15cf19cc44773e19e9b38e989ff23ea32e5903ef1015950 url: "https://pub.dev" source: hosted - version: "3.3.2" + version: "3.3.1" manage_calendar_events: dependency: "direct main" description: @@ -1407,6 +1479,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.8" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "92aa3841d083cc4b0f4709b5c74fd6409a3e6ba833ffc7dc6a8fee096366acf5" + url: "https://pub.dev" + source: hosted + version: "4.0.0" posix: dependency: transitive description: @@ -1419,10 +1499,10 @@ packages: dependency: transitive description: name: protobuf - sha256: "68645b24e0716782e58948f8467fd42a880f255096a821f9e7d0ec625b00c84d" + sha256: "75ec242d22e950bdcc79ee38dd520ce4ee0bc491d7fadc4ea47694604d22bf06" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "6.0.0" provider: dependency: "direct main" description: @@ -1463,6 +1543,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" + scrollable_positioned_list: + dependency: "direct main" + description: + name: scrollable_positioned_list + sha256: "1b54d5f1329a1e263269abc9e2543d90806131aa14fe7c6062a8054d57249287" + url: "https://pub.dev" + source: hosted + version: "0.3.8" share_plus: dependency: "direct main" description: @@ -1600,10 +1688,10 @@ packages: dependency: transitive description: name: sqflite_android - sha256: ecd684501ebc2ae9a83536e8b15731642b9570dc8623e0073d227d0ee2bfea88 + sha256: "2b3070c5fa881839f8b402ee4a39c1b4d561704d4ebbbcfb808a119bc2a1701b" url: "https://pub.dev" source: hosted - version: "2.4.2+2" + version: "2.4.1" sqflite_common: dependency: transitive description: @@ -1725,7 +1813,7 @@ packages: source: hosted version: "2.1.5" timezone: - dependency: transitive + dependency: "direct main" description: name: timezone sha256: dd14a3b83cfd7cb19e7888f1cbc20f258b8d71b54c06f79ac585f14093a287d1 @@ -1752,10 +1840,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "199bc33e746088546a39cc5f36bac5a278c5e53b40cb3196f99e7345fdcfae6b" + sha256: "81777b08c498a292d93ff2feead633174c386291e35612f8da438d6e92c4447e" url: "https://pub.dev" source: hosted - version: "6.3.22" + version: "6.3.20" url_launcher_ios: dependency: transitive description: @@ -1888,10 +1976,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 url: "https://pub.dev" source: hosted - version: "15.0.2" + version: "15.0.0" wakelock_plus: dependency: transitive description: @@ -1928,10 +2016,10 @@ packages: dependency: transitive description: name: webview_flutter_android - sha256: "21507ea5a326ceeba4d29dea19e37d92d53d9959cfc746317b9f9f7a57418d87" + sha256: "9a25f6b4313978ba1c2cda03a242eea17848174912cfb4d2d8ee84a556f248e3" url: "https://pub.dev" source: hosted - version: "4.10.3" + version: "4.10.1" webview_flutter_platform_interface: dependency: transitive description: @@ -1944,10 +2032,10 @@ packages: dependency: transitive description: name: webview_flutter_wkwebview - sha256: fea63576b3b7e02b2df8b78ba92b48ed66caec2bb041e9a0b1cbd586d5d80bfd + sha256: fb46db8216131a3e55bcf44040ca808423539bc6732e7ed34fb6d8044e3d512f url: "https://pub.dev" source: hosted - version: "3.23.1" + version: "3.23.0" win32: dependency: transitive description: @@ -1981,5 +2069,5 @@ packages: source: hosted version: "6.6.1" sdks: - dart: ">=3.9.0 <4.0.0" - flutter: ">=3.35.0" + dart: ">=3.8.1 <4.0.0" + flutter: ">=3.32.0" From 1edeff439edd780c04b20c8f222f903e8d3847b6 Mon Sep 17 00:00:00 2001 From: Sultan khan Date: Thu, 15 Jan 2026 10:29:48 +0300 Subject: [PATCH 08/12] notifications page updates --- .../notification_details_page.dart | 284 ++++++++++++++++++ .../notifications_list_page.dart | 168 +++++++++-- 2 files changed, 435 insertions(+), 17 deletions(-) create mode 100644 lib/presentation/notifications/notification_details_page.dart diff --git a/lib/presentation/notifications/notification_details_page.dart b/lib/presentation/notifications/notification_details_page.dart new file mode 100644 index 0000000..a4aef02 --- /dev/null +++ b/lib/presentation/notifications/notification_details_page.dart @@ -0,0 +1,284 @@ +import 'package:flutter/material.dart'; +import 'package:hmg_patient_app_new/core/utils/date_util.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/features/notifications/models/resp_models/notification_response_model.dart'; +import 'package:hmg_patient_app_new/theme/colors.dart'; +import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; +import 'package:intl/intl.dart'; +import 'package:share_plus/share_plus.dart'; + +class NotificationDetailsPage extends StatelessWidget { + final NotificationResponseModel notification; + + const NotificationDetailsPage({ + super.key, + required this.notification, + }); + + @override + Widget build(BuildContext context) { + // Debug logging + print('=== Notification Details ==='); + print('Message: ${notification.message}'); + print('MessageType: ${notification.messageType}'); + print('MessageTypeData: ${notification.messageTypeData}'); + print('VideoURL: ${notification.videoURL}'); + print('========================'); + + return CollapsingListView( + title: "Notification Details".needTranslation, + trailing: IconButton( + icon: Icon( + Icons.share_outlined, + size: 24.h, + color: AppColors.textColor, + ), + onPressed: () { + _shareNotification(); + }, + ), + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 24.h), + // Notification content card + _buildNotificationCard(context), + SizedBox(height: 24.h), + ], + ).paddingSymmetrical(24.w, 0.h), + ), + ); + } + + Widget _buildNotificationCard(BuildContext context) { + return Container( + decoration: RoundedRectangleBorder().toSmoothCornerDecoration( + color: AppColors.whiteColor, + borderRadius: 24.h, + hasShadow: true, + ), + padding: EdgeInsets.all(16.h), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Date and Time row + Row( + children: [ + // Time chip with clock icon + Container( + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), + decoration: BoxDecoration( + color: AppColors.greyColor, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.access_time, size: 12.w, color: AppColors.textColor), + SizedBox(width: 4.w), + _formatTime(notification.isSentOn).toText10( + weight: FontWeight.w500, + color: AppColors.textColor, + ), + ], + ), + ), + SizedBox(width: 8.w), + // Date chip with calendar icon + Container( + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), + decoration: BoxDecoration( + color: AppColors.greyColor, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.calendar_today, size: 12.w, color: AppColors.textColor), + SizedBox(width: 4.w), + _formatDate(notification.isSentOn).toText10( + weight: FontWeight.w500, + color: AppColors.textColor, + ), + ], + ), + ), + ], + ), + SizedBox(height: 16.h), + + // Notification message + if (notification.message != null && notification.message!.isNotEmpty) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 'Message'.needTranslation.toText14( + weight: FontWeight.w600, + color: AppColors.greyTextColor, + ), + SizedBox(height: 8.h), + notification.message!.toText16( + weight: FontWeight.w400, + color: AppColors.textColor, + maxlines: 100, + ), + SizedBox(height: 16.h), + ], + ), + + // Notification image (if MessageType is "image") + if (notification.messageType != null && + notification.messageType!.toLowerCase() == "image") + Builder( + builder: (context) { + // Try to get image URL from videoURL or messageTypeData + String? imageUrl; + + if (notification.videoURL != null && notification.videoURL!.isNotEmpty) { + imageUrl = notification.videoURL; + print('Image URL from videoURL: $imageUrl'); + } else if (notification.messageTypeData != null && notification.messageTypeData!.isNotEmpty) { + imageUrl = notification.messageTypeData; + print('Image URL from messageTypeData: $imageUrl'); + } + + if (imageUrl == null || imageUrl.isEmpty) { + print('No image URL found. videoURL: ${notification.videoURL}, messageTypeData: ${notification.messageTypeData}'); + return SizedBox.shrink(); + } + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 'Attached Image'.needTranslation.toText14( + weight: FontWeight.w600, + color: AppColors.greyTextColor, + ), + SizedBox(height: 8.h), + ClipRRect( + borderRadius: BorderRadius.circular(12.h), + child: Image.network( + imageUrl, + width: double.infinity, + fit: BoxFit.cover, + errorBuilder: (context, error, stackTrace) { + print('Error loading image: $error'); + print('Image URL: $imageUrl'); + return Container( + height: 200.h, + decoration: BoxDecoration( + color: AppColors.greyColor.withValues(alpha: 0.2), + borderRadius: BorderRadius.circular(12.h), + ), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.broken_image_outlined, + size: 48.h, + color: AppColors.greyTextColor, + ), + SizedBox(height: 8.h), + 'Failed to load image'.needTranslation.toText12( + color: AppColors.greyTextColor, + ), + SizedBox(height: 4.h), + Text( + imageUrl!, + style: TextStyle(fontSize: 8, color: AppColors.greyTextColor), + textAlign: TextAlign.center, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ], + ), + ), + ); + }, + loadingBuilder: (context, child, loadingProgress) { + if (loadingProgress == null) { + print('Image loaded successfully'); + return child; + } + return Container( + height: 200.h, + decoration: BoxDecoration( + color: AppColors.greyColor.withValues(alpha: 0.2), + borderRadius: BorderRadius.circular(12.h), + ), + child: Center( + child: CircularProgressIndicator( + value: loadingProgress.expectedTotalBytes != null + ? loadingProgress.cumulativeBytesLoaded / + loadingProgress.expectedTotalBytes! + : null, + ), + ), + ); + }, + ), + ), + SizedBox(height: 16.h), + ], + ); + }, + ), + + // Additional notification info + if (notification.notificationType != null && notification.notificationType!.isNotEmpty) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 'Type'.needTranslation.toText14( + weight: FontWeight.w600, + color: AppColors.greyTextColor, + ), + SizedBox(height: 8.h), + notification.notificationType!.toText16( + weight: FontWeight.w400, + color: AppColors.textColor, + ), + ], + ), + ], + ), + ); + } + + void _shareNotification() async { + final String shareText = ''' +${notification.message ?? 'Notification'} + +Time: ${_formatTime(notification.isSentOn)} +Date: ${_formatDate(notification.isSentOn)} +${notification.notificationType != null ? '\nType: ${notification.notificationType}' : ''} + '''.trim(); + + await Share.share(shareText); + } + + String _formatTime(String? dateTimeString) { + if (dateTimeString == null || dateTimeString.isEmpty) return '--'; + try { + final dateTime = DateUtil.convertStringToDate(dateTimeString); + return DateFormat('hh:mm a').format(dateTime); + } catch (e) { + return '--'; + } + } + + String _formatDate(String? dateTimeString) { + if (dateTimeString == null || dateTimeString.isEmpty) return '--'; + try { + final dateTime = DateUtil.convertStringToDate(dateTimeString); + return DateFormat('dd MMM yyyy').format(dateTime); + } catch (e) { + return '--'; + } + } +} + diff --git a/lib/presentation/notifications/notifications_list_page.dart b/lib/presentation/notifications/notifications_list_page.dart index 99d4270..650753c 100644 --- a/lib/presentation/notifications/notifications_list_page.dart +++ b/lib/presentation/notifications/notifications_list_page.dart @@ -1,15 +1,19 @@ import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; +import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; +import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/int_extensions.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/notifications/notifications_view_model.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; +import 'package:hmg_patient_app_new/presentation/notifications/notification_details_page.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:provider/provider.dart'; +import 'package:intl/intl.dart'; class NotificationsListPage extends StatelessWidget { const NotificationsListPage({super.key}); @@ -46,24 +50,134 @@ class NotificationsListPage extends StatelessWidget { child: SlideAnimation( verticalOffset: 100.0, child: FadeInAnimation( - child: AnimatedContainer( - duration: Duration(milliseconds: 300), - curve: Curves.easeInOut, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 16.h), - // "Notification Title".toText14(), - // SizedBox(height: 8.h), - Row( - children: [ - Expanded(child: notificationsVM.notificationsList[index].message!.toText16(isBold: notificationsVM.notificationsList[index].isRead ?? false)), - ], + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => NotificationDetailsPage( + notification: notificationsVM.notificationsList[index], + ), ), - SizedBox(height: 12.h), - DateUtil.formatDateToDate(DateUtil.convertStringToDate(notificationsVM.notificationsList[index].isSentOn!), false).toText14(weight: FontWeight.w500), - 1.divider, - ], + ); + }, + child: AnimatedContainer( + duration: Duration(milliseconds: 300), + curve: Curves.easeInOut, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 16.h), + // Message row with red dot for unread + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: notificationsVM.notificationsList[index].message!.toText16( + isBold: (notificationsVM.notificationsList[index].isRead == false), + weight: (notificationsVM.notificationsList[index].isRead == false) + ? FontWeight.w600 + : FontWeight.w400, + ), + ), + SizedBox(width: 8.w), + // Red dot for unread notifications ONLY + if (notificationsVM.notificationsList[index].isRead == false) + Container( + width: 8.w, + height: 8.w, + decoration: BoxDecoration( + color: Colors.red, + shape: BoxShape.circle, + ), + ), + ], + ), + SizedBox(height: 12.h), + // First row: Time and Date chips with arrow + Row( + children: [ + // Time chip with clock icon + Container( + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), + decoration: BoxDecoration( + color: AppColors.greyColor, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.access_time, size: 12.w, color: AppColors.textColor), + SizedBox(width: 4.w), + _formatTime(notificationsVM.notificationsList[index].isSentOn).toText10( + weight: FontWeight.w500, + color: AppColors.textColor, + ), + ], + ), + ), + SizedBox(width: 8.w), + // Date chip with calendar icon + Container( + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), + decoration: BoxDecoration( + color: AppColors.greyColor, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.calendar_today, size: 12.w, color: AppColors.textColor), + SizedBox(width: 4.w), + _formatDate(notificationsVM.notificationsList[index].isSentOn).toText10( + weight: FontWeight.w500, + color: AppColors.textColor, + ), + ], + ), + ), + Spacer(), + // Arrow icon + Utils.buildSvgWithAssets( + icon: AppAssets.arrow_forward, + width: 16.w, + height: 16.h, + iconColor: AppColors.greyTextColor, + ), + ], + ), + // Second row: Contains Image chip (if MessageType is "image") + if (notificationsVM.notificationsList[index].messageType != null && + notificationsVM.notificationsList[index].messageType!.toLowerCase() == "image") + Padding( + padding: EdgeInsets.only(top: 8.h), + child: Row( + children: [ + Container( + padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h), + decoration: BoxDecoration( + color: AppColors.greyColor, + borderRadius: BorderRadius.circular(8), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.image_outlined, size: 12.w, color: AppColors.textColor), + SizedBox(width: 4.w), + 'Contains Image'.toText10( + weight: FontWeight.w500, + color: AppColors.textColor, + ), + ], + ), + ), + ], + ), + ), + SizedBox(height: 16.h), + 1.divider, + ], + ), ), ), ), @@ -75,4 +189,24 @@ class NotificationsListPage extends StatelessWidget { ), ); } + + String _formatTime(String? dateTimeString) { + if (dateTimeString == null || dateTimeString.isEmpty) return '--'; + try { + final dateTime = DateUtil.convertStringToDate(dateTimeString); + return DateFormat('hh:mm a').format(dateTime); + } catch (e) { + return '--'; + } + } + + String _formatDate(String? dateTimeString) { + if (dateTimeString == null || dateTimeString.isEmpty) return '--'; + try { + final dateTime = DateUtil.convertStringToDate(dateTimeString); + return DateFormat('dd MMM yyyy').format(dateTime); + } catch (e) { + return '--'; + } + } } From 3ff9628cd3bf5405541bc898cdd57ed391045d05 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 15 Jan 2026 13:52:14 +0300 Subject: [PATCH 09/12] Translation updates --- assets/langs/ar-SA.json | 157 ++++++++- assets/langs/en-US.json | 160 ++++++++- lib/core/location_util.dart | 4 +- lib/core/utils/calendar_utils.dart | 6 +- .../widgets/hospital_selection.dart | 11 +- .../book_appointments_view_model.dart | 36 +- .../emergency_services_view_model.dart | 43 ++- .../utils/appointment_type.dart | 4 +- .../prescriptions_view_model.dart | 4 +- .../radiology/radiology_view_model.dart | 4 +- .../water_monitor_view_model.dart | 24 +- lib/generated/locale_keys.g.dart | 155 +++++++++ lib/presentation/home/landing_page.dart | 32 +- .../home/widgets/habib_wallet_card.dart | 4 +- .../home/widgets/large_service_card.dart | 2 +- .../home/widgets/welcome_widget.dart | 4 +- .../hhc_order_detail_page.dart | 7 +- .../home_health_care/hhc_procedures_page.dart | 33 +- .../hhc_selection_review_page.dart | 16 +- .../widgets/hhc_ui_selection_helper.dart | 4 +- .../insurance_approval_details_page.dart | 4 +- .../insurance/insurance_approvals_page.dart | 2 +- .../insurance/insurance_home_page.dart | 2 +- .../widgets/insurance_approval_card.dart | 2 +- .../insurance/widgets/insurance_history.dart | 2 +- .../insurance_update_details_card.dart | 2 +- .../widgets/patient_insurance_card.dart | 6 +- lib/presentation/lab/lab_order_by_test.dart | 2 +- lib/presentation/lab/lab_orders_page.dart | 2 +- .../LabResultByClinic.dart | 6 +- .../lab_result_via_clinic/LabResultList.dart | 5 +- .../lab_order_result_item.dart | 2 +- .../lab/lab_results/lab_result_details.dart | 21 +- .../eye_measurement_details_page.dart | 4 +- .../eye_measurements_appointments_page.dart | 4 +- .../medical_file/medical_file_page.dart | 111 ++++--- .../patient_sickleaves_list_page.dart | 4 +- .../medical_file/vaccine_list_page.dart | 6 +- .../medical_file_appointment_card.dart | 2 +- .../widgets/patient_sick_leave_card.dart | 4 +- .../medical_report_request_page.dart | 4 +- .../medical_report/medical_reports_page.dart | 16 +- .../widgets/patient_medical_report_card.dart | 2 +- .../monthly_report/monthly_report.dart | 9 +- .../monthly_reports/monthly_reports_page.dart | 310 ------------------ .../monthly_reports/user_agreement_page.dart | 117 ------- lib/presentation/my_family/my_family.dart | 8 +- .../my_family/widget/family_cards.dart | 26 +- .../my_family/widget/my_family_sheet.dart | 6 +- .../my_invoices/my_invoices_details_page.dart | 16 +- .../my_invoices/my_invoices_list.dart | 2 +- .../widgets/invoice_list_card.dart | 7 +- .../notifications_list_page.dart | 4 +- .../onboarding/onboarding_screen.dart | 16 +- lib/presentation/parking/paking_page.dart | 44 +-- lib/presentation/parking/parking_slot.dart | 20 +- ...scription_delivery_order_summary_page.dart | 4 +- ...rescription_delivery_orders_list_page.dart | 2 +- .../prescription_detail_page.dart | 14 +- .../prescription_reminder_view.dart | 2 +- .../prescriptions_list_page.dart | 4 +- .../profile_settings/profile_settings.dart | 52 ++- .../widgets/family_card_widget.dart | 12 +- .../radiology/radiology_orders_page.dart | 6 +- .../radiology/radiology_result_page.dart | 12 +- .../rate_appointment_clinic.dart | 14 +- .../rate_appointment_doctor.dart | 16 +- .../organ_selector_screen.dart | 14 +- .../possible_conditions_screen.dart | 6 +- .../symptoms_checker/risk_factors_screen.dart | 19 +- .../pages/age_selection_page.dart | 4 +- .../pages/gender_selection_page.dart | 8 +- .../pages/height_selection_page.dart | 4 +- .../pages/weight_selection_page.dart | 4 +- .../user_info_flow_manager.dart | 10 +- .../widgets/condition_card.dart | 6 +- .../widgets/selected_organs_section.dart | 6 +- 77 files changed, 887 insertions(+), 842 deletions(-) delete mode 100644 lib/presentation/monthly_reports/monthly_reports_page.dart delete mode 100644 lib/presentation/monthly_reports/user_agreement_page.dart diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 19db982..f49873a 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -1213,5 +1213,160 @@ "virtualTour": "جولة افتراضية", "carParking": "موقف السيارات", "latestNews": "آخر الأخبار", - "hmgContact": "اتصل بمجموعة الحبيب الطبية" + "hmgContact": "اتصل بمجموعة الحبيب الطبية", + "durationCannotExceed90": "لا يجوز أن تتجاوز المدة 90 دقيقة", + "unexpectedError": "حدث خطأ غير متوقع", + "gettingAmbulanceTransportOption": "جاري الحصول على خيارات نقل الإسعاف", + "fetchingAppointment": "جاري جلب الموعد", + "doYouWantToCancelTheRequest": "هل تريد إلغاء الطلب", + "cancellingRequest": "جاري إلغاء الطلب", + "fetchingTermsAndConditions": "جاري جلب الشروط والأحكام", + "selectLocationPrescriptionDelivery": "يرجى تحديد موقع توصيل الوصفة الطبية", + "noRadiologyOrders": "لم يتم العثور على أي طلبات تصوير شعاعي", + "ageIsRequired": "العمر مطلوب", + "invalidAge": "العمر غير صالح", + "ageMustBeBetween11And120": "يجب أن يكون العمر بين 11 و 120", + "heightIsRequired": "الطول مطلوب", + "invalidHeight": "الطول غير صالح", + "weightIsRequired": "الوزن مطلوب", + "invalidWeight": "الوزن غير صالح", + "timeToDrinkWater": "حان وقت شرب الماء! 💧", + "stayHydratedDrinkWater": "ابق رطبًا! اشرب {amount} مل من الماء.", + "visitPharmacyOnline": "زيارة الصيدلة على الانترنت", + "howAreYouFeelingToday": "كيف حالك اليوم؟", + "checkYourSymptomsWithScale": "تحقق من أعراضك باستخدام ذا المقياس", + "checkYourSymptoms": "تحقق من أعراضك", + "noUpcomingAppointmentPleaseBook": "ليس لديك أي مواعيد قادمة. يرجى حجز موعد", + "youHaveEROnlineCheckInRequest": "لديك طلب تسجيل وصول عبر الإنترنت للطوارئ", + "quickLinks": "روابط سريعة", + "viewMedicalFileLandingPage": "عرض الملف الطبي", + "immediateLiveCareRequest": "طلب LiveCare الفوري", + "yourTurnIsAfterPatients": "دورك بعد {count} مريض.", + "dontHaveHHCOrders": "ليس لديك أي أوامر رعاية صحية منزلية حتى الآن.", + "hhcOrders": "أوامر الرعاية الصحية المنزلية", + "requestedServices": "الخدمات المطلوبة", + "selectServices": "اختر الخدمات", + "selectedServices": "الخدمات المختارة", + "createNewRequest": "إنشاء طلب جديد", + "youHaveNoPendingRequests": "ليس لديك أي طلبات معلقة.", + "noInsuranceDataFound": "لم يتم العثور على بيانات التأمين...", + "noInsuranceUpdateRequest": "لم يتم العثور على أي طلبات لتحديث بيانات التأمين.", + "policyNumberInsurancePage": "الوثيقة: {number}", + "insuranceExpired": "التأمين منتهي الصلاحية", + "insuranceActive": "التأمين نشط", + "patientCardID": "رقم بطاقة المريض: {id}", + "noInsuranceApprovals": "لم تحصل على أي موافقات تأمينية حتى الآن.", + "noInsuranceWithHMG": "ليس لديك تأمين مسجل لدى مجموعة حبيب الطبية.", + "referenceRange": "النطاق المرجعي", + "downloadReport": "تنزيل التقرير", + "generatingReport": "جارٍ إنشاء التقرير، يرجى الانتظار...", + "noLabResults": "ليس لديك أي نتائج مختبرية حتى الآن.", + "labResultDetails": "تفاصيل نتائج المختبر", + "resultOf": "نتيجة", + "whatIsThisResult": "ما هي هذه النتيجة؟", + "lastTested": "آخر اختبار", + "byVisit": "حسب الزيارة", + "byTest": "حسب التحليل", + "results": "نتائج", + "viewResults": "عرض النتائج", + "rebook": "إعادة الحجز", + "noOphthalmologyAppointments": "لم يتم العثور على أي مواعيد في قسم طب العيون...", + "noVitalSignsRecordedYet": "لا توجد علامات حيوية مسجلة بعد", + "appointmentsAndVisits": "المواعيد والزيارات", + "labAndRadiology": "المختبر والأشعة", + "activeMedicationsAndPrescriptions": "الأدوية النشطة والوصفات الطبية", + "allPrescriptions": "جميع الوصفات", + "allMedications": "جميع الأدوية", + "youDontHaveAnyPrescriptionsYet": "ليس لديك أي وصفات طبية بعد.", + "youDontHaveAnyCompletedVisitsYet": "ليس لديك أي زيارات مكتملة بعد", + "others": "أخرى", + "allergyInfo": "معلومات الحساسية", + "vaccineInfo": "معلومات اللقاحات", + "updateInsuranceInfo": "تحديث التأمين", + "myInvoicesList": "قائمة فواتيري", + "ancillaryOrdersList": "قائمة الطلبات المساعدة", + "youDontHaveAnySickLeavesYet": "ليس لديك أي إجازات مرضية بعد.", + "medicalReports": "التقارير الطبية", + "sickLeaveReport": "تقرير الإجازة المرضية", + "weightTracker": "متتبع الوزن", + "askYourDoctor": "اسأل طبيبك", + "internetPairing": "الاقتران بالإنترنت", + "requested": "مطلوب", + "youDontHaveAnyMedicalReportsYet": "ليس لديك أي تقارير طبية بعد.", + "requestMedicalReport": "طلب تقرير طبي", + "youDoNotHaveAnyAppointmentsToRequestMedicalReport": "ليس لديك أي مواعيد لطلب تقرير طبي.", + "areYouSureYouWantToRequestMedicalReport": "هل أنت متأكد أنك تريد طلب تقرير طبي لهذا الموعد؟", + "yourMedicalReportRequestSubmittedSuccessfully": "تم إرسال طلب التقرير الطبي بنجاح.", + "monthlyHealthSummaryReportDisclaimer": "يعكس تقرير الملخص الصحي الشهري هذا المؤشرات الصحية ونتائج التحليل لأحدث الزيارات. يرجى ملاحظة أن هذا سيتم إرساله تلقائيًا من النظام ولا يعتبر تقريرًا رسميًا لذا لا ينبغي اتخاذ أي قرار طبي بناءً عليه", + "updatingMonthlyReportStatus": "جاري تحديث حالة التقرير الشهري...", + "monthlyReportStatusUpdatedSuccessfully": "تم تحديث حالة التقرير الشهري بنجاح", + "whoCanViewMyMedicalFile": "من يمكنه عرض ملفي الطبي؟", + "acceptedYourRequestToBeYourFamilyMember": "{status} طلبك لتكون فردًا من عائلتك", + "canViewYourFile": "يمكنه عرض ملفك", + "hasARequestPendingToBeYourFamilyMember": "لديه طلب {status} ليكون فردًا من عائلتك", + "wantsToAddYouAsTheirFamilyMember": "يريد إضافتك كفرد من عائلته", + "rejectedYourRequestToBeYourFamilyMember": "{status} طلبك لتكون فردًا من عائلتك", + "rejectedYourFamilyMemberRequest": "{status} طلب فرد عائلتك", + "notAvailable": "غير متاح", + "selectAProfile": "الرجاء تحديد ملف تعريف", + "switchFamilyFile": "قم بالتبديل من قائمة الملفات الطبية أدناه", + "medicalFiles": "الملفات الطبية", + "addANewFamilyMember": "إضافة فرد جديد من العائلة", + "viewInvoiceDetails": "عرض تفاصيل الفاتورة", + "outPatient": "مريض خارجي", + "invoiceDetails": "تفاصيل الفاتورة", + "sendingEmailPleaseWait": "جاري إرسال ال��ريد الإلكتروني، يرجى الانتظار...", + "emailSentSuccessfullyMessage": "تم إرسال البريد الإلكتروني بنجاح.", + "discount": "خصم", + "paid": "مدفوع", + "fetchingInvoiceDetails": "جارٍ جلب تفاصيل الفاتورة، يرجى الانتظار...", + "scanQRCode": "مسح رمز الاستجابة السريعة", + "parkingSlotDetails": "تفاصيل موقف السيارة", + "slotNumber": "رقم الموقف: {code}", + "basement": "الطابق: {description}", + "parkingDate": "التاريخ: {date}", + "parkedSince": "متوقف منذ: {time}", + "resetDirection": "إعادة تعيين الاتجاه", + "noPrescriptionOrdersYet": "ليس لديك أي طلبات وصفات طبية حتى الآن.", + "fetchingPrescriptionPDFPleaseWait": "جاري جلب ملف الوصفة الطبية، يرجى الانتظار...", + "ratingValue": "التقييم: {rating}", + "downloadPrescription": "تحميل الوصفة الطبية", + "fetchingPrescriptionDetails": "جاري جلب تفاصيل الوصفة الطبية...", + "switchBackFamilyFile": "العودة إلى ملف العائلة", + "profileAndSettings": "الملف الشخصي والإعدادات", + "quickActions": "إجراءات سريعة", + "notificationsSettings": "إعدادات الإشعارات", + "touchIDFaceIDServices": "خدمات Touch ID / Face ID", + "personalInformation": "المعلومات الشخصية", + "updateEmailAddress": "تحديث عنوان البريد الإلكتروني", + "helpAndSupport": "المساعدة والدعم", + "permissionsProfile": "الأذونات", + "privacyPolicy": "سياسة الخصوصية", + "deactivateAccount": "إلغاء تنشيط الحساب", + "ageYearsOld": "{age} {yearsOld}", + "youDontHaveRadiologyOrders": "ليس لديك أي نتائج للأشعة حتى الآن.", + "radiologyResult": "نتيجة الأشعة", + "viewRadiologyImage": "عرض صورة الأشعة", + "rateClinic": "تقييم العيادة", + "back": "رجوع", + "rateDoctor": "تقييم الطبيب", + "howWasYourLastVisitWithDoctor": "كيف كانت زيارتك الأخيرة مع الطبيب؟", + "dateOfBirthSymptoms": "ما هو تاريخ ميلادك؟", + "genderSymptoms": "ما هو جنسك؟", + "heightSymptoms": "كم طولك؟", + "weightSymptoms": "ما هو وزنك؟", + "femaleGender": "أنثى", + "previous": "سابق", + "selectedOrgans": "الهيئات المختارة", + "noOrgansSelected": "لم يتم تحديد أي أعضاء بعد", + "organSelector": "محدد الأعضاء", + "noPredictionsAvailable": "لا توجد تنبؤات متاحة", + "areYouSureYouWantToRestartOrganSelection": "هل أنت متأكد أنك تريد إعادة تشغيل اختيار الأعضاء؟", + "possibleConditions": "الحالات المحتملة", + "pleaseSelectAtLeastOneRiskBeforeProceeding": "يرجى اختيار عامل خطر واحد على الأقل قبل المتابعة", + "aboveYouSeeCommonRiskFactors": "أعلاه ترى عوامل الخطر الأكثر شيوعًا. على الرغم من أن /diagnosis قد تعيد أسئلة حول عوامل الخطر، ", + "readMore": "اقرأ المزيد", + "riskFactors": "عوامل الخطر", + "noRiskFactorsFound": "لم يتم العثور على عوامل خطر", + "basedOnYourSelectedSymptomsNoRiskFactors": "بناءً على الأعراض المحددة، لم يتم تحديد عوامل خطر إضافية." } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index ee489f5..c4b6c19 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -889,7 +889,6 @@ "pickADate": "Pick a Date", "confirmingAppointmentPleaseWait": "Confirming Appointment, Please Wait...", "appointmentConfirmedSuccessfully": "Appointment Confirmed Successfully", - "appointmentPayment": "Appointment Payment", "checkingPaymentStatusPleaseWait": "Checking payment status, Please wait...", "paymentFailedPleaseTryAgain": "Payment Failed! Please try again.", @@ -1207,5 +1206,160 @@ "virtualTour": "Virtual Tour", "carParking": "Car Parking", "latestNews": "Latest News", - "hmgContact": "HMG Contact" -} \ No newline at end of file + "hmgContact": "HMG Contact", + "durationCannotExceed90": "Duration can not exceed 90 mins", + "unexpectedError": "Unexpected Error Occurred", + "gettingAmbulanceTransportOption": "Getting Ambulance Transport Option", + "fetchingAppointment": "Fetching Appointment", + "doYouWantToCancelTheRequest": "Do you want to cancel the request", + "cancellingRequest": "Cancelling request", + "fetchingTermsAndConditions": "Fetching Terms And Conditions", + "selectLocationPrescriptionDelivery": "Please select the location for prescription delivery", + "noRadiologyOrders": "No Radiology Orders Found", + "ageIsRequired": "Age is required", + "invalidAge": "Invalid age", + "ageMustBeBetween11And120": "Age must be between 11 and 120", + "heightIsRequired": "Height is required", + "invalidHeight": "Invalid height", + "weightIsRequired": "Weight is required", + "invalidWeight": "Invalid weight", + "timeToDrinkWater": "Time to Drink Water! 💧", + "stayHydratedDrinkWater": "Stay hydrated! Drink {amount}ml of water.", + "visitPharmacyOnline": "Visit Pharmacy Online", + "howAreYouFeelingToday": "How are you feeling today?", + "checkYourSymptomsWithScale": "Check your symptoms with this scale", + "checkYourSymptoms": "Check your symptoms", + "noUpcomingAppointmentPleaseBook": "You do not have any upcoming appointment. Please book an appointment", + "youHaveEROnlineCheckInRequest": "You have ER Online Check-In Request", + "quickLinks": "Quick Links", + "viewMedicalFileLandingPage": "View medical file", + "immediateLiveCareRequest": "Immediate LiveCare Request", + "yourTurnIsAfterPatients": "Your turn is after {count} patients.", + "dontHaveHHCOrders": "You don't have any Home Health Care orders yet.", + "hhcOrders": "HHC Orders", + "requestedServices": "Requested Services", + "selectServices": "Select Services", + "selectedServices": "Selected Services", + "createNewRequest": "Create new request", + "youHaveNoPendingRequests": "You have no pending requests.", + "noInsuranceDataFound": "No insurance data found...", + "noInsuranceUpdateRequest": "No insurance update requests found.", + "policyNumberInsurancePage": "Policy: {number}", + "insuranceExpired": "Insurance Expired", + "insuranceActive": "Insurance Active", + "patientCardID": "Patient Card ID: {id}", + "noInsuranceApprovals": "You don't have any insurance approvals yet.", + "noInsuranceWithHMG": "You don't have insurance registered with HMG.", + "referenceRange": "Reference Range", + "downloadReport": "Download report", + "generatingReport": "Generating report, Please wait...", + "noLabResults": "You don't have any lab results yet.", + "labResultDetails": "Lab Result Details", + "resultOf": "Result of", + "whatIsThisResult": "What is this result?", + "lastTested": "Last Tested", + "byVisit": "By Visit", + "byTest": "By Test", + "results": "results", + "viewResults": "View Results", + "rebook": "Rebook", + "noOphthalmologyAppointments": "No Ophthalmology appointments found...", + "noVitalSignsRecordedYet": "No vital signs recorded yet", + "appointmentsAndVisits": "Appointments & visits", + "labAndRadiology": "Lab & Radiology", + "activeMedicationsAndPrescriptions": "Active Medications & Prescriptions", + "allPrescriptions": "All Prescriptions", + "allMedications": "All Medications", + "youDontHaveAnyPrescriptionsYet": "You don't have any prescriptions yet.", + "youDontHaveAnyCompletedVisitsYet": "You don't have any completed visits yet", + "others": "Others", + "allergyInfo": "Allergy Info", + "vaccineInfo": "Vaccine Info", + "updateInsuranceInfo": "Update Insurance", + "myInvoicesList": "My Invoices List", + "ancillaryOrdersList": "Ancillary Orders List", + "youDontHaveAnySickLeavesYet": "You don't have any sick leaves yet.", + "medicalReports": "Medical Reports", + "sickLeaveReport": "Sick Leave Report", + "weightTracker": "Weight Tracker", + "askYourDoctor": "Ask Your Doctor", + "internetPairing": "Internet Pairing", + "requested": "Requested", + "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.", + "areYouSureYouWantToRequestMedicalReport": "Are you sure you want to request a medical report for this appointment?", + "yourMedicalReportRequestSubmittedSuccessfully": "Your medical report request has been successfully submitted.", + "monthlyHealthSummaryReportDisclaimer": "This monthly health summary report reflects the health indicators and analysis results of the latest visits. Please note that this will be sent automatically from the system and it's not considered as a official report so no medical decision should be taken based on it", + "updatingMonthlyReportStatus": "Updating Monthly Report Status...", + "monthlyReportStatusUpdatedSuccessfully": "Monthly Report Status Updated Successfully", + "whoCanViewMyMedicalFile": "Who can view my medical file?", + "acceptedYourRequestToBeYourFamilyMember": "{status} your request to be your family member", + "canViewYourFile": "can view your file", + "hasARequestPendingToBeYourFamilyMember": "has a request {status} to be your family member", + "wantsToAddYouAsTheirFamilyMember": "wants to add you as their family member", + "rejectedYourRequestToBeYourFamilyMember": "{status} your request to be your family member", + "rejectedYourFamilyMemberRequest": "{status} your family member request", + "notAvailable": "N/A", + "selectAProfile": "Please select a profile", + "switchFamilyFile": "Switch from the below list of medical file", + "medicalFiles": "Medical Files", + "addANewFamilyMember": "Add a new family member", + "viewInvoiceDetails": "View invoice details", + "outPatient": "OutPatient", + "invoiceDetails": "Invoice Details", + "sendingEmailPleaseWait": "Sending email, Please wait...", + "emailSentSuccessfullyMessage": "Email sent successfully.", + "discount": "Discount", + "paid": "Paid", + "fetchingInvoiceDetails": "Fetching invoice details, Please wait...", + "scanQRCode": "Scan QR code", + "parkingSlotDetails": "Parking Slot Details", + "slotNumber": "Slot: {code}", + "basement": "Basement: {description}", + "parkingDate": "Date: {date}", + "parkedSince": "Parked Since: {time}", + "resetDirection": "Reset Direction", + "noPrescriptionOrdersYet": "You don't have any prescription orders yet.", + "fetchingPrescriptionPDFPleaseWait": "Fetching prescription PDF, Please wait...", + "ratingValue": "Rating: {rating}", + "downloadPrescription": "Download Prescription", + "fetchingPrescriptionDetails": "Fetching prescription details...", + "switchBackFamilyFile": "Switch Back To Family File", + "profileAndSettings": "Profile & Settings", + "quickActions": "Quick Actions", + "notificationsSettings": "Notifications Settings", + "touchIDFaceIDServices": "Touch ID / Face ID Services", + "personalInformation": "Personal Information", + "updateEmailAddress": "Update Email Address", + "helpAndSupport": "Help & Support", + "permissionsProfile": "Permissions", + "privacyPolicy": "Privacy Policy", + "deactivateAccount": "Deactivate account", + "ageYearsOld": "{age} {yearsOld}", + "youDontHaveRadiologyOrders": "You don't have any radiology results yet.", + "radiologyResult": "Radiology Result", + "viewRadiologyImage": "View Radiology Image", + "rateClinic": "Rate Clinic", + "back": "Back", + "rateDoctor": "Rate Doctor", + "howWasYourLastVisitWithDoctor": "How was your last visit with doctor?", + "dateOfBirthSymptoms": "What is your Date of Birth?", + "genderSymptoms": "What is your gender?", + "heightSymptoms": "How tall are you?", + "weightSymptoms": "What is your weight?", + "femaleGender": "Female", + "previous": "Previous", + "selectedOrgans": "Selected Organs", + "noOrgansSelected": "No organs selected yet", + "organSelector": "Organ Selector", + "noPredictionsAvailable": "No Predictions available", + "areYouSureYouWantToRestartOrganSelection": "Are you sure you want to restart the organ selection?", + "possibleConditions": "Possible Conditions", + "pleaseSelectAtLeastOneRiskBeforeProceeding": "Please select at least one risk before proceeding", + "aboveYouSeeCommonRiskFactors": "Above you see the most common risk factors. Although /diagnosis may return questions about risk factors, ", + "readMore": "Read more", + "riskFactors": "Risk Factors", + "noRiskFactorsFound": "No risk factors found", + "basedOnYourSelectedSymptomsNoRiskFactors": "Based on your selected symptoms, no additional risk factors were identified." +} diff --git a/lib/core/location_util.dart b/lib/core/location_util.dart index 9dcdbb5..cf26d24 100644 --- a/lib/core/location_util.dart +++ b/lib/core/location_util.dart @@ -104,7 +104,7 @@ class LocationUtils { title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), navigationService.navigatorKey.currentContext!, child: Utils.getWarningWidget( - loadingText: "Please grant location permission from app settings to see better results".needTranslation, + loadingText: "Please grant location permission from app settings to see better results", isShowActionButtons: true, onCancelTap: () { navigationService.pop(); @@ -265,7 +265,7 @@ class LocationUtils { title: LocaleKeys.notice.tr(context: navigationService.navigatorKey.currentContext!), navigationService.navigatorKey.currentContext!, child: Utils.getWarningWidget( - loadingText: "Please grant location permission from app settings to see better results".needTranslation, + loadingText: "Please grant location permission from app settings to see better results", isShowActionButtons: true, onCancelTap: () { navigationService.pop(); diff --git a/lib/core/utils/calendar_utils.dart b/lib/core/utils/calendar_utils.dart index 8c0db18..8b21111 100644 --- a/lib/core/utils/calendar_utils.dart +++ b/lib/core/utils/calendar_utils.dart @@ -215,14 +215,14 @@ showReminderBottomSheet(BuildContext context, DateTime dateTime, String doctorNa Future _showReminderBottomSheet(BuildContext providedContext, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, {required Function onSuccess, String? title, String? description, Function(int)? onMultiDateSuccess, bool? isMultiAllowed}) async { - showCommonBottomSheetWithoutHeight(providedContext, title: "Set the timer of reminder".needTranslation, child: PrescriptionReminderView( + showCommonBottomSheetWithoutHeight(providedContext, title: "Set the timer of reminder", child: PrescriptionReminderView( setReminder: (int value) async { if (!isMultiAllowed!) { if (onMultiDateSuccess == null) { CalendarUtils calendarUtils = await CalendarUtils.getInstance(); await calendarUtils.createOrUpdateEvent( - title: title ?? "You have appointment with Dr. ".needTranslation + doctorName, - description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, + title: title ?? "You have appointment with Dr. $doctorName", + description: description ?? "At $appoDateFormatted $appoTimeFormatted", scheduleDateTime: dateTime, eventId: eventId, location: ''); diff --git a/lib/features/blood_donation/widgets/hospital_selection.dart b/lib/features/blood_donation/widgets/hospital_selection.dart index 288ac34..c6065ae 100644 --- a/lib/features/blood_donation/widgets/hospital_selection.dart +++ b/lib/features/blood_donation/widgets/hospital_selection.dart @@ -1,3 +1,4 @@ +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_state.dart'; @@ -8,6 +9,7 @@ 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/blood_donation/blood_donation_view_model.dart'; import 'package:hmg_patient_app_new/features/blood_donation/models/blood_group_hospitals_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors; import 'package:provider/provider.dart'; @@ -23,14 +25,7 @@ class HospitalBottomSheetBodySelection extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - "Please select the hospital you want to make an appointment.".needTranslation, - style: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w500, - color: AppColors.greyTextColor, - ), - ), + LocaleKeys.selectHospital.tr(context: context).toText16(weight: FontWeight.w500, color: AppColors.greyTextColor), SizedBox(height: 16.h), SizedBox( height: MediaQuery.sizeOf(context).height * .4, diff --git a/lib/features/book_appointments/book_appointments_view_model.dart b/lib/features/book_appointments/book_appointments_view_model.dart index 3f5517a..664f244 100644 --- a/lib/features/book_appointments/book_appointments_view_model.dart +++ b/lib/features/book_appointments/book_appointments_view_model.dart @@ -473,7 +473,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { result.fold( (failure) async { - onError!("No doctors found for the search criteria".needTranslation); + onError!(LocaleKeys.noDoctorFound.tr()); }, (apiResponse) { if (apiResponse.messageStatus == 2) { @@ -501,7 +501,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { result.fold( (failure) async { isDoctorsListLoading = false; - if (onError != null) onError("No doctors found for the search criteria".needTranslation); + if (onError != null) onError(LocaleKeys.noDoctorFound.tr()); notifyListeners(); }, @@ -533,7 +533,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { result.fold( (failure) async { isDoctorsListLoading = false; - if (onError != null) onError("No doctors found for the search criteria".needTranslation); + if (onError != null) onError(LocaleKeys.noDoctorFound.tr()); notifyListeners(); }, @@ -569,7 +569,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { result.fold( (failure) async { - onError?.call("No doctors found for the search criteria".needTranslation); + onError?.call(LocaleKeys.noDoctorFound.tr()); }, (apiResponse) async { if (apiResponse.messageStatus == 2) { @@ -784,7 +784,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { ); showCommonBottomSheet(navigationService.navigatorKey.currentContext!, - child: Utils.getLoadingWidget(loadingText: "Cancelling your previous appointment....".needTranslation), + child: Utils.getLoadingWidget(loadingText: LocaleKeys.cancellingAppointmentPleaseWait.tr()), callBackFunc: (str) {}, title: "", height: ResponsiveExtension.screenHeight * 0.3, @@ -794,7 +794,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async { navigationService.pop(); Future.delayed(Duration(milliseconds: 50)).then((value) async {}); - LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation); + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: LocaleKeys.bookingYourAppointment.tr()); await insertSpecificAppointment( onError: (err) {}, onSuccess: (apiResp) async { @@ -880,7 +880,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { ); showCommonBottomSheet(navigationService.navigatorKey.currentContext!, - child: Utils.getLoadingWidget(loadingText: "Cancelling your previous appointment....".needTranslation), + child: Utils.getLoadingWidget(loadingText: LocaleKeys.cancellingAppointmentPleaseWait.tr()), callBackFunc: (str) {}, title: "", height: ResponsiveExtension.screenHeight * 0.3, @@ -890,7 +890,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { await cancelAppointment(patientAppointmentHistoryResponseModel: patientAppointmentHistoryResponseModel).then((val) async { navigationService.pop(); Future.delayed(Duration(milliseconds: 50)).then((value) async {}); - LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: "Booking your appointment...".needTranslation); + LoadingUtils.showFullScreenLoader(barrierDismissible: true, isSuccessDialog: false, loadingText: LocaleKeys.bookingYourAppointment.tr()); await insertSpecificAppointment( onError: (err) {}, onSuccess: (apiResp) async { @@ -1204,7 +1204,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { result.fold( (failure) async { - onError!("No doctors found for the search criteria...".needTranslation); + onError!(LocaleKeys.noDoctorFound.tr()); }, (apiResponse) { if (apiResponse.messageStatus == 2) { @@ -1291,18 +1291,18 @@ class BookAppointmentsViewModel extends ChangeNotifier { notifyListeners(); } else { - if (this.duration == 90) { - dialogService.showErrorBottomSheet( - message: "Duration can not exceed 90 min".needTranslation, - ); - return; - } + // if (this.duration == 90) { + // dialogService.showErrorBottomSheet( + // message: "Duration can not exceed 90 min".needTranslation, + // ); + // return; + // } selectedBodyPartList.add(part); var duration = getDuration(); if (duration > 90) { selectedBodyPartList.remove(part); dialogService.showErrorBottomSheet( - message: "Duration Exceeds 90 min".needTranslation, + message: LocaleKeys.durationCannotExceed90.tr(), ); return; } @@ -1336,7 +1336,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { result.fold( (failure) async { - onError!("Invalid verification point scanned.".needTranslation); + onError!("Invalid verification point scanned."); }, (apiResponse) { // if (apiResponse.data['returnValue'] == 0) { @@ -1410,7 +1410,7 @@ class BookAppointmentsViewModel extends ChangeNotifier { ); } else if (apiResponse.messageStatus == 1) { if (apiResponse.data == null || apiResponse.data!.isEmpty) { - onError!("Unexpected Error Occurred".needTranslation); + onError!(LocaleKeys.unexpectedError.tr()); return; } notifyListeners(); diff --git a/lib/features/emergency_services/emergency_services_view_model.dart b/lib/features/emergency_services/emergency_services_view_model.dart index 400eb04..ec21179 100644 --- a/lib/features/emergency_services/emergency_services_view_model.dart +++ b/lib/features/emergency_services/emergency_services_view_model.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart' as GMSMapServices; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -32,6 +33,7 @@ import 'package:hmg_patient_app_new/features/my_appointments/models/facility_sel import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/hospital_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_repo.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/rrt_request_type_select.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/RRT/terms_and_condition.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/call_ambulance/call_ambulance_page.dart'; @@ -152,7 +154,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { print("the app state is ${appState.isAuthenticated}"); if (!appState.isAuthenticated) { dialogService.showErrorBottomSheet( - message: "You Need To Login First To Continue".needTranslation, + message: LocaleKeys.loginToUseService.tr(), onOkPressed: () { navServices.pop(); getIt().onLoginPressed(); @@ -196,7 +198,6 @@ class EmergencyServicesViewModel extends ChangeNotifier { } void filterErList(String query) { - print("the query is $query"); if (query.isEmpty) { nearestERFilteredList = nearestERList; } else { @@ -277,7 +278,6 @@ class EmergencyServicesViewModel extends ChangeNotifier { flushData(); selectedFacility = FacilitySelection.ALL; - print("the app state is ${appState.isAuthenticated}"); if (appState.isAuthenticated) { locationUtils!.getLocation( isShowConfirmDialog: true, @@ -289,7 +289,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { }); } else { dialogService.showErrorBottomSheet( - message: "You Need To Login First To Continue".needTranslation, + message: LocaleKeys.loginToUseService.tr(), onOkPressed: () { navServices.pop(); navServices.pushAndReplace(AppRoutes.loginScreen); @@ -311,7 +311,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { void updateBottomSheetState(BottomSheetType sheetType) { if (sheetType == BottomSheetType.EXPANDED && selectedHospital == null) { - dialogService.showErrorBottomSheet(message: "Kindly Select Hospital".needTranslation); + dialogService.showErrorBottomSheet(message: LocaleKeys.selectHospital.tr()); return; } bottomSheetType = sheetType; @@ -481,21 +481,18 @@ class EmergencyServicesViewModel extends ChangeNotifier { Future getTransportationOption() async { //handle the cache if the data is present then dont fetch it in the authenticated lifecycle - - print("the app state is ${appState.isAuthenticated}"); if (appState.isAuthenticated == false) { dialogService.showErrorBottomSheet( - message: "You Need To Login First To Continue".needTranslation, + message: LocaleKeys.loginToUseService.tr(), onOkPressed: () { navServices.pop(); - print("inside the ok button"); getIt().onLoginPressed(); }); return; } int? id = appState.getAuthenticatedUser()?.patientId; - LoaderBottomSheet.showLoader(loadingText: "Getting Ambulance Transport Option".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.gettingAmbulanceTransportOption.tr()); notifyListeners(); var response = await emergencyServicesRepo.getTransportationMethods(id: id); @@ -514,7 +511,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { Future getTransportationMethods() async { int? id = appState.getAuthenticatedUser()?.patientId; - LoaderBottomSheet.showLoader(loadingText: "Getting Ambulance Transport Option".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.gettingAmbulanceTransportOption.tr()); notifyListeners(); var response = await emergencyServicesRepo.getTransportationMethods(id: id); @@ -703,7 +700,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { } Future getAppointments() async { - LoaderBottomSheet.showLoader(loadingText: "Fetching Appointment".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingAppointment.tr()); var result = await appointmentRepo.getPatientAppointments(isActiveAppointment: true, isArrivedAppointments: false); LoaderBottomSheet.hideLoader(); @@ -860,10 +857,10 @@ class EmergencyServicesViewModel extends ChangeNotifier { Future cancelOrder(AmbulanceRequestOrdersModel? order, {bool shouldPop = false}) async { dialogService.showCommonBottomSheetWithoutH( - message: "Do you want to cancel the request".needTranslation, + message: LocaleKeys.doYouWantToCancelTheRequest.tr(), onOkPressed: () async { navServices.pop(); - LoaderBottomSheet.showLoader(loadingText: "Cancelling request".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.cancellingRequest.tr()); var response = await emergencyServicesRepo.cancelOrder(order?.iD, appState.getAuthenticatedUser()?.patientId ?? 0); LoaderBottomSheet.hideLoader(); response.fold((failure) => errorHandlerService.handleError(failure: failure), (success) { @@ -968,10 +965,10 @@ class EmergencyServicesViewModel extends ChangeNotifier { FutureOr cancelRRTOrder(int? orderID, {bool shouldPop = false}) async { dialogService.showCommonBottomSheetWithoutH( - message: "Do you want to cancel the request".needTranslation, + message: LocaleKeys.doYouWantToCancelTheRequest.tr(), onOkPressed: () async { navServices.pop(); - LoaderBottomSheet.showLoader(loadingText: "Cancelling request".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.cancellingRequest.tr()); var response = await emergencyServicesRepo.cancelRRTOrder(orderID); LoaderBottomSheet.hideLoader(); response.fold((failure) => errorHandlerService.handleError(failure: failure), (success) { @@ -1001,11 +998,10 @@ class EmergencyServicesViewModel extends ChangeNotifier { } void openRRT() { - print("the app state is ${appState.isAuthenticated}"); if (appState.isAuthenticated) { if (agreedToTermsAndCondition == false) { dialogService.showErrorBottomSheet( - message: "You Need To Agree To Terms And Conditions".needTranslation, + message: LocaleKeys.pleaseAcceptTermsConditions.tr(), onOkPressed: () { if (navServices.context == null) return; showCommonBottomSheetWithoutHeight( @@ -1042,9 +1038,9 @@ class EmergencyServicesViewModel extends ChangeNotifier { bool result = await navServices.push( CustomPageRoute( page: MapUtilityScreen( - confirmButtonString: "Submit Request".needTranslation, - titleString: "Select Location".needTranslation, - subTitleString: "Please select the location".needTranslation, + confirmButtonString: LocaleKeys.submitRequest.tr(), + titleString: LocaleKeys.selectLocation.tr(), + subTitleString: LocaleKeys.pleaseSelectTheLocation.tr(), isGmsAvailable: appState.isGMSAvailable, ), direction: AxisDirection.down), @@ -1059,7 +1055,7 @@ class EmergencyServicesViewModel extends ChangeNotifier { }); } else { dialogService.showErrorBottomSheet( - message: "You Need To Login First To Continue".needTranslation, + message: LocaleKeys.loginToUseService.tr(), onOkPressed: () { navServices.pop(); getIt().onLoginPressed(); @@ -1072,12 +1068,11 @@ class EmergencyServicesViewModel extends ChangeNotifier { } FutureOr getTermsAndConditions() async { - LoaderBottomSheet.showLoader(loadingText: "Fetching Terms And Conditions".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingTermsAndConditions.tr()); var response = await emergencyServicesRepo.getTermsAndCondition(); LoaderBottomSheet.hideLoader(); response.fold((failure) => errorHandlerService.handleError(failure: failure), (success) { termsAndConditions = success.data; - print("the response terms are $termsAndConditions"); notifyListeners(); navServices.push( CustomPageRoute(page: TermsAndCondition(termsAndCondition: success.data ?? ""), direction: AxisDirection.down), diff --git a/lib/features/my_appointments/utils/appointment_type.dart b/lib/features/my_appointments/utils/appointment_type.dart index abc23dc..aa2ef38 100644 --- a/lib/features/my_appointments/utils/appointment_type.dart +++ b/lib/features/my_appointments/utils/appointment_type.dart @@ -84,7 +84,7 @@ class AppointmentType { static String getNextActionText(nextAction) { switch (nextAction) { case 0: - return "No Action".needTranslation; + return LocaleKeys.upcomingNoAction.tr(); case 10: return LocaleKeys.confirm.tr(); case 15: @@ -96,7 +96,7 @@ class AppointmentType { case 90: return LocaleKeys.checkinOption.tr(); default: - return "No Action".needTranslation; + return LocaleKeys.upcomingNoAction.tr(); } } diff --git a/lib/features/prescriptions/prescriptions_view_model.dart b/lib/features/prescriptions/prescriptions_view_model.dart index ff86406..3f9af34 100644 --- a/lib/features/prescriptions/prescriptions_view_model.dart +++ b/lib/features/prescriptions/prescriptions_view_model.dart @@ -245,8 +245,8 @@ class PrescriptionsViewModel extends ChangeNotifier { CustomPageRoute( page: MapUtilityScreen( confirmButtonString: LocaleKeys.next.tr(), - titleString: "Select Location".needTranslation, - subTitleString: "Please select the location for prescription delivery".needTranslation, + titleString: LocaleKeys.selectLocation.tr(), + subTitleString: LocaleKeys.selectLocationPrescriptionDelivery.tr(), isGmsAvailable: getIt.get().isGMSAvailable, ), direction: AxisDirection.down), diff --git a/lib/features/radiology/radiology_view_model.dart b/lib/features/radiology/radiology_view_model.dart index 986945e..46a27bf 100644 --- a/lib/features/radiology/radiology_view_model.dart +++ b/lib/features/radiology/radiology_view_model.dart @@ -1,7 +1,9 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart'; import 'package:hmg_patient_app_new/features/radiology/radiology_repo.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/radiology/radiology_result_page.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; @@ -97,7 +99,7 @@ class RadiologyViewModel extends ChangeNotifier { ); } else { if (onError != null) { - onError("No Radiology Orders Found".needTranslation); + onError(LocaleKeys.noRadiologyOrders.tr()); } } } diff --git a/lib/features/water_monitor/water_monitor_view_model.dart b/lib/features/water_monitor/water_monitor_view_model.dart index d82712a..1ef2ef6 100644 --- a/lib/features/water_monitor/water_monitor_view_model.dart +++ b/lib/features/water_monitor/water_monitor_view_model.dart @@ -1,5 +1,6 @@ import 'dart:developer'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -14,6 +15,7 @@ import 'package:hmg_patient_app_new/features/water_monitor/models/update_user_de import 'package:hmg_patient_app_new/features/water_monitor/models/user_progress_models.dart'; import 'package:hmg_patient_app_new/features/water_monitor/models/water_cup_model.dart'; import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_repo.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/routes/app_routes.dart'; import 'package:hmg_patient_app_new/services/cache_service.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; @@ -598,36 +600,36 @@ class WaterMonitorViewModel extends ChangeNotifier { String? validateAge() { if (ageController.text.trim().isEmpty) { - return 'Age is required'.needTranslation; + return LocaleKeys.ageIsRequired.tr(); } final age = int.tryParse(ageController.text.trim()); if (age == null) { - return 'Invalid age'.needTranslation; + return LocaleKeys.invalidAge.tr(); } if (age < 11 || age > 120) { - return 'Age must be between 11 and 120'.needTranslation; + return LocaleKeys.ageMustBeBetween11And120.tr(); } return null; } String? validateHeight() { if (heightController.text.trim().isEmpty) { - return 'Height is required'.needTranslation; + return LocaleKeys.heightIsRequired.tr(); } final height = double.tryParse(heightController.text.trim()); if (height == null || height <= 0) { - return 'Invalid height'.needTranslation; + return LocaleKeys.invalidHeight.tr(); } return null; } String? validateWeight() { if (weightController.text.trim().isEmpty) { - return 'Weight is required'.needTranslation; + return LocaleKeys.weightIsRequired.tr(); } final weight = double.tryParse(weightController.text.trim()); if (weight == null || weight <= 0) { - return 'Invalid weight'.needTranslation; + return LocaleKeys.invalidWeight.tr(); } return null; } @@ -1212,8 +1214,8 @@ class WaterMonitorViewModel extends ChangeNotifier { // Schedule water reminders await notificationService.scheduleWaterReminders( reminderTimes: reminderTimes, - title: 'Time to Drink Water! 💧'.needTranslation, - body: 'Stay hydrated! Drink ${selectedCupCapacityMl}ml of water.'.needTranslation, + title: LocaleKeys.timeToDrinkWater.tr(), + body: LocaleKeys.stayHydratedDrinkWater.tr(namedArgs: {'amount': selectedCupCapacityMl.toString()}), ); // Save reminder enabled state to cache @@ -1334,8 +1336,8 @@ class WaterMonitorViewModel extends ChangeNotifier { await notificationService.scheduleNotification( id: 9999, // Use a unique ID for test notifications - title: 'Time to Drink Water! 💧'.needTranslation, - body: 'Stay hydrated! Drink ${selectedCupCapacityMl}ml of water.'.needTranslation, + title: LocaleKeys.timeToDrinkWater.tr(), + body: LocaleKeys.stayHydratedDrinkWater.tr(namedArgs: {'amount': selectedCupCapacityMl.toString()}), scheduledDate: scheduledTime, payload: 'test_notification', ); diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 689587c..a3989ad 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1208,5 +1208,160 @@ abstract class LocaleKeys { static const carParking = 'carParking'; static const latestNews = 'latestNews'; static const hmgContact = 'hmgContact'; + static const durationCannotExceed90 = 'durationCannotExceed90'; + static const unexpectedError = 'unexpectedError'; + static const gettingAmbulanceTransportOption = 'gettingAmbulanceTransportOption'; + static const fetchingAppointment = 'fetchingAppointment'; + static const doYouWantToCancelTheRequest = 'doYouWantToCancelTheRequest'; + static const cancellingRequest = 'cancellingRequest'; + static const fetchingTermsAndConditions = 'fetchingTermsAndConditions'; + static const selectLocationPrescriptionDelivery = 'selectLocationPrescriptionDelivery'; + static const noRadiologyOrders = 'noRadiologyOrders'; + static const ageIsRequired = 'ageIsRequired'; + static const invalidAge = 'invalidAge'; + static const ageMustBeBetween11And120 = 'ageMustBeBetween11And120'; + static const heightIsRequired = 'heightIsRequired'; + static const invalidHeight = 'invalidHeight'; + static const weightIsRequired = 'weightIsRequired'; + static const invalidWeight = 'invalidWeight'; + static const timeToDrinkWater = 'timeToDrinkWater'; + static const stayHydratedDrinkWater = 'stayHydratedDrinkWater'; + static const visitPharmacyOnline = 'visitPharmacyOnline'; + static const howAreYouFeelingToday = 'howAreYouFeelingToday'; + static const checkYourSymptomsWithScale = 'checkYourSymptomsWithScale'; + static const checkYourSymptoms = 'checkYourSymptoms'; + static const noUpcomingAppointmentPleaseBook = 'noUpcomingAppointmentPleaseBook'; + static const youHaveEROnlineCheckInRequest = 'youHaveEROnlineCheckInRequest'; + static const quickLinks = 'quickLinks'; + static const viewMedicalFileLandingPage = 'viewMedicalFileLandingPage'; + static const immediateLiveCareRequest = 'immediateLiveCareRequest'; + static const yourTurnIsAfterPatients = 'yourTurnIsAfterPatients'; + static const dontHaveHHCOrders = 'dontHaveHHCOrders'; + static const hhcOrders = 'hhcOrders'; + static const requestedServices = 'requestedServices'; + static const selectServices = 'selectServices'; + static const selectedServices = 'selectedServices'; + static const createNewRequest = 'createNewRequest'; + static const youHaveNoPendingRequests = 'youHaveNoPendingRequests'; + static const noInsuranceDataFound = 'noInsuranceDataFound'; + static const noInsuranceUpdateRequest = 'noInsuranceUpdateRequest'; + static const policyNumberInsurancePage = 'policyNumberInsurancePage'; + static const insuranceExpired = 'insuranceExpired'; + static const insuranceActive = 'insuranceActive'; + static const patientCardID = 'patientCardID'; + static const noInsuranceApprovals = 'noInsuranceApprovals'; + static const noInsuranceWithHMG = 'noInsuranceWithHMG'; + static const referenceRange = 'referenceRange'; + static const downloadReport = 'downloadReport'; + static const generatingReport = 'generatingReport'; + static const noLabResults = 'noLabResults'; + static const labResultDetails = 'labResultDetails'; + static const resultOf = 'resultOf'; + static const whatIsThisResult = 'whatIsThisResult'; + static const lastTested = 'lastTested'; + static const byVisit = 'byVisit'; + static const byTest = 'byTest'; + static const results = 'results'; + static const viewResults = 'viewResults'; + static const rebook = 'rebook'; + static const noOphthalmologyAppointments = 'noOphthalmologyAppointments'; + static const noVitalSignsRecordedYet = 'noVitalSignsRecordedYet'; + static const appointmentsAndVisits = 'appointmentsAndVisits'; + static const labAndRadiology = 'labAndRadiology'; + static const activeMedicationsAndPrescriptions = 'activeMedicationsAndPrescriptions'; + static const allPrescriptions = 'allPrescriptions'; + static const allMedications = 'allMedications'; + static const youDontHaveAnyPrescriptionsYet = 'youDontHaveAnyPrescriptionsYet'; + static const youDontHaveAnyCompletedVisitsYet = 'youDontHaveAnyCompletedVisitsYet'; + static const others = 'others'; + static const allergyInfo = 'allergyInfo'; + static const vaccineInfo = 'vaccineInfo'; + static const updateInsuranceInfo = 'updateInsuranceInfo'; + static const myInvoicesList = 'myInvoicesList'; + static const ancillaryOrdersList = 'ancillaryOrdersList'; + static const youDontHaveAnySickLeavesYet = 'youDontHaveAnySickLeavesYet'; + static const medicalReports = 'medicalReports'; + static const sickLeaveReport = 'sickLeaveReport'; + static const weightTracker = 'weightTracker'; + static const askYourDoctor = 'askYourDoctor'; + static const internetPairing = 'internetPairing'; + static const requested = 'requested'; + static const youDontHaveAnyMedicalReportsYet = 'youDontHaveAnyMedicalReportsYet'; + static const requestMedicalReport = 'requestMedicalReport'; + static const youDoNotHaveAnyAppointmentsToRequestMedicalReport = 'youDoNotHaveAnyAppointmentsToRequestMedicalReport'; + static const areYouSureYouWantToRequestMedicalReport = 'areYouSureYouWantToRequestMedicalReport'; + static const yourMedicalReportRequestSubmittedSuccessfully = 'yourMedicalReportRequestSubmittedSuccessfully'; + static const monthlyHealthSummaryReportDisclaimer = 'monthlyHealthSummaryReportDisclaimer'; + static const updatingMonthlyReportStatus = 'updatingMonthlyReportStatus'; + static const monthlyReportStatusUpdatedSuccessfully = 'monthlyReportStatusUpdatedSuccessfully'; + static const whoCanViewMyMedicalFile = 'whoCanViewMyMedicalFile'; + static const acceptedYourRequestToBeYourFamilyMember = 'acceptedYourRequestToBeYourFamilyMember'; + static const canViewYourFile = 'canViewYourFile'; + static const hasARequestPendingToBeYourFamilyMember = 'hasARequestPendingToBeYourFamilyMember'; + static const wantsToAddYouAsTheirFamilyMember = 'wantsToAddYouAsTheirFamilyMember'; + static const rejectedYourRequestToBeYourFamilyMember = 'rejectedYourRequestToBeYourFamilyMember'; + static const rejectedYourFamilyMemberRequest = 'rejectedYourFamilyMemberRequest'; + static const notAvailable = 'notAvailable'; + static const selectAProfile = 'selectAProfile'; + static const switchFamilyFile = 'switchFamilyFile'; + static const medicalFiles = 'medicalFiles'; + static const addANewFamilyMember = 'addANewFamilyMember'; + static const viewInvoiceDetails = 'viewInvoiceDetails'; + static const outPatient = 'outPatient'; + static const invoiceDetails = 'invoiceDetails'; + static const sendingEmailPleaseWait = 'sendingEmailPleaseWait'; + static const emailSentSuccessfullyMessage = 'emailSentSuccessfullyMessage'; + static const discount = 'discount'; + static const paid = 'paid'; + static const fetchingInvoiceDetails = 'fetchingInvoiceDetails'; + static const scanQRCode = 'scanQRCode'; + static const parkingSlotDetails = 'parkingSlotDetails'; + static const slotNumber = 'slotNumber'; + static const basement = 'basement'; + static const parkingDate = 'parkingDate'; + static const parkedSince = 'parkedSince'; + static const resetDirection = 'resetDirection'; + static const noPrescriptionOrdersYet = 'noPrescriptionOrdersYet'; + static const fetchingPrescriptionPDFPleaseWait = 'fetchingPrescriptionPDFPleaseWait'; + static const ratingValue = 'ratingValue'; + static const downloadPrescription = 'downloadPrescription'; + static const fetchingPrescriptionDetails = 'fetchingPrescriptionDetails'; + static const switchBackFamilyFile = 'switchBackFamilyFile'; + static const profileAndSettings = 'profileAndSettings'; + static const quickActions = 'quickActions'; + static const notificationsSettings = 'notificationsSettings'; + static const touchIDFaceIDServices = 'touchIDFaceIDServices'; + static const personalInformation = 'personalInformation'; + static const updateEmailAddress = 'updateEmailAddress'; + static const helpAndSupport = 'helpAndSupport'; + static const permissionsProfile = 'permissionsProfile'; + static const privacyPolicy = 'privacyPolicy'; + static const deactivateAccount = 'deactivateAccount'; + static const ageYearsOld = 'ageYearsOld'; + static const youDontHaveRadiologyOrders = 'youDontHaveRadiologyOrders'; + static const radiologyResult = 'radiologyResult'; + static const viewRadiologyImage = 'viewRadiologyImage'; + static const rateClinic = 'rateClinic'; + static const back = 'back'; + static const rateDoctor = 'rateDoctor'; + static const howWasYourLastVisitWithDoctor = 'howWasYourLastVisitWithDoctor'; + static const dateOfBirthSymptoms = 'dateOfBirthSymptoms'; + static const genderSymptoms = 'genderSymptoms'; + static const heightSymptoms = 'heightSymptoms'; + static const weightSymptoms = 'weightSymptoms'; + static const femaleGender = 'femaleGender'; + static const previous = 'previous'; + static const selectedOrgans = 'selectedOrgans'; + static const noOrgansSelected = 'noOrgansSelected'; + static const organSelector = 'organSelector'; + static const noPredictionsAvailable = 'noPredictionsAvailable'; + static const areYouSureYouWantToRestartOrganSelection = 'areYouSureYouWantToRestartOrganSelection'; + static const possibleConditions = 'possibleConditions'; + static const pleaseSelectAtLeastOneRiskBeforeProceeding = 'pleaseSelectAtLeastOneRiskBeforeProceeding'; + static const aboveYouSeeCommonRiskFactors = 'aboveYouSeeCommonRiskFactors'; + static const readMore = 'readMore'; + static const riskFactors = 'riskFactors'; + static const noRiskFactorsFound = 'noRiskFactorsFound'; + static const basedOnYourSelectedSymptomsNoRiskFactors = 'basedOnYourSelectedSymptomsNoRiskFactors'; } diff --git a/lib/presentation/home/landing_page.dart b/lib/presentation/home/landing_page.dart index f336c5b..fc400c4 100644 --- a/lib/presentation/home/landing_page.dart +++ b/lib/presentation/home/landing_page.dart @@ -275,11 +275,11 @@ class _LandingPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "How are you feeling today?".needTranslation.toText14(isBold: true), - "Check your symptoms with this scale".needTranslation.toText12(fontWeight: FontWeight.w500), + LocaleKeys.howAreYouFeelingToday.tr(context: context).toText14(isBold: true), + LocaleKeys.checkYourSymptomsWithScale.tr(context: context).toText12(fontWeight: FontWeight.w500), SizedBox(height: 14.h), CustomButton( - text: "Check your symptoms".needTranslation, + text: LocaleKeys.checkYourSymptoms.tr(context: context), onPressed: () async { context.navigateWithName(AppRoutes.userInfoSelection); }, @@ -416,7 +416,7 @@ class _LandingPageState extends State { children: [ Utils.buildSvgWithAssets(icon: AppAssets.home_calendar_icon, width: 32.h, height: 32.h), SizedBox(height: 12.h), - "You do not have any upcoming appointment. Please book an appointment".needTranslation.toText12(isCenter: true), + LocaleKeys.noUpcomingAppointmentPleaseBook.tr(context: context).toText12(isCenter: true), SizedBox(height: 12.h), CustomButton( text: LocaleKeys.bookAppo.tr(context: context), @@ -476,7 +476,7 @@ class _LandingPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "You have ER Online Check-In Request".needTranslation.toText12(isBold: true), + LocaleKeys.youHaveEROnlineCheckInRequest.tr(context: context).toText12(isBold: true), Utils.buildSvgWithAssets( icon: AppAssets.forward_arrow_icon_small, iconColor: AppColors.blackColor, @@ -503,10 +503,10 @@ class _LandingPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Quick Links".needTranslation.toText16(isBold: true), + LocaleKeys.quickLinks.tr(context: context).toText16(isBold: true), Row( children: [ - "View medical file".needTranslation.toText12(color: AppColors.primaryRedColor), + LocaleKeys.viewMedicalFile.tr(context: context).toText12(color: AppColors.primaryRedColor), SizedBox(width: 2.h), Icon(Icons.arrow_forward_ios, color: AppColors.primaryRedColor, size: 10.h), ], @@ -664,7 +664,7 @@ class _LandingPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppCustomChipWidget( - labelText: myAppointmentsViewModel.currentQueueStatus == 0 ? "In Queue".needTranslation : "Your Turn".needTranslation, + labelText: myAppointmentsViewModel.currentQueueStatus == 0 ? LocaleKeys.inQueue.tr() : LocaleKeys.yourTurn.tr(), backgroundColor: Utils.getCardBorderColor(myAppointmentsViewModel.currentQueueStatus).withValues(alpha: 0.20), textColor: Utils.getCardBorderColor(myAppointmentsViewModel.currentQueueStatus), ), @@ -672,9 +672,9 @@ class _LandingPageState extends State { ], ), SizedBox(height: 8.h), - "Hala ${appState.getAuthenticatedUser()!.firstName}!!!".needTranslation.toText16(isBold: true), + LocaleKeys.halaFirstName.tr(namedArgs: {'firstName': appState.getAuthenticatedUser()!.firstName!}).toText16(isBold: true), SizedBox(height: 2.h), - "Thank you for your patience, here is your queue number.".needTranslation.toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), + LocaleKeys.thankYouForPatience.tr().toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), SizedBox(height: 8.h), myAppointmentsViewModel.currentPatientQueueDetails.queueNo!.toText28(isBold: true), SizedBox(height: 6.h), @@ -683,7 +683,7 @@ class _LandingPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - "Serving Now: ".needTranslation.toText14(isBold: true), + "${LocaleKeys.servingNow.tr()}: ".toText14(isBold: true), Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ @@ -691,7 +691,7 @@ class _LandingPageState extends State { SizedBox(width: 8.w), AppCustomChipWidget( deleteIcon: myAppointmentsViewModel.patientQueueDetailsList.first.callType == 1 ? AppAssets.call_for_vitals : AppAssets.call_for_doctor, - labelText: myAppointmentsViewModel.patientQueueDetailsList.first.callType == 1 ? "Call for vital signs".needTranslation : "Call for Doctor".needTranslation, + labelText: myAppointmentsViewModel.patientQueueDetailsList.first.callType == 1 ? LocaleKeys.callForVitalSigns.tr() : LocaleKeys.callForDoctor.tr(), iconColor: myAppointmentsViewModel.patientQueueDetailsList.first.callType == 1 ? AppColors.primaryRedColor : AppColors.successColor, textColor: myAppointmentsViewModel.patientQueueDetailsList.first.callType == 1 ? AppColors.primaryRedColor : AppColors.successColor, iconSize: 14.w, @@ -746,7 +746,7 @@ class _LandingPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Immediate LiveCare Request".needTranslation.toText16(isBold: true), + LocaleKeys.immediateLiveCareRequest.tr(context: context).toText16(isBold: true), SizedBox(height: 10.h), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -769,14 +769,14 @@ class _LandingPageState extends State { ], ), SizedBox(height: 10.h), - "Hala ${appState.getAuthenticatedUser()!.firstName}!!!".needTranslation.toText16(isBold: true), + LocaleKeys.halaFirstName.tr(namedArgs: {'firstName': appState.getAuthenticatedUser()!.firstName!}, context: context).toText16(isBold: true), SizedBox(height: 8.h), - "Your turn is after ${immediateLiveCareViewModel.patientLiveCareHistoryList[0].patCount} patients.".needTranslation.toText14(isBold: true), + LocaleKeys.yourTurnIsAfterPatients.tr(namedArgs: {'count': immediateLiveCareViewModel.patientLiveCareHistoryList[0].patCount.toString()}, context: context).toText14(isBold: true), SizedBox(height: 8.h), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Expected waiting time: ".needTranslation.toText12(isBold: true), + "${LocaleKeys.waitingTime.tr()}: ".toText12(isBold: true), SizedBox(height: 7.h), ValueListenableBuilder( valueListenable: immediateLiveCareViewModel.durationNotifier, diff --git a/lib/presentation/home/widgets/habib_wallet_card.dart b/lib/presentation/home/widgets/habib_wallet_card.dart index b2649f9..9058c8f 100644 --- a/lib/presentation/home/widgets/habib_wallet_card.dart +++ b/lib/presentation/home/widgets/habib_wallet_card.dart @@ -1,3 +1,4 @@ +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/utils/size_utils.dart'; @@ -5,6 +6,7 @@ import 'package:hmg_patient_app_new/core/utils/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/features/habib_wallet/habib_wallet_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/habib_wallet/habib_wallet_page.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -115,7 +117,7 @@ class HabibWalletCard extends StatelessWidget { CustomButton( icon: AppAssets.recharge_icon, iconSize: 18.h, - text: "Recharge".needTranslation, + text: LocaleKeys.recharge.tr(context: context), onPressed: () {}, backgroundColor: AppColors.infoColor, borderColor: AppColors.infoColor, diff --git a/lib/presentation/home/widgets/large_service_card.dart b/lib/presentation/home/widgets/large_service_card.dart index 5274d5b..6025ba8 100644 --- a/lib/presentation/home/widgets/large_service_card.dart +++ b/lib/presentation/home/widgets/large_service_card.dart @@ -98,7 +98,7 @@ class LargeServiceCard extends StatelessWidget { ], ).paddingSymmetrical(16.w, 20.h), CustomButton( - text: serviceCardData.isBold ? "Visit Pharmacy Online".needTranslation : LocaleKeys.bookNow.tr(context: context), + text: serviceCardData.isBold ? LocaleKeys.visitPharmacyOnline.tr() : LocaleKeys.bookNow.tr(context: context), onPressed: () { handleOnTap(); }, diff --git a/lib/presentation/home/widgets/welcome_widget.dart b/lib/presentation/home/widgets/welcome_widget.dart index 8ef0697..1bb17b5 100644 --- a/lib/presentation/home/widgets/welcome_widget.dart +++ b/lib/presentation/home/widgets/welcome_widget.dart @@ -1,7 +1,9 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.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/theme/colors.dart'; class WelcomeWidget extends StatelessWidget { @@ -31,7 +33,7 @@ class WelcomeWidget extends StatelessWidget { spacing: 4.h, mainAxisSize: MainAxisSize.min, children: [ - "Welcome".needTranslation.toText14(color: AppColors.greyTextColor, height: 1, weight: FontWeight.w500), + LocaleKeys.welcome.tr(context: context).toText14(color: AppColors.greyTextColor, height: 1, weight: FontWeight.w500), Row( spacing: 4.h, crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/presentation/home_health_care/hhc_order_detail_page.dart b/lib/presentation/home_health_care/hhc_order_detail_page.dart index 92c93d1..7017441 100644 --- a/lib/presentation/home_health_care/hhc_order_detail_page.dart +++ b/lib/presentation/home_health_care/hhc_order_detail_page.dart @@ -10,6 +10,7 @@ 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/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_all_orders_resp_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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/chip/app_custom_chip_widget.dart'; @@ -121,7 +122,7 @@ class _HhcOrderDetailPageState extends State { Row( children: [ if (!isLoading) ...[ - "Request ID:".needTranslation.toText14( + LocaleKeys.requestID.tr(context: context).toText14( color: AppColors.textColorLight, weight: FontWeight.w500, ), @@ -186,7 +187,7 @@ class _HhcOrderDetailPageState extends State { ), child: Utils.getNoDataWidget( context, - noDataText: "You don't have any Home Health Care orders yet.".needTranslation, + noDataText: LocaleKeys.dontHaveHHCOrders.tr(context: context), isSmallWidget: true, width: 62.w, height: 62.h, @@ -199,7 +200,7 @@ class _HhcOrderDetailPageState extends State { @override Widget build(BuildContext context) { return CollapsingListView( - title: "HHC Orders".needTranslation, + title: LocaleKeys.hhcOrders.tr(context: context), isLeading: true, child: SingleChildScrollView( child: Column( diff --git a/lib/presentation/home_health_care/hhc_procedures_page.dart b/lib/presentation/home_health_care/hhc_procedures_page.dart index be97a88..ef5dce5 100644 --- a/lib/presentation/home_health_care/hhc_procedures_page.dart +++ b/lib/presentation/home_health_care/hhc_procedures_page.dart @@ -11,6 +11,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_all_orders_resp_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/get_cmc_services_resp_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/home_health_care/hhc_order_detail_page.dart'; import 'package:hmg_patient_app_new/presentation/home_health_care/hhc_selection_review_page.dart'; import 'package:hmg_patient_app_new/presentation/home_health_care/widgets/hhc_ui_selection_helper.dart'; @@ -93,7 +94,7 @@ class _HhcProceduresPageState extends State { children: [ Row( children: [ - "Request ID:".needTranslation.toText14(color: AppColors.textColorLight, weight: FontWeight.w500), + LocaleKeys.requestID.tr(context: context).toText14(color: AppColors.textColorLight, weight: FontWeight.w500), SizedBox(width: 4.w), "${order.iD ?? '-'}".toText16(isBold: true), ], @@ -132,7 +133,7 @@ class _HhcProceduresPageState extends State { color: AppColors.primaryRedColor, ), SizedBox(width: 6.w), - "Requested Services".needTranslation.toText14( + LocaleKeys.requestedServices.tr().toText14( weight: FontWeight.w600, color: AppColors.blackColor, ), @@ -209,7 +210,7 @@ class _HhcProceduresPageState extends State { ), SizedBox(width: 8.w), Expanded( - child: "You have a pending order. Please wait for it to be processed.".needTranslation.toText12( + child: LocaleKeys.pendingOrderWait.tr(context: context).toText12( color: AppColors.infoBannerTextColor, fontWeight: FontWeight.w500, ), @@ -223,7 +224,7 @@ class _HhcProceduresPageState extends State { children: [ Expanded( child: CustomButton( - text: "Cancel Order".needTranslation, + text: LocaleKeys.cancelOrder.tr(context: context), onPressed: () => HhcUiSelectionHelper.showCancelConfirmationDialog(context: context, order: order), backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, @@ -248,7 +249,7 @@ class _HhcProceduresPageState extends State { hasBottomPadding: false, padding: EdgeInsets.only(top: 24.h), context, - title: 'Select Services'.needTranslation, + title: LocaleKeys.selectServices.tr(context: context), isCloseButtonVisible: true, isDismissible: true, callBackFunc: () {}, @@ -257,9 +258,9 @@ class _HhcProceduresPageState extends State { child: Padding( padding: EdgeInsets.all(24.h), child: Text( - 'No services available'.needTranslation, + LocaleKeys.noServicesAvailable.tr(context: context), style: TextStyle( - fontSize: 16.h, + fontSize: 16.f, color: AppColors.greyTextColor, ), ), @@ -300,7 +301,7 @@ class _HhcProceduresPageState extends State { duration: const Duration(milliseconds: 300), curve: Curves.easeInOut, width: 24.w, - height: 24.w, + height: 24.h, decoration: BoxDecoration( color: isSelected ? AppColors.primaryRedColor : Colors.transparent, borderRadius: BorderRadius.circular(5.r), @@ -353,7 +354,7 @@ class _HhcProceduresPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Selected Services".needTranslation.toText12( + LocaleKeys.selectedServices.tr(context: context).toText12( color: AppColors.textColorLight, fontWeight: FontWeight.w600, ), @@ -368,7 +369,7 @@ class _HhcProceduresPageState extends State { SizedBox(height: 16.h), CustomButton( borderWidth: 0, - text: "Next".needTranslation, + text: LocaleKeys.next.tr(context: context), onPressed: () { Navigator.pop(context); _proceedWithSelectedService(); @@ -398,9 +399,9 @@ class _HhcProceduresPageState extends State { bool result = await navigationServices.push( CustomPageRoute( page: MapUtilityScreen( - confirmButtonString: "Submit Request ".needTranslation, - titleString: "Select Location", - subTitleString: "Please select the location".needTranslation, + confirmButtonString: LocaleKeys.submitRequest.tr(context: context), + titleString: LocaleKeys.selectLocation.tr(context: context), + subTitleString: LocaleKeys.pleaseSelectTheLocation.tr(context: context), isGmsAvailable: appState.isGMSAvailable, ), direction: AxisDirection.down), @@ -447,7 +448,7 @@ class _HhcProceduresPageState extends State { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "Home Health Care".needTranslation, + title: LocaleKeys.homeHealthCare.tr(context: context), history: () => Navigator.of(context).push(CustomPageRoute(page: HhcOrderDetailPage(), direction: AxisDirection.up)), bottomChild: Consumer( builder: (BuildContext context, HmgServicesViewModel hmgServicesViewModel, Widget? child) { @@ -466,7 +467,7 @@ class _HhcProceduresPageState extends State { padding: EdgeInsets.all(24.w), child: CustomButton( borderWidth: 0, - text: "Create new request".needTranslation, + text: LocaleKeys.createNewRequest.tr(context: context), onPressed: () => _buildServicesListBottomsSheet(hmgServicesViewModel.hhcServicesList), textColor: AppColors.whiteColor, borderRadius: 12.r, @@ -494,7 +495,7 @@ class _HhcProceduresPageState extends State { Center( child: Utils.getNoDataWidget( context, - noDataText: "You have no pending requests.".needTranslation, + noDataText: LocaleKeys.youHaveNoPendingRequests.tr(context: context), ), ), ], diff --git a/lib/presentation/home_health_care/hhc_selection_review_page.dart b/lib/presentation/home_health_care/hhc_selection_review_page.dart index 37410e2..ae2430a 100644 --- a/lib/presentation/home_health_care/hhc_selection_review_page.dart +++ b/lib/presentation/home_health_care/hhc_selection_review_page.dart @@ -50,7 +50,7 @@ class _HhcSelectionReviewPageState extends State { final isArabic = appState.isArabic(); return CollapsingListView( - title: "Summary".needTranslation, + title: LocaleKeys.summary.tr(context: context), bottomChild: _buildBottomButton(), child: SingleChildScrollView( padding: EdgeInsets.all(16.w), @@ -75,7 +75,7 @@ class _HhcSelectionReviewPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Selected Services".needTranslation.toText14( + LocaleKeys.selectedServices.tr(context: context).toText14( weight: FontWeight.w600, color: AppColors.textColor, letterSpacing: -0.4, @@ -86,7 +86,7 @@ class _HhcSelectionReviewPageState extends State { runSpacing: 12.w, children: widget.selectedServices.map((service) { final serviceName = isArabic ? (service.textN ?? service.text ?? '') : (service.text ?? ''); - return AppCustomChipWidget(labelText: serviceName.needTranslation); + return AppCustomChipWidget(labelText: serviceName); }).toList(), ), ], @@ -110,7 +110,7 @@ class _HhcSelectionReviewPageState extends State { if (lat == 0.0 || lng == 0.0) return SizedBox.shrink(); // Get address from geocode response - String address = "Selected Location".needTranslation; + String address = LocaleKeys.selectLocation.tr(context: context); if (geocodeResponse != null && geocodeResponse.results.isNotEmpty) { address = geocodeResponse.results.first.formattedAddress; } @@ -133,7 +133,7 @@ class _HhcSelectionReviewPageState extends State { ), child: CustomButton( borderWidth: 0, - text: "Confirm".needTranslation, + text: LocaleKeys.confirm.tr(context: context), onPressed: () => _handleConfirm(), textColor: AppColors.whiteColor, borderRadius: 12.r, @@ -155,10 +155,10 @@ class _HhcSelectionReviewPageState extends State { padding: EdgeInsets.all(16.w), child: Column( children: [ - Utils.getSuccessWidget(loadingText: "Your request has been successfully submitted.".needTranslation), + Utils.getSuccessWidget(loadingText: LocaleKeys.requestSubmittedSuccessfully.tr(context: context)), Row( children: [ - "Here is your request #: ".needTranslation.toText14( + LocaleKeys.hereIsYourRequestNumber.tr(context: context).toText14( color: AppColors.textColorLight, weight: FontWeight.w500, ), @@ -200,7 +200,7 @@ class _HhcSelectionReviewPageState extends State { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: "Are you sure you want to submit this request?".needTranslation, + loadingText: LocaleKeys.confirmSubmitRequest.tr(context: context), isShowActionButtons: true, onCancelTap: () { Navigator.pop(context); diff --git a/lib/presentation/home_health_care/widgets/hhc_ui_selection_helper.dart b/lib/presentation/home_health_care/widgets/hhc_ui_selection_helper.dart index 688612c..d5310b3 100644 --- a/lib/presentation/home_health_care/widgets/hhc_ui_selection_helper.dart +++ b/lib/presentation/home_health_care/widgets/hhc_ui_selection_helper.dart @@ -25,7 +25,7 @@ class HhcUiSelectionHelper { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: "Are you sure you want to cancel this order?".needTranslation, + loadingText: LocaleKeys.cancelOrderConfirmation.tr(context: context), isShowActionButtons: true, onCancelTap: () { Navigator.pop(context); @@ -51,7 +51,7 @@ class HhcUiSelectionHelper { padding: EdgeInsets.all(16.w), child: Column( children: [ - Utils.getSuccessWidget(loadingText: "Order has been cancelled successfully".needTranslation), + Utils.getSuccessWidget(loadingText: LocaleKeys.orderCancelledSuccessfully.tr(context: context)), SizedBox(height: 24.h), Row( children: [ diff --git a/lib/presentation/insurance/insurance_approval_details_page.dart b/lib/presentation/insurance/insurance_approval_details_page.dart index 415d66f..a6d8157 100644 --- a/lib/presentation/insurance/insurance_approval_details_page.dart +++ b/lib/presentation/insurance/insurance_approval_details_page.dart @@ -56,7 +56,7 @@ class InsuranceApprovalDetailsPage extends StatelessWidget { AppCustomChipWidget( icon: (!insuranceApprovalResponseModel.isLiveCareAppointment! ? AppAssets.walkin_appointment_icon : AppAssets.small_livecare_icon), iconColor: !insuranceApprovalResponseModel.isLiveCareAppointment! ? AppColors.textColor : AppColors.whiteColor, - labelText: insuranceApprovalResponseModel.isLiveCareAppointment! ? LocaleKeys.livecare.tr(context: context) : "Walk In".needTranslation, + labelText: insuranceApprovalResponseModel.isLiveCareAppointment! ? LocaleKeys.livecare.tr(context: context) : LocaleKeys.walkin.tr(context: context), backgroundColor: (!insuranceApprovalResponseModel.isLiveCareAppointment! ? AppColors.greyColor : AppColors.successColor), textColor: (!insuranceApprovalResponseModel.isLiveCareAppointment! ? AppColors.textColor : AppColors.whiteColor), ), @@ -137,7 +137,7 @@ class InsuranceApprovalDetailsPage extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Status:".needTranslation.toText14(isBold: true), + "${LocaleKeys.status.tr(context: context)}: ".toText14(isBold: true), insuranceApprovalResponseModel.apporvalDetails!.status!.toText12(fontWeight: FontWeight.w500, color: AppColors.greyTextColor), ], ), diff --git a/lib/presentation/insurance/insurance_approvals_page.dart b/lib/presentation/insurance/insurance_approvals_page.dart index b70c116..52f8b1f 100644 --- a/lib/presentation/insurance/insurance_approvals_page.dart +++ b/lib/presentation/insurance/insurance_approvals_page.dart @@ -95,7 +95,7 @@ class _InsuranceApprovalsPageState extends State { ), ), ) - : Utils.getNoDataWidget(context, noDataText: "You don't have any insurance approvals yet.".needTranslation); + : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noInsuranceApprovals.tr(context: context)); }, separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), ), diff --git a/lib/presentation/insurance/insurance_home_page.dart b/lib/presentation/insurance/insurance_home_page.dart index b005e42..04940fb 100644 --- a/lib/presentation/insurance/insurance_home_page.dart +++ b/lib/presentation/insurance/insurance_home_page.dart @@ -78,7 +78,7 @@ class _InsuranceHomePageState extends State { padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.12), child: Utils.getNoDataWidget( context, - noDataText: "You don't have insurance registered with HMG.".needTranslation, + noDataText: LocaleKeys.noInsuranceWithHMG.tr(context: context), callToActionButton: CustomButton( icon: AppAssets.update_insurance_card_icon, iconColor: AppColors.successColor, diff --git a/lib/presentation/insurance/widgets/insurance_approval_card.dart b/lib/presentation/insurance/widgets/insurance_approval_card.dart index ee31538..588f988 100644 --- a/lib/presentation/insurance/widgets/insurance_approval_card.dart +++ b/lib/presentation/insurance/widgets/insurance_approval_card.dart @@ -54,7 +54,7 @@ class InsuranceApprovalCard extends StatelessWidget { ? "Walk In" : insuranceApprovalResponseModel.isLiveCareAppointment! ? LocaleKeys.livecare.tr(context: context) - : "Walk In".needTranslation, + : LocaleKeys.walkin.tr(context: context), backgroundColor: isLoading ? AppColors.greyColor : (!insuranceApprovalResponseModel.isLiveCareAppointment! ? AppColors.greyColor : AppColors.successColor), textColor: isLoading ? AppColors.textColor : (!insuranceApprovalResponseModel.isLiveCareAppointment! ? AppColors.textColor : AppColors.whiteColor), ).toShimmer2(isShow: isLoading), diff --git a/lib/presentation/insurance/widgets/insurance_history.dart b/lib/presentation/insurance/widgets/insurance_history.dart index 341e234..7219a34 100644 --- a/lib/presentation/insurance/widgets/insurance_history.dart +++ b/lib/presentation/insurance/widgets/insurance_history.dart @@ -111,7 +111,7 @@ class InsuranceHistory extends StatelessWidget { ) : Utils.getNoDataWidget( context, - noDataText: "No insurance update requests found.".needTranslation, + noDataText: LocaleKeys.noInsuranceUpdateRequest.tr(context: context), // isSmallWidget: true, // width: 62, // height: 62, diff --git a/lib/presentation/insurance/widgets/insurance_update_details_card.dart b/lib/presentation/insurance/widgets/insurance_update_details_card.dart index c3bbcd7..c737732 100644 --- a/lib/presentation/insurance/widgets/insurance_update_details_card.dart +++ b/lib/presentation/insurance/widgets/insurance_update_details_card.dart @@ -90,7 +90,7 @@ class PatientInsuranceCardUpdateCard extends StatelessWidget { ], ).paddingSymmetrical(16.h, 16.h), ).paddingSymmetrical(24.h, 0.h) - : Utils.getNoDataWidget(context, noDataText: "No insurance data found...".needTranslation), + : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noInsuranceDataFound.tr(context: context)), SizedBox( height: 24.h, ), diff --git a/lib/presentation/insurance/widgets/patient_insurance_card.dart b/lib/presentation/insurance/widgets/patient_insurance_card.dart index fde5811..84fdee4 100644 --- a/lib/presentation/insurance/widgets/patient_insurance_card.dart +++ b/lib/presentation/insurance/widgets/patient_insurance_card.dart @@ -50,12 +50,12 @@ class PatientInsuranceCard extends StatelessWidget { children: [ SizedBox( width: MediaQuery.of(context).size.width * 0.45, child: "${appState.getAuthenticatedUser()!.firstName} ${appState.getAuthenticatedUser()!.lastName}".toText18(isBold: true)), - "Policy: ${insuranceCardDetailsModel.insurancePolicyNo}".needTranslation.toText12(isBold: true, color: AppColors.lightGrayColor), + LocaleKeys.policyNumber.tr(namedArgs: {'number': insuranceCardDetailsModel.insurancePolicyNo ?? ''}, context: context).toText12(isBold: true, color: AppColors.lightGrayColor), ], ), AppCustomChipWidget( icon: isInsuranceExpired ? AppAssets.cancel_circle_icon : AppAssets.insurance_active_icon, - labelText: isInsuranceExpired ? "Insurance Expired".needTranslation : "Insurance Active".needTranslation, + labelText: isInsuranceExpired ? LocaleKeys.insuranceExpired.tr(context: context) : LocaleKeys.insuranceActive.tr(context: context), iconColor: isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor, textColor: isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor, iconSize: 12, @@ -78,7 +78,7 @@ class PatientInsuranceCard extends StatelessWidget { labelText: "${LocaleKeys.expiryDate.tr(context: context)} ${DateUtil.formatDateToDate(DateUtil.convertStringToDate(insuranceCardDetailsModel.cardValidTo), false)}", labelPadding: EdgeInsetsDirectional.only(start: -4.h, end: 8.h), ), - AppCustomChipWidget(labelText: "Patient Card ID: ${insuranceCardDetailsModel.patientCardID}".needTranslation), + AppCustomChipWidget(labelText: LocaleKeys.patientCardID.tr(namedArgs: {'id': insuranceCardDetailsModel.patientCardID ?? ''}, context: context)), ], ), SizedBox(height: 10.h), diff --git a/lib/presentation/lab/lab_order_by_test.dart b/lib/presentation/lab/lab_order_by_test.dart index 837f482..2e4a96b 100644 --- a/lib/presentation/lab/lab_order_by_test.dart +++ b/lib/presentation/lab/lab_order_by_test.dart @@ -44,7 +44,7 @@ class LabOrderByTest extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppCustomChipWidget( - richText: '${"Last Tested:".needTranslation} ${DateUtil.formatDateToDate(DateUtil.convertStringToDate(tests!.createdOn), false)}'.toText12(fontWeight: FontWeight.w500), + richText: '${"${LocaleKeys.lastTested.tr(context: context)}:"} ${DateUtil.formatDateToDate(DateUtil.convertStringToDate(tests!.createdOn), false)}'.toText12(fontWeight: FontWeight.w500), backgroundColor: AppColors.greyLightColor, textColor: AppColors.textColor, ), diff --git a/lib/presentation/lab/lab_orders_page.dart b/lib/presentation/lab/lab_orders_page.dart index 90651f1..799f574 100644 --- a/lib/presentation/lab/lab_orders_page.dart +++ b/lib/presentation/lab/lab_orders_page.dart @@ -1 +1 @@ -import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.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/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/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/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart'; import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_toolbar.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; import 'alphabeticScroll.dart'; class LabOrdersPage extends StatefulWidget { const LabOrdersPage({super.key}); @override State createState() => _LabOrdersPageState(); } class _LabOrdersPageState extends State { late LabViewModel labProvider; late DateRangeSelectorRangeViewModel rangeViewModel; late AppState _appState; List?> labSuggestions = []; int? expandedIndex; String? selectedFilterText = ''; int activeIndex = 0; @override void initState() { scheduleMicrotask(() { labProvider.initLabProvider(); }); super.initState(); } @override Widget build(BuildContext context) { labProvider = Provider.of(context, listen: false); rangeViewModel = Provider.of(context); _appState = getIt(); return CollapsingToolbar( title: LocaleKeys.labResults.tr(), search: () async { final lavVM = Provider.of(context, listen: false); if (lavVM.isLabOrdersLoading) { return; } else { String? value = await Navigator.of(context).push( CustomPageRoute( page: SearchLabResultsContent(labSuggestionsList: lavVM.labSuggestions), fullScreenDialog: true, direction: AxisDirection.down, ), ); if (value != null) { selectedFilterText = value; lavVM.filterLabReports(value); } } }, child: Consumer( builder: (context, model, child) { return SingleChildScrollView( physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.all(24.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Expanded( child: CustomTabBar( activeTextColor: Color(0xffED1C2B), activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), tabs: [ CustomTabBarModel(null, "By Visit".needTranslation), CustomTabBarModel(null, "By Test".needTranslation), // CustomTabBarModel(null, "Completed".needTranslation), ], onTabChange: (index) { activeIndex = index; setState(() {}); }, ), ), ], ), if (activeIndex == 0) Padding( padding: EdgeInsets.symmetric(vertical: 10.h), child: Row( children: [ CustomButton( text: LocaleKeys.byClinic.tr(context: context), onPressed: () { model.setIsSortByClinic(true); }, backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, fontSize: 12, fontWeight: FontWeight.w500, borderRadius: 10, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), SizedBox(width: 8.h), CustomButton( text: LocaleKeys.byHospital.tr(context: context), onPressed: () { model.setIsSortByClinic(false); }, backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, borderColor: model.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, fontSize: 12, fontWeight: FontWeight.w500, borderRadius: 10, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), ], ), ), SizedBox(height: 8.h), selectedFilterText!.isNotEmpty ? CustomChipWidget( chipText: selectedFilterText!, chipType: ChipTypeEnum.alert, isSelected: true, ) : SizedBox(), activeIndex == 0 ? // By Visit - show grouped view when available model.isLabOrdersLoading ? ListView.builder( shrinkWrap: true, physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: 5, itemBuilder: (context, index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, ), ) : (model.patientLabOrdersViewList.isNotEmpty ? ListView.builder( shrinkWrap: true, physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: model.patientLabOrdersViewList.length, itemBuilder: (context, index) { final group = model.patientLabOrdersViewList[index]; final isExpanded = expandedIndex == index; return AnimationConfiguration.staggeredList( position: index, duration: const Duration(milliseconds: 500), child: SlideAnimation( verticalOffset: 100.0, child: FadeInAnimation( child: AnimatedContainer( duration: Duration(milliseconds: 300), curve: Curves.easeInOut, margin: EdgeInsets.symmetric(vertical: 8.h), decoration: RoundedRectangleBorder() .toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), child: InkWell( onTap: () { setState(() { expandedIndex = isExpanded ? null : index; }); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.all(16.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppCustomChipWidget(labelText: "${group.length} ${'results'.needTranslation}"), Icon(isExpanded ? Icons.expand_less : Icons.expand_more), ], ), SizedBox(height: 8.h), Text( model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown'), style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis, ), ], ), ), AnimatedSwitcher( duration: Duration(milliseconds: 500), switchInCurve: Curves.easeIn, switchOutCurve: Curves.easeOut, transitionBuilder: (Widget child, Animation animation) { return FadeTransition( opacity: animation, child: SizeTransition( sizeFactor: animation, axisAlignment: 0.0, child: child, ), ); }, child: isExpanded ? Container( key: ValueKey(index), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ ...group.map((order) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisSize: MainAxisSize.min, children: [ Image.network( order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", width: 24.w, height: 24.h, fit: BoxFit.cover, ).circle(100), SizedBox(width: 8.h), Expanded(child: (order.doctorName ?? order.doctorNameEnglish ?? "").toString().toText14(weight: FontWeight.w500)), ], ), SizedBox(height: 8.h), Wrap( direction: Axis.horizontal, spacing: 4.h, runSpacing: 4.h, children: [ AppCustomChipWidget( labelText: ("Order No: ".needTranslation + order.orderNo!), ), AppCustomChipWidget( labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), ), AppCustomChipWidget( labelText: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""), ), ], ), // Row( // children: [ // CustomButton( // text: ("Order No: ".needTranslation + order.orderNo!), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // SizedBox(width: 8.h), // CustomButton( // text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // ], // ), // SizedBox(height: 8.h), // Row( // children: [ // CustomButton( // text: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // ], // ), SizedBox(height: 12.h), Row( children: [ Expanded(flex: 2, child: SizedBox()), // Expanded( // flex: 1, // child: Container( // height: 40.h, // width: 40.w, // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( // color: AppColors.textColor, // borderRadius: 12, // ), // child: Padding( // padding: EdgeInsets.all(12.h), // child: Transform.flip( // flipX: _appState.isArabic(), // child: Utils.buildSvgWithAssets( // icon: AppAssets.forward_arrow_icon_small, // iconColor: AppColors.whiteColor, // fit: BoxFit.contain, // ), // ), // ), // ).onPress(() { // model.currentlySelectedPatientOrder = order; // labProvider.getPatientLabResultByHospital(order); // labProvider.getPatientSpecialResult(order); // Navigator.of(context).push( // CustomPageRoute(page: LabResultByClinic(labOrder: order)), // ); // }), // ) Expanded( flex:2, child: CustomButton( icon: AppAssets.view_report_icon, iconColor: AppColors.primaryRedColor, iconSize: 16.h, text: "View Results".needTranslation, onPressed: () { model.currentlySelectedPatientOrder = order; labProvider.getPatientLabResultByHospital(order); labProvider.getPatientSpecialResult(order); Navigator.of(context).push( CustomPageRoute(page: LabResultByClinic(labOrder: order)), ); }, backgroundColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor, textColor: AppColors.primaryRedColor, fontSize: 14, fontWeight: FontWeight.w500, borderRadius: 12, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), ) ], ), SizedBox(height: 12.h), Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), SizedBox(height: 12.h), ], ); }).toList(), ], ), ) : SizedBox.shrink(), ), ], ), ), ), ), )); }, ) : Utils.getNoDataWidget(context, noDataText: "You don't have any lab results yet.".needTranslation)) : // By Test or other tabs keep existing behavior (model.isLabOrdersLoading) ? Column( children: List.generate( 5, (index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, )), ) : AlphabeticScroll( alpahbetsAvailable: model.indexedCharacterForUniqueTest, details: model.uniqueTestsList, labViewModel: model, rangeViewModel: rangeViewModel, appState: _appState, ) ], ) ); }, ), ); } Color getLabOrderStatusColor(num status) { switch (status) { case 44: return AppColors.warningColorYellow; case 45: return AppColors.warningColorYellow; case 16: return AppColors.successColor; case 17: return AppColors.successColor; default: return AppColors.greyColor; } } String getLabOrderStatusText(num status) { switch (status) { case 44: return LocaleKeys.resultsPending.tr(context: context); case 45: return LocaleKeys.resultsPending.tr(context: context); case 16: return LocaleKeys.resultsAvailable.tr(context: context); case 17: return LocaleKeys.resultsAvailable.tr(context: context); default: return ""; } } getLabSuggestions(LabViewModel model) { if (model.patientLabOrders.isEmpty) { return []; } return model.patientLabOrders.map((m) => m.testDetails).toList(); } } \ No newline at end of file +import 'dart:async'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.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/core/enums.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/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/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/patient_lab_orders_response_model.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart'; import 'package:hmg_patient_app_new/presentation/lab/search_lab_report.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_toolbar.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/chip/custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart'; import 'package:hmg_patient_app_new/widgets/date_range_selector/viewmodel/date_range_view_model.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:provider/provider.dart'; import 'alphabeticScroll.dart'; class LabOrdersPage extends StatefulWidget { const LabOrdersPage({super.key}); @override State createState() => _LabOrdersPageState(); } class _LabOrdersPageState extends State { late LabViewModel labProvider; late DateRangeSelectorRangeViewModel rangeViewModel; late AppState _appState; List?> labSuggestions = []; int? expandedIndex; String? selectedFilterText = ''; int activeIndex = 0; @override void initState() { scheduleMicrotask(() { labProvider.initLabProvider(); }); super.initState(); } @override Widget build(BuildContext context) { labProvider = Provider.of(context, listen: false); rangeViewModel = Provider.of(context); _appState = getIt(); return CollapsingToolbar( title: LocaleKeys.labResults.tr(), search: () async { final lavVM = Provider.of(context, listen: false); if (lavVM.isLabOrdersLoading) { return; } else { String? value = await Navigator.of(context).push( CustomPageRoute( page: SearchLabResultsContent(labSuggestionsList: lavVM.labSuggestions), fullScreenDialog: true, direction: AxisDirection.down, ), ); if (value != null) { selectedFilterText = value; lavVM.filterLabReports(value); } } }, child: Consumer( builder: (context, model, child) { return SingleChildScrollView( physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.all(24.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Expanded( child: CustomTabBar( activeTextColor: Color(0xffED1C2B), activeBackgroundColor: Color(0xffED1C2B).withValues(alpha: .1), tabs: [ CustomTabBarModel(null, LocaleKeys.byVisit.tr()), CustomTabBarModel(null, LocaleKeys.byTest.tr()), // CustomTabBarModel(null, "Completed".needTranslation), ], onTabChange: (index) { activeIndex = index; setState(() {}); }, ), ), ], ), if (activeIndex == 0) Padding( padding: EdgeInsets.symmetric(vertical: 10.h), child: Row( children: [ CustomButton( text: LocaleKeys.byClinic.tr(context: context), onPressed: () { model.setIsSortByClinic(true); }, backgroundColor: model.isSortByClinic ? AppColors.bgRedLightColor : AppColors.whiteColor, borderColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.textColor.withValues(alpha: 0.2), textColor: model.isSortByClinic ? AppColors.primaryRedColor : AppColors.blackColor, fontSize: 12, fontWeight: FontWeight.w500, borderRadius: 10, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), SizedBox(width: 8.h), CustomButton( text: LocaleKeys.byHospital.tr(context: context), onPressed: () { model.setIsSortByClinic(false); }, backgroundColor: model.isSortByClinic ? AppColors.whiteColor : AppColors.bgRedLightColor, borderColor: model.isSortByClinic ? AppColors.textColor.withValues(alpha: 0.2) : AppColors.primaryRedColor, textColor: model.isSortByClinic ? AppColors.blackColor : AppColors.primaryRedColor, fontSize: 12, fontWeight: FontWeight.w500, borderRadius: 10, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), ], ), ), SizedBox(height: 8.h), selectedFilterText!.isNotEmpty ? CustomChipWidget( chipText: selectedFilterText!, chipType: ChipTypeEnum.alert, isSelected: true, ) : SizedBox(), activeIndex == 0 ? // By Visit - show grouped view when available model.isLabOrdersLoading ? ListView.builder( shrinkWrap: true, physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: 5, itemBuilder: (context, index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, ), ) : (model.patientLabOrdersViewList.isNotEmpty ? ListView.builder( shrinkWrap: true, physics: AlwaysScrollableScrollPhysics(), padding: EdgeInsets.zero, itemCount: model.patientLabOrdersViewList.length, itemBuilder: (context, index) { final group = model.patientLabOrdersViewList[index]; final isExpanded = expandedIndex == index; return AnimationConfiguration.staggeredList( position: index, duration: const Duration(milliseconds: 500), child: SlideAnimation( verticalOffset: 100.0, child: FadeInAnimation( child: AnimatedContainer( duration: Duration(milliseconds: 300), curve: Curves.easeInOut, margin: EdgeInsets.symmetric(vertical: 8.h), decoration: RoundedRectangleBorder() .toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 20.h, hasShadow: true), child: InkWell( onTap: () { setState(() { expandedIndex = isExpanded ? null : index; }); }, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.all(16.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ AppCustomChipWidget(labelText: "${group.length} ${LocaleKeys.results.tr(context: context)}"), Icon(isExpanded ? Icons.expand_less : Icons.expand_more), ], ), SizedBox(height: 8.h), Text( model.isSortByClinic ? (group.first.clinicDescription ?? 'Unknown') : (group.first.projectName ?? 'Unknown'), style: TextStyle(fontSize: 16.h, fontWeight: FontWeight.w600), overflow: TextOverflow.ellipsis, ), ], ), ), AnimatedSwitcher( duration: Duration(milliseconds: 500), switchInCurve: Curves.easeIn, switchOutCurve: Curves.easeOut, transitionBuilder: (Widget child, Animation animation) { return FadeTransition( opacity: animation, child: SizeTransition( sizeFactor: animation, axisAlignment: 0.0, child: child, ), ); }, child: isExpanded ? Container( key: ValueKey(index), padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 0.h), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ ...group.map((order) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisSize: MainAxisSize.min, children: [ Image.network( order.doctorImageURL ?? "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", width: 24.w, height: 24.h, fit: BoxFit.cover, ).circle(100), SizedBox(width: 8.h), Expanded(child: (order.doctorName ?? order.doctorNameEnglish ?? "").toString().toText14(weight: FontWeight.w500)), ], ), SizedBox(height: 8.h), Wrap( direction: Axis.horizontal, spacing: 4.h, runSpacing: 4.h, children: [ AppCustomChipWidget( labelText: ("${LocaleKeys.orderNo.tr()}: ${order.orderNo!}"), ), AppCustomChipWidget( labelText: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), ), AppCustomChipWidget( labelText: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""), ), ], ), // Row( // children: [ // CustomButton( // text: ("Order No: ".needTranslation + order.orderNo!), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // SizedBox(width: 8.h), // CustomButton( // text: DateUtil.formatDateToDate(DateUtil.convertStringToDate(order.orderDate ?? ""), false), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // ], // ), // SizedBox(height: 8.h), // Row( // children: [ // CustomButton( // text: model.isSortByClinic ? (order.clinicDescription ?? "") : (order.projectName ?? ""), // onPressed: () {}, // backgroundColor: AppColors.greyColor, // borderColor: AppColors.greyColor, // textColor: AppColors.blackColor, // fontSize: 10, // fontWeight: FontWeight.w500, // borderRadius: 8, // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), // height: 24.h, // ), // ], // ), SizedBox(height: 12.h), Row( children: [ Expanded(flex: 2, child: SizedBox()), // Expanded( // flex: 1, // child: Container( // height: 40.h, // width: 40.w, // decoration: RoundedRectangleBorder().toSmoothCornerDecoration( // color: AppColors.textColor, // borderRadius: 12, // ), // child: Padding( // padding: EdgeInsets.all(12.h), // child: Transform.flip( // flipX: _appState.isArabic(), // child: Utils.buildSvgWithAssets( // icon: AppAssets.forward_arrow_icon_small, // iconColor: AppColors.whiteColor, // fit: BoxFit.contain, // ), // ), // ), // ).onPress(() { // model.currentlySelectedPatientOrder = order; // labProvider.getPatientLabResultByHospital(order); // labProvider.getPatientSpecialResult(order); // Navigator.of(context).push( // CustomPageRoute(page: LabResultByClinic(labOrder: order)), // ); // }), // ) Expanded( flex:2, child: CustomButton( icon: AppAssets.view_report_icon, iconColor: AppColors.primaryRedColor, iconSize: 16.h, text: LocaleKeys.viewResults.tr(context: context), onPressed: () { model.currentlySelectedPatientOrder = order; labProvider.getPatientLabResultByHospital(order); labProvider.getPatientSpecialResult(order); Navigator.of(context).push( CustomPageRoute(page: LabResultByClinic(labOrder: order)), ); }, backgroundColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor, textColor: AppColors.primaryRedColor, fontSize: 14, fontWeight: FontWeight.w500, borderRadius: 12, padding: EdgeInsets.fromLTRB(10, 0, 10, 0), height: 40.h, ), ) ], ), SizedBox(height: 12.h), Divider(color: AppColors.borderOnlyColor.withValues(alpha: 0.05), height: 1.h), SizedBox(height: 12.h), ], ); }), ], ), ) : SizedBox.shrink(), ), ], ), ), ), ), )); }, ) : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noLabResults.tr(context: context))) : // By Test or other tabs keep existing behavior (model.isLabOrdersLoading) ? Column( children: List.generate( 5, (index) => LabResultItemView( onTap: () {}, labOrder: null, index: index, isLoading: true, )), ) : AlphabeticScroll( alpahbetsAvailable: model.indexedCharacterForUniqueTest, details: model.uniqueTestsList, labViewModel: model, rangeViewModel: rangeViewModel, appState: _appState, ) ], ) ); }, ), ); } Color getLabOrderStatusColor(num status) { switch (status) { case 44: return AppColors.warningColorYellow; case 45: return AppColors.warningColorYellow; case 16: return AppColors.successColor; case 17: return AppColors.successColor; default: return AppColors.greyColor; } } String getLabOrderStatusText(num status) { switch (status) { case 44: return LocaleKeys.resultsPending.tr(context: context); case 45: return LocaleKeys.resultsPending.tr(context: context); case 16: return LocaleKeys.resultsAvailable.tr(context: context); case 17: return LocaleKeys.resultsAvailable.tr(context: context); default: return ""; } } getLabSuggestions(LabViewModel model) { if (model.patientLabOrders.isEmpty) { return []; } return model.patientLabOrders.map((m) => m.testDetails).toList(); } } \ No newline at end of file diff --git a/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart b/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart index ad4a032..50fd1f1 100644 --- a/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart +++ b/lib/presentation/lab/lab_result_via_clinic/LabResultByClinic.dart @@ -89,9 +89,9 @@ class LabResultByClinic extends StatelessWidget { hasShadow: true, ), child: CustomButton( - text: "Download report".needTranslation, + text: LocaleKeys.downloadReport.tr(context: context), onPressed: () async { - LoaderBottomSheet.showLoader(loadingText: "Generating report, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.generatingReport.tr(context: context)); await labViewModel .getLabResultReportPDF( labOrder: labOrder, @@ -114,7 +114,7 @@ class LabResultByClinic extends StatelessWidget { } catch (ex) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Cannot open file".needTranslation), + child: Utils.getErrorWidget(loadingText: "Cannot open file"), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/lab/lab_result_via_clinic/LabResultList.dart b/lib/presentation/lab/lab_result_via_clinic/LabResultList.dart index 3f05443..6caa4a5 100644 --- a/lib/presentation/lab/lab_result_via_clinic/LabResultList.dart +++ b/lib/presentation/lab/lab_result_via_clinic/LabResultList.dart @@ -1,8 +1,10 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/lab/models/resp_models/lab_result.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart'; import 'package:provider/provider.dart' show Selector, Provider, ReadContext; @@ -17,8 +19,7 @@ class LabResultList extends StatelessWidget { builder: (__, list, ___) { if (list.isEmpty && context.read().labSpecialResult.isEmpty) { return Utils.getNoDataWidget(context, - noDataText: "You don't have any lab results yet." - .needTranslation); + noDataText: LocaleKeys.noLabResults.tr(context: context)); } else { return ListView.builder( physics: NeverScrollableScrollPhysics(), diff --git a/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart b/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart index c6841b3..e332066 100644 --- a/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart +++ b/lib/presentation/lab/lab_result_via_clinic/lab_order_result_item.dart @@ -71,7 +71,7 @@ class LabOrderResultItem extends StatelessWidget { child: Visibility( visible: tests?.referanceRange != null, child: Text( - "(Reference range: ${tests?.referanceRange})".needTranslation, + "(${LocaleKeys.referenceRange.tr(context: context)}: ${tests?.referanceRange})", style: TextStyle( fontSize: 12.f, fontWeight: FontWeight.w500, diff --git a/lib/presentation/lab/lab_results/lab_result_details.dart b/lib/presentation/lab/lab_results/lab_result_details.dart index 1d54e06..eb39fef 100644 --- a/lib/presentation/lab/lab_results/lab_result_details.dart +++ b/lib/presentation/lab/lab_results/lab_result_details.dart @@ -32,7 +32,7 @@ class LabResultDetails extends StatelessWidget { @override Widget build(BuildContext context) { return CollapsingListView( - title: 'Lab Result Details'.needTranslation, + title: LocaleKeys.labResultDetails.tr(context: context), child: SingleChildScrollView( child: Column( spacing: 16.h, @@ -89,7 +89,7 @@ class LabResultDetails extends StatelessWidget { ], ), SizedBox(height: 4.h), - ("Result of ${recentLabResult.verifiedOn ?? ""}".needTranslation).toText11(weight: FontWeight.w500, color: AppColors.greyTextColor), + ("${LocaleKeys.resultOf.tr(context: context)} ${recentLabResult.verifiedOn ?? ""}").toText11(weight: FontWeight.w500, color: AppColors.greyTextColor), ], ), Row( @@ -116,7 +116,7 @@ class LabResultDetails extends StatelessWidget { Visibility( visible: recentLabResult.referanceRange != null, child: Text( - "Reference range: \n${recentLabResult.referanceRange!.trim()}".needTranslation, + "${LocaleKeys.referenceRange.tr(context: context)}: \n${recentLabResult.referanceRange!.trim()}", style: TextStyle( fontSize: 12.f, fontWeight: FontWeight.w500, @@ -261,13 +261,15 @@ class LabResultDetails extends StatelessWidget { leftLabelFormatter: (value) { value = double.parse(value.toStringAsFixed(1)); // return leftLabels(value.toStringAsFixed(2)); - if(value == labmodel.highRefrenceValue) - return leftLabels("High".needTranslation); + if (value == labmodel.highRefrenceValue) { + return leftLabels(LocaleKeys.high.tr()); + } - if(value== labmodel.lowRefenceValue) - return leftLabels("Low".needTranslation); + if (value == labmodel.lowRefenceValue) { + return leftLabels(LocaleKeys.low.tr()); + } - return SizedBox.shrink(); + return SizedBox.shrink(); // } }, graphColor:AppColors.blackColor, @@ -366,8 +368,7 @@ class LabResultDetails extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, spacing: 8.h, children: [ - "What is this result?" - .needTranslation + LocaleKeys.whatIsThisResult.tr(context: context) .toText16(weight: FontWeight.w600, color: AppColors.textColor), testDescription?.toText12( fontWeight: FontWeight.w500, color: AppColors.textColorLight) ?? diff --git a/lib/presentation/medical_file/eye_measurement_details_page.dart b/lib/presentation/medical_file/eye_measurement_details_page.dart index 0662cb1..0822609 100644 --- a/lib/presentation/medical_file/eye_measurement_details_page.dart +++ b/lib/presentation/medical_file/eye_measurement_details_page.dart @@ -96,7 +96,7 @@ class EyeMeasurementDetailsPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.leftEye.tr().needTranslation.toText14(isBold: true), + LocaleKeys.leftEye.tr().toText14(isBold: true), SizedBox(height: 16.h), getRow(LocaleKeys.sphere.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].leftEyeSpherical}', '-'), getRow(LocaleKeys.cylinder.tr(), '${patientAppointmentHistoryResponseModel.listHISGetGlassPrescription![0].leftEyeCylinder}', '-'), @@ -139,7 +139,7 @@ class EyeMeasurementDetailsPage extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - LocaleKeys.leftEye.tr().needTranslation.toText14(isBold: true), + LocaleKeys.leftEye.tr().toText14(isBold: true), SizedBox(height: 16.h), getRow(LocaleKeys.brand.tr(), '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![1].brand}', ''), getRow('B.C', '${patientAppointmentHistoryResponseModel.listHISGetContactLensPrescription![1].baseCurve}', ''), diff --git a/lib/presentation/medical_file/eye_measurements_appointments_page.dart b/lib/presentation/medical_file/eye_measurements_appointments_page.dart index 3b82ad4..d8438ba 100644 --- a/lib/presentation/medical_file/eye_measurements_appointments_page.dart +++ b/lib/presentation/medical_file/eye_measurements_appointments_page.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; @@ -7,6 +8,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -75,7 +77,7 @@ class EyeMeasurementsAppointmentsPage extends StatelessWidget { ), ), ) - : Utils.getNoDataWidget(context, noDataText: "No Ophthalmology appointments found...".needTranslation); + : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noOphthalmologyAppointments.tr(context: context)); }, separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), ), diff --git a/lib/presentation/medical_file/medical_file_page.dart b/lib/presentation/medical_file/medical_file_page.dart index c6ff85f..ad2461f 100644 --- a/lib/presentation/medical_file/medical_file_page.dart +++ b/lib/presentation/medical_file/medical_file_page.dart @@ -195,8 +195,8 @@ class _MedicalFilePageState extends State { ).withHorizontalPadding(24.w).onPress(() { DialogService dialogService = getIt.get(); dialogService.showFamilyBottomSheetWithoutH( - label: "Family Files".needTranslation, - message: "This clinic or doctor is only available for the below eligible profiles.".needTranslation, + label: LocaleKeys.familyTitle.tr(context: context), + message: "", onSwitchPress: (FamilyFileResponseModelLists profile) { medicalFileViewModel.switchFamilyFiles(responseID: profile.responseId, patientID: profile.patientId, phoneNumber: profile.mobileNumber); }, @@ -289,7 +289,7 @@ class _MedicalFilePageState extends State { Consumer(builder: (context, insuranceVM, child) { return AppCustomChipWidget( icon: insuranceVM.isInsuranceExpired ? AppAssets.cancel_circle_icon : AppAssets.insurance_active_icon, - labelText: insuranceVM.isInsuranceExpired ? "Insurance Expired".needTranslation : "Insurance Active".needTranslation, + labelText: insuranceVM.isInsuranceExpired ? LocaleKeys.insuranceExpired.tr(context: context) : LocaleKeys.insuranceActive.tr(context: context), iconColor: insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor, textColor: insuranceVM.isInsuranceExpired ? AppColors.primaryRedColor : AppColors.successColor, iconSize: 12.w, @@ -316,7 +316,7 @@ class _MedicalFilePageState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Vital Signs".needTranslation.toText16(weight: FontWeight.w500, letterSpacing: -0.2), + LocaleKeys.vitalSigns.tr(context: context).toText16(weight: FontWeight.w500, letterSpacing: -0.2), Row( children: [ LocaleKeys.viewAll.tr().toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), @@ -359,7 +359,7 @@ class _MedicalFilePageState extends State { children: [ Utils.buildSvgWithAssets(icon: AppAssets.call_for_vitals, width: 32.h, height: 32.h), SizedBox(height: 12.h), - "No vital signs recorded yet".needTranslation.toText12(isCenter: true), + LocaleKeys.noVitalSignsRecordedYet.tr().toText12(isCenter: true), ], ), ), @@ -417,20 +417,20 @@ class _MedicalFilePageState extends State { }), SizedBox(height: 16.h), - TextInputWidget( - labelText: LocaleKeys.search.tr(context: context), - hintText: "Type any record".needTranslation, - controller: TextEditingController(), - keyboardType: TextInputType.number, - isEnable: true, - prefix: null, - autoFocus: false, - isBorderAllowed: false, - isAllowLeadingIcon: true, - padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 8.h), - leadingIcon: AppAssets.search_icon, - hintColor: AppColors.textColor, - ).paddingSymmetrical(24.w, 0.0), + // TextInputWidget( + // labelText: LocaleKeys.search.tr(context: context), + // hintText: "Type any record".needTranslation, + // controller: TextEditingController(), + // keyboardType: TextInputType.number, + // isEnable: true, + // prefix: null, + // autoFocus: false, + // isBorderAllowed: false, + // isAllowLeadingIcon: true, + // padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 8.h), + // leadingIcon: AppAssets.search_icon, + // hintColor: AppColors.textColor, + // ).paddingSymmetrical(24.w, 0.0), SizedBox(height: 16.h), // Using CustomExpandableList CustomExpandableList( @@ -547,7 +547,7 @@ class _MedicalFilePageState extends State { onSuccess: (dynamic respData) async { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( - title: "Pick a Date".needTranslation, + title: LocaleKeys.pickADate.tr(context: context), context, child: AppointmentCalendar(), isFullScreen: false, @@ -577,7 +577,7 @@ class _MedicalFilePageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Appointments & visits".needTranslation.toText16(weight: FontWeight.w500, letterSpacing: -0.2), + LocaleKeys.appointmentsAndVisits.tr().toText16(weight: FontWeight.w500, letterSpacing: -0.2), Row( children: [ LocaleKeys.viewAll.tr().toText12(color: AppColors.primaryRedColor, fontWeight: FontWeight.w500), @@ -615,7 +615,7 @@ class _MedicalFilePageState extends State { children: [ Utils.buildSvgWithAssets(icon: AppAssets.home_calendar_icon, width: 32.h, height: 32.h), SizedBox(height: 12.h), - "You do not have any appointments. Please book an appointment".needTranslation.toText12(isCenter: true), + LocaleKeys.noUpcomingAppointmentPleaseBook.tr(context: context).toText12(isCenter: true), SizedBox(height: 12.h), CustomButton( text: LocaleKeys.bookAppo.tr(context: context), @@ -662,7 +662,7 @@ class _MedicalFilePageState extends State { openDoctorScheduleCalendar(myAppointmentsVM.patientAppointmentsHistoryList[index]); }, onAskDoctorTap: () async { - LoaderBottomSheet.showLoader(loadingText: "Checking doctor availability...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingDoctorAvailability.tr(context: context)); await myAppointmentsViewModel.isDoctorAvailable( projectID: myAppointmentsVM.patientAppointmentsHistoryList[index].projectID, doctorId: myAppointmentsVM.patientAppointmentsHistoryList[index].doctorID, @@ -687,7 +687,6 @@ class _MedicalFilePageState extends State { }); } else { LoaderBottomSheet.hideLoader(); - print("Doctor is not available"); } }, onError: (_) { @@ -705,7 +704,7 @@ class _MedicalFilePageState extends State { ).paddingSymmetrical(0.w, 0.h); }), SizedBox(height: 10.h), - "Lab & Radiology".needTranslation.toText16(weight: FontWeight.w500, letterSpacing: -0.2), + LocaleKeys.labAndRadiology.tr().toText16(weight: FontWeight.w500, letterSpacing: -0.2), SizedBox(height: 16.h), Row( children: [ @@ -728,7 +727,7 @@ class _MedicalFilePageState extends State { Expanded( child: LabRadCard( icon: AppAssets.radiology_icon, - labelText: "${LocaleKeys.radiology.tr(context: context)} Results".needTranslation, + labelText: "${LocaleKeys.radiology.tr(context: context)} ${LocaleKeys.results.tr(context: context)}", // labOrderTests: ["Complete blood count", "Creatinine", "Blood Sugar", // labOrderTests: ["Chest X-ray", "Abdominal Ultrasound", "Dental X-ray"], labOrderTests: [], @@ -744,7 +743,7 @@ class _MedicalFilePageState extends State { ], ).paddingSymmetrical(0.w, 0.h), SizedBox(height: 24.h), - "Active Medications & Prescriptions".needTranslation.toText16(weight: FontWeight.w500, letterSpacing: -0.2), + LocaleKeys.activeMedicationsAndPrescriptions.tr().toText16(weight: FontWeight.w500, letterSpacing: -0.2), SizedBox(height: 16.h), Consumer(builder: (context, prescriptionVM, child) { return prescriptionVM.isPrescriptionsOrdersLoading @@ -836,7 +835,7 @@ class _MedicalFilePageState extends State { children: [ Expanded( child: CustomButton( - text: "All Prescriptions".needTranslation, + text: LocaleKeys.allPrescriptions.tr(context: context), onPressed: () { Navigator.of(context).push( CustomPageRoute( @@ -859,7 +858,7 @@ class _MedicalFilePageState extends State { SizedBox(width: 6.w), Expanded( child: CustomButton( - text: "All Medications".needTranslation, + text: LocaleKeys.allMedications.tr(context: context), onPressed: () {}, backgroundColor: AppColors.secondaryLightRedColor, borderColor: AppColors.secondaryLightRedColor, @@ -887,7 +886,7 @@ class _MedicalFilePageState extends State { ), child: Utils.getNoDataWidget( context, - noDataText: "You don't have any prescriptions yet.".needTranslation, + noDataText: LocaleKeys.youDontHaveAnyPrescriptionsYet.tr(context: context), isSmallWidget: true, width: 62.w, height: 62.h, @@ -945,7 +944,7 @@ class _MedicalFilePageState extends State { ), child: Utils.getNoDataWidget( context, - noDataText: "You don't have any completed visits yet".needTranslation, + noDataText: LocaleKeys.youDontHaveAnyCompletedVisitsYet.tr(context: context), isSmallWidget: true, width: 62.w, height: 62.h, @@ -1017,7 +1016,7 @@ class _MedicalFilePageState extends State { ).paddingSymmetrical(0.w, 0); }), SizedBox(height: 24.h), - "Others".needTranslation.toText16(weight: FontWeight.w500, letterSpacing: -0.2), + LocaleKeys.others.tr(context: context).toText16(weight: FontWeight.w500, letterSpacing: -0.2), SizedBox(height: 16.h), GridView( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( @@ -1031,7 +1030,7 @@ class _MedicalFilePageState extends State { shrinkWrap: true, children: [ MedicalFileCard( - label: "Eye Test Results".needTranslation, + label: LocaleKeys.eyeMeasurements.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.eye_result_icon, @@ -1048,7 +1047,7 @@ class _MedicalFilePageState extends State { ); }), MedicalFileCard( - label: "Allergy Info".needTranslation, + label: LocaleKeys.allergyInfo.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.allergy_info_icon, @@ -1063,7 +1062,7 @@ class _MedicalFilePageState extends State { ); }), MedicalFileCard( - label: "Vaccine Info".needTranslation, + label: LocaleKeys.vaccineInfo.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.vaccine_info_icon, @@ -1108,7 +1107,7 @@ class _MedicalFilePageState extends State { ), child: Utils.getNoDataWidget( context, - noDataText: "You don't have insurance registered with HMG.".needTranslation, + noDataText: LocaleKeys.noInsuranceWithHMG.tr(context: context), isSmallWidget: true, width: 62.w, height: 62.h, @@ -1153,7 +1152,7 @@ class _MedicalFilePageState extends State { shrinkWrap: true, children: [ MedicalFileCard( - label: "Update Insurance".needTranslation, + label: LocaleKeys.updateInsuranceInfo.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.update_insurance_icon, @@ -1177,7 +1176,7 @@ class _MedicalFilePageState extends State { ); }), MedicalFileCard( - label: "My Invoices List".needTranslation, + label: LocaleKeys.myInvoicesList.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.invoices_list_icon, @@ -1191,7 +1190,7 @@ class _MedicalFilePageState extends State { ); }), MedicalFileCard( - label: "Ancillary Orders List".needTranslation, + label: LocaleKeys.ancillaryOrdersList.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.ancillary_orders_list_icon, @@ -1232,7 +1231,7 @@ class _MedicalFilePageState extends State { ), child: Utils.getNoDataWidget( context, - noDataText: "You don't have any sick leaves yet.".needTranslation, + noDataText: LocaleKeys.youDontHaveAnySickLeavesYet.tr(context: context), isSmallWidget: true, width: 62.w, height: 62.h, @@ -1267,7 +1266,7 @@ class _MedicalFilePageState extends State { ); }), MedicalFileCard( - label: "Medical Reports".needTranslation, + label: LocaleKeys.medicalReports.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.medical_reports_icon, @@ -1283,7 +1282,7 @@ class _MedicalFilePageState extends State { ); }), MedicalFileCard( - label: "Sick Leave Report".needTranslation, + label: LocaleKeys.sickLeaveReport.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.sick_leave_report_icon, @@ -1308,7 +1307,7 @@ class _MedicalFilePageState extends State { children: [ Row( children: [ - "Health Trackers".needTranslation.toText16(weight: FontWeight.w500, color: AppColors.textColor), + LocaleKeys.healthTrackers.tr(context: context).toText16(weight: FontWeight.w500, color: AppColors.textColor), ], ), SizedBox(height: 16.h), @@ -1324,7 +1323,7 @@ class _MedicalFilePageState extends State { shrinkWrap: true, children: [ MedicalFileCard( - label: "Blood Sugar".needTranslation, + label: LocaleKeys.bloodSugar.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.blood_sugar_icon, @@ -1332,7 +1331,7 @@ class _MedicalFilePageState extends State { iconSize: 36.w, ).onPress(() => context.navigateWithName(AppRoutes.healthTrackerDetailPage, arguments: HealthTrackerTypeEnum.bloodSugar)), MedicalFileCard( - label: "Blood Pressure".needTranslation, + label: LocaleKeys.bloodPressure.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.lab_result_icon, @@ -1340,7 +1339,7 @@ class _MedicalFilePageState extends State { iconSize: 36.w, ).onPress(() => context.navigateWithName(AppRoutes.healthTrackerDetailPage, arguments: HealthTrackerTypeEnum.bloodPressure)), MedicalFileCard( - label: "Weight Tracker".needTranslation, + label: LocaleKeys.weightTracker.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.weight_tracker_icon, @@ -1352,7 +1351,7 @@ class _MedicalFilePageState extends State { SizedBox(height: 16.h), Row( children: [ - "Others".needTranslation.toText16(weight: FontWeight.w500, color: AppColors.textColor), + LocaleKeys.others.tr().toText16(weight: FontWeight.w500, color: AppColors.textColor), ], ), SizedBox(height: 16.h), @@ -1368,21 +1367,21 @@ class _MedicalFilePageState extends State { shrinkWrap: true, children: [ MedicalFileCard( - label: "Ask Your Doctor".needTranslation, + label: LocaleKeys.askYourDoctor.tr(context: context), textColor: AppColors.blackColor, backgroundColor: AppColors.whiteColor, svgIcon: AppAssets.ask_doctor_medical_file_icon, isLargeText: true, iconSize: 36.w, ).onPress(() {}), - MedicalFileCard( - label: "Internet Pairing".needTranslation, - textColor: AppColors.blackColor, - backgroundColor: AppColors.whiteColor, - svgIcon: AppAssets.internet_pairing_icon, - isLargeText: true, - iconSize: 36.w, - ).onPress(() {}), + // MedicalFileCard( + // label: LocaleKeys.internetPairing.tr(context: context), + // textColor: AppColors.blackColor, + // backgroundColor: AppColors.whiteColor, + // svgIcon: AppAssets.internet_pairing_icon, + // isLargeText: true, + // iconSize: 36.w, + // ).onPress(() {}), ], ).paddingSymmetrical(0.w, 0.0), SizedBox(height: 24.h), diff --git a/lib/presentation/medical_file/patient_sickleaves_list_page.dart b/lib/presentation/medical_file/patient_sickleaves_list_page.dart index ef5aaeb..fcdb12e 100644 --- a/lib/presentation/medical_file/patient_sickleaves_list_page.dart +++ b/lib/presentation/medical_file/patient_sickleaves_list_page.dart @@ -245,7 +245,7 @@ class _PatientSickleavesListPageState extends State { Expanded( flex: 6, child: CustomButton( - text: "Download Report".needTranslation, + text: LocaleKeys.downloadReport.tr(context: context), onPressed: () async { LoaderBottomSheet.showLoader(); await medicalFileViewModel.getPatientSickLeavePDF(sickLeave, appState.getAuthenticatedUser()!).then((val) async { @@ -293,7 +293,7 @@ class _PatientSickleavesListPageState extends State { ), ), ) - : Utils.getNoDataWidget(context, noDataText: "You don't have any sick leaves yet.".needTranslation); + : Utils.getNoDataWidget(context, noDataText: LocaleKeys.youDontHaveAnySickLeavesYet.tr(context: context)); }, ).paddingSymmetrical(24.h, 0.h), ], diff --git a/lib/presentation/medical_file/vaccine_list_page.dart b/lib/presentation/medical_file/vaccine_list_page.dart index 777426f..bf02cb7 100644 --- a/lib/presentation/medical_file/vaccine_list_page.dart +++ b/lib/presentation/medical_file/vaccine_list_page.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -9,6 +10,7 @@ import 'package:hmg_patient_app_new/core/utils/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/features/medical_file/medical_file_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:provider/provider.dart'; @@ -40,7 +42,7 @@ class _VaccineListPageState extends State { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "Vaccine Info".needTranslation, + title: LocaleKeys.vaccineInfo.tr(context: context), child: SingleChildScrollView( child: Consumer(builder: (context, medicalFileVM, child) { return Column( @@ -170,7 +172,7 @@ class _VaccineListPageState extends State { ), ), ) - : Utils.getNoDataWidget(context, noDataText: "No vaccines data found...".needTranslation); + : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noDataAvailable.tr(context: context)); }, separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), ), diff --git a/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart b/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart index fbe79bb..3d3624d 100644 --- a/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart +++ b/lib/presentation/medical_file/widgets/medical_file_appointment_card.dart @@ -183,7 +183,7 @@ class MedicalFileAppointmentCard extends StatelessWidget { iconSize: 16.h, ) : CustomButton( - text: "Rebook".needTranslation, + text: LocaleKeys.rebook.tr(context: context), onPressed: () { onRescheduleTap(); }, diff --git a/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart b/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart index 6f9b8b5..16c05d8 100644 --- a/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart +++ b/lib/presentation/medical_file/widgets/patient_sick_leave_card.dart @@ -94,7 +94,7 @@ class PatientSickLeaveCard extends StatelessWidget { : Expanded( flex: 6, child: CustomButton( - text: "Download Report".needTranslation, + text: LocaleKeys.downloadReport.tr(context: context), onPressed: () async { LoaderBottomSheet.showLoader(); await medicalFileViewModel.getPatientSickLeavePDF(patientSickLeavesResponseModel, _appState.getAuthenticatedUser()!).then((val) async { @@ -106,7 +106,7 @@ class PatientSickLeaveCard extends StatelessWidget { } catch (ex) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Cannot open file".needTranslation), + child: Utils.getErrorWidget(loadingText: "Cannot open file"), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/medical_report/medical_report_request_page.dart b/lib/presentation/medical_report/medical_report_request_page.dart index 8eabcdd..47a2df3 100644 --- a/lib/presentation/medical_report/medical_report_request_page.dart +++ b/lib/presentation/medical_report/medical_report_request_page.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; @@ -6,6 +7,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/book_appointments/book_appointments_view_model.dart'; import 'package:hmg_patient_app_new/features/medical_file/medical_file_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/appointments/widgets/appointment_card.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -20,7 +22,7 @@ class MedicalReportRequestPage extends StatelessWidget { Widget build(BuildContext context) { medicalFileViewModel = Provider.of(context, listen: false); return CollapsingListView( - title: "Medical Reports".needTranslation, + title: LocaleKeys.medicalReports.tr(context: context), isClose: true, child: Column( children: [ diff --git a/lib/presentation/medical_report/medical_reports_page.dart b/lib/presentation/medical_report/medical_reports_page.dart index f6d7576..87420fd 100644 --- a/lib/presentation/medical_report/medical_reports_page.dart +++ b/lib/presentation/medical_report/medical_reports_page.dart @@ -44,7 +44,7 @@ class _MedicalReportsPageState extends State { children: [ Expanded( child: CollapsingListView( - title: "Medical Reports".needTranslation, + title: LocaleKeys.medicalReports.tr(context: context), child: SingleChildScrollView( child: Consumer(builder: (context, medicalFileVM, child) { return Column( @@ -88,7 +88,7 @@ class _MedicalReportsPageState extends State { Row( children: [ CustomButton( - text: "Requested".needTranslation, + text: LocaleKeys.requested.tr(context: context), onPressed: () { setState(() { expandedIndex = null; @@ -300,7 +300,7 @@ class _MedicalReportsPageState extends State { Expanded( flex: 6, child: CustomButton( - text: "Download Report".needTranslation, + text: LocaleKeys.downloadReport.tr(context: context), onPressed: () async { LoaderBottomSheet.showLoader(); await medicalFileViewModel.getPatientMedicalReportPDF(report, appState.getAuthenticatedUser()!).then((val) async { @@ -348,7 +348,7 @@ class _MedicalReportsPageState extends State { ), ), ) - : Utils.getNoDataWidget(context, noDataText: "You don't have any medical reports yet.".needTranslation) + : Utils.getNoDataWidget(context, noDataText: LocaleKeys.youDontHaveAnyMedicalReportsYet.tr(context: context)) .paddingSymmetrical(24.h, 24.h); }, ).paddingSymmetrical(24.h, 0.h), @@ -366,7 +366,7 @@ class _MedicalReportsPageState extends State { hasShadow: true, ), child: CustomButton( - text: "Request medical report".needTranslation, + text: LocaleKeys.requestMedicalReport.tr(context: context), onPressed: () async { LoaderBottomSheet.showLoader(); await medicalFileViewModel.getPatientMedicalReportAppointmentsList(onSuccess: (val) async { @@ -385,7 +385,7 @@ class _MedicalReportsPageState extends State { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "You do not have any appointments to request a medical report.".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.youDoNotHaveAnyAppointmentsToRequestMedicalReport.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -414,7 +414,7 @@ class _MedicalReportsPageState extends State { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: "Are you sure you want to request a medical report for this appointment?".needTranslation, + loadingText: LocaleKeys.areYouSureYouWantToRequestMedicalReport.tr(context: context), isShowActionButtons: true, onCancelTap: () { Navigator.pop(context); @@ -425,7 +425,7 @@ class _MedicalReportsPageState extends State { await medicalFileViewModel.insertRequestForMedicalReport(onSuccess: (val) { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight(context, - child: Utils.getSuccessWidget(loadingText: "Your medical report request has been successfully submitted.".needTranslation), + child: Utils.getSuccessWidget(loadingText: LocaleKeys.yourMedicalReportRequestSubmittedSuccessfully.tr(context: context)), callBackFunc: () { medicalFileViewModel.setIsPatientMedicalReportsLoading(true); medicalFileViewModel.onMedicalReportTabChange(0); diff --git a/lib/presentation/medical_report/widgets/patient_medical_report_card.dart b/lib/presentation/medical_report/widgets/patient_medical_report_card.dart index 413858d..282a2d6 100644 --- a/lib/presentation/medical_report/widgets/patient_medical_report_card.dart +++ b/lib/presentation/medical_report/widgets/patient_medical_report_card.dart @@ -144,7 +144,7 @@ class PatientMedicalReportCard extends StatelessWidget { } catch (ex) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Cannot open file".needTranslation), + child: Utils.getErrorWidget(loadingText: "Cannot open file"), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/monthly_report/monthly_report.dart b/lib/presentation/monthly_report/monthly_report.dart index 1776510..474863b 100644 --- a/lib/presentation/monthly_report/monthly_report.dart +++ b/lib/presentation/monthly_report/monthly_report.dart @@ -95,10 +95,7 @@ class MonthlyReport extends StatelessWidget { Utils.buildSvgWithAssets(icon: AppAssets.prescription_remarks_icon, width: 18.w, height: 18.h), SizedBox(width: 9.h), Expanded( - child: - "This monthly health summary report reflects the health indicators and analysis results of the latest visits. Please note that this will be sent automatically from the system and it’s not considered as a official report so no medical decision should be taken based on it" - .needTranslation - .toText10(weight: FontWeight.w500, color: AppColors.greyTextColorLight), + child: LocaleKeys.monthlyHealthSummaryReportDisclaimer.tr(context: context).toText10(weight: FontWeight.w500, color: AppColors.greyTextColorLight), ), ], ), @@ -146,7 +143,7 @@ class MonthlyReport extends StatelessWidget { CustomButton( text: LocaleKeys.save.tr(), onPressed: () async { - LoaderBottomSheet.showLoader(loadingText: "Updating Monthly Report Status...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.updatingMonthlyReportStatus.tr(context: context)); await monthlyReportVM.updatePatientHealthSummaryReport( rSummaryReport: monthlyReportVM.isHealthSummaryEnabled, onSuccess: (response) async { @@ -157,7 +154,7 @@ class MonthlyReport extends StatelessWidget { ); showCommonBottomSheetWithoutHeight( context, - child: Utils.getSuccessWidget(loadingText: "Monthly Report Status Updated Successfully".needTranslation), + child: Utils.getSuccessWidget(loadingText: LocaleKeys.monthlyReportStatusUpdatedSuccessfully.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/monthly_reports/monthly_reports_page.dart b/lib/presentation/monthly_reports/monthly_reports_page.dart deleted file mode 100644 index d1a4d0c..0000000 --- a/lib/presentation/monthly_reports/monthly_reports_page.dart +++ /dev/null @@ -1,310 +0,0 @@ -import 'package:easy_localization/easy_localization.dart'; -import 'package:flutter/material.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/monthly_reports/monthly_reports_view_model.dart'; -import 'package:hmg_patient_app_new/presentation/monthly_reports/user_agreement_page.dart'; -import 'package:provider/provider.dart'; - -import '../../generated/locale_keys.g.dart'; -import '../../theme/colors.dart'; -import '../../widgets/appbar/app_bar_widget.dart'; -import '../../widgets/input_widget.dart'; -import '../../widgets/loader/bottomsheet_loader.dart'; - -class MonthlyReportsPage extends StatefulWidget { - const MonthlyReportsPage({super.key}); - - @override - State createState() => _MonthlyReportsPageState(); -} - -class _MonthlyReportsPageState extends State { - bool isHealthSummaryEnabled = false; - bool isTermsAccepted = false; - - final TextEditingController emailController = TextEditingController(); - - @override - void dispose() { - emailController.dispose(); - super.dispose(); - } - - void _showError(String message) { - ScaffoldMessenger.of(context).hideCurrentSnackBar(); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(message), - behavior: SnackBarBehavior.floating, - ), - ); - } - - void _showSuccessSnackBar() { - ScaffoldMessenger.of(context).hideCurrentSnackBar(); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - "Successfully updated".needTranslation, - style: const TextStyle( - color: AppColors.whiteColor, - fontWeight: FontWeight.w600, - ), - ), - behavior: SnackBarBehavior.floating, - backgroundColor: AppColors.textGreenColor, - duration: const Duration(seconds: 2), - ), - ); - } - - Future _onSavePressed() async { - if (!isTermsAccepted) { - _showError("Please accept the terms and conditions".needTranslation); - return; - } - - final email = emailController.text.trim(); - if (email.isEmpty) { - _showError("Please enter your email".needTranslation); - return; - } - - final vm = context.read(); - - // LoaderBottomSheet.showLoader(); - final ok = await vm.saveMonthlyReport(email: email); - // LoaderBottomSheet.hideLoader(); - - if (ok) { - setState(() => isHealthSummaryEnabled = true); - _showSuccessSnackBar(); - } else { - // _showError("Failed to update".needTranslation); - } - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: AppColors.scaffoldBgColor, - appBar: CustomAppBar( - onBackPressed: () => Navigator.of(context).pop(), - onLanguageChanged: (_) {}, - hideLogoAndLang: true, - ), - body: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "Monthly Reports".needTranslation, - style: TextStyle( - color: AppColors.textColor, - fontSize: 27.f, - fontWeight: FontWeight.w600, - ), - ), - SizedBox(height: 16.h), - - Container( - padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 8.h), - height: 54.h, - alignment: Alignment.center, - decoration: RoundedRectangleBorder().toSmoothCornerDecoration( - color: AppColors.whiteColor, - borderRadius: (12.r), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Patient Health Summary Report".needTranslation, - style: TextStyle( - color: AppColors.textColor, - fontSize: 14.f, - fontWeight: FontWeight.w600, - ), - ), - _buildToggle(), - ], - ), - ), - - SizedBox(height: 16.h), - - TextInputWidget( - controller: emailController, - labelText: "Eamil*".needTranslation, - hintText: "email@email.com", - isEnable: true, - prefix: null, - isAllowRadius: true, - isBorderAllowed: false, - isAllowLeadingIcon: true, - autoFocus: true, - keyboardType: TextInputType.emailAddress, - padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 8.h), - onChange: (value) { - setState(() {}); - }, - ).paddingOnly(top: 8.h, bottom: 8.h), - - Row( - children: [ - Text( - "To View The Terms and Conditions".needTranslation, - style: TextStyle( - color: AppColors.textColor, - fontSize: 14.f, - fontWeight: FontWeight.w600, - ), - ), - InkWell( - child: Text( - "Click here".needTranslation, - style: TextStyle( - color: AppColors.primaryRedColor, - fontSize: 14.f, - fontWeight: FontWeight.w600, - ), - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (_) => const UserAgreementPage(), - ), - ); - }, - ), - ], - ), - - SizedBox(height: 12.h), - - GestureDetector( - onTap: () => setState(() => isTermsAccepted = !isTermsAccepted), - child: Row( - children: [ - AnimatedContainer( - duration: const Duration(milliseconds: 200), - height: 24.h, - width: 24.h, - decoration: BoxDecoration( - color: isTermsAccepted - ? AppColors.textGreenColor - : Colors.transparent, - borderRadius: BorderRadius.circular(6), - border: Border.all( - color: isTermsAccepted - ? AppColors.lightGreenColor - : AppColors.greyColor, - width: 2.h, - ), - ), - child: isTermsAccepted - ? Icon(Icons.check, size: 16.f, color: AppColors.whiteColor,) - : null, - ), - SizedBox(width: 12.h), - Text( - "I agree to the terms and conditions".needTranslation, - style: context.dynamicTextStyle( - fontSize: 12.f, - fontWeight: FontWeight.w500, - color: AppColors.textColor, - ), - ), - ], - ), - ), - - SizedBox(height: 12.h), - - Text( - "This monthly Health Summary Report reflects the health indicators and analysis results of the latest visits. Please note that this will be sent automatically from the system and it's not considered as an official report so no medical decisions should be taken based on it" - .needTranslation, - style: TextStyle( - color: AppColors.textColor, - fontSize: 10.f, - fontWeight: FontWeight.w600, - ), - ), - - SizedBox(height: 12.h), - - Image.asset('assets/images/jpg/report.jpg'), - - SizedBox(height: 16.h), - - Row( - children: [ - Expanded( - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: AppColors.successColor, - foregroundColor: AppColors.whiteColor, - elevation: 0, - padding: const EdgeInsets.symmetric(vertical: 14), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(12), - ), - ), - onPressed: _onSavePressed, - child: Text( - LocaleKeys.save.tr(), - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 16.f, - ), - ), - ), - ), - ], - ), - ], - ), - ).paddingAll(16), - ); - } - - Widget _buildToggle() { - final value = isHealthSummaryEnabled; - - return AbsorbPointer( - absorbing: true, - child: AnimatedContainer( - duration: const Duration(milliseconds: 200), - width: 50.h, - height: 28.h, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: value - ? AppColors.lightGreenColor - : AppColors.greyColor.withOpacity(0.3), - ), - child: AnimatedAlign( - duration: const Duration(milliseconds: 200), - alignment: value ? Alignment.centerRight : Alignment.centerLeft, - child: Padding( - padding: const EdgeInsets.all(3), - child: Container( - width: 22.h, - height: 22.h, - decoration: BoxDecoration( - shape: BoxShape.circle, - color: value - ? AppColors.textGreenColor - : AppColors.greyTextColor, - ), - ), - ), - ), - ), - ); - } -} diff --git a/lib/presentation/monthly_reports/user_agreement_page.dart b/lib/presentation/monthly_reports/user_agreement_page.dart deleted file mode 100644 index 73ea564..0000000 --- a/lib/presentation/monthly_reports/user_agreement_page.dart +++ /dev/null @@ -1,117 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; -import 'package:hmg_patient_app_new/features/monthly_reports/terms_conditions_view_model.dart'; -import 'package:provider/provider.dart'; -import 'package:webview_flutter/webview_flutter.dart'; - -import '../../theme/colors.dart'; -import '../../widgets/appbar/app_bar_widget.dart'; - -class UserAgreementPage extends StatefulWidget { - const UserAgreementPage({super.key}); - - @override - State createState() => _UserAgreementPageState(); -} - -class _UserAgreementPageState extends State { - late final WebViewController _webViewController; - bool _isLoading = true; - String? _errorMessage; - - @override - void initState() { - super.initState(); - - _webViewController = WebViewController() - ..setJavaScriptMode(JavaScriptMode.unrestricted) - ..setBackgroundColor(const Color(0x00000000)) - ..setNavigationDelegate( - NavigationDelegate( - onPageStarted: (_) { - setState(() { - _isLoading = true; - }); - }, - onPageFinished: (_) { - setState(() { - _isLoading = false; - }); - }, - onWebResourceError: (error) { - }, - ), - ); - - WidgetsBinding.instance.addPostFrameCallback((_) { - final vm = - Provider.of(context, listen: false); - - vm.getTermsConditions( - onSuccess: () { - final htmlString = vm.termsConditionsHtml ?? ''; - - if (htmlString.isNotEmpty) { - setState(() { - _errorMessage = null; - _isLoading = true; - }); - _webViewController.loadHtmlString(htmlString); - } else { - setState(() { - _isLoading = false; - _errorMessage = 'لا توجد شروط متاحة حالياً'.needTranslation; - }); - } - }, - onError: (msg) { - setState(() { - _isLoading = false; - _errorMessage = msg; - }); - }, - ); - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: AppColors.scaffoldBgColor, - appBar: CustomAppBar( - onBackPressed: () => Navigator.of(context).pop(), - onLanguageChanged: (_) {}, - hideLogoAndLang: true, - ), - body: Stack( - children: [ - WebViewWidget(controller: _webViewController), - - if (_errorMessage != null) - Center( - child: Container( - margin: const EdgeInsets.all(16), - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: AppColors.whiteColor, - borderRadius: BorderRadius.circular(8), - ), - child: Text( - _errorMessage!, - textAlign: TextAlign.center, - style: TextStyle( - color: AppColors.primaryRedColor, - fontWeight: FontWeight.w600, - ), - ), - ), - ), - if (_isLoading) - const Center( - child: CircularProgressIndicator(), - ), - ], - ), - ); - } -} diff --git a/lib/presentation/my_family/my_family.dart b/lib/presentation/my_family/my_family.dart index 07f1a4f..b16c587 100644 --- a/lib/presentation/my_family/my_family.dart +++ b/lib/presentation/my_family/my_family.dart @@ -50,7 +50,7 @@ class _FamilyMedicalScreenState extends State { AppState appState = getIt.get(); return CollapsingListView( - title: "Medical Files".needTranslation, + title: LocaleKeys.medicalFiles.tr(context: context), bottomChild: appState.getAuthenticatedUser()!.isParentUser! ? Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( @@ -59,13 +59,13 @@ class _FamilyMedicalScreenState extends State { ), padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 20.h), child: CustomButton( - text: "Add a new family member".needTranslation, + text: LocaleKeys.addANewFamilyMember.tr(context: context), onPressed: () { DialogService dialogService = getIt.get(); medicalVM!.clearAuthValues(); dialogService.showAddFamilyFileSheet( - label: "Add Family Member".needTranslation, - message: "Please fill the below field to add a new family member to your profile".needTranslation, + label: LocaleKeys.addFamilyMember.tr(context: context), + message: LocaleKeys.pleaseFillBelowFieldToAddNewFamilyMember.tr(context: context), onVerificationPress: () { medicalVM!.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); }); diff --git a/lib/presentation/my_family/widget/family_cards.dart b/lib/presentation/my_family/widget/family_cards.dart index 3621cc3..675da18 100644 --- a/lib/presentation/my_family/widget/family_cards.dart +++ b/lib/presentation/my_family/widget/family_cards.dart @@ -54,12 +54,10 @@ class _FamilyCardsState extends State { children: [ Utils.buildSvgWithAssets(icon: AppAssets.alertSquare), SizedBox(width: 8.h), - "Who can view my medical file ?" - .needTranslation - .toText14(color: AppColors.textColor, isUnderLine: true, weight: FontWeight.w500) + LocaleKeys.whoCanViewMyMedicalFile.tr(context: context).toText14(color: AppColors.textColor, isUnderLine: true, weight: FontWeight.w500) .onPress(() { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: "Manage Family".needTranslation, + label: LocaleKeys.manageFiles.tr(context: context), message: "", child: manageFamily(), onOkPressed: () {}, @@ -213,7 +211,7 @@ class _FamilyCardsState extends State { onPressed: () { if (canSwitch) widget.onSelect(profile); }, - text: isActive ? "Active".needTranslation : "Switch".needTranslation, + text: isActive ? LocaleKeys.active.tr(context: context) : LocaleKeys.switchLogin.tr(context: context), backgroundColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor, borderColor: isActive || !canSwitch ? Colors.grey.shade200 : AppColors.secondaryLightRedColor, textColor: isActive || !canSwitch ? AppColors.greyTextColor : AppColors.primaryRedColor, @@ -309,7 +307,7 @@ class _FamilyCardsState extends State { height: 30.h, chipType: ChipTypeEnum.alert, backgroundColor: AppColors.lightGrayBGColor, - chipText: "Medical File: ${profile.patientId ?? "N/A".needTranslation}", + chipText: "${LocaleKeys.medicalFile.tr(context: context)}: ${profile.patientId ?? "N/A"}", iconAsset: null, isShowBorder: false, borderRadius: 8.h, @@ -364,26 +362,26 @@ class _FamilyCardsState extends State { switch (status) { case FamilyFileEnum.active: if (isRequestFromMySide) { - return "${status.displayName} your request to be your family member".needTranslation; + return LocaleKeys.acceptedYourRequestToBeYourFamilyMember.tr(namedArgs: {'status': status.displayName}, context: context); } else { - return "can view your file".needTranslation; + return LocaleKeys.canViewYourFile.tr(context: context); } case FamilyFileEnum.pending: if (isRequestFromMySide) { - return "has a request ${status.displayName} to be your family member".needTranslation; + return LocaleKeys.hasARequestPendingToBeYourFamilyMember.tr(namedArgs: {'status': status.displayName}, context: context); } else { - return "wants to add you as their family member".needTranslation; + return LocaleKeys.wantsToAddYouAsTheirFamilyMember.tr(context: context); } case FamilyFileEnum.rejected: if (isRequestFromMySide) { - return "${status.displayName} your request to be your family member".needTranslation; + return LocaleKeys.rejectedYourRequestToBeYourFamilyMember.tr(namedArgs: {'status': status.displayName}, context: context); } else { - return "${status.displayName} your family member request".needTranslation; + return LocaleKeys.rejectedYourFamilyMemberRequest.tr(namedArgs: {'status': status.displayName}, context: context); } case FamilyFileEnum.inactive: - return "Inactive".needTranslation; + return LocaleKeys.inactive.tr(context: context); default: - return "N/A".needTranslation; + return LocaleKeys.notAvailable.tr(context: context); } } } diff --git a/lib/presentation/my_family/widget/my_family_sheet.dart b/lib/presentation/my_family/widget/my_family_sheet.dart index d469ab2..50f1b2a 100644 --- a/lib/presentation/my_family/widget/my_family_sheet.dart +++ b/lib/presentation/my_family/widget/my_family_sheet.dart @@ -1,7 +1,9 @@ +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/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/medical_file/models/family_file_response_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/my_family/widget/family_cards.dart'; import 'package:hmg_patient_app_new/services/navigation_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -15,8 +17,8 @@ class MyFamilySheet { titleWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - 'Please select a profile'.needTranslation.toText21(isBold: true), - 'switch from the below list of medical file'.needTranslation.toText16(weight: FontWeight.w100, color: AppColors.greyTextColor), + LocaleKeys.selectAProfile.tr(context: context).toText21(isBold: true), + LocaleKeys.switchFamilyFile.tr(context: context).toText16(weight: FontWeight.w100, color: AppColors.greyTextColor), ], ), child: FamilyCards( diff --git a/lib/presentation/my_invoices/my_invoices_details_page.dart b/lib/presentation/my_invoices/my_invoices_details_page.dart index cccd671..a38194f 100644 --- a/lib/presentation/my_invoices/my_invoices_details_page.dart +++ b/lib/presentation/my_invoices/my_invoices_details_page.dart @@ -39,9 +39,9 @@ class _MyInvoicesDetailsPageState extends State { children: [ Expanded( child: CollapsingListView( - title: "Invoice Details".needTranslation, + title: LocaleKeys.invoiceDetails.tr(context: context), sendEmail: () async { - LoaderBottomSheet.showLoader(loadingText: "Sending email, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.sendingEmailPleaseWait.tr(context: context)); await myInvoicesViewModel.sendInvoiceEmail( appointmentNo: widget.getInvoiceDetailsResponseModel.appointmentNo!, projectID: widget.getInvoiceDetailsResponseModel.projectID!, @@ -49,7 +49,7 @@ class _MyInvoicesDetailsPageState extends State { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getSuccessWidget(loadingText: "Email sent successfully.".needTranslation), + child: Utils.getSuccessWidget(loadingText: LocaleKeys.emailSentSuccessfullyMessage.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -223,12 +223,12 @@ class _MyInvoicesDetailsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 24.h), - "Total Balance".needTranslation.toText18(isBold: true).paddingSymmetrical(24.h, 0.h), + LocaleKeys.totalBalance.tr(context: context).toText18(isBold: true).paddingSymmetrical(24.h, 0.h), SizedBox(height: 17.h), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Amount before tax".needTranslation.toText14(isBold: true), + LocaleKeys.amountBeforeTax.tr(context: context).toText14(isBold: true), Utils.getPaymentAmountWithSymbol(widget.getInvoiceDetailsResponseModel.listConsultation!.first.totalShare.toString().toText16(isBold: true), AppColors.blackColor, 13, isSaudiCurrency: true), ], @@ -236,7 +236,7 @@ class _MyInvoicesDetailsPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "VAT 15%".needTranslation.toText14(isBold: true, color: AppColors.greyTextColor), + LocaleKeys.vat15.tr(context: context).toText14(isBold: true, color: AppColors.greyTextColor), Utils.getPaymentAmountWithSymbol( widget.getInvoiceDetailsResponseModel.listConsultation!.first.totalVATAmount!.toString().toText14(isBold: true, color: AppColors.greyTextColor), AppColors.greyTextColor, 13, isSaudiCurrency: true), @@ -246,7 +246,7 @@ class _MyInvoicesDetailsPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Discount".needTranslation.toText14(isBold: true), + LocaleKeys.discount.tr(context: context).toText14(isBold: true), Utils.getPaymentAmountWithSymbol(widget.getInvoiceDetailsResponseModel.listConsultation!.first.discountAmount!.toString().toText14(isBold: true, color: AppColors.primaryRedColor), AppColors.primaryRedColor, 13, isSaudiCurrency: true), @@ -255,7 +255,7 @@ class _MyInvoicesDetailsPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Paid".needTranslation.toText14(isBold: true), + LocaleKeys.paid.tr(context: context).toText14(isBold: true), Utils.getPaymentAmountWithSymbol( widget.getInvoiceDetailsResponseModel.listConsultation!.first.grandTotal!.toString().toText14(isBold: true, color: AppColors.textColor), AppColors.textColor, 13, isSaudiCurrency: true), diff --git a/lib/presentation/my_invoices/my_invoices_list.dart b/lib/presentation/my_invoices/my_invoices_list.dart index ef1a9c2..9f969e8 100644 --- a/lib/presentation/my_invoices/my_invoices_list.dart +++ b/lib/presentation/my_invoices/my_invoices_list.dart @@ -77,7 +77,7 @@ class _MyInvoicesListState extends State { getInvoicesListResponseModel: myInvoicesVM.allInvoicesList[index], onTap: () async { myInvoicesVM.setInvoiceDetailLoading(); - LoaderBottomSheet.showLoader(loadingText: "Fetching invoice details, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingInvoiceDetails.tr(context: context)); await myInvoicesVM.getInvoiceDetails( appointmentNo: myInvoicesVM.allInvoicesList[index].appointmentNo!, invoiceNo: myInvoicesVM.allInvoicesList[index].invoiceNo!, diff --git a/lib/presentation/my_invoices/widgets/invoice_list_card.dart b/lib/presentation/my_invoices/widgets/invoice_list_card.dart index 27ca79a..4a328c5 100644 --- a/lib/presentation/my_invoices/widgets/invoice_list_card.dart +++ b/lib/presentation/my_invoices/widgets/invoice_list_card.dart @@ -1,3 +1,4 @@ +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_state.dart'; @@ -41,11 +42,11 @@ class InvoiceListCard extends StatelessWidget { AppCustomChipWidget( icon: AppAssets.walkin_appointment_icon, iconColor: AppColors.textColor, - labelText: 'Walk In'.needTranslation, + labelText: LocaleKeys.walkin.tr(context: context), textColor: AppColors.textColor, ), AppCustomChipWidget( - labelText: 'OutPatient'.needTranslation, + labelText: LocaleKeys.outPatient.tr(context: context), backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.1), textColor: AppColors.primaryRedColor, ), @@ -127,7 +128,7 @@ class InvoiceListCard extends StatelessWidget { ), SizedBox(height: 16.h), CustomButton( - text: "View invoice details".needTranslation, + text: LocaleKeys.viewInvoiceDetails.tr(context: context), onPressed: () { if (onTap != null) { onTap!(); diff --git a/lib/presentation/notifications/notifications_list_page.dart b/lib/presentation/notifications/notifications_list_page.dart index 99d4270..c9a93ff 100644 --- a/lib/presentation/notifications/notifications_list_page.dart +++ b/lib/presentation/notifications/notifications_list_page.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; @@ -6,6 +7,7 @@ import 'package:hmg_patient_app_new/extensions/int_extensions.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/notifications/notifications_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/lab/lab_result_item_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -17,7 +19,7 @@ class NotificationsListPage extends StatelessWidget { @override Widget build(BuildContext context) { return CollapsingListView( - title: "Notifications".needTranslation, + title: LocaleKeys.notifications.tr(context: context), child: SingleChildScrollView( child: Consumer(builder: (context, notificationsVM, child) { return Container( diff --git a/lib/presentation/onboarding/onboarding_screen.dart b/lib/presentation/onboarding/onboarding_screen.dart index a40a27b..bfcdc96 100644 --- a/lib/presentation/onboarding/onboarding_screen.dart +++ b/lib/presentation/onboarding/onboarding_screen.dart @@ -1,3 +1,4 @@ +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_state.dart'; @@ -6,6 +7,7 @@ import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/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/home/navigation_screen.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -67,13 +69,13 @@ class _OnboardingScreenState extends State { children: [ onboardingView( AppAnimations.onboarding_1, - "Booking appointment has never been easy".needTranslation, - "In few clicks find yourself having consultation with the doctor of your choice.".needTranslation, + LocaleKeys.onboardingHeading1.tr(context: context), + LocaleKeys.onboardingBody1.tr(context: context), ), onboardingView( AppAnimations.onboarding_2, - "Access the medical history on finger tips".needTranslation, - "Keep track on your medical history including labs, prescription, insurance, etc".needTranslation, + LocaleKeys.onboardingHeading2.tr(context: context), + LocaleKeys.onboardingBody2.tr(context: context), ), ], onPageChanged: (int index) { @@ -107,7 +109,7 @@ class _OnboardingScreenState extends State { transitionBuilder: (child, anim) => FadeTransition(opacity: anim, child: child), child: selectedIndex == 0 ? CustomButton( - text: "Skip".needTranslation, + text: LocaleKeys.skip.tr(context: context), onPressed: () => goToHomePage(), width: 86.w, height: 56.h, @@ -136,13 +138,13 @@ class _OnboardingScreenState extends State { iconSize: 32.w, width: 86.w, height: 56.h, - text: "".needTranslation, + text: "", backgroundColor: Colors.transparent, onPressed: () { pageController.animateToPage(1, duration: Duration(milliseconds: 400), curve: Curves.easeInOut); }) : CustomButton( - text: "Get Started".needTranslation, + text: LocaleKeys.getStarted.tr(context: context), fontWeight: FontWeight.w500, fontSize: 16.f, height: 56.h, diff --git a/lib/presentation/parking/paking_page.dart b/lib/presentation/parking/paking_page.dart index d9cc1d8..db451b2 100644 --- a/lib/presentation/parking/paking_page.dart +++ b/lib/presentation/parking/paking_page.dart @@ -1,9 +1,10 @@ - +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.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/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/parking/parking_slot.dart'; import 'package:provider/provider.dart'; @@ -85,7 +86,7 @@ class _ParkingPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Parking".needTranslation, + LocaleKeys.parking.tr(context: context), style: TextStyle( color: AppColors.textColor, fontSize: 27.f, @@ -100,22 +101,7 @@ class _ParkingPageState extends State { hasShadow: true, ), child: Padding( - padding: EdgeInsets.all(16.h), - child: Text( - "Dr. Sulaiman Al Habib hospital are conduction a test for the emerging corona" - " virus and issuing travel certificates 24/7 in a short time and with high accuracy." - " Those wishing to benefit from this service can visit one of Dr. Sulaiman Al Habib branches " - "to conduct a corona test within few minutes. Dr. Sulaiman Al Habib hospital are conduction" - " a test for the emerging corona virus and issuing travel certificates 24/7 in a short time and with high accuracy. " - "Those wishing to benefit from this service can visit one of Dr. Sulaiman Al Habib branches to conduct a corona test within few minutes.", - style: TextStyle( - color: AppColors.textColor, - fontSize: 12, - height: 1.4, - fontWeight: FontWeight.w500, - ), - ), - ), + padding: EdgeInsets.all(16.h), child: LocaleKeys.parkingDescription.tr(context: context).toText12(fontWeight: FontWeight.w500, color: AppColors.textColor)), ).paddingOnly(top: 16, bottom: 16), ], ), @@ -131,18 +117,16 @@ class _ParkingPageState extends State { ), child: Padding( padding: EdgeInsets.all(24.h), - child: SizedBox( - width: double.infinity, - height: 56, - child: CustomButton( - text: "Read Barcodes".needTranslation, - onPressed: () => _readQR(context), // always non-null - isDisabled: vm.isLoading, - backgroundColor: AppColors.primaryRedColor, - borderColor: AppColors.primaryRedColor, - fontSize: 18, - fontWeight: FontWeight.bold, - ), + child: CustomButton( + text: LocaleKeys.scanQRCode.tr(context: context), + onPressed: () => _readQR(context), + // always non-null + isDisabled: vm.isLoading, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + fontSize: 18.f, + height: 56.h, + fontWeight: FontWeight.bold, ), ), ), diff --git a/lib/presentation/parking/parking_slot.dart b/lib/presentation/parking/parking_slot.dart index 0eb3718..52ab181 100644 --- a/lib/presentation/parking/parking_slot.dart +++ b/lib/presentation/parking/parking_slot.dart @@ -1,10 +1,12 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.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/qr_parking/models/qr_parking_response_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import '../../features/qr_parking/qr_parking_view_model.dart'; import '../../theme/colors.dart'; import '../../widgets/appbar/app_bar_widget.dart'; @@ -157,7 +159,7 @@ class _ParkingSlotState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "Parking Slot Details".needTranslation, + LocaleKeys.parkingSlotDetails.tr(context: context), style: TextStyle( fontSize: 16.f, fontWeight: FontWeight.w600, @@ -170,16 +172,16 @@ class _ParkingSlotState extends State { runSpacing: 4, children: [ AppCustomChipWidget( - labelText: "Slot: ${widget.model.qRParkingCode ?? '-'}".needTranslation, + labelText: LocaleKeys.slotNumber.tr(namedArgs: {'code': widget.model.qRParkingCode ?? '-'}, context: context), ), AppCustomChipWidget( - labelText: "Basement: ${widget.model.floorDescription ?? '-'}".needTranslation, + labelText: LocaleKeys.basement.tr(namedArgs: {'description': widget.model.floorDescription ?? '-'}, context: context), ), AppCustomChipWidget( - labelText: "Date: ${_formatPrettyDate(widget.model.createdOn)}".needTranslation, + labelText: LocaleKeys.parkingDate.tr(namedArgs: {'date': _formatPrettyDate(widget.model.createdOn)}, context: context), ), AppCustomChipWidget( - labelText: "Parked Since: ${_formatPrettyTime(widget.model.createdOn)}".needTranslation, + labelText: LocaleKeys.parkedSince.tr(namedArgs: {'time': _formatPrettyTime(widget.model.createdOn)}, context: context), ), ], ), @@ -193,7 +195,7 @@ class _ParkingSlotState extends State { width: double.infinity, height: 48.h, child: CustomButton( - text: "Get Direction".needTranslation, + text: LocaleKeys.getDirections.tr(context: context), onPressed: _openDirection, backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, @@ -210,14 +212,14 @@ class _ParkingSlotState extends State { width: double.infinity, height: 48.h, child: CustomButton( - text: "Reset Direction".needTranslation, + text: LocaleKeys.resetDirection.tr(context: context), onPressed: _resetDirection, backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, textColor: AppColors.whiteColor, - fontSize: 18, + fontSize: 18.f, fontWeight: FontWeight.bold, - borderRadius: 10, + borderRadius: 10.r, ), ), ], diff --git a/lib/presentation/prescriptions/prescription_delivery_order_summary_page.dart b/lib/presentation/prescriptions/prescription_delivery_order_summary_page.dart index 0bedbe2..5a34034 100644 --- a/lib/presentation/prescriptions/prescription_delivery_order_summary_page.dart +++ b/lib/presentation/prescriptions/prescription_delivery_order_summary_page.dart @@ -118,7 +118,7 @@ class PrescriptionDeliveryOrderSummaryPage extends StatelessWidget { child: CustomButton( text: LocaleKeys.submit.tr(context: context), onPressed: () async { - LoaderBottomSheet.showLoader(loadingText: "Submitting your request..."); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.loadingText.tr(context: context)); await prescriptionsViewModel.submitPrescriptionDeliveryRequest( latitude: prescriptionsViewModel.locationGeocodeResponse.results.first.geometry.location.lat.toString(), longitude: prescriptionsViewModel.locationGeocodeResponse.results.first.geometry.location.lng.toString(), @@ -129,7 +129,7 @@ class PrescriptionDeliveryOrderSummaryPage extends StatelessWidget { LoaderBottomSheet.hideLoader(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getSuccessWidget(loadingText: "Request sent successfully.".needTranslation), + child: Utils.getSuccessWidget(loadingText: LocaleKeys.requestSubmittedSuccessfully.tr(context: context)), callBackFunc: () { Navigator.of(context).pop(); }, diff --git a/lib/presentation/prescriptions/prescription_delivery_orders_list_page.dart b/lib/presentation/prescriptions/prescription_delivery_orders_list_page.dart index e2ce865..7760fd2 100644 --- a/lib/presentation/prescriptions/prescription_delivery_orders_list_page.dart +++ b/lib/presentation/prescriptions/prescription_delivery_orders_list_page.dart @@ -88,7 +88,7 @@ class PrescriptionDeliveryOrdersListPage extends StatelessWidget { ), ), ) - : Utils.getNoDataWidget(context, noDataText: "You don't have any prescription orders yet.".needTranslation); + : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noPrescriptionOrdersYet.tr(context: context)); }, ).paddingSymmetrical(24.h, 0.h), ], diff --git a/lib/presentation/prescriptions/prescription_detail_page.dart b/lib/presentation/prescriptions/prescription_detail_page.dart index 1216c61..9b1ae6d 100644 --- a/lib/presentation/prescriptions/prescription_detail_page.dart +++ b/lib/presentation/prescriptions/prescription_detail_page.dart @@ -62,7 +62,7 @@ class _PrescriptionDetailPageState extends State { child: CollapsingListView( title: LocaleKeys.prescriptions.tr(context: context), instructions: () async { - LoaderBottomSheet.showLoader(loadingText: "Fetching prescription PDF, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionPDFPleaseWait.tr(context: context)); await prescriptionsViewModel.getPrescriptionInstructionsPDF(widget.prescriptionsResponseModel, onSuccess: (val) { LoaderBottomSheet.hideLoader(); if (prescriptionsViewModel.prescriptionInstructionsPDFLink.isNotEmpty) { @@ -71,7 +71,7 @@ class _PrescriptionDetailPageState extends State { } else { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Unable to fetch PDF".needTranslation), + child: Utils.getErrorWidget(loadingText: "Unable to fetch PDF"), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -136,7 +136,7 @@ class _PrescriptionDetailPageState extends State { AppCustomChipWidget( icon: AppAssets.rating_icon, iconColor: AppColors.ratingColorYellow, - labelText: "Rating: ${widget.prescriptionsResponseModel.decimalDoctorRate}".needTranslation, + labelText: LocaleKeys.ratingValue.tr(namedArgs: {'rating': widget.prescriptionsResponseModel.decimalDoctorRate.toString()}, context: context), ), AppCustomChipWidget( labelText: widget.prescriptionsResponseModel.name!, @@ -145,9 +145,9 @@ class _PrescriptionDetailPageState extends State { ), SizedBox(height: 16.h), CustomButton( - text: "Download Prescription".needTranslation, + text: LocaleKeys.downloadPrescription.tr(context: context), onPressed: () async { - LoaderBottomSheet.showLoader(loadingText: "Fetching prescription PDF, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionPDFPleaseWait.tr(context: context)); await prescriptionVM.getPrescriptionPDFBase64(widget.prescriptionsResponseModel).then((val) async { LoaderBottomSheet.hideLoader(); if (prescriptionVM.prescriptionPDFBase64Data.isNotEmpty) { @@ -157,7 +157,7 @@ class _PrescriptionDetailPageState extends State { } catch (ex) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Cannot open file".needTranslation), + child: Utils.getErrorWidget(loadingText: "Cannot open file"), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, @@ -221,7 +221,7 @@ class _PrescriptionDetailPageState extends State { : LocaleKeys.prescriptionDeliveryError.tr(context: context), onPressed: () async { if (widget.prescriptionsResponseModel.isHomeMedicineDeliverySupported!) { - LoaderBottomSheet.showLoader(loadingText: "Fetching prescription details...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context)); await prescriptionsViewModel.getPrescriptionDetails(widget.prescriptionsResponseModel, onSuccess: (val) { LoaderBottomSheet.hideLoader(); prescriptionsViewModel.initiatePrescriptionDelivery(); diff --git a/lib/presentation/prescriptions/prescription_reminder_view.dart b/lib/presentation/prescriptions/prescription_reminder_view.dart index 2f1154f..aab587d 100644 --- a/lib/presentation/prescriptions/prescription_reminder_view.dart +++ b/lib/presentation/prescriptions/prescription_reminder_view.dart @@ -54,7 +54,7 @@ class _PrescriptionReminderViewState extends State { ), child: RadioListTile( title: Text( - "${_options[index]} minutes before".needTranslation, + "${_options[index]} ${LocaleKeys.minute.tr(context: context)}", style: TextStyle( fontSize: 16.h, fontWeight: FontWeight.w500, diff --git a/lib/presentation/prescriptions/prescriptions_list_page.dart b/lib/presentation/prescriptions/prescriptions_list_page.dart index 8b60159..e2a862b 100644 --- a/lib/presentation/prescriptions/prescriptions_list_page.dart +++ b/lib/presentation/prescriptions/prescriptions_list_page.dart @@ -247,7 +247,7 @@ class _PrescriptionsListPageState extends State { : LocaleKeys.prescriptionDeliveryError.tr(context: context), onPressed: () async { if (prescription.isHomeMedicineDeliverySupported!) { - LoaderBottomSheet.showLoader(loadingText: "Fetching prescription details...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.fetchingPrescriptionDetails.tr(context: context)); await prescriptionsViewModel.getPrescriptionDetails(prescriptionsViewModel.patientPrescriptionOrders[index], onSuccess: (val) { LoaderBottomSheet.hideLoader(); @@ -322,7 +322,7 @@ class _PrescriptionsListPageState extends State { ), ), ) - : Utils.getNoDataWidget(context, noDataText: "You don't have any prescriptions yet.".needTranslation); + : Utils.getNoDataWidget(context, noDataText: LocaleKeys.youDontHaveAnyPrescriptionsYet.tr(context: context)); }, ).paddingSymmetrical(24.h, 0.h), ], diff --git a/lib/presentation/profile_settings/profile_settings.dart b/lib/presentation/profile_settings/profile_settings.dart index 1c16439..0bf7058 100644 --- a/lib/presentation/profile_settings/profile_settings.dart +++ b/lib/presentation/profile_settings/profile_settings.dart @@ -83,7 +83,7 @@ class ProfileSettingsState extends State { @override Widget build(BuildContext context) { return CollapsingListView( - title: "Profile & Settings".needTranslation, + title: LocaleKeys.profileAndSettings.tr(context: context), logout: () {}, isClose: true, child: SingleChildScrollView( @@ -114,8 +114,8 @@ class ProfileSettingsState extends State { onAddFamilyMemberPress: () { DialogService dialogService = getIt.get(); dialogService.showAddFamilyFileSheet( - label: "Add Family Member".needTranslation, - message: "Please fill the below field to add a new family member to your profile".needTranslation, + label: LocaleKeys.addFamilyMember.tr(), + message: LocaleKeys.pleaseFillBelowFieldToAddNewFamilyMember.tr(), onVerificationPress: () { medicalVm.addFamilyFile(otpTypeEnum: OTPTypeEnum.sms); }); @@ -149,7 +149,7 @@ class ProfileSettingsState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Utils.buildSvgWithAssets(icon: AppAssets.wallet, width: 40.w, height: 40.h), - "Habib Wallet".needTranslation.toText16(weight: FontWeight.w600, maxlines: 2).expanded, + LocaleKeys.habibWallet.tr(context: context).toText16(weight: FontWeight.w600, maxlines: 2).expanded, Utils.buildSvgWithAssets(icon: getIt.get().isArabic() ? AppAssets.arrow_back : AppAssets.arrow_forward), ], ), @@ -165,7 +165,7 @@ class ProfileSettingsState extends State { iconSize: 22.w, iconColor: AppColors.infoColor, textColor: AppColors.infoColor, - text: "Recharge".needTranslation, + text: LocaleKeys.recharge.tr(context: context), borderWidth: 0.w, fontWeight: FontWeight.w500, borderColor: Colors.transparent, @@ -183,9 +183,7 @@ class ProfileSettingsState extends State { ), ], ), - "Quick Actions" - .needTranslation - .toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1) + LocaleKeys.quickActions.tr(context: context).toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1) .paddingOnly(left: 24.w, right: 24.w), Container( margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h, bottom: 24.h), @@ -195,17 +193,15 @@ class ProfileSettingsState extends State { children: [ actionItem(AppAssets.language_change, LocaleKeys.language.tr(context: context), () { showCommonBottomSheetWithoutHeight(context, title: LocaleKeys.language.tr(context: context), child: AppLanguageChange(), callBackFunc: () {}, isFullScreen: false); - }, trailingLabel: Utils.appState.isArabic() ? "العربية".needTranslation : "English".needTranslation), + }, trailingLabel: Utils.appState.isArabic() ? "العربية" : "English"), 1.divider, - actionItem(AppAssets.bell, "Notifications Settings".needTranslation, () {}), + actionItem(AppAssets.bell, LocaleKeys.notificationsSettings.tr(context: context), () {}), 1.divider, - actionItem(AppAssets.touch_face_id, "Touch ID / Face ID Services".needTranslation, () {}, switchValue: true), + actionItem(AppAssets.touch_face_id, LocaleKeys.touchIDFaceIDServices.tr(), () {}, switchValue: true), ], ), ), - "Personal Information" - .needTranslation - .toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1) + LocaleKeys.personalInformation.tr().toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1) .paddingOnly(left: 24.w, right: 24.w), Container( margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h, bottom: 24.h), @@ -213,7 +209,7 @@ class ProfileSettingsState extends State { decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.r, hasShadow: true), child: Column( children: [ - actionItem(AppAssets.email_transparent, "Update Email Address".needTranslation, () {}), + actionItem(AppAssets.email_transparent, LocaleKeys.updateEmailAddress.tr(), () {}), // 1.divider, // actionItem(AppAssets.smart_phone_fill, "Phone Number".needTranslation, () {}), // 1.divider, @@ -223,9 +219,7 @@ class ProfileSettingsState extends State { ], ), ), - "Help & Support" - .needTranslation - .toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1) + LocaleKeys.helpAndSupport.tr().toText18(weight: FontWeight.w600, textOverflow: TextOverflow.ellipsis, maxlines: 1) .paddingOnly(left: 24.w, right: 24.w), Container( margin: EdgeInsets.only(left: 24.w, right: 24.w, top: 16.h), @@ -237,9 +231,9 @@ class ProfileSettingsState extends State { launchUrl(Uri.parse("tel://" + "+966 11 525 9999")); }, trailingLabel: "011 525 9999"), 1.divider, - actionItem(AppAssets.permission, "Permissions".needTranslation, () {}, trailingLabel: "Location, Camera"), + actionItem(AppAssets.permission, LocaleKeys.permissions.tr(), () {}, trailingLabel: "Location, Camera"), 1.divider, - actionItem(AppAssets.rate, "Rate Our App".needTranslation, () { + actionItem(AppAssets.rate, LocaleKeys.rateApp.tr(), () { if (Platform.isAndroid) { Utils.openWebView( url: 'https://play.google.com/store/apps/details?id=com.ejada.hmg', @@ -251,13 +245,13 @@ class ProfileSettingsState extends State { } }, isExternalLink: true), 1.divider, - actionItem(AppAssets.privacy_terms, "Privacy Policy".needTranslation, () { + actionItem(AppAssets.privacy_terms, LocaleKeys.privacyPolicy.tr(), () { Utils.openWebView( url: 'https://hmg.com/en/Pages/Privacy.aspx', ); }, isExternalLink: true), 1.divider, - actionItem(AppAssets.privacy_terms, "Terms & Conditions".needTranslation, () { + actionItem(AppAssets.privacy_terms, LocaleKeys.termsConditoins.tr(context: context), () { Utils.openWebView( url: 'https://hmg.com/en/Pages/Terms.aspx', ); @@ -268,7 +262,7 @@ class ProfileSettingsState extends State { CustomButton( height: 56.h, icon: AppAssets.minus, - text: "Deactivate account".needTranslation, + text: LocaleKeys.deactivateAccount.tr(), onPressed: () {}, ).paddingAll(24.w), ], @@ -363,7 +357,7 @@ class FamilyCardWidget extends StatelessWidget { runSpacing: 4.h, children: [ AppCustomChipWidget( - labelText: "${profile.age} Years Old".needTranslation, + labelText: LocaleKeys.ageYearsOld.tr(namedArgs: {'age': profile.age.toString(), 'yearsOld': LocaleKeys.yearsOld.tr(context: context)}), ), isActive && appState.getAuthenticatedUser()!.bloodGroup != null ? AppCustomChipWidget( @@ -396,17 +390,17 @@ class FamilyCardWidget extends StatelessWidget { if (isLoading) { icon = AppAssets.cancel_circle_icon; - labelText = "Insurance".needTranslation; + labelText = LocaleKeys.insurance.tr(context: context); iconColor = AppColors.primaryRedColor; backgroundColor = AppColors.primaryRedColor; } else if (isExpired) { icon = AppAssets.cancel_circle_icon; - labelText = "Insurance Expired".needTranslation; + labelText = LocaleKeys.insuranceExpired.tr(context: context); iconColor = AppColors.primaryRedColor; backgroundColor = AppColors.primaryRedColor.withValues(alpha: 0.15); } else { icon = AppAssets.insurance_active_icon; - labelText = "Insurance Active".needTranslation; + labelText = LocaleKeys.insuranceActive.tr(context: context); iconColor = AppColors.successColor; backgroundColor = AppColors.successColor.withValues(alpha: 0.15); } @@ -451,7 +445,7 @@ class FamilyCardWidget extends StatelessWidget { return CustomButton( icon: canSwitch ? AppAssets.switch_user : AppAssets.add_family, - text: canSwitch ? "Switch Family File".needTranslation : "Add a new family member".needTranslation, + text: canSwitch ? LocaleKeys.switchFamilyFile.tr() : LocaleKeys.addANewFamilyMember.tr(), onPressed: canSwitch ? () => onFamilySwitchPress(profile) : onAddFamilyMemberPress, backgroundColor: canSwitch ? AppColors.secondaryLightRedColor : AppColors.primaryRedColor, borderColor: canSwitch ? AppColors.secondaryLightRedColor : AppColors.primaryRedColor, @@ -467,7 +461,7 @@ class FamilyCardWidget extends StatelessWidget { return CustomButton( icon: AppAssets.switch_user, - text: canSwitchBack ? "Switch Back To Family File".needTranslation : "Switch".needTranslation, + text: canSwitchBack ? LocaleKeys.switchBackFamilyFile.tr() : LocaleKeys.switchLogin.tr(), backgroundColor: canSwitchBack ? AppColors.primaryRedColor : Colors.grey.shade200, borderColor: canSwitchBack ? AppColors.primaryRedColor : Colors.grey.shade200, textColor: canSwitchBack ? AppColors.whiteColor : AppColors.greyTextColor, diff --git a/lib/presentation/profile_settings/widgets/family_card_widget.dart b/lib/presentation/profile_settings/widgets/family_card_widget.dart index eaee4c0..b21c52d 100644 --- a/lib/presentation/profile_settings/widgets/family_card_widget.dart +++ b/lib/presentation/profile_settings/widgets/family_card_widget.dart @@ -73,7 +73,7 @@ class FamilyCardWidget extends StatelessWidget { runSpacing: 4.h, children: [ AppCustomChipWidget( - labelText: "${profile.age} Years Old".needTranslation, + labelText: "${profile.age} ${LocaleKeys.yearsOld.tr(context: context)}", ), isActive && appState.getAuthenticatedUser()!.bloodGroup != null ? AppCustomChipWidget( @@ -106,17 +106,17 @@ class FamilyCardWidget extends StatelessWidget { if (isLoading) { icon = AppAssets.cancel_circle_icon; - labelText = "Insurance".needTranslation; + labelText = LocaleKeys.insurance.tr(context: context); iconColor = AppColors.primaryRedColor; backgroundColor = AppColors.primaryRedColor; } else if (isExpired) { icon = AppAssets.cancel_circle_icon; - labelText = "Insurance Expired".needTranslation; + labelText = LocaleKeys.insuranceExpired.tr(context: context); iconColor = AppColors.primaryRedColor; backgroundColor = AppColors.primaryRedColor.withValues(alpha: 0.15); } else { icon = AppAssets.insurance_active_icon; - labelText = "Insurance Active".needTranslation; + labelText = LocaleKeys.insuranceActive.tr(context: context); iconColor = AppColors.successColor; backgroundColor = AppColors.successColor.withValues(alpha: 0.15); } @@ -161,7 +161,7 @@ class FamilyCardWidget extends StatelessWidget { return CustomButton( icon: canSwitch ? AppAssets.switch_user : AppAssets.add_family, - text: canSwitch ? "Switch Family File".needTranslation : "Add a new family member".needTranslation, + text: canSwitch ? LocaleKeys.switchAccount.tr() : LocaleKeys.addANewFamilyMember.tr(), onPressed: canSwitch ? () => onFamilySwitchPress(profile) : onAddFamilyMemberPress, backgroundColor: canSwitch ? AppColors.secondaryLightRedColor : AppColors.primaryRedColor, borderColor: canSwitch ? AppColors.secondaryLightRedColor : AppColors.primaryRedColor, @@ -177,7 +177,7 @@ class FamilyCardWidget extends StatelessWidget { return CustomButton( icon: AppAssets.switch_user, - text: canSwitchBack ? "Switch Back To Family File".needTranslation : "Switch".needTranslation, + text: canSwitchBack ? LocaleKeys.switchBackFamilyFile.tr() : LocaleKeys.switchLogin.tr(), backgroundColor: canSwitchBack ? AppColors.primaryRedColor : Colors.grey.shade200, borderColor: canSwitchBack ? AppColors.primaryRedColor : Colors.grey.shade200, textColor: canSwitchBack ? AppColors.whiteColor : AppColors.greyTextColor, diff --git a/lib/presentation/radiology/radiology_orders_page.dart b/lib/presentation/radiology/radiology_orders_page.dart index fb153ea..e1ec426 100644 --- a/lib/presentation/radiology/radiology_orders_page.dart +++ b/lib/presentation/radiology/radiology_orders_page.dart @@ -179,7 +179,7 @@ class _RadiologyOrdersPageState extends State { } if (model.patientRadiologyOrdersViewList.isEmpty) { - return Utils.getNoDataWidget(ctx, noDataText: "You don't have any radiology results yet.".needTranslation); + return Utils.getNoDataWidget(ctx, noDataText: LocaleKeys.youDontHaveRadiologyOrders.tr(context: context)); } return ListView.builder( @@ -239,7 +239,7 @@ class _RadiologyOrdersPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - AppCustomChipWidget(labelText: "${group.length} ${'results'.needTranslation}"), + AppCustomChipWidget(labelText: "${group.length} ${LocaleKeys.results.tr(context: context)}"), Icon(isExpanded ? Icons.expand_less : Icons.expand_more), ], ), @@ -323,7 +323,7 @@ class _RadiologyOrdersPageState extends State { icon: AppAssets.view_report_icon, iconColor: AppColors.primaryRedColor, iconSize: 16.h, - text: "View Results".needTranslation, + text: LocaleKeys.viewResults.tr(context: context), onPressed: () { model.navigationService.push( CustomPageRoute( diff --git a/lib/presentation/radiology/radiology_result_page.dart b/lib/presentation/radiology/radiology_result_page.dart index 1fc2d9f..2328d0e 100644 --- a/lib/presentation/radiology/radiology_result_page.dart +++ b/lib/presentation/radiology/radiology_result_page.dart @@ -1,5 +1,6 @@ import 'dart:async'; +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_state.dart'; @@ -10,6 +11,7 @@ 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/radiology/models/resp_models/patient_radiology_response_model.dart'; import 'package:hmg_patient_app_new/features/radiology/radiology_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -49,7 +51,7 @@ class _RadiologyResultPageState extends State { children: [ Expanded( child: CollapsingListView( - title: "Radiology Result".needTranslation, + title: LocaleKeys.radiologyResult.tr(context: context), child: SingleChildScrollView( child: Padding( padding: EdgeInsets.symmetric(horizontal: 24.h), @@ -72,13 +74,13 @@ class _RadiologyResultPageState extends State { widget.patientRadiologyResponseModel.reportData!.trim().toText12(isBold: true, color: AppColors.textColorLight), SizedBox(height: 16.h), CustomButton( - text: "View Radiology Image".needTranslation, + text: LocaleKeys.viewRadiologyImage.tr(context: context), onPressed: () async { if (radiologyViewModel.radiologyImageURL.isNotEmpty) { Uri uri = Uri.parse(radiologyViewModel.radiologyImageURL); launchUrl(uri, mode: LaunchMode.platformDefault, webOnlyWindowName: ""); } else { - Utils.showToast("Radiology image not available".needTranslation); + Utils.showToast("Radiology image not available"); } }, backgroundColor: AppColors.primaryRedColor, @@ -111,7 +113,7 @@ class _RadiologyResultPageState extends State { hasShadow: true, ), child: CustomButton( - text: "Download report".needTranslation, + text: LocaleKeys.downloadReport.tr(context: context), onPressed: () async { LoaderBottomSheet.showLoader(); await radiologyViewModel.getRadiologyPDF(patientRadiologyResponseModel: widget.patientRadiologyResponseModel, authenticatedUser: _appState.getAuthenticatedUser()!, onError: (err) { @@ -132,7 +134,7 @@ class _RadiologyResultPageState extends State { } catch (ex) { showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Cannot open file".needTranslation), + child: Utils.getErrorWidget(loadingText: "Cannot open file"), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/rate_appointment/rate_appointment_clinic.dart b/lib/presentation/rate_appointment/rate_appointment_clinic.dart index 5fb1fa3..e7e29f6 100644 --- a/lib/presentation/rate_appointment/rate_appointment_clinic.dart +++ b/lib/presentation/rate_appointment/rate_appointment_clinic.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; @@ -5,6 +6,7 @@ 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/my_appointments/appointment_rating_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/rate_appointment/widget/doctor_row.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -77,9 +79,7 @@ class _RateAppointmentClinicState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - - "Rate Clinic".needTranslation.toText16(isBold: true), - + LocaleKeys.rateClinic.tr(context: context).toText16(isBold: true), SizedBox(height: 12), Row( mainAxisAlignment: MainAxisAlignment.center, @@ -147,13 +147,13 @@ class _RateAppointmentClinicState extends State { children: [ Expanded( child: CustomButton( - text: "Back".needTranslation, + text: LocaleKeys.back.tr(context: context), backgroundColor: Color(0xffFEE9EA), borderColor: Color(0xffFEE9EA), textColor: Color(0xffED1C2B), onPressed: () { - appointmentRatingViewModel!.setTitle("Rate Doctor".needTranslation); - appointmentRatingViewModel!.setSubTitle("How was your last visit with doctor?".needTranslation); + appointmentRatingViewModel!.setTitle(LocaleKeys.rateDoctor.tr(context: context)); + appointmentRatingViewModel!.setSubTitle(LocaleKeys.howWasYourLastVisitWithDoctor.tr(context: context)); appointmentRatingViewModel!.setClinicOrDoctor(false); setState(() { @@ -164,7 +164,7 @@ class _RateAppointmentClinicState extends State { SizedBox(width: 10), Expanded( child: CustomButton( - text: "Submit".needTranslation, + text: LocaleKeys.submit.tr(context: context), onPressed: () { submitRating(); diff --git a/lib/presentation/rate_appointment/rate_appointment_doctor.dart b/lib/presentation/rate_appointment/rate_appointment_doctor.dart index ac79744..b9a6c58 100644 --- a/lib/presentation/rate_appointment/rate_appointment_doctor.dart +++ b/lib/presentation/rate_appointment/rate_appointment_doctor.dart @@ -1,9 +1,11 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.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/features/my_appointments/appointment_rating_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/rate_appointment/rate_appointment_clinic.dart'; import 'package:hmg_patient_app_new/presentation/rate_appointment/widget/doctor_row.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -88,9 +90,7 @@ class _RateAppointmentDoctorState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - - "Please rate the doctor".needTranslation.toText16(isBold: true), - + "Please rate the doctor".toText16(isBold: true), SizedBox(height: 12), Row( mainAxisAlignment: MainAxisAlignment.center, @@ -142,7 +142,7 @@ class _RateAppointmentDoctorState extends State { maxLines: 4, decoration: InputDecoration.collapsed( - hintText: "Notes".needTranslation, + hintText: LocaleKeys.notes.tr(context: context), hintStyle: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -172,7 +172,7 @@ class _RateAppointmentDoctorState extends State { children: [ Expanded( child: CustomButton( - text: "Later".needTranslation, + text: "Later", backgroundColor: Color(0xffFEE9EA), borderColor: Color(0xffFEE9EA), textColor: Color(0xffED1C2B), @@ -184,11 +184,11 @@ class _RateAppointmentDoctorState extends State { SizedBox(width: 10), Expanded( child: CustomButton( - text: "Next".needTranslation, + text: LocaleKeys.next.tr(context: context), onPressed: () { // Set up clinic rating and show clinic rating view - appointmentRatingViewModel!.setTitle("Rate Clinic".needTranslation); - appointmentRatingViewModel!.setSubTitle("How was your appointment?".needTranslation); + appointmentRatingViewModel!.setTitle(LocaleKeys.rateDoctor.tr(context: context),); + appointmentRatingViewModel!.setSubTitle(LocaleKeys.howWasYourLastVisitWithDoctor.tr(context: context),); appointmentRatingViewModel!.setClinicOrDoctor(true); setState(() {}); diff --git a/lib/presentation/symptoms_checker/organ_selector_screen.dart b/lib/presentation/symptoms_checker/organ_selector_screen.dart index 1786dec..cc956dc 100644 --- a/lib/presentation/symptoms_checker/organ_selector_screen.dart +++ b/lib/presentation/symptoms_checker/organ_selector_screen.dart @@ -1,3 +1,4 @@ +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'; @@ -9,6 +10,7 @@ import 'package:hmg_patient_app_new/extensions/route_extensions.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/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/symptoms_checker/widgets/interactive_body_widget.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -38,11 +40,11 @@ class _OrganSelectorPageState extends State { void _onNextPressed(SymptomsCheckerViewModel viewModel) async { if (!viewModel.validateSelection()) { dialogService.showErrorBottomSheet( - message: 'Please select at least one organ'.needTranslation, + message: LocaleKeys.noOrgansSelected.tr(context: context), ); return; } - LoaderBottomSheet.showLoader(loadingText: "Please wait".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.pleaseWait.tr(context: context),); final String userName = 'guest_user'; final String password = '123456'; @@ -112,7 +114,7 @@ class _OrganSelectorPageState extends State { return Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), child: Text( - "Organ Selector".needTranslation, + LocaleKeys.organSelector.tr(context: context), style: TextStyle( color: AppColors.textColor, fontSize: 22.f, @@ -249,7 +251,7 @@ class _OrganSelectorPageState extends State { return Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), child: Text( - 'Selected Organs'.needTranslation, + LocaleKeys.selectedOrgans.tr(context: context), style: TextStyle( fontSize: 16.f, fontWeight: FontWeight.w600, @@ -264,7 +266,7 @@ class _OrganSelectorPageState extends State { return Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), child: Text( - 'No organs selected yet'.needTranslation, + LocaleKeys.noOrgansSelected.tr(context: context), style: TextStyle( color: AppColors.greyTextColor, fontSize: 14.f, @@ -301,7 +303,7 @@ class _OrganSelectorPageState extends State { return Padding( padding: EdgeInsets.symmetric(horizontal: 16.w), child: CustomButton( - text: 'Next'.needTranslation, + text: LocaleKeys.next.tr(context: context), onPressed: () => _onNextPressed(viewModel), isDisabled: viewModel.selectedOrgans.isEmpty, backgroundColor: AppColors.primaryRedColor, diff --git a/lib/presentation/symptoms_checker/possible_conditions_screen.dart b/lib/presentation/symptoms_checker/possible_conditions_screen.dart index a63d1e2..bc233a4 100644 --- a/lib/presentation/symptoms_checker/possible_conditions_screen.dart +++ b/lib/presentation/symptoms_checker/possible_conditions_screen.dart @@ -51,7 +51,7 @@ class PossibleConditionsPage extends StatelessWidget { child: Padding( padding: EdgeInsets.all(24.h), child: Text( - 'No Predictions available'.needTranslation, + LocaleKeys.noPredictionsAvailable.tr(context: context), style: TextStyle( fontSize: 16.h, color: AppColors.greyTextColor, @@ -102,7 +102,7 @@ class PossibleConditionsPage extends StatelessWidget { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: "Are you sure you want to restart the organ selection?".needTranslation, + loadingText: LocaleKeys.areYouSureYouWantToRestartOrganSelection.tr(context: context), isShowActionButtons: true, onCancelTap: () => Navigator.pop(context), onConfirmTap: () => onConfirm(), @@ -161,7 +161,7 @@ class PossibleConditionsPage extends StatelessWidget { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "Possible Conditions".needTranslation, + title: LocaleKeys.possibleConditions.tr(context: context), trailing: _buildTrailingSection(context), child: Consumer( builder: (context, symptomsCheckerViewModel, child) { diff --git a/lib/presentation/symptoms_checker/risk_factors_screen.dart b/lib/presentation/symptoms_checker/risk_factors_screen.dart index 8669c3c..6ee4f29 100644 --- a/lib/presentation/symptoms_checker/risk_factors_screen.dart +++ b/lib/presentation/symptoms_checker/risk_factors_screen.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -8,6 +9,7 @@ import 'package:hmg_patient_app_new/extensions/route_extensions.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/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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'; @@ -44,7 +46,7 @@ class _RiskFactorsScreenState extends State { context.navigateWithName(AppRoutes.suggestionsPage); } else { dialogService.showErrorBottomSheet( - message: 'Please select at least one risk before proceeding'.needTranslation, + message: LocaleKeys.pleaseSelectAtLeastOneRiskBeforeProceeding.tr(context: context), ); } } @@ -121,11 +123,10 @@ class _RiskFactorsScreenState extends State { ), children: [ TextSpan( - text: "Above you see the most common risk factors. Although /diagnosis may return questions about risk factors, " - .needTranslation, + text: LocaleKeys.aboveYouSeeCommonRiskFactors.tr(context: context), ), TextSpan( - text: "read more".needTranslation, + text: LocaleKeys.readMore.tr(context: context), style: TextStyle( color: AppColors.primaryRedColor, fontWeight: FontWeight.w500, @@ -216,7 +217,7 @@ class _RiskFactorsScreenState extends State { children: [ Expanded( child: CollapsingListView( - title: "Risk Factors".needTranslation, + title: LocaleKeys.riskFactors.tr(context: context), leadingCallback: () => context.pop(), child: viewModel.isRiskFactorsLoading ? _buildLoadingShimmer() @@ -249,7 +250,7 @@ class _RiskFactorsScreenState extends State { Icon(Icons.info_outline, size: 64.h, color: AppColors.greyTextColor), SizedBox(height: 16.h), Text( - 'No risk factors found'.needTranslation, + LocaleKeys.noRiskFactorsFound.tr(context: context), style: TextStyle( fontSize: 18.f, fontWeight: FontWeight.w600, @@ -258,7 +259,7 @@ class _RiskFactorsScreenState extends State { ), SizedBox(height: 8.h), Text( - 'Based on your selected symptoms, no additional risk factors were identified.'.needTranslation, + LocaleKeys.basedOnYourSelectedSymptomsNoRiskFactors.tr(context: context), textAlign: TextAlign.center, style: TextStyle( fontSize: 14.f, @@ -282,7 +283,7 @@ class _RiskFactorsScreenState extends State { children: [ Expanded( child: CustomButton( - text: "Previous".needTranslation, + text: LocaleKeys.previous.tr(context: context), onPressed: _onPreviousPressed, backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), borderColor: Colors.transparent, @@ -293,7 +294,7 @@ class _RiskFactorsScreenState extends State { SizedBox(width: 12.w), Expanded( child: CustomButton( - text: "Next".needTranslation, + text: LocaleKeys.next.tr(context: context), onPressed: () => _onNextPressed(viewModel), backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, diff --git a/lib/presentation/symptoms_checker/user_info_selection/pages/age_selection_page.dart b/lib/presentation/symptoms_checker/user_info_selection/pages/age_selection_page.dart index 8366545..37802a2 100644 --- a/lib/presentation/symptoms_checker/user_info_selection/pages/age_selection_page.dart +++ b/lib/presentation/symptoms_checker/user_info_selection/pages/age_selection_page.dart @@ -1,8 +1,10 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.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/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/widgets/custom_date_picker.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:provider/provider.dart'; @@ -25,7 +27,7 @@ class AgeSelectionPage extends StatelessWidget { builder: (BuildContext context, symptomsViewModel, Widget? child) { return Column( children: [ - "What is your Date of Birth?".needTranslation.toText18(weight: FontWeight.w600, color: AppColors.textColor).paddingAll(24.w), + LocaleKeys.dateOfBirthSymptoms.tr(context: context).toText18(weight: FontWeight.w600, color: AppColors.textColor).paddingAll(24.w), SizedBox(height: 30.h), ThreeColumnDatePicker( enableHaptic: true, diff --git a/lib/presentation/symptoms_checker/user_info_selection/pages/gender_selection_page.dart b/lib/presentation/symptoms_checker/user_info_selection/pages/gender_selection_page.dart index 85cb6e2..6eaae8c 100644 --- a/lib/presentation/symptoms_checker/user_info_selection/pages/gender_selection_page.dart +++ b/lib/presentation/symptoms_checker/user_info_selection/pages/gender_selection_page.dart @@ -1,3 +1,4 @@ +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'; @@ -5,6 +6,7 @@ import 'package:hmg_patient_app_new/core/utils/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/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:provider/provider.dart'; @@ -48,21 +50,21 @@ class GenderSelectionPage extends StatelessWidget { builder: (BuildContext context, symptomsViewModel, Widget? child) { return Column( children: [ - "What is your gender?".needTranslation.toText18(weight: FontWeight.w600, color: AppColors.textColor), + LocaleKeys.genderSymptoms.tr(context: context).toText18(weight: FontWeight.w600, color: AppColors.textColor), SizedBox(height: 70.h), Row( children: [ Expanded( child: InkWell( onTap: () => onGenderSelected(genders[0]), - child: _buildGenderOption(AppAssets.maleIcon, "Male".needTranslation, symptomsViewModel.selectedGender == genders[0]), + child: _buildGenderOption(AppAssets.maleIcon, LocaleKeys.malE.tr(context: context), symptomsViewModel.selectedGender == genders[0]), ), ), SizedBox(width: 16.w), Expanded( child: InkWell( onTap: () => onGenderSelected(genders[1]), - child: _buildGenderOption(AppAssets.femaleIcon, "Female".needTranslation, symptomsViewModel.selectedGender == genders[1]), + child: _buildGenderOption(AppAssets.femaleIcon, LocaleKeys.femaleGender.tr(context: context), symptomsViewModel.selectedGender == genders[1]), )) ], ), diff --git a/lib/presentation/symptoms_checker/user_info_selection/pages/height_selection_page.dart b/lib/presentation/symptoms_checker/user_info_selection/pages/height_selection_page.dart index 0744e81..65cf5a5 100644 --- a/lib/presentation/symptoms_checker/user_info_selection/pages/height_selection_page.dart +++ b/lib/presentation/symptoms_checker/user_info_selection/pages/height_selection_page.dart @@ -1,10 +1,12 @@ import 'dart:developer'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.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/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/widgets/height_scale.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:provider/provider.dart'; @@ -107,7 +109,7 @@ class HeightSelectionPage extends StatelessWidget { SizedBox(height: 24.h), Center( child: Text( - 'How tall are you?'.needTranslation, + LocaleKeys.heightSymptoms.tr(context: context), style: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, color: AppColors.textColor), ), ), diff --git a/lib/presentation/symptoms_checker/user_info_selection/pages/weight_selection_page.dart b/lib/presentation/symptoms_checker/user_info_selection/pages/weight_selection_page.dart index 1d38a91..8c83796 100644 --- a/lib/presentation/symptoms_checker/user_info_selection/pages/weight_selection_page.dart +++ b/lib/presentation/symptoms_checker/user_info_selection/pages/weight_selection_page.dart @@ -1,10 +1,12 @@ import 'dart:developer'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.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/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/widgets/weight_scale.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:provider/provider.dart'; @@ -113,7 +115,7 @@ class WeightSelectionPage extends StatelessWidget { SizedBox(height: 24.h), Center( child: Text( - 'What is your weight?'.needTranslation, + LocaleKeys.weightSymptoms.tr(context: context), style: TextStyle(fontSize: 18.f, fontWeight: FontWeight.w600, color: AppColors.textColor), ), ), diff --git a/lib/presentation/symptoms_checker/user_info_selection/user_info_flow_manager.dart b/lib/presentation/symptoms_checker/user_info_selection/user_info_flow_manager.dart index 523470e..b5df05b 100644 --- a/lib/presentation/symptoms_checker/user_info_selection/user_info_flow_manager.dart +++ b/lib/presentation/symptoms_checker/user_info_selection/user_info_flow_manager.dart @@ -1,10 +1,12 @@ import 'dart:developer'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/extensions/route_extensions.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/pages/age_selection_page.dart'; import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/pages/gender_selection_page.dart'; import 'package:hmg_patient_app_new/presentation/symptoms_checker/user_info_selection/pages/height_selection_page.dart'; @@ -184,7 +186,7 @@ class _UserInfoFlowManagerState extends State { child: isSingleEdit ? // Single page edit mode - show only Save button CustomButton( - text: "Save".needTranslation, + text: LocaleKeys.save.tr(context: context), onPressed: _onNext, backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, @@ -197,7 +199,7 @@ class _UserInfoFlowManagerState extends State { if (!isFirstPage) ...[ Expanded( child: CustomButton( - text: "Previous".needTranslation, + text: LocaleKeys.previous.tr(context: context), onPressed: _onPrevious, backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), borderColor: Colors.transparent, @@ -209,7 +211,7 @@ class _UserInfoFlowManagerState extends State { ], Expanded( child: CustomButton( - text: isLastPage ? "Submit".needTranslation : "Next".needTranslation, + text: isLastPage ? LocaleKeys.submit.tr(context: context) : LocaleKeys.next.tr(context: context), onPressed: _onNext, backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, @@ -233,7 +235,7 @@ class _UserInfoFlowManagerState extends State { Expanded( child: CollapsingListView( physics: NeverScrollableScrollPhysics(), - title: _pageTitles[_viewModel.userInfoCurrentPage].needTranslation, + title: _pageTitles[_viewModel.userInfoCurrentPage], isLeading: true, child: Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/presentation/symptoms_checker/widgets/condition_card.dart b/lib/presentation/symptoms_checker/widgets/condition_card.dart index 87a8f3d..b89eac2 100644 --- a/lib/presentation/symptoms_checker/widgets/condition_card.dart +++ b/lib/presentation/symptoms_checker/widgets/condition_card.dart @@ -1,9 +1,11 @@ +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/core/enums.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/symptoms_checker/widgets/custom_progress_bar.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -156,12 +158,12 @@ class ConditionCard extends StatelessWidget { ), _buildSymptomsRow(), SizedBox(height: 16.h), - Text("Description".needTranslation, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.f, color: AppColors.textColor)), + Text(LocaleKeys.description.tr(context: context), style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.f, color: AppColors.textColor)), SizedBox(height: 2.h), Text(description, style: TextStyle(color: AppColors.greyTextColor, fontWeight: FontWeight.w500, fontSize: 12.f)), if (possibleConditionsSeverityEnum == PossibleConditionsSeverityEnum.emergency) CustomButton( - text: appointmentLabel ?? "Book Appointment".needTranslation, + text: appointmentLabel ?? LocaleKeys.bookAppointment.tr(context: context), onPressed: () { if (onActionPressed != null) { onActionPressed!(); diff --git a/lib/presentation/symptoms_checker/widgets/selected_organs_section.dart b/lib/presentation/symptoms_checker/widgets/selected_organs_section.dart index c0f1be3..b66ef03 100644 --- a/lib/presentation/symptoms_checker/widgets/selected_organs_section.dart +++ b/lib/presentation/symptoms_checker/widgets/selected_organs_section.dart @@ -1,8 +1,10 @@ +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/features/symptoms_checker/models/organ_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; @@ -52,7 +54,7 @@ class _SelectedOrgansSectionState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - 'Selected Organs'.needTranslation, + LocaleKeys.selectedOrgans.tr(context: context), style: TextStyle( fontSize: 16.f, fontWeight: FontWeight.w600, @@ -101,7 +103,7 @@ class _SelectedOrgansSectionState extends State { Padding( padding: EdgeInsets.symmetric(vertical: 8.h), child: Text( - 'No organs selected yet'.needTranslation, + LocaleKeys.noOrgansSelected.tr(context: context), style: TextStyle( color: AppColors.greyTextColor, fontSize: 14.f, From e5f24b9c06addc9b10dfe6a8819df1dc99b103bf Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 15 Jan 2026 14:05:32 +0300 Subject: [PATCH 10/12] updates --- lib/core/api_consts.dart | 2 +- lib/core/dependencies.dart | 15 +++++++-------- lib/main.dart | 4 ++++ lib/routes/app_routes.dart | 2 -- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index 720fda7..efefee1 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -680,7 +680,7 @@ const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard'; class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/core/dependencies.dart b/lib/core/dependencies.dart index 45cd2a4..44a8bde 100644 --- a/lib/core/dependencies.dart +++ b/lib/core/dependencies.dart @@ -61,7 +61,6 @@ import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_repo.da import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; import 'package:hmg_patient_app_new/presentation/health_trackers/health_trackers_view_model.dart'; import 'package:hmg_patient_app_new/services/analytics/analytics_service.dart'; -import 'package:hmg_patient_app_new/presentation/monthly_reports/monthly_reports_page.dart'; import 'package:hmg_patient_app_new/services/cache_service.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; import 'package:hmg_patient_app_new/services/error_handler_service.dart'; @@ -299,13 +298,13 @@ class AppDependencies { activePrescriptionsRepo: getIt() ), ); - // getIt.registerFactory( - // () => QrParkingViewModel( - // qrParkingRepo: getIt(), - // errorHandlerService: getIt(), - // cacheService: getIt(), - // ), - // ); + getIt.registerFactory( + () => QrParkingViewModel( + qrParkingRepo: getIt(), + errorHandlerService: getIt(), + cacheService: getIt(), + ), + ); } } diff --git a/lib/main.dart b/lib/main.dart index 5158706..ec3b7ec 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -32,6 +32,7 @@ import 'package:hmg_patient_app_new/features/notifications/notifications_view_mo import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart'; import 'package:hmg_patient_app_new/features/prescriptions/prescriptions_view_model.dart'; import 'package:hmg_patient_app_new/features/profile_settings/profile_settings_view_model.dart'; +import 'package:hmg_patient_app_new/features/qr_parking/qr_parking_view_model.dart'; import 'package:hmg_patient_app_new/features/radiology/radiology_view_model.dart'; import 'package:hmg_patient_app_new/features/smartwatch_health_data/health_provider.dart'; import 'package:hmg_patient_app_new/features/symptoms_checker/symptoms_checker_view_model.dart'; @@ -191,6 +192,9 @@ void main() async { ChangeNotifierProvider( create: (_) => getIt.get(), ), + ChangeNotifierProvider( + create: (_) => getIt.get(), + ), ChangeNotifierProvider( create: (_) => getIt.get(), ) diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart index ebc7165..bf665ea 100644 --- a/lib/routes/app_routes.dart +++ b/lib/routes/app_routes.dart @@ -37,7 +37,6 @@ import '../presentation/covid19test/covid19_landing_page.dart'; import '../core/dependencies.dart'; import '../features/monthly_reports/monthly_reports_repo.dart'; import '../features/monthly_reports/monthly_reports_view_model.dart'; -import '../presentation/monthly_reports/monthly_reports_page.dart'; import '../presentation/parking/paking_page.dart'; import '../services/error_handler_service.dart'; import 'package:provider/provider.dart'; @@ -140,7 +139,6 @@ class AppRoutes { monthlyReportsRepo: getIt(), errorHandlerService: getIt(), ), - child: const MonthlyReportsPage(), ), qrParking: (context) => ChangeNotifierProvider( create: (_) => getIt(), From 39af08ddc3cea7750d2f3f525b3a585d033ecccf Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Fri, 16 Jan 2026 13:03:04 +0300 Subject: [PATCH 11/12] Translation updates --- assets/langs/ar-SA.json | 71 ++++++++++++++++++- assets/langs/en-US.json | 69 +++++++++++++++++- lib/generated/locale_keys.g.dart | 67 +++++++++++++++++ .../allergies/allergies_list_page.dart | 2 +- .../notification_details_page.dart | 13 ++-- .../smartwatch_instructions_page.dart | 12 ++-- .../smartwatches/widgets/health_metric.dart | 6 +- .../symptoms_checker/suggestions_screen.dart | 14 ++-- .../symptoms_selector_screen.dart | 14 ++-- .../symptoms_checker/triage_screen.dart | 23 +++--- .../symptoms_checker/user_info_selection.dart | 26 +++---- .../ancillary_order_payment_page.dart | 34 ++++----- .../ancillary_procedures_details_page.dart | 26 +++---- lib/presentation/todo_section/todo_page.dart | 4 +- .../widgets/ancillary_orders_list.dart | 16 ++--- .../widgets/ancillary_procedures_list.dart | 19 ++--- lib/widgets/common_bottom_sheet.dart | 6 +- lib/widgets/countdown_timer.dart | 8 ++- 18 files changed, 322 insertions(+), 108 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index f49873a..e304710 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -1368,5 +1368,72 @@ "readMore": "اقرأ المزيد", "riskFactors": "عوامل الخطر", "noRiskFactorsFound": "لم يتم العثور على عوامل خطر", - "basedOnYourSelectedSymptomsNoRiskFactors": "بناءً على الأعراض المحددة، لم يتم تحديد عوامل خطر إضافية." -} \ No newline at end of file + "basedOnYourSelectedSymptomsNoRiskFactors": "بناءً على الأعراض المحددة، لم يتم تحديد عوامل خطر إضافية.", + "messageNotification": "الرسالة", + "attachedImage": "الصورة المرفقة", + "failedToLoadImage": "فشل تحميل الصورة", + "typeNotification": "النوع", + "pleaseSelectAtLeastOneOptionBeforeProceeding": "يرجى اختيار خيار واحد على الأقل قبل المتابعة", + "suggestions": "الاقتراحات", + "pleaseGoBackAndSelectOrgansFirst": "يرجى العودة واختيار الأعضاء أولاً", + "symptomsSelector": "محدد الأعراض", + "emergencyTriage": "طوارئ", + "emergencyEvidenceDetected": "تم اكتشاف دليل طوارئ. يرجى طلب العناية الطبية.", + "noQuestionItemsAvailable": "لا توجد عناصر أسئلة متاحة", + "pleaseAnswerAllQuestionsBeforeProceeding": "يرجى الإجابة على جميع الأسئلة قبل المتابعة", + "triage": "الفرز", + "areYouSureYouWantToExitProgress": "هل أنت متأكد أنك تريد الخروج؟ سيتم فقدان تقدمك.", + "noQuestionAvailable": "لا يوجد سؤال متاح", + "possibleSymptom": "عرض محتمل: ", + "symptomsCheckerFindingScore": "- درجة نتائج فاحص الأعراض", + "notSet": "غير محدد", + "years": "سنوات", + "symptomsChecker": "فاحص الأعراض", + "helloIsYourInformationUpToDate": "مرحباً {name}، هل معلوماتك محدثة؟", + "noEditAll": "لا، تعديل الكل", + "yesItIs": "نعم، إنها كذلك", + "age": "العمر", + "youDontHaveAnyAncillaryOrdersYet": "ليس لديك أي طلبات مساعدة بعد.", + "invoiceWithNumber": "الفاتورة: {invoiceNo}", + "queued": "في قائمة الانتظار", + "checkInReady": "جاهز للتسجيل", + "checkIn": "تسجيل الوصول", + "viewDetails": "عرض التفاصيل", + "selectPaymentMethod": "اختر طريقة الدفع", + "processingPaymentPleaseWait": "جاري معالجة الدفع، يرجى الانتظار...", + "finalizingPaymentPleaseWait": "جاري إتمام الدفع، يرجى الانتظار...", + "generatingInvoicePleaseWait": "جاري إنشاء الفاتورة، يرجى الانتظار...", + "hereIsYourInvoiceNumber": "هذا هو رقم فاتورتك #: ", + "paymentCompletedSuccessfully": "تم الدفع بنجاح", + "failedToInitializeApplePay": "فشل في تهيئة Apple Pay. يرجى المحاولة مرة أخرى.", + "cash": "نقدي", + "approved": "موافق عليه", + "approvalRejectedPleaseVisitReceptionist": "تم رفض الموافقة - يرجى زيارة موظف الاستقبال", + "sentForApproval": "تم إرساله للموافقة", + "ancillaryOrderDetails": "تفاصيل الطلب المساعد", + "noProceduresAvailableForSelectedOrder": "لا توجد إجراءات متاحة للطلب المحدد.", + "procedures": "الإجراءات", + "totalAmount": "المبلغ الإجمالي", + "covered": "مغطى", + "vatPercent": "ضريبة القيمة المضافة (15%)", + "proceedToPayment": "المتابعة للدفع", + "supportedSmartWatches": "الساعات الذكية المدعومة", + "pleaseMakeSureSamsungWatchConnected": "يرجى التأكد من أن ساعة Samsung الخاصة بك متصلة بهاتفك، ومتزامنة ومحدثة بشكل نشط.", + "beforeSyncingDataFollowInstructions": "قبل مزامنة البيانات، يرجى التأكد من اتباع التعليمات بشكل صحيح.", + "viewWatchInstructions": "عرض تعليمات الساعة", + "healthConnectAppNotInstalled": "يبدو أنه ليس لديك تطبيق Health Connect مثبتًا. يرجى تثبيته من متجر Play لمزامنة بيانات صحتك.", + "setTimerOfReminder": "ضبط مؤقت التذكير", + "youHaveAppointmentWithDr": "لديك موعد مع د. ", + "hours": "ساعات", + "secs": "ثواني", + "noAllergiesDataFound": "لم يتم العثور على بيانات الحساسية...", + "heartRateDescription": "معدل ضربات قلبك يشير إلى عدد المرات التي ينبض فيها قلبك في الدقيقة", + "bloodOxygenDescription": "مستوى الأكسجين في الدم يشير إلى كمية الأكسجين التي تحملها خلايا الدم الحمراء", + "stepsDescription": "عدد الخطوات المتخذة على مدار اليوم", + "caloriesDescription": "السعرات الحرارية المحروقة أثناء النشاط البدني", + "distanceDescription": "المسافة المقطوعة على مدار اليوم", + "overview": "نظرة عامة", + "details": "التفاصيل", + "healthy": "صحي", + "warning": "تحذير" +} diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index c4b6c19..98ca7ad 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -1361,5 +1361,72 @@ "readMore": "Read more", "riskFactors": "Risk Factors", "noRiskFactorsFound": "No risk factors found", - "basedOnYourSelectedSymptomsNoRiskFactors": "Based on your selected symptoms, no additional risk factors were identified." + "basedOnYourSelectedSymptomsNoRiskFactors": "Based on your selected symptoms, no additional risk factors were identified.", + "messageNotification": "Message", + "attachedImage": "Attached Image", + "failedToLoadImage": "Failed to load image", + "typeNotification": "Type", + "pleaseSelectAtLeastOneOptionBeforeProceeding": "Please select at least one option before proceeding", + "suggestions": "Suggestions", + "pleaseGoBackAndSelectOrgansFirst": "Please go back and select organs first", + "symptomsSelector": "Symptoms Selector", + "emergencyTriage": "Emergency", + "emergencyEvidenceDetected": "Emergency evidence detected. Please seek medical attention.", + "noQuestionItemsAvailable": "No question items available", + "pleaseAnswerAllQuestionsBeforeProceeding": "Please answer all questions before proceeding", + "triage": "Triage", + "areYouSureYouWantToExitProgress": "Are you sure you want to exit? Your progress will be lost.", + "noQuestionAvailable": "No question available", + "possibleSymptom": "Possible symptom: ", + "symptomsCheckerFindingScore": "- Symptoms checker finding score", + "notSet": "Not set", + "years": "Years", + "symptomsChecker": "Symptoms Checker", + "helloIsYourInformationUpToDate": "Hello {name}, Is your information up to date?", + "noEditAll": "No, Edit all", + "yesItIs": "Yes, It is", + "age": "Age", + "youDontHaveAnyAncillaryOrdersYet": "You don't have any ancillary orders yet.", + "invoiceWithNumber": "Invoice: {invoiceNo}", + "queued": "Queued", + "checkInReady": "Check-in Ready", + "checkIn": "Check In", + "viewDetails": "View Details", + "selectPaymentMethod": "Select Payment Method", + "processingPaymentPleaseWait": "Processing payment, Please wait...", + "finalizingPaymentPleaseWait": "Finalizing payment, Please wait...", + "generatingInvoicePleaseWait": "Generating invoice, Please wait...", + "hereIsYourInvoiceNumber": "Here is your invoice #: ", + "paymentCompletedSuccessfully": "Payment Completed Successfully", + "failedToInitializeApplePay": "Failed to initialize Apple Pay. Please try again.", + "cash": "Cash", + "approved": "Approved", + "approvalRejectedPleaseVisitReceptionist": "Approval Rejected - Please visit receptionist", + "sentForApproval": "Sent For Approval", + "ancillaryOrderDetails": "Ancillary Order Details", + "noProceduresAvailableForSelectedOrder": "No Procedures available for the selected order.", + "procedures": "Procedures", + "totalAmount": "Total Amount", + "covered": "Covered", + "vatPercent": "VAT (15%)", + "proceedToPayment": "Proceed to Payment", + "supportedSmartWatches": "Supported Smart Watches", + "pleaseMakeSureSamsungWatchConnected": "Please make sure that your Samsung Watch is connected to your Phone, is actively synced & updated.", + "beforeSyncingDataFollowInstructions": "Before syncing data, please make sure that you have followed the instructions properly.", + "viewWatchInstructions": "View watch instructions", + "healthConnectAppNotInstalled": "Seems like you do not have Health Connect App installed. Please install it from the Play Store to sync your health data.", + "setTimerOfReminder": "Set the timer of reminder", + "youHaveAppointmentWithDr": "You have appointment with Dr. ", + "hours": "Hours", + "secs": "Secs", + "noAllergiesDataFound": "No allergies data found...", + "heartRateDescription": "Your heart rate indicates how many times your heart beats per minute", + "bloodOxygenDescription": "Blood oxygen level indicates how much oxygen your red blood cells are carrying", + "stepsDescription": "Number of steps taken throughout the day", + "caloriesDescription": "Calories burned during physical activity", + "distanceDescription": "Distance covered throughout the day", + "overview": "Overview", + "details": "Details", + "healthy": "Healthy", + "warning": "Warning" } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index a3989ad..dc0655d 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1363,5 +1363,72 @@ abstract class LocaleKeys { static const riskFactors = 'riskFactors'; static const noRiskFactorsFound = 'noRiskFactorsFound'; static const basedOnYourSelectedSymptomsNoRiskFactors = 'basedOnYourSelectedSymptomsNoRiskFactors'; + static const messageNotification = 'messageNotification'; + static const attachedImage = 'attachedImage'; + static const failedToLoadImage = 'failedToLoadImage'; + static const typeNotification = 'typeNotification'; + static const pleaseSelectAtLeastOneOptionBeforeProceeding = 'pleaseSelectAtLeastOneOptionBeforeProceeding'; + static const suggestions = 'suggestions'; + static const pleaseGoBackAndSelectOrgansFirst = 'pleaseGoBackAndSelectOrgansFirst'; + static const symptomsSelector = 'symptomsSelector'; + static const emergencyTriage = 'emergencyTriage'; + static const emergencyEvidenceDetected = 'emergencyEvidenceDetected'; + static const noQuestionItemsAvailable = 'noQuestionItemsAvailable'; + static const pleaseAnswerAllQuestionsBeforeProceeding = 'pleaseAnswerAllQuestionsBeforeProceeding'; + static const triage = 'triage'; + static const areYouSureYouWantToExitProgress = 'areYouSureYouWantToExitProgress'; + static const noQuestionAvailable = 'noQuestionAvailable'; + static const possibleSymptom = 'possibleSymptom'; + static const symptomsCheckerFindingScore = 'symptomsCheckerFindingScore'; + static const notSet = 'notSet'; + static const years = 'years'; + static const symptomsChecker = 'symptomsChecker'; + static const helloIsYourInformationUpToDate = 'helloIsYourInformationUpToDate'; + static const noEditAll = 'noEditAll'; + static const yesItIs = 'yesItIs'; + static const age = 'age'; + static const youDontHaveAnyAncillaryOrdersYet = 'youDontHaveAnyAncillaryOrdersYet'; + static const invoiceWithNumber = 'invoiceWithNumber'; + static const queued = 'queued'; + static const checkInReady = 'checkInReady'; + static const checkIn = 'checkIn'; + static const viewDetails = 'viewDetails'; + static const selectPaymentMethod = 'selectPaymentMethod'; + static const processingPaymentPleaseWait = 'processingPaymentPleaseWait'; + static const finalizingPaymentPleaseWait = 'finalizingPaymentPleaseWait'; + static const generatingInvoicePleaseWait = 'generatingInvoicePleaseWait'; + static const hereIsYourInvoiceNumber = 'hereIsYourInvoiceNumber'; + static const paymentCompletedSuccessfully = 'paymentCompletedSuccessfully'; + static const failedToInitializeApplePay = 'failedToInitializeApplePay'; + static const cash = 'cash'; + static const approved = 'approved'; + static const approvalRejectedPleaseVisitReceptionist = 'approvalRejectedPleaseVisitReceptionist'; + static const sentForApproval = 'sentForApproval'; + static const ancillaryOrderDetails = 'ancillaryOrderDetails'; + static const noProceduresAvailableForSelectedOrder = 'noProceduresAvailableForSelectedOrder'; + static const procedures = 'procedures'; + static const totalAmount = 'totalAmount'; + static const covered = 'covered'; + static const vatPercent = 'vatPercent'; + static const proceedToPayment = 'proceedToPayment'; + static const supportedSmartWatches = 'supportedSmartWatches'; + static const pleaseMakeSureSamsungWatchConnected = 'pleaseMakeSureSamsungWatchConnected'; + static const beforeSyncingDataFollowInstructions = 'beforeSyncingDataFollowInstructions'; + static const viewWatchInstructions = 'viewWatchInstructions'; + static const healthConnectAppNotInstalled = 'healthConnectAppNotInstalled'; + static const setTimerOfReminder = 'setTimerOfReminder'; + static const youHaveAppointmentWithDr = 'youHaveAppointmentWithDr'; + static const hours = 'hours'; + static const secs = 'secs'; + static const noAllergiesDataFound = 'noAllergiesDataFound'; + static const heartRateDescription = 'heartRateDescription'; + static const bloodOxygenDescription = 'bloodOxygenDescription'; + static const stepsDescription = 'stepsDescription'; + static const caloriesDescription = 'caloriesDescription'; + static const distanceDescription = 'distanceDescription'; + static const overview = 'overview'; + static const details = 'details'; + static const healthy = 'healthy'; + static const warning = 'warning'; } diff --git a/lib/presentation/allergies/allergies_list_page.dart b/lib/presentation/allergies/allergies_list_page.dart index efcdd0a..adb63f0 100644 --- a/lib/presentation/allergies/allergies_list_page.dart +++ b/lib/presentation/allergies/allergies_list_page.dart @@ -123,7 +123,7 @@ class AllergiesListPage extends StatelessWidget { ), ), ) - : Utils.getNoDataWidget(context, noDataText: "No allergies data found...".needTranslation); + : Utils.getNoDataWidget(context, noDataText: LocaleKeys.noAllergiesDataFound.tr()); }, separatorBuilder: (BuildContext cxt, int index) => SizedBox(height: 16.h), ), diff --git a/lib/presentation/notifications/notification_details_page.dart b/lib/presentation/notifications/notification_details_page.dart index a4aef02..949b872 100644 --- a/lib/presentation/notifications/notification_details_page.dart +++ b/lib/presentation/notifications/notification_details_page.dart @@ -1,12 +1,13 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.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/features/notifications/models/resp_models/notification_response_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; -import 'package:intl/intl.dart'; import 'package:share_plus/share_plus.dart'; class NotificationDetailsPage extends StatelessWidget { @@ -28,7 +29,7 @@ class NotificationDetailsPage extends StatelessWidget { print('========================'); return CollapsingListView( - title: "Notification Details".needTranslation, + title: LocaleKeys.notificationDetails.tr(), trailing: IconButton( icon: Icon( Icons.share_outlined, @@ -115,7 +116,7 @@ class NotificationDetailsPage extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - 'Message'.needTranslation.toText14( + LocaleKeys.messageNotification.tr().toText14( weight: FontWeight.w600, color: AppColors.greyTextColor, ), @@ -153,7 +154,7 @@ class NotificationDetailsPage extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - 'Attached Image'.needTranslation.toText14( + LocaleKeys.attachedImage.tr().toText14( weight: FontWeight.w600, color: AppColors.greyTextColor, ), @@ -183,7 +184,7 @@ class NotificationDetailsPage extends StatelessWidget { color: AppColors.greyTextColor, ), SizedBox(height: 8.h), - 'Failed to load image'.needTranslation.toText12( + LocaleKeys.failedToLoadImage.tr().toText12( color: AppColors.greyTextColor, ), SizedBox(height: 4.h), @@ -233,7 +234,7 @@ class NotificationDetailsPage extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - 'Type'.needTranslation.toText14( + LocaleKeys.typeNotification.tr().toText14( weight: FontWeight.w600, color: AppColors.greyTextColor, ), diff --git a/lib/presentation/smartwatches/smartwatch_instructions_page.dart b/lib/presentation/smartwatches/smartwatch_instructions_page.dart index 7f17f5a..8edbd24 100644 --- a/lib/presentation/smartwatches/smartwatch_instructions_page.dart +++ b/lib/presentation/smartwatches/smartwatch_instructions_page.dart @@ -38,7 +38,7 @@ class SmartwatchInstructionsPage extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Supported Smart Watches".needTranslation.toText20(isBold: true), + LocaleKeys.supportedSmartWatches.tr().toText20(isBold: true), SizedBox(height: 16.h), Row( children: [ @@ -161,15 +161,15 @@ class SmartwatchInstructionsPage extends StatelessWidget { ), ), SizedBox(height: 12), - "Please make sure that your Samsung Watch is connected to your Phone, is actively synced & updated.".needTranslation.toText14(isBold: true), - SizedBox(height: 12), - "Before syncing data, please make sure that you have followed the instructions properly.".needTranslation.toText14(isBold: true), + LocaleKeys.pleaseMakeSureSamsungWatchConnected.tr().toText14(isBold: true), + SizedBox(height: 8.h), + LocaleKeys.beforeSyncingDataFollowInstructions.tr().toText14(isBold: true), SizedBox(height: 12), InkWell( onTap: () { showInstructionsDialog(context); }, - child: "View watch instructions".needTranslation.toText12(isBold: true, color: AppColors.textColor, isUnderLine: true)), + child: LocaleKeys.viewWatchInstructions.tr().toText12(isBold: true, color: AppColors.textColor, isUnderLine: true)), SizedBox( height: 130.h, ), @@ -186,7 +186,7 @@ class SmartwatchInstructionsPage extends StatelessWidget { ); } else { getIt.get().showErrorBottomSheet( - message: "Seems like you do not have Health Connect App installed. Please install it from the Play Store to sync your health data.".needTranslation, + message: LocaleKeys.healthConnectAppNotInstalled.tr(), onOkPressed: () { Navigator.pop(context); Uri uri = Uri.parse("https://play.google.com/store/apps/details?id=com.google.android.apps.healthdata"); diff --git a/lib/presentation/smartwatches/widgets/health_metric.dart b/lib/presentation/smartwatches/widgets/health_metric.dart index 5375966..43a5746 100644 --- a/lib/presentation/smartwatches/widgets/health_metric.dart +++ b/lib/presentation/smartwatches/widgets/health_metric.dart @@ -1,8 +1,10 @@ import 'dart:io'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:health/health.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; class HealthMetricInfo { @@ -39,7 +41,7 @@ class HealthMetrics { unit: 'BPM', color: AppColors.primaryRedColor, icon: Icons.favorite, - description: "Your heart rate indicates how many times your heart beats per minute".needTranslation, + description: LocaleKeys.heartRateDescription.tr(), minHealthyValue: 60, maxHealthyValue: 100, svgIcon: "assets/images/smartwatches/heartrate_icon.svg"), @@ -51,7 +53,7 @@ class HealthMetrics { // color: Colors.blue, color: Color(0xff3A3558), icon: Icons.air, - description: "Blood oxygen level indicates how much oxygen your red blood cells are carrying".needTranslation, + description: LocaleKeys.bloodOxygenDescription.tr(), minHealthyValue: 95, maxHealthyValue: 100, svgIcon: "assets/images/smartwatches/bloodoxygen_icon.svg"), diff --git a/lib/presentation/symptoms_checker/suggestions_screen.dart b/lib/presentation/symptoms_checker/suggestions_screen.dart index d0d5b2f..f09ebd5 100644 --- a/lib/presentation/symptoms_checker/suggestions_screen.dart +++ b/lib/presentation/symptoms_checker/suggestions_screen.dart @@ -1,3 +1,4 @@ +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'; @@ -7,6 +8,7 @@ import 'package:hmg_patient_app_new/extensions/route_extensions.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/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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'; @@ -46,7 +48,7 @@ class _SuggestionsScreenState extends State { context.navigateWithName(AppRoutes.triagePage); } else { dialogService.showErrorBottomSheet( - message: 'Please select at least one option before proceeding'.needTranslation, + message: LocaleKeys.pleaseSelectAtLeastOneOptionBeforeProceeding.tr(), ); } } @@ -192,7 +194,7 @@ class _SuggestionsScreenState extends State { children: [ Expanded( child: CollapsingListView( - title: "Suggestions".needTranslation, + title: LocaleKeys.suggestions.tr(), leadingCallback: () => context.pop(), child: viewModel.isSuggestionsLoading ? _buildLoadingShimmer() @@ -225,7 +227,7 @@ class _SuggestionsScreenState extends State { Icon(Icons.info_outline, size: 64.h, color: AppColors.greyTextColor), SizedBox(height: 16.h), Text( - 'No organs selected'.needTranslation, + LocaleKeys.noOrgansSelected.tr(), style: TextStyle( fontSize: 18.f, fontWeight: FontWeight.w600, @@ -234,7 +236,7 @@ class _SuggestionsScreenState extends State { ), SizedBox(height: 8.h), Text( - 'Please go back and select organs first'.needTranslation, + LocaleKeys.pleaseGoBackAndSelectOrgansFirst.tr(), textAlign: TextAlign.center, style: TextStyle( fontSize: 14.f, @@ -258,7 +260,7 @@ class _SuggestionsScreenState extends State { children: [ Expanded( child: CustomButton( - text: "Previous".needTranslation, + text: LocaleKeys.previous.tr(), onPressed: _onPreviousPressed, backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), borderColor: Colors.transparent, @@ -269,7 +271,7 @@ class _SuggestionsScreenState extends State { SizedBox(width: 12.w), Expanded( child: CustomButton( - text: "Next".needTranslation, + text: LocaleKeys.next.tr(), onPressed: () => _onNextPressed(viewModel), backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, diff --git a/lib/presentation/symptoms_checker/symptoms_selector_screen.dart b/lib/presentation/symptoms_checker/symptoms_selector_screen.dart index d6036c6..b4ba802 100644 --- a/lib/presentation/symptoms_checker/symptoms_selector_screen.dart +++ b/lib/presentation/symptoms_checker/symptoms_selector_screen.dart @@ -44,7 +44,7 @@ class _SymptomsSelectorPageState extends State { context.navigateWithName(AppRoutes.riskFactorsPage); } else { dialogService.showErrorBottomSheet( - message: 'Please select at least one symptom before proceeding'.needTranslation, + message: LocaleKeys.pleaseSelectAtLeastOneOptionBeforeProceeding.tr(), ); } } @@ -58,7 +58,7 @@ class _SymptomsSelectorPageState extends State { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: "Are you sure you want to restart the organ selection?".needTranslation, + loadingText: LocaleKeys.areYouSureYouWantToRestartOrganSelection.tr(), isShowActionButtons: true, onCancelTap: () => Navigator.pop(context), onConfirmTap: () => onConfirm(), @@ -79,7 +79,7 @@ class _SymptomsSelectorPageState extends State { children: [ Expanded( child: CollapsingListView( - title: "Symptoms Selector".needTranslation, + title: LocaleKeys.symptomsSelector.tr(), leadingCallback: () => _buildConfirmationBottomSheet( context: context, onConfirm: () => { @@ -252,7 +252,7 @@ class _SymptomsSelectorPageState extends State { Icon(Icons.info_outline, size: 64.h, color: AppColors.greyTextColor), SizedBox(height: 16.h), Text( - 'No organs selected'.needTranslation, + LocaleKeys.noOrgansSelected.tr(context: context), style: TextStyle( fontSize: 18.f, fontWeight: FontWeight.w600, @@ -261,7 +261,7 @@ class _SymptomsSelectorPageState extends State { ), SizedBox(height: 8.h), Text( - 'Please go back and select organs first'.needTranslation, + LocaleKeys.pleaseGoBackAndSelectOrgansFirst.tr(), textAlign: TextAlign.center, style: TextStyle( fontSize: 14.f, @@ -285,7 +285,7 @@ class _SymptomsSelectorPageState extends State { children: [ Expanded( child: CustomButton( - text: "Previous".needTranslation, + text: LocaleKeys.previous.tr(context: context), onPressed: _onPreviousPressed, backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), borderColor: Colors.transparent, @@ -296,7 +296,7 @@ class _SymptomsSelectorPageState extends State { SizedBox(width: 12.w), Expanded( child: CustomButton( - text: "Next".needTranslation, + text: LocaleKeys.next.tr(context: context), onPressed: () => _onNextPressed(viewModel), backgroundColor: AppColors.primaryRedColor, borderColor: AppColors.primaryRedColor, diff --git a/lib/presentation/symptoms_checker/triage_screen.dart b/lib/presentation/symptoms_checker/triage_screen.dart index 9d5d884..526136c 100644 --- a/lib/presentation/symptoms_checker/triage_screen.dart +++ b/lib/presentation/symptoms_checker/triage_screen.dart @@ -117,10 +117,9 @@ class _TriagePageState extends State { Lottie.asset(AppAnimations.ambulanceAlert, repeat: false, reverse: false, frameRate: FrameRate(60), width: 120.h, height: 120.h, fit: BoxFit.contain), SizedBox(height: 8.h), - "Emergency".needTranslation.toText28(color: AppColors.whiteColor, isBold: true), + LocaleKeys.emergencyTriage.tr(context: context).toText28(color: AppColors.whiteColor, isBold: true), SizedBox(height: 8.h), - "Emergency evidence detected. Please seek medical attention." - .needTranslation + LocaleKeys.emergencyEvidenceDetected.tr(context: context) .toText14(color: AppColors.whiteColor, weight: FontWeight.w500), SizedBox(height: 24.h), CustomButton( @@ -159,14 +158,14 @@ class _TriagePageState extends State { final currentQuestion = viewModel.currentTriageQuestion; if (currentQuestion?.items == null || currentQuestion!.items!.isEmpty) { dialogService.showErrorBottomSheet( - message: 'No question items available'.needTranslation, + message: LocaleKeys.noQuestionItemsAvailable.tr(context: context), ); return; } // Check if all items have been answered if (!viewModel.areAllTriageItemsAnswered) { - dialogService.showErrorBottomSheet(message: 'Please answer all questions before proceeding'.needTranslation); + dialogService.showErrorBottomSheet(message: LocaleKeys.pleaseAnswerAllQuestionsBeforeProceeding.tr(context: context)); return; } @@ -222,7 +221,7 @@ class _TriagePageState extends State { children: [ Expanded( child: CollapsingListView( - title: "Triage".needTranslation, + title: LocaleKeys.triage.tr(context: context), leadingCallback: () => _showConfirmationBeforeExit(context), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -304,7 +303,7 @@ class _TriagePageState extends State { title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: "Are you sure you want to exit? Your progress will be lost.".needTranslation, + loadingText: LocaleKeys.areYouSureYouWantToExitProgress.tr(context: context), isShowActionButtons: true, onCancelTap: () => Navigator.pop(context), onConfirmTap: () { @@ -325,7 +324,7 @@ class _TriagePageState extends State { if (viewModel.currentTriageQuestion == null) { return Center( - child: "No question available".needTranslation.toText16(weight: FontWeight.w500), + child: LocaleKeys.noQuestionAvailable.tr(context: context).toText16(weight: FontWeight.w500), ); } @@ -457,7 +456,7 @@ class _TriagePageState extends State { children: [ RichText( text: TextSpan( - text: "Possible symptom: ".needTranslation, + text: LocaleKeys.possibleSymptom.tr(context: context), style: TextStyle( color: AppColors.greyTextColor, fontWeight: FontWeight.w600, @@ -492,7 +491,7 @@ class _TriagePageState extends State { ), children: [ TextSpan( - text: "- Symptoms checker finding score".needTranslation, + text: LocaleKeys.symptomsCheckerFindingScore.tr(context: context), style: TextStyle( color: AppColors.textColor, fontWeight: FontWeight.w500, @@ -510,7 +509,7 @@ class _TriagePageState extends State { children: [ Expanded( child: CustomButton( - text: "Previous".needTranslation, + text: LocaleKeys.previous.tr(context: context), onPressed: isFirstQuestion ? () {} : _onPreviousPressed, isDisabled: isFirstQuestion || viewModel.isTriageDiagnosisLoading, backgroundColor: AppColors.primaryRedColor.withValues(alpha: 0.11), @@ -522,7 +521,7 @@ class _TriagePageState extends State { SizedBox(width: 12.w), Expanded( child: CustomButton( - text: "Next".needTranslation, + text: LocaleKeys.next.tr(context: context), isDisabled: viewModel.isTriageDiagnosisLoading, onPressed: _onNextPressed, backgroundColor: AppColors.primaryRedColor, diff --git a/lib/presentation/symptoms_checker/user_info_selection.dart b/lib/presentation/symptoms_checker/user_info_selection.dart index b438420..9973d54 100644 --- a/lib/presentation/symptoms_checker/user_info_selection.dart +++ b/lib/presentation/symptoms_checker/user_info_selection.dart @@ -1,3 +1,4 @@ +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'; @@ -9,6 +10,7 @@ import 'package:hmg_patient_app_new/extensions/route_extensions.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/symptoms_checker/symptoms_checker_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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'; @@ -149,20 +151,20 @@ class _UserInfoSelectionScreenState extends State { viewModel.selectedWeight == null; // Get display values - String genderText = viewModel.selectedGender ?? "Not set"; + String genderText = viewModel.selectedGender ?? LocaleKeys.notSet.tr(context: context); // Show age calculated from DOB (prefer viewModel's age, fallback to calculated from user's DOB) int? displayAge = viewModel.selectedAge ?? userAgeFromDOB; - String ageText = displayAge != null ? "$displayAge Years" : "Not set"; + String ageText = displayAge != null ? "$displayAge ${LocaleKeys.years.tr(context: context)}" : LocaleKeys.notSet.tr(context: context); String heightText = - viewModel.selectedHeight != null ? "${viewModel.selectedHeight!.round()} ${viewModel.isHeightCm ? 'cm' : 'ft'}" : "Not set"; + viewModel.selectedHeight != null ? "${viewModel.selectedHeight!.round()} ${viewModel.isHeightCm ? 'cm' : 'ft'}" : LocaleKeys.notSet.tr(context: context); String weightText = - viewModel.selectedWeight != null ? "${viewModel.selectedWeight!.round()} ${viewModel.isWeightKg ? 'kg' : 'lbs'}" : "Not set"; + viewModel.selectedWeight != null ? "${viewModel.selectedWeight!.round()} ${viewModel.isWeightKg ? 'kg' : 'lbs'}" : LocaleKeys.notSet.tr(context: context); return Column( children: [ Expanded( child: CollapsingListView( - title: "Symptoms Checker".needTranslation, + title: LocaleKeys.symptomsChecker.tr(context: context), isLeading: true, child: SingleChildScrollView( child: Column( @@ -173,7 +175,7 @@ class _UserInfoSelectionScreenState extends State { padding: EdgeInsets.symmetric(vertical: 24.h, horizontal: 16.w), child: Column( children: [ - "Hello $name, Is your information up to date?".needTranslation.toText16( + LocaleKeys.helloIsYourInformationUpToDate.tr(namedArgs: {'name': name}).toText16( weight: FontWeight.w600, color: AppColors.textColor, ), @@ -181,7 +183,7 @@ class _UserInfoSelectionScreenState extends State { _buildEditInfoTile( context: context, leadingIcon: AppAssets.genderIcon, - title: "Gender".needTranslation, + title: LocaleKeys.gender.tr(context: context), subTitle: genderText, onTap: () { viewModel.setUserInfoPage(0, isSinglePageEdit: true); @@ -193,7 +195,7 @@ class _UserInfoSelectionScreenState extends State { _buildEditInfoTile( context: context, leadingIcon: AppAssets.calendarGrey, - title: "Age".needTranslation, + title: LocaleKeys.age.tr(context: context), subTitle: ageText, iconColor: AppColors.greyTextColor, onTap: () { @@ -206,7 +208,7 @@ class _UserInfoSelectionScreenState extends State { _buildEditInfoTile( context: context, leadingIcon: AppAssets.rulerIcon, - title: "Height".needTranslation, + title: LocaleKeys.height.tr(context: context), subTitle: heightText, onTap: () { viewModel.setUserInfoPage(2, isSinglePageEdit: true); @@ -218,7 +220,7 @@ class _UserInfoSelectionScreenState extends State { _buildEditInfoTile( context: context, leadingIcon: AppAssets.weightScale, - title: "Weight".needTranslation, + title: LocaleKeys.weight.tr(context: context), subTitle: weightText, onTap: () { viewModel.setUserInfoPage(3, isSinglePageEdit: true); @@ -255,7 +257,7 @@ class _UserInfoSelectionScreenState extends State { children: [ Expanded( child: CustomButton( - text: "No, Edit all".needTranslation, + text: LocaleKeys.noEditAll.tr(context: context), icon: AppAssets.edit_icon, iconColor: AppColors.primaryRedColor, onPressed: () { @@ -271,7 +273,7 @@ class _UserInfoSelectionScreenState extends State { SizedBox(width: 12.w), Expanded( child: CustomButton( - text: "Yes, It is".needTranslation, + text: LocaleKeys.yesItIs.tr(context: context), icon: AppAssets.tickIcon, iconColor: hasEmptyFields ? AppColors.greyTextColor : AppColors.whiteColor, onPressed: hasEmptyFields diff --git a/lib/presentation/todo_section/ancillary_order_payment_page.dart b/lib/presentation/todo_section/ancillary_order_payment_page.dart index 054108d..fe07186 100644 --- a/lib/presentation/todo_section/ancillary_order_payment_page.dart +++ b/lib/presentation/todo_section/ancillary_order_payment_page.dart @@ -83,7 +83,7 @@ class _AncillaryOrderPaymentPageState extends State { children: [ Expanded( child: CollapsingListView( - title: "Select Payment Method".needTranslation, + title: LocaleKeys.selectPaymentMethod.tr(context: context), child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -103,9 +103,9 @@ class _AncillaryOrderPaymentPageState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Image.asset(AppAssets.mada, width: 72.h, height: 25.h).toShimmer2(isShow: todoVM.isProcessingPayment), + LocaleKeys.visaOrMastercard.tr(context: context).toText16(isBold: true).toShimmer2(isShow: todoVM.isProcessingPayment), SizedBox(height: 16.h), - "Mada".needTranslation.toText16(isBold: true).toShimmer2(isShow: todoVM.isProcessingPayment), + LocaleKeys.mada.tr(context: context).toText16(isBold: true).toShimmer2(isShow: todoVM.isProcessingPayment), ], ), SizedBox(width: 8.h), @@ -152,7 +152,7 @@ class _AncillaryOrderPaymentPageState extends State { ], ).toShimmer2(isShow: todoVM.isProcessingPayment), SizedBox(height: 16.h), - "Visa or Mastercard".needTranslation.toText16(isBold: true).toShimmer2(isShow: todoVM.isProcessingPayment), + LocaleKeys.visaOrMastercard.tr(context: context).toText16(isBold: true).toShimmer2(isShow: todoVM.isProcessingPayment), ], ), SizedBox(width: 8.h), @@ -210,14 +210,14 @@ class _AncillaryOrderPaymentPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox(height: 24.h), - "Total amount to pay".needTranslation.toText18(isBold: true).paddingSymmetrical(24.h, 0.h), + LocaleKeys.totalAmountToPay.tr(context: context).toText18(isBold: true).paddingSymmetrical(24.h, 0.h), SizedBox(height: 17.h), // Amount before tax Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Amount before tax".needTranslation.toText14(isBold: true), + LocaleKeys.amountBeforeTax.tr(context: context).toText14(isBold: true), Utils.getPaymentAmountWithSymbol( amountBeforeTax.toStringAsFixed(2).toText16(isBold: true), AppColors.blackColor, @@ -231,7 +231,7 @@ class _AncillaryOrderPaymentPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "VAT 15%".needTranslation.toText14(isBold: true, color: AppColors.greyTextColor), + LocaleKeys.vat15.tr(context: context).toText14(isBold: true, color: AppColors.greyTextColor), Utils.getPaymentAmountWithSymbol( taxAmount.toStringAsFixed(2).toText14(isBold: true, color: AppColors.greyTextColor), AppColors.greyTextColor, @@ -247,7 +247,7 @@ class _AncillaryOrderPaymentPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "".needTranslation.toText14(isBold: true), + "".toText14(isBold: true), Utils.getPaymentAmountWithSymbol( widget.totalAmount.toStringAsFixed(2).toText24(isBold: true), AppColors.blackColor, @@ -346,7 +346,7 @@ class _AncillaryOrderPaymentPageState extends State { } void _checkPaymentStatus() { - LoaderBottomSheet.showLoader(loadingText: "Checking payment status, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.checkingPaymentStatusPleaseWait.tr(context: context)); todoSectionViewModel.checkPaymentStatus( transID: transID, @@ -384,7 +384,7 @@ class _AncillaryOrderPaymentPageState extends State { required String paymentReference, required String paymentMethod, }) { - LoaderBottomSheet.showLoader(loadingText: "Processing payment, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.processingPaymentPleaseWait.tr(context: context)); final user = appState.getAuthenticatedUser(); @@ -426,7 +426,7 @@ class _AncillaryOrderPaymentPageState extends State { required String advanceNumber, required String paymentReference, }) { - LoaderBottomSheet.showLoader(loadingText: "Finalizing payment, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.finalizingPaymentPleaseWait.tr(context: context)); final user = appState.getAuthenticatedUser(); @@ -450,7 +450,7 @@ class _AncillaryOrderPaymentPageState extends State { } void _autoGenerateInvoice() { - LoaderBottomSheet.showLoader(loadingText: "Generating invoice, Please wait...".needTranslation); + LoaderBottomSheet.showLoader(loadingText: LocaleKeys.generatingInvoicePleaseWait.tr(context: context)); List selectedProcListAPI = widget.selectedProcedures.map((element) { return { @@ -496,7 +496,7 @@ class _AncillaryOrderPaymentPageState extends State { children: [ Row( children: [ - "Here is your invoice #: ".needTranslation.toText14( + LocaleKeys.hereIsYourInvoiceNumber.tr(context: context).toText14( color: AppColors.textColorLight, weight: FontWeight.w500, ), @@ -510,7 +510,7 @@ class _AncillaryOrderPaymentPageState extends State { Expanded( child: CustomButton( height: 56.h, - text: LocaleKeys.ok.tr(), + text: LocaleKeys.ok.tr(context: context), onPressed: () { Navigator.pushAndRemoveUntil( context, @@ -528,8 +528,8 @@ class _AncillaryOrderPaymentPageState extends State { ), ], ), - // title: "Payment Completed Successfully".needTranslation, - titleWidget: Utils.getSuccessWidget(loadingText: "Payment Completed Successfully".needTranslation), + // title: LocaleKeys.paymentCompletedSuccessfully.tr(context: context), + titleWidget: Utils.getSuccessWidget(loadingText: LocaleKeys.paymentCompletedSuccessfully.tr(context: context)), isCloseButtonVisible: false, isDismissible: false, isFullScreen: false, @@ -607,7 +607,7 @@ class _AncillaryOrderPaymentPageState extends State { Navigator.of(context).pop(); showCommonBottomSheetWithoutHeight( context, - child: Utils.getErrorWidget(loadingText: "Failed to initialize Apple Pay. Please try again.".needTranslation), + child: Utils.getErrorWidget(loadingText: LocaleKeys.failedToInitializeApplePay.tr(context: context)), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, diff --git a/lib/presentation/todo_section/ancillary_procedures_details_page.dart b/lib/presentation/todo_section/ancillary_procedures_details_page.dart index b7515af..f604673 100644 --- a/lib/presentation/todo_section/ancillary_procedures_details_page.dart +++ b/lib/presentation/todo_section/ancillary_procedures_details_page.dart @@ -102,14 +102,14 @@ class _AncillaryOrderDetailsListState extends State { String _getApprovalStatusText(AncillaryOrderProcDetail procedure) { if (procedure.isApprovalRequired == false) { - return "Cash"; + return LocaleKeys.cash.tr(context: context); } else { if (procedure.isApprovalCreated == true && procedure.approvalNo != 0) { - return "Approved"; + return LocaleKeys.approved.tr(context: context); } else if (procedure.isApprovalRequired == true && procedure.isApprovalCreated == true && procedure.approvalNo == 0) { - return "Approval Rejected - Please visit receptionist"; + return LocaleKeys.approvalRejectedPleaseVisitReceptionist.tr(context: context); } else { - return "Sent For Approval"; + return LocaleKeys.sentForApproval.tr(context: context); } } } @@ -135,7 +135,7 @@ class _AncillaryOrderDetailsListState extends State { children: [ Expanded( child: CollapsingListView( - title: "Ancillary Order Details".needTranslation, + title: LocaleKeys.ancillaryOrderDetails.tr(context: context), child: viewModel.isAncillaryDetailsProceduresLoading ? _buildLoadingShimmer().paddingSymmetrical(24.w, 0) : viewModel.patientAncillaryOrderProceduresList.isEmpty @@ -186,7 +186,7 @@ class _AncillaryOrderDetailsListState extends State { ), child: Utils.getNoDataWidget( context, - noDataText: "No Procedures available for the selected order.".needTranslation, + noDataText: LocaleKeys.noProceduresAvailableForSelectedOrder.tr(context: context), isSmallWidget: true, width: 62.w, height: 62.h, @@ -372,7 +372,7 @@ class _AncillaryOrderDetailsListState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Procedures".needTranslation.toText12( + LocaleKeys.procedures.tr(context: context).toText12( color: AppColors.textColorLight, fontWeight: FontWeight.w600, ), @@ -385,7 +385,7 @@ class _AncillaryOrderDetailsListState extends State { Column( crossAxisAlignment: CrossAxisAlignment.end, children: [ - "Total Amount".needTranslation.toText12( + LocaleKeys.totalAmount.tr(context: context).toText12( color: AppColors.textColorLight, fontWeight: FontWeight.w600, ), @@ -535,7 +535,7 @@ class _AncillaryOrderDetailsListState extends State { // ), if (procedure.isCovered == true) AppCustomChipWidget( - labelText: "Covered".needTranslation, + labelText: LocaleKeys.covered.tr(context: context), backgroundColor: AppColors.successColor.withValues(alpha: 0.1), textColor: AppColors.successColor, ), @@ -551,7 +551,7 @@ class _AncillaryOrderDetailsListState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Price".needTranslation.toText10(color: AppColors.textColorLight), + LocaleKeys.price.tr(context: context).toText10(color: AppColors.textColorLight), SizedBox(height: 4.h), Row( children: [ @@ -570,7 +570,7 @@ class _AncillaryOrderDetailsListState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "VAT (15%)".needTranslation.toText10(color: AppColors.textColorLight), + LocaleKeys.vatPercent.tr(context: context).toText10(color: AppColors.textColorLight), SizedBox(height: 4.h), Row( children: [ @@ -589,7 +589,7 @@ class _AncillaryOrderDetailsListState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Total".needTranslation.toText10(color: AppColors.textColorLight), + LocaleKeys.total.tr(context: context).toText10(color: AppColors.textColorLight), SizedBox(height: 4.h), Row( children: [ @@ -654,7 +654,7 @@ class _AncillaryOrderDetailsListState extends State { CustomButton( borderWidth: 0, backgroundColor: AppColors.infoLightColor, - text: "Proceed to Payment".needTranslation, + text: LocaleKeys.proceedToPayment.tr(context: context), onPressed: () { // Navigate to payment page with selected procedures Navigator.of(context).push( diff --git a/lib/presentation/todo_section/todo_page.dart b/lib/presentation/todo_section/todo_page.dart index 0d2d806..161ffaf 100644 --- a/lib/presentation/todo_section/todo_page.dart +++ b/lib/presentation/todo_section/todo_page.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'dart:developer'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; @@ -9,6 +10,7 @@ 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/todo_section/models/resp_models/ancillary_order_list_response_model.dart'; import 'package:hmg_patient_app_new/features/todo_section/todo_section_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/todo_section/ancillary_procedures_details_page.dart'; import 'package:hmg_patient_app_new/presentation/todo_section/widgets/ancillary_orders_list.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; @@ -61,7 +63,7 @@ class _ToDoPageState extends State { Widget build(BuildContext context) { appState = getIt.get(); return CollapsingListView( - title: "Ancillary Orders".needTranslation, + title: LocaleKeys.ancillaryOrdersList.tr(context: context), isLeading: true, child: SingleChildScrollView( child: Column( diff --git a/lib/presentation/todo_section/widgets/ancillary_orders_list.dart b/lib/presentation/todo_section/widgets/ancillary_orders_list.dart index 78d7e3e..aa4d0ba 100644 --- a/lib/presentation/todo_section/widgets/ancillary_orders_list.dart +++ b/lib/presentation/todo_section/widgets/ancillary_orders_list.dart @@ -79,7 +79,7 @@ class AncillaryOrdersList extends StatelessWidget { ), child: Utils.getNoDataWidget( context, - noDataText: "You don't have any ancillary orders yet.".needTranslation, + noDataText: LocaleKeys.youDontHaveAnyAncillaryOrdersYet.tr(context: context), isSmallWidget: true, width: 62.w, height: 62.h, @@ -187,31 +187,31 @@ class AncillaryOrderCard extends StatelessWidget { if (order.appointmentDate != null || isLoading) AppCustomChipWidget( icon: AppAssets.appointment_calendar_icon, - labelText: isLoading ? "Date: Jan 20, 2024" : DateFormat('MMM dd, yyyy').format(order.appointmentDate!).needTranslation, + labelText: isLoading ? "Date: Jan 20, 2024" : DateFormat('MMM dd, yyyy').format(order.appointmentDate!), ).toShimmer2(isShow: isLoading), // Appointment Number if (order.appointmentNo != null || isLoading) AppCustomChipWidget( - labelText: isLoading ? "Appt# : 98765" : "Appt #: ${order.appointmentNo}".needTranslation, + labelText: isLoading ? "Appt# : 98765" : "Appt #: ${order.appointmentNo}", ).toShimmer2(isShow: isLoading), // Invoice Number if (order.invoiceNo != null || isLoading) AppCustomChipWidget( - labelText: isLoading ? "Invoice: 45678" : "Invoice: ${order.invoiceNo}".needTranslation, + labelText: isLoading ? "Invoice: 45678" : LocaleKeys.invoiceWithNumber.tr(namedArgs: {'invoiceNo': '${order.invoiceNo}'}), ).toShimmer2(isShow: isLoading), // Queued Status if (order.isQueued == true || isLoading) AppCustomChipWidget( - labelText: "Queued".needTranslation, + labelText: LocaleKeys.queued.tr(context: context), ).toShimmer2(isShow: isLoading), // Check-in Available Status if (order.isCheckInAllow == true || isLoading) AppCustomChipWidget( - labelText: "Check-in Ready".needTranslation, + labelText: LocaleKeys.checkInReady.tr(context: context), ).toShimmer2(isShow: isLoading), ], ), @@ -225,7 +225,7 @@ class AncillaryOrderCard extends StatelessWidget { if (order.isCheckInAllow == true || isLoading) Expanded( child: CustomButton( - text: "Check In".needTranslation, + text: LocaleKeys.checkIn.tr(context: context), onPressed: () { if (isLoading) { return; @@ -249,7 +249,7 @@ class AncillaryOrderCard extends StatelessWidget { // View Details Button Expanded( child: CustomButton( - text: "View Details".needTranslation, + text: LocaleKeys.viewDetails.tr(context: context), onPressed: () { if (isLoading) { return; diff --git a/lib/presentation/todo_section/widgets/ancillary_procedures_list.dart b/lib/presentation/todo_section/widgets/ancillary_procedures_list.dart index ba2f94d..2d99aa0 100644 --- a/lib/presentation/todo_section/widgets/ancillary_procedures_list.dart +++ b/lib/presentation/todo_section/widgets/ancillary_procedures_list.dart @@ -7,6 +7,7 @@ import 'package:hmg_patient_app_new/core/utils/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/features/todo_section/models/resp_models/ancillary_order_list_response_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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'; @@ -73,7 +74,7 @@ class AncillaryProceduresList extends StatelessWidget { ), child: Utils.getNoDataWidget( context, - noDataText: "You don't have any ancillary orders yet.".needTranslation, + noDataText: LocaleKeys.youDontHaveAnyAncillaryOrdersYet.tr(context: context), isSmallWidget: true, width: 62.w, height: 62.h, @@ -118,7 +119,7 @@ class AncillaryOrderCard extends StatelessWidget { children: [ Row( children: [ - "Order #".needTranslation.toText14( + LocaleKeys.orderNumber.tr(context: context).toText14( color: AppColors.textColorLight, weight: FontWeight.w500, ), @@ -181,31 +182,31 @@ class AncillaryOrderCard extends StatelessWidget { AppCustomChipWidget( icon: AppAssets.calendar, labelText: - isLoading ? "Date: Jan 20, 2024" : "Date: ${DateFormat('MMM dd, yyyy').format(order.appointmentDate!)}".needTranslation, + isLoading ? "Date: Jan 20, 2024" : "Date: ${DateFormat('MMM dd, yyyy').format(order.appointmentDate!)}", ).toShimmer2(isShow: isLoading), // Appointment Number if (order.appointmentNo != null || isLoading) AppCustomChipWidget( - labelText: isLoading ? "Appt #: 98765" : "Appt #: ${order.appointmentNo}".needTranslation, + labelText: isLoading ? "Appt #: 98765" : "Appt #: ${order.appointmentNo}", ).toShimmer2(isShow: isLoading), // Invoice Number if (order.invoiceNo != null || isLoading) AppCustomChipWidget( - labelText: isLoading ? "Invoice: 45678" : "Invoice: ${order.invoiceNo}".needTranslation, + labelText: isLoading ? "Invoice: 45678" : LocaleKeys.invoiceWithNumber.tr(namedArgs: {'invoiceNo': '${order.invoiceNo}'}), ).toShimmer2(isShow: isLoading), // Queued Status if (order.isQueued == true || isLoading) AppCustomChipWidget( - labelText: "Queued".needTranslation, + labelText: LocaleKeys.queued.tr(context: context), ).toShimmer2(isShow: isLoading), // Check-in Available Status if (order.isCheckInAllow == true || isLoading) AppCustomChipWidget( - labelText: "Check-in Ready".needTranslation, + labelText: LocaleKeys.checkInReady.tr(context: context), ).toShimmer2(isShow: isLoading), ], ), @@ -219,7 +220,7 @@ class AncillaryOrderCard extends StatelessWidget { if (order.isCheckInAllow == true || isLoading) Expanded( child: CustomButton( - text: "Check In".needTranslation, + text: LocaleKeys.checkIn.tr(context: context), onPressed: () { if (isLoading) { return; @@ -243,7 +244,7 @@ class AncillaryOrderCard extends StatelessWidget { // View Details Button Expanded( child: CustomButton( - text: "View Details".needTranslation, + text: LocaleKeys.viewDetails.tr(context: context), onPressed: () { if (isLoading) { return; diff --git a/lib/widgets/common_bottom_sheet.dart b/lib/widgets/common_bottom_sheet.dart index 6ff5cc5..4cfde1b 100644 --- a/lib/widgets/common_bottom_sheet.dart +++ b/lib/widgets/common_bottom_sheet.dart @@ -1,5 +1,6 @@ import 'dart:io' show Platform; +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'; @@ -7,6 +8,7 @@ import 'package:hmg_patient_app_new/core/utils/calender_utils_new.dart'; import 'package:hmg_patient_app_new/core/utils/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/prescriptions/prescription_reminder_view.dart'; import 'package:hmg_patient_app_new/services/permission_service.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -40,13 +42,13 @@ class BottomSheetUtils{ Future _showReminderBottomSheet(BuildContext providedContext, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted, {required Function onSuccess, String? title, String? description, Function(int)? onMultiDateSuccess, bool? isMultiAllowed}) async { - showCommonBottomSheetWithoutHeight(providedContext, title: "Set the timer of reminder".needTranslation, child: PrescriptionReminderView( + showCommonBottomSheetWithoutHeight(providedContext, title: LocaleKeys.setTimerOfReminder.tr(), child: PrescriptionReminderView( setReminder: (int value) async { if (!isMultiAllowed!) { if (onMultiDateSuccess == null) { CalenderUtilsNew calendarUtils = CalenderUtilsNew.instance; await calendarUtils.createOrUpdateEvent( - title: title ?? "You have appointment with Dr. ".needTranslation + doctorName, + title: title ?? LocaleKeys.youHaveAppointmentWithDr.tr() + doctorName, description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted, scheduleDateTime: dateTime, eventId: eventId, diff --git a/lib/widgets/countdown_timer.dart b/lib/widgets/countdown_timer.dart index 165a833..1722ebf 100644 --- a/lib/widgets/countdown_timer.dart +++ b/lib/widgets/countdown_timer.dart @@ -1,6 +1,8 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.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/generated/locale_keys.g.dart'; Widget buildTime(Duration duration, {bool isHomePage = false}) { String twoDigits(int n) => n.toString().padLeft(2, '0'); @@ -11,9 +13,9 @@ Widget buildTime(Duration duration, {bool isHomePage = false}) { return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - buildTimeColumn(hours, "Hours".needTranslation), - buildTimeColumn(minutes, "Mins".needTranslation), - buildTimeColumn(seconds, "Secs".needTranslation, isLast: true), + buildTimeColumn(hours, LocaleKeys.hours.tr()), + buildTimeColumn(minutes, LocaleKeys.mins.tr()), + buildTimeColumn(seconds, LocaleKeys.secs.tr(), isLast: true), ], ); } From 5feacfaf27bcb46a34f76abe31ca56a05f502ba2 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 18 Jan 2026 10:45:17 +0300 Subject: [PATCH 12/12] Translation updates --- assets/langs/ar-SA.json | 68 +++++++++++++++++- assets/langs/en-US.json | 70 +++++++++++++++++-- lib/core/utils/utils.dart | 6 +- lib/generated/locale_keys.g.dart | 58 +++++++++++++++ .../active_medication_page.dart | 37 +++++----- .../vital_sign/vital_sign_details_page.dart | 60 +++++++++------- .../water_monitor/water_consumption_page.dart | 22 +++--- .../water_monitor_settings_page.dart | 34 ++++----- .../widgets/cup_bottomsheet_widgets.dart | 8 ++- .../widgets/hydration_tips_widget.dart | 12 ++-- .../widgets/water_action_buttons_widget.dart | 8 ++- .../widgets/water_intake_summary_widget.dart | 20 +++--- lib/widgets/app_language_change.dart | 4 +- lib/widgets/appbar/collapsing_list_view.dart | 16 +++-- lib/widgets/appbar/collapsing_toolbar.dart | 12 ++-- .../date_range_calender.dart | 16 ++--- .../family_files/family_file_add_widget.dart | 2 +- lib/widgets/map/location_map_widget.dart | 4 +- lib/widgets/map/map_utility_screen.dart | 12 ++-- lib/widgets/time_picker_widget.dart | 8 ++- 20 files changed, 346 insertions(+), 131 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index e304710..9c1c962 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -408,7 +408,7 @@ "brand": "العلامة التجارية", "power": "القوة", "diameter": "القطر", - "remarks": "ملاحظات", + "remarks": "ملاحظات: ", "activeMedications": "الأدوية النشطة", "expDate": "تاريخ انتهاء الصلاحية النشط:", "route": "الطريق", @@ -1435,5 +1435,69 @@ "overview": "نظرة عامة", "details": "التفاصيل", "healthy": "صحي", - "warning": "تحذير" + "warning": "تحذير", + "vitalSignDetails": "تفاصيل العلامات الحيوية", + "resultOf": "نتيجة {date}", + "resultOfNoDate": "نتيجة --", + "referenceRangeBetween": "النطاق المرجعي: {low} – {high} {unit}", + "referenceRangeMin": "النطاق المرجعي: ≥ {low} {unit}", + "referenceRangeMax": "النطاق المرجعي: ≤ {high} {unit}", + "noHistoryAvailable": "لا يوجد تاريخ متاح", + "bmiDescription": "مؤشر كتلة الجسم هو قياس يعتمد على الطول والوزن لتقدير دهون الجسم.", + "heightDescription": "يقاس الطول بالسنتيمتر ويستخدم لحساب مؤشر كتلة الجسم وتوصيات الجرعات.", + "weightDescription": "الوزن يساعد في تتبع الصحة العامة والتغذية والتغيرات مع مرور الوقت.", + "bloodPressureDescription": "ضغط الدم يعكس قوة الدم على جدران الشرايين. يظهر كانقباضي/انبساطي.", + "temperatureDescription": "درجة حرارة الجسم تعكس مدى سخونة جسمك وقد تتغير مع العدوى أو الالتهاب.", + "heartRateDescriptionVital": "معدل ضربات القلب يشير إلى عدد نبضات القلب في الدقيقة.", + "respiratoryRateDescription": "معدل التنفس هو عدد الأنفاس المأخوذة في الدقيقة.", + "bmiAdvice": "حافظ على نظام غذائي متوازن ونشاط منتظم. إذا كان مؤشر كتلة جسمك مرتفعًا أو منخفضًا، فكر في استشارة طبيبك.", + "heightAdvice": "لا حاجة لاتخاذ أي إجراء إلا إذا بدا قياسك غير صحيح. قم بتحديثه في زيارتك القادمة.", + "weightAdvice": "راقب تغيرات الوزن. الزيادة أو الخسارة المفاجئة قد تتطلب استشارة طبية.", + "bloodPressureAdvice": "استمر في تتبع ضغط دمك. يجب مناقشة القراءات المرتفعة أو المنخفضة مع طبيبك.", + "temperatureAdvice": "إذا كان لديك حمى مستمرة أو أعراض، اتصل بمقدم الرعاية الصحية.", + "heartRateAdvice": "تتبع اتجاهات معدل ضربات قلبك. إذا شعرت بدوار أو ألم في الصدر، اطلب الرعاية الطبية.", + "respiratoryRateAdvice": "إذا لاحظت ضيقًا في التنفس أو تنفسًا غير طبيعي، اطلب المشورة الطبية.", + "whatShouldIDoNext": "ماذا يجب أن أفعل بعد ذلك؟", + "customizeDrinkCup": "قم بتخصيص كوب مشروبك", + "tipsToStayHydrated": "نصائح للبقاء رطبًا", + "drinkBeforeYouFeelThirsty": "اشرب قبل أن تشعر بالعطش", + "keepRefillableBottleNextToYou": "احتفظ بزجاجة قابلة لإعادة التعبئة بجانبك", + "trackYourDailyIntakeToStayMotivated": "تتبع كمية الماء اليومية للحفاظ على الحافز", + "chooseSparklingWaterInsteadOfSoda": "اختر الماء الفوار بدلاً من الصودا", + "switchCup": "تبديل الكوب", + "plainWater": "ماء عادي", + "yourGoal": "هدفك", + "remaining": "المتبقي", + "hydrationStatus": "حالة الترطيب", + "areYouSureYouWantToCancelAllWaterReminders": "هل أنت متأكد أنك تريد إلغاء جميع تذكيرات الماء؟", + "remindersSet": "تم ضبط التذكيرات!", + "dailyWaterRemindersScheduledAt": "تم جدولة تذكيرات الماء اليومية في:", + "waterConsumption": "استهلاك المياه", + "selectNumberOfReminders": "حدد عدد التذكيرات", + "h2oSettings": "إعدادات H20", + "settingsSavedSuccessfully": "تم حفظ الإعدادات بنجاح", + "yourName": "اسمك", + "ageYears": "العمر (11-120) سنة", + "numberOfRemindersInADay": "عدد التذكيرات في اليوم", + + "medications": "الأدوية", + "someRemarksAboutPrescription": "ستجدون هنا بعض الملاحظات حول الوصفة الطبية", + "notifyMeBeforeConsumptionTime": "أبلغني قبل وقت الاستهلاك", + "noMedicationsToday": "لا أدوية اليوم", + "route": "Route: {route}", + "frequency": "Frequency: {frequency}", + "instruction": "Instruction: {instruction}", + "duration": "Duration: {days}", + "reminders": "تذكيرات", + "reminderAddedToCalendar": "تمت إضافة تذكير إلى التقويم ✅", + "errorWhileSettingCalendar": "حدث خطأ أثناء ضبط التقويم:{error}", + "instructions": "التعليمات", + "requests": "الطلبات", + "thisWeek": "هذا الأسبوع", + "lastMonth": "الشهر الماضي", + "lastSixMonths": "آخر 6 أشهر", + "selectTime": "حدد الوقت", + "pleaseWaitYouWillBeCalledForVitalSigns": "يرجى الانتظار! سيتم استدعاؤك لقياس العلامات الحيوية", + "pleaseVisitRoomForVitalSigns": "يرجى زيارة الغرفة {roomNumber} لقياس العلامات الحيوية", + "pleaseVisitRoomToTheDoctor": "يرجى زيارة الغرفة {roomNumber} لمقابلة الطبيب" } diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 98ca7ad..5f356ba 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -406,11 +406,8 @@ "brand": "Brand", "power": "Power", "diameter": "Diameter", - "remarks": "Remarks", "activeMedications": "Active Medications", "expDate": "Active Exp Date :", - "route": "Route", - "frequency": "Frequency", "dailyQuantity": "Daily Quantity :", "addReminder": "Add Reminder", "cancelReminder": "Cancel Reminder", @@ -1428,5 +1425,70 @@ "overview": "Overview", "details": "Details", "healthy": "Healthy", - "warning": "Warning" + "warning": "Warning", + "vitalSignDetails": "Vital Sign Details", + "resultOf": "Result of {date}", + "resultOfNoDate": "Result of --", + "referenceRangeBetween": "Reference range: {low} – {high} {unit}", + "referenceRangeMin": "Reference range: ≥ {low} {unit}", + "referenceRangeMax": "Reference range: ≤ {high} {unit}", + "noHistoryAvailable": "No history available", + "bmiDescription": "BMI is a measurement based on height and weight that estimates body fat.", + "heightDescription": "Height is measured in centimeters and is used to calculate BMI and dosage recommendations.", + "weightDescription": "Weight helps track overall health, nutrition, and changes over time.", + "bloodPressureDescription": "Blood pressure reflects the force of blood against artery walls. It is shown as systolic/diastolic.", + "temperatureDescription": "Body temperature reflects how hot your body is and may change with infection or inflammation.", + "heartRateDescriptionVital": "Heart rate refers to the number of heart beats per minute.", + "respiratoryRateDescription": "Respiratory rate is the number of breaths taken per minute.", + "bmiAdvice": "Maintain a balanced diet and regular activity. If your BMI is high or low, consider consulting your doctor.", + "heightAdvice": "No action is needed unless your measurement looks incorrect. Update it during your next visit.", + "weightAdvice": "Monitor weight changes. Sudden gain or loss may require medical advice.", + "bloodPressureAdvice": "Keep tracking your blood pressure. High or low readings should be discussed with your doctor.", + "temperatureAdvice": "If you have a persistent fever or symptoms, contact your healthcare provider.", + "heartRateAdvice": "Track your heart rate trends. If you feel dizziness or chest pain, seek medical care.", + "respiratoryRateAdvice": "If you notice shortness of breath or abnormal breathing, seek medical advice.", + "whatShouldIDoNext": "What should I do next?", + "customizeDrinkCup": "Customize your drink cup", + "tipsToStayHydrated": "Tips to stay hydrated", + "drinkBeforeYouFeelThirsty": "Drink before you feel thirsty", + "keepRefillableBottleNextToYou": "Keep a refillable bottle next to you", + "trackYourDailyIntakeToStayMotivated": "Track your daily intake to stay motivated", + "chooseSparklingWaterInsteadOfSoda": "Choose sparkling water instead of soda", + "switchCup": "Switch Cup", + "plainWater": "Plain Water", + "yourGoal": "Your Goal", + "remaining": "Remaining", + "hydrationStatus": "Hydration Status", + "areYouSureYouWantToCancelAllWaterReminders": "Are you sure you want to cancel all water reminders?", + "remindersSet": "Reminders Set!", + "dailyWaterRemindersScheduledAt": "Daily water reminders scheduled at:", + "waterConsumption": "Water Consumption", + "selectActivityLevel": "Select Activity Level", + "selectNumberOfReminders": "Select Number of Reminders", + "h2oSettings": "H20 Settings", + "settingsSavedSuccessfully": "Settings saved successfully", + "yourName": "Your Name", + "ageYears": "Age (11-120) yrs", + "numberOfRemindersInADay": "Number of reminders in a day", + "medications": "Medications", + "remarks": "Remarks: ", + "someRemarksAboutPrescription": "some remarks about the prescription will be here", + "notifyMeBeforeConsumptionTime": "Notify me before the consumption time", + "noMedicationsToday": "No medications today", + "route": "Route: {route}", + "frequency": "Frequency: {frequency}", + "instruction": "Instruction: {instruction}", + "duration": "Duration: {days}", + "reminders": "Reminders", + "reminderAddedToCalendar": "Reminder added to calendar ✅", + "errorWhileSettingCalendar": "Error while setting calendar: {error}", + "instructions": "Instructions", + "requests": "Requests", + "thisWeek": "This Week", + "lastMonth": "Last Month", + "lastSixMonths": "Last 6 Months", + "selectTime": "Select Time", + "pleaseWaitYouWillBeCalledForVitalSigns": "Please wait! you will be called for vital signs", + "pleaseVisitRoomForVitalSigns": "Please visit Room {roomNumber} for vital signs", + "pleaseVisitRoomToTheDoctor": "Please visit Room {roomNumber} to the Doctor" } diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart index 8978fcd..e5b0ca4 100644 --- a/lib/core/utils/utils.dart +++ b/lib/core/utils/utils.dart @@ -959,11 +959,11 @@ class Utils { static String getCardButtonText(int currentQueueStatus, String roomNumber) { switch (currentQueueStatus) { case 0: - return "Please wait! you will be called for vital signs".needTranslation; + return LocaleKeys.pleaseWaitYouWillBeCalledForVitalSigns.tr(); case 1: - return "Please visit Room $roomNumber for vital signs".needTranslation; + return LocaleKeys.pleaseVisitRoomForVitalSigns.tr(namedArgs: {'roomNumber': roomNumber.toString()}); case 2: - return "Please visit Room $roomNumber to the Doctor".needTranslation; + return LocaleKeys.pleaseVisitRoomToTheDoctor.tr(namedArgs: {'roomNumber': roomNumber.toString()}); } return ""; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index dc0655d..b3b2edf 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1430,5 +1430,63 @@ abstract class LocaleKeys { static const details = 'details'; static const healthy = 'healthy'; static const warning = 'warning'; + static const vitalSignDetails = 'vitalSignDetails'; + static const resultOfNoDate = 'resultOfNoDate'; + static const referenceRangeBetween = 'referenceRangeBetween'; + static const referenceRangeMin = 'referenceRangeMin'; + static const referenceRangeMax = 'referenceRangeMax'; + static const noHistoryAvailable = 'noHistoryAvailable'; + static const bmiDescription = 'bmiDescription'; + static const heightDescription = 'heightDescription'; + static const weightDescription = 'weightDescription'; + static const bloodPressureDescription = 'bloodPressureDescription'; + static const temperatureDescription = 'temperatureDescription'; + static const heartRateDescriptionVital = 'heartRateDescriptionVital'; + static const respiratoryRateDescription = 'respiratoryRateDescription'; + static const bmiAdvice = 'bmiAdvice'; + static const heightAdvice = 'heightAdvice'; + static const weightAdvice = 'weightAdvice'; + static const bloodPressureAdvice = 'bloodPressureAdvice'; + static const temperatureAdvice = 'temperatureAdvice'; + static const heartRateAdvice = 'heartRateAdvice'; + static const respiratoryRateAdvice = 'respiratoryRateAdvice'; + static const whatShouldIDoNext = 'whatShouldIDoNext'; + static const customizeDrinkCup = 'customizeDrinkCup'; + static const tipsToStayHydrated = 'tipsToStayHydrated'; + static const drinkBeforeYouFeelThirsty = 'drinkBeforeYouFeelThirsty'; + static const keepRefillableBottleNextToYou = 'keepRefillableBottleNextToYou'; + static const trackYourDailyIntakeToStayMotivated = 'trackYourDailyIntakeToStayMotivated'; + static const chooseSparklingWaterInsteadOfSoda = 'chooseSparklingWaterInsteadOfSoda'; + static const switchCup = 'switchCup'; + static const plainWater = 'plainWater'; + static const yourGoal = 'yourGoal'; + static const remaining = 'remaining'; + static const hydrationStatus = 'hydrationStatus'; + static const areYouSureYouWantToCancelAllWaterReminders = 'areYouSureYouWantToCancelAllWaterReminders'; + static const remindersSet = 'remindersSet'; + static const dailyWaterRemindersScheduledAt = 'dailyWaterRemindersScheduledAt'; + static const waterConsumption = 'waterConsumption'; + static const selectNumberOfReminders = 'selectNumberOfReminders'; + static const h2oSettings = 'h2oSettings'; + static const settingsSavedSuccessfully = 'settingsSavedSuccessfully'; + static const yourName = 'yourName'; + static const ageYears = 'ageYears'; + static const numberOfRemindersInADay = 'numberOfRemindersInADay'; + static const medications = 'medications'; + static const someRemarksAboutPrescription = 'someRemarksAboutPrescription'; + static const notifyMeBeforeConsumptionTime = 'notifyMeBeforeConsumptionTime'; + static const noMedicationsToday = 'noMedicationsToday'; + static const reminders = 'reminders'; + static const reminderAddedToCalendar = 'reminderAddedToCalendar'; + static const errorWhileSettingCalendar = 'errorWhileSettingCalendar'; + static const instructions = 'instructions'; + static const requests = 'requests'; + static const thisWeek = 'thisWeek'; + static const lastMonth = 'lastMonth'; + static const lastSixMonths = 'lastSixMonths'; + static const selectTime = 'selectTime'; + static const pleaseWaitYouWillBeCalledForVitalSigns = 'pleaseWaitYouWillBeCalledForVitalSigns'; + static const pleaseVisitRoomForVitalSigns = 'pleaseVisitRoomForVitalSigns'; + static const pleaseVisitRoomToTheDoctor = 'pleaseVisitRoomToTheDoctor'; } diff --git a/lib/presentation/active_medication/active_medication_page.dart b/lib/presentation/active_medication/active_medication_page.dart index d0720fb..14da5b0 100644 --- a/lib/presentation/active_medication/active_medication_page.dart +++ b/lib/presentation/active_medication/active_medication_page.dart @@ -134,7 +134,7 @@ class _ActiveMedicationPageState extends State { body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Active Medications".needTranslation, + Text(LocaleKeys.activeMedications.tr(), style: TextStyle( color: AppColors.textColor, fontSize: 27.f, @@ -191,7 +191,7 @@ class _ActiveMedicationPageState extends State { ], ), ), - Text("Medications".needTranslation, + Text(LocaleKeys.medications.tr(), style: TextStyle( color: AppColors.primaryRedBorderColor, fontSize: 12.f, @@ -253,8 +253,7 @@ class _ActiveMedicationPageState extends State { text: TextSpan( children: [ TextSpan( - text: "Remarks: " - .needTranslation, + text: LocaleKeys.remarks.tr(), style: TextStyle( color: AppColors.textColor, @@ -265,8 +264,7 @@ class _ActiveMedicationPageState extends State { ), TextSpan( text: - "some remarks about the prescription will be here" - .needTranslation, + LocaleKeys.someRemarksAboutPrescription.tr(), style: TextStyle( color: AppColors .lightGreyTextColor, @@ -312,8 +310,7 @@ class _ActiveMedicationPageState extends State { CrossAxisAlignment.start, children: [ Text( - "Set Reminder" - .needTranslation, + LocaleKeys.setReminder.tr(), style: TextStyle( fontSize: 14.f, fontWeight: @@ -321,8 +318,7 @@ class _ActiveMedicationPageState extends State { color: AppColors .textColor)), Text( - "Notify me before the consumption time" - .needTranslation, + LocaleKeys.notifyMeBeforeConsumptionTime.tr(), style: TextStyle( fontSize: 12.f, color: AppColors @@ -346,7 +342,7 @@ class _ActiveMedicationPageState extends State { : Utils.getNoDataWidget( context, noDataText: - "No medications today".needTranslation, + LocaleKeys.noMedicationsToday.tr(), ), ), ), @@ -397,17 +393,16 @@ class _ActiveMedicationPageState extends State { children: [ AppCustomChipWidget( labelText: - "Route: ${med.route}".needTranslation), + LocaleKeys.route.tr(namedArgs: {'route': med.route ?? ''})), AppCustomChipWidget( labelText: - "Frequency: ${med.frequency}".needTranslation), + LocaleKeys.frequency.tr(namedArgs: {'frequency': med.frequency ?? ''})), AppCustomChipWidget( labelText: - "Daily Dose: ${med.doseDailyQuantity}" - .needTranslation), + LocaleKeys.instruction.tr(namedArgs: {'instruction': med.doseDailyQuantity?.toString() ?? ''})), AppCustomChipWidget( labelText: - "Duration: ${med.days}".needTranslation), + LocaleKeys.duration.tr(namedArgs: {'days': med.days.toString() ?? ''})), ], ), ], @@ -419,7 +414,7 @@ class _ActiveMedicationPageState extends State { child: Row(children: [ Expanded( child: CustomButton( - text: "Check Availability".needTranslation, + text: LocaleKeys.checkAvailability.tr(), fontSize: 13.f, onPressed: () {}, backgroundColor: AppColors.secondaryLightRedColor, @@ -430,7 +425,7 @@ class _ActiveMedicationPageState extends State { SizedBox(width: 12.h), Expanded( child: CustomButton( - text: "Read Instructions".needTranslation, + text: LocaleKeys.readInstructions.tr(), fontSize: 13.f, onPressed: () {})), ]), @@ -519,7 +514,7 @@ class _ActiveMedicationPageState extends State { MainAxisAlignment.spaceBetween, children: [ Text( - "Reminders".needTranslation, + LocaleKeys.reminders.tr(), style: TextStyle( fontSize: 20.f, fontWeight: FontWeight.w600, @@ -988,11 +983,11 @@ class _ReminderTimerDialogState extends State { route: widget.med.route ?? "", ); ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text("Reminder added to calendar ✅".needTranslation)), + SnackBar(content: Text(LocaleKeys.reminderAddedToCalendar.tr())), ); } catch (e) { ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text("Error while setting calendar: $e".needTranslation)), + SnackBar(content: Text(LocaleKeys.errorWhileSettingCalendar.tr(namedArgs: {'error': e.toString()}))), ); } Navigator.pop(context); diff --git a/lib/presentation/vital_sign/vital_sign_details_page.dart b/lib/presentation/vital_sign/vital_sign_details_page.dart index f632502..980357d 100644 --- a/lib/presentation/vital_sign/vital_sign_details_page.dart +++ b/lib/presentation/vital_sign/vital_sign_details_page.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -9,6 +10,7 @@ import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/vital_sign_respo_model.dart'; import 'package:hmg_patient_app_new/features/hmg_services/models/ui_models/vital_sign_ui_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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/graph/custom_graph.dart'; @@ -62,7 +64,7 @@ class _VitalSignDetailsPageState extends State { @override Widget build(BuildContext context) { return CollapsingListView( - title: 'Vital Sign Details'.needTranslation, + title: LocaleKeys.vitalSignDetails.tr(context: context), child: Consumer( builder: (context, viewModel, child) { final latest = viewModel.vitalSignList.isNotEmpty ? viewModel.vitalSignList.first : null; @@ -128,8 +130,8 @@ class _VitalSignDetailsPageState extends State { ), SizedBox(height: 8.h), (latestDate != null - ? ('Result of ${latestDate.toString().split(' ').first}'.needTranslation) - : ('Result of --'.needTranslation)) + ? LocaleKeys.resultOf.tr(namedArgs: {'date': latestDate.toString().split(' ').first}) + : LocaleKeys.resultOfNoDate.tr(context: context)) .toText11(weight: FontWeight.w500, color: AppColors.greyTextColor), ], ), @@ -185,13 +187,23 @@ class _VitalSignDetailsPageState extends State { String _referenceText(BuildContext context) { if (args.low != null && args.high != null) { - return 'Reference range: ${args.low} – ${args.high} ${args.unit}'.needTranslation; + return LocaleKeys.referenceRangeBetween.tr(namedArgs: { + 'low': args.low.toString(), + 'high': args.high.toString(), + 'unit': args.unit ?? '' + }); } if (args.low != null) { - return 'Reference range: ≥ ${args.low} ${args.unit}'.needTranslation; + return LocaleKeys.referenceRangeMin.tr(namedArgs: { + 'low': args.low.toString(), + 'unit': args.unit ?? '' + }); } if (args.high != null) { - return 'Reference range: ≤ ${args.high} ${args.unit}'.needTranslation; + return LocaleKeys.referenceRangeMax.tr(namedArgs: { + 'high': args.high.toString(), + 'unit': args.unit ?? '' + }); } return ''; } @@ -208,7 +220,7 @@ class _VitalSignDetailsPageState extends State { crossAxisAlignment: CrossAxisAlignment.start, spacing: 8.h, children: [ - 'What is this result?'.needTranslation.toText16(weight: FontWeight.w600, color: AppColors.textColor), + LocaleKeys.whatIsThisResult.tr(context: context).toText16(weight: FontWeight.w600, color: AppColors.textColor), _descriptionText(context).toText12(fontWeight: FontWeight.w500, color: AppColors.textColorLight), ], ), @@ -243,7 +255,7 @@ class _VitalSignDetailsPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - _isGraphVisible ? 'History flowchart'.needTranslation : 'History'.needTranslation, + _isGraphVisible ? LocaleKeys.historyFlowchart.tr(context: context) : LocaleKeys.history.tr(context: context), style: TextStyle( fontSize: 16, fontFamily: 'Poppins', @@ -288,7 +300,7 @@ class _VitalSignDetailsPageState extends State { ).paddingOnly(bottom: _isGraphVisible ? 16.h : 24.h), if (history.isEmpty) - Utils.getNoDataWidget(context, noDataText: 'No history available'.needTranslation, isSmallWidget: true) + Utils.getNoDataWidget(context, noDataText: LocaleKeys.noHistoryAvailable.tr(context: context), isSmallWidget: true) else if (_isGraphVisible) _buildHistoryGraph(history, secondaryHistory: secondaryHistory) else @@ -649,38 +661,38 @@ class _VitalSignDetailsPageState extends State { String _descriptionText(BuildContext context) { switch (args.metric) { case VitalSignMetric.bmi: - return 'BMI is a measurement based on height and weight that estimates body fat.'.needTranslation; + return LocaleKeys.bmiDescription.tr(context: context); case VitalSignMetric.height: - return 'Height is measured in centimeters and is used to calculate BMI and dosage recommendations.'.needTranslation; + return LocaleKeys.heightDescription.tr(context: context); case VitalSignMetric.weight: - return 'Weight helps track overall health, nutrition, and changes over time.'.needTranslation; + return LocaleKeys.weightDescription.tr(context: context); case VitalSignMetric.bloodPressure: - return 'Blood pressure reflects the force of blood against artery walls. It is shown as systolic/diastolic.'.needTranslation; + return LocaleKeys.bloodPressureDescription.tr(context: context); case VitalSignMetric.temperature: - return 'Body temperature reflects how hot your body is and may change with infection or inflammation.'.needTranslation; + return LocaleKeys.temperatureDescription.tr(context: context); case VitalSignMetric.heartRate: - return 'Heart rate refers to the number of heart beats per minute.'.needTranslation; + return LocaleKeys.heartRateDescriptionVital.tr(context: context); case VitalSignMetric.respiratoryRate: - return 'Respiratory rate is the number of breaths taken per minute.'.needTranslation; + return LocaleKeys.respiratoryRateDescription.tr(context: context); } } String _nextStepsText(BuildContext context) { switch (args.metric) { case VitalSignMetric.bmi: - return 'Maintain a balanced diet and regular activity. If your BMI is high or low, consider consulting your doctor.'.needTranslation; + return LocaleKeys.bmiAdvice.tr(context: context); case VitalSignMetric.height: - return 'No action is needed unless your measurement looks incorrect. Update it during your next visit.'.needTranslation; + return LocaleKeys.heightAdvice.tr(context: context); case VitalSignMetric.weight: - return 'Monitor weight changes. Sudden gain or loss may require medical advice.'.needTranslation; + return LocaleKeys.weightAdvice.tr(context: context); case VitalSignMetric.bloodPressure: - return 'Keep tracking your blood pressure. High or low readings should be discussed with your doctor.'.needTranslation; + return LocaleKeys.bloodPressureAdvice.tr(context: context); case VitalSignMetric.temperature: - return 'If you have a persistent fever or symptoms, contact your healthcare provider.'.needTranslation; + return LocaleKeys.temperatureAdvice.tr(context: context); case VitalSignMetric.heartRate: - return 'Track your heart rate trends. If you feel dizziness or chest pain, seek medical care.'.needTranslation; + return LocaleKeys.heartRateAdvice.tr(context: context); case VitalSignMetric.respiratoryRate: - return 'If you notice shortness of breath or abnormal breathing, seek medical advice.'.needTranslation; + return LocaleKeys.respiratoryRateAdvice.tr(context: context); } } @@ -695,7 +707,7 @@ class _VitalSignDetailsPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - 'What should I do next?'.needTranslation.toText16(weight: FontWeight.w600), + LocaleKeys.whatShouldIDoNext.tr(context: context).toText16(weight: FontWeight.w600), SizedBox(height: 8.h), _nextStepsText(context).toText12(color: AppColors.greyTextColor, fontWeight: FontWeight.w500, maxLine: 10), ], diff --git a/lib/presentation/water_monitor/water_consumption_page.dart b/lib/presentation/water_monitor/water_consumption_page.dart index 2bd429c..54dace5 100644 --- a/lib/presentation/water_monitor/water_consumption_page.dart +++ b/lib/presentation/water_monitor/water_consumption_page.dart @@ -1,3 +1,4 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -9,6 +10,7 @@ import 'package:hmg_patient_app_new/core/utils/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/features/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/hydration_tips_widget.dart'; import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/water_intake_summary_widget.dart'; import 'package:hmg_patient_app_new/services/dialog_service.dart'; @@ -100,7 +102,7 @@ class _WaterConsumptionPageState extends State { children: [ Row( children: [ - "History".needTranslation.toText16(isBold: true), + LocaleKeys.history.tr(context: context).toText16(isBold: true), SizedBox(width: 8.w), InkWell( onTap: () => _showHistoryDurationBottomsheet(context, viewModel), @@ -604,7 +606,7 @@ class _WaterConsumptionPageState extends State { final dialogService = getIt.get(); dialogService.showFamilyBottomSheetWithoutHWithChild( - label: title.needTranslation, + label: title, message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -634,7 +636,7 @@ class _WaterConsumptionPageState extends State { void _showHistoryDurationBottomsheet(BuildContext context, WaterMonitorViewModel viewModel) { _showSelectionBottomSheet( context: context, - title: "Select Duration".needTranslation, + title: LocaleKeys.selectDuration.tr(context: context), items: viewModel.durationFilters, selectedValue: viewModel.selectedDurationFilter, onSelected: viewModel.setFilterDuration, @@ -655,10 +657,10 @@ class _WaterConsumptionPageState extends State { /// Show confirmation bottom sheet before cancelling reminders void _showCancelReminderConfirmation(WaterMonitorViewModel viewModel) { showCommonBottomSheetWithoutHeight( - title: 'Notice'.needTranslation, + title: LocaleKeys.notice.tr(context: context), context, child: Utils.getWarningWidget( - loadingText: "Are you sure you want to cancel all water reminders?".needTranslation, + loadingText: LocaleKeys.areYouSureYouWantToCancelAllWaterReminders.tr(context: context), isShowActionButtons: true, onCancelTap: () { Navigator.pop(context); @@ -694,7 +696,7 @@ class _WaterConsumptionPageState extends State { /// Show bottom sheet with scheduled reminder times void _showReminderScheduledDialog(List times) { showCommonBottomSheetWithoutHeight( - title: 'Reminders Set!'.needTranslation, + title: LocaleKeys.remindersSet.tr(context: context), context, isCloseButtonVisible: false, isDismissible: false, @@ -703,7 +705,7 @@ class _WaterConsumptionPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Utils.getSuccessWidget(loadingText: 'Daily water reminders scheduled at:'.needTranslation), + Utils.getSuccessWidget(loadingText: LocaleKeys.dailyWaterRemindersScheduledAt.tr(context: context)), SizedBox(height: 16.h), Wrap( spacing: 8.w, @@ -728,7 +730,7 @@ class _WaterConsumptionPageState extends State { Expanded( child: CustomButton( height: 56.h, - text: 'OK'.needTranslation, + text: LocaleKeys.ok.tr(context: context), onPressed: () => Navigator.of(context).pop(), textColor: AppColors.whiteColor, ), @@ -792,7 +794,7 @@ class _WaterConsumptionPageState extends State { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "Water Consumption".needTranslation, + title: LocaleKeys.waterConsumption.tr(context: context), bottomChild: Consumer( builder: (context, viewModel, child) { return Container( @@ -804,7 +806,7 @@ class _WaterConsumptionPageState extends State { child: Padding( padding: EdgeInsets.all(24.w), child: CustomButton( - text: viewModel.isWaterReminderEnabled ? "Cancel Reminders".needTranslation : "Set Reminder".needTranslation, + text: viewModel.isWaterReminderEnabled ? LocaleKeys.cancelReminder.tr(context: context) : LocaleKeys.setReminder.tr(context: context), textColor: viewModel.isWaterReminderEnabled ? AppColors.errorColor : AppColors.successColor, backgroundColor: viewModel.isWaterReminderEnabled ? AppColors.errorColor.withValues(alpha: 0.1) : AppColors.successLightBgColor, onPressed: () => _handleReminderButtonTap(viewModel), diff --git a/lib/presentation/water_monitor/water_monitor_settings_page.dart b/lib/presentation/water_monitor/water_monitor_settings_page.dart index 302940c..a3c82c0 100644 --- a/lib/presentation/water_monitor/water_monitor_settings_page.dart +++ b/lib/presentation/water_monitor/water_monitor_settings_page.dart @@ -1,3 +1,4 @@ +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'; @@ -6,6 +7,7 @@ import 'package:hmg_patient_app_new/core/utils/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/features/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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'; @@ -69,7 +71,7 @@ class _WaterMonitorSettingsPageState extends State { bool useUpperCase = false, }) { dialogService.showFamilyBottomSheetWithoutHWithChild( - label: title.needTranslation, + label: title, message: "", child: Container( padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 4.h, bottom: 4.h), @@ -99,7 +101,7 @@ class _WaterMonitorSettingsPageState extends State { void _showGenderSelectionBottomsheet(BuildContext context, WaterMonitorViewModel viewModel) { _showSelectionBottomSheet( context: context, - title: "Select Gender".needTranslation, + title: LocaleKeys.selectGender.tr(context: context), items: viewModel.genderOptions, selectedValue: viewModel.selectedGender, onSelected: viewModel.setGender, @@ -109,7 +111,7 @@ class _WaterMonitorSettingsPageState extends State { void _showHeightUnitSelectionBottomSheet(BuildContext context, WaterMonitorViewModel viewModel) { _showSelectionBottomSheet( context: context, - title: "Select Unit".needTranslation, + title: LocaleKeys.selectUnit.tr(context: context), items: viewModel.heightUnits, selectedValue: viewModel.selectedHeightUnit, onSelected: viewModel.setHeightUnit, @@ -120,7 +122,7 @@ class _WaterMonitorSettingsPageState extends State { void _showWeightUnitSelectionBottomsheet(BuildContext context, WaterMonitorViewModel viewModel) { _showSelectionBottomSheet( context: context, - title: "Select Unit".needTranslation, + title: LocaleKeys.selectUnit.tr(context: context), items: viewModel.weightUnits, selectedValue: viewModel.selectedWeightUnit, onSelected: viewModel.setWeightUnit, @@ -131,7 +133,7 @@ class _WaterMonitorSettingsPageState extends State { void _showActivityLevelSelectionBottomsheet(BuildContext context, WaterMonitorViewModel viewModel) { _showSelectionBottomSheet( context: context, - title: "Select Activity Level".needTranslation, + title: LocaleKeys.selectActivityLevel.tr(context: context), items: viewModel.activityLevels, selectedValue: viewModel.selectedActivityLevel, onSelected: viewModel.setActivityLevel, @@ -141,7 +143,7 @@ class _WaterMonitorSettingsPageState extends State { void _showNumberOfRemindersSelectionBottomsheet(BuildContext context, WaterMonitorViewModel viewModel) { _showSelectionBottomSheet( context: context, - title: "Select Number of Reminders".needTranslation, + title: LocaleKeys.selectNumberOfReminders.tr(context: context), items: viewModel.reminderOptions, selectedValue: viewModel.selectedNumberOfReminders, onSelected: viewModel.setNumberOfReminders, @@ -256,7 +258,7 @@ class _WaterMonitorSettingsPageState extends State { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( - title: "H20 Settings".needTranslation, + title: LocaleKeys.h2oSettings.tr(context: context), bottomChild: Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, @@ -266,7 +268,7 @@ class _WaterMonitorSettingsPageState extends State { child: Padding( padding: EdgeInsets.all(24.w), child: CustomButton( - text: "Save".needTranslation, + text: LocaleKeys.save.tr(context: context), onPressed: () async { final success = await viewModel.saveSettings(); if (!success && viewModel.validationError != null) { @@ -277,7 +279,7 @@ class _WaterMonitorSettingsPageState extends State { showCommonBottomSheetWithoutHeight( context, child: Utils.getSuccessWidget( - loadingText: "Settings saved successfully".needTranslation, + loadingText: LocaleKeys.settingsSavedSuccessfully.tr(context: context), ), callBackFunc: () {}, isCloseButtonVisible: false, @@ -299,18 +301,18 @@ class _WaterMonitorSettingsPageState extends State { children: [ _buildSettingsRow( icon: AppAssets.profileIcon, - label: "Your Name".needTranslation, + label: LocaleKeys.yourName.tr(context: context), inputField: _buildTextField(viewModel.nameController, 'Guest'), ), _buildSettingsRow( icon: AppAssets.genderIcon, - label: "Select Gender".needTranslation, + label: LocaleKeys.selectGender.tr(context: context), value: viewModel.selectedGender, onRowTap: () => _showGenderSelectionBottomsheet(context, viewModel), ), _buildSettingsRow( icon: AppAssets.calendarGrey, - label: "Age (11-120) yrs".needTranslation, + label: LocaleKeys.ageYears.tr(context: context), inputField: _buildTextField( viewModel.ageController, '20', @@ -319,7 +321,7 @@ class _WaterMonitorSettingsPageState extends State { ), _buildSettingsRow( icon: AppAssets.heightIcon, - label: "Height".needTranslation, + label: LocaleKeys.height.tr(context: context), inputField: _buildTextField( viewModel.heightController, '175', @@ -330,7 +332,7 @@ class _WaterMonitorSettingsPageState extends State { ), _buildSettingsRow( icon: AppAssets.weightScaleIcon, - label: "Weight".needTranslation, + label: LocaleKeys.weight.tr(context: context), inputField: _buildTextField( viewModel.weightController, '75', @@ -341,13 +343,13 @@ class _WaterMonitorSettingsPageState extends State { ), _buildSettingsRow( icon: AppAssets.dumbellIcon, - label: "Activity Level".needTranslation, + label: LocaleKeys.activityLevel.tr(context: context), value: viewModel.selectedActivityLevel, onRowTap: () => _showActivityLevelSelectionBottomsheet(context, viewModel), ), _buildSettingsRow( icon: AppAssets.notificationIconGrey, - label: "Number of reminders in a day".needTranslation, + label: LocaleKeys.numberOfRemindersInADay.tr(context: context), value: viewModel.selectedNumberOfReminders, onRowTap: () => _showNumberOfRemindersSelectionBottomsheet(context, viewModel), showDivider: false, diff --git a/lib/presentation/water_monitor/widgets/cup_bottomsheet_widgets.dart b/lib/presentation/water_monitor/widgets/cup_bottomsheet_widgets.dart index 4ffa30d..4ee6170 100644 --- a/lib/presentation/water_monitor/widgets/cup_bottomsheet_widgets.dart +++ b/lib/presentation/water_monitor/widgets/cup_bottomsheet_widgets.dart @@ -1,3 +1,4 @@ +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'; @@ -7,6 +8,7 @@ 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/water_monitor/models/water_cup_model.dart'; import 'package:hmg_patient_app_new/features/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.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/common_bottom_sheet.dart'; @@ -143,7 +145,7 @@ class SwitchCupBottomSheet extends StatelessWidget { child: Center(child: Utils.buildSvgWithAssets(icon: AppAssets.cupAdd, height: 30.h, width: 42.w)), ), SizedBox(height: 4.h), - 'Add'.needTranslation.toText10(weight: FontWeight.w500), + LocaleKeys.add.tr(context: context).toText10(weight: FontWeight.w500), ], ), ); @@ -157,7 +159,7 @@ void showCustomizeCupBottomSheet(BuildContext context, {WaterCupModel? cupToEdit titleWidget: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Customize your drink cup".needTranslation.toText20(weight: FontWeight.w600), + LocaleKeys.customizeDrinkCup.tr(context: context).toText20(weight: FontWeight.w600), ], ), child: CustomizeCupBottomSheet(cupToEdit: cupToEdit), @@ -294,7 +296,7 @@ class _CustomizeCupBottomSheetState extends State { SizedBox(height: 24.h), CustomButton( - text: 'Select'.needTranslation, + text: LocaleKeys.select.tr(context: context), onPressed: () { final newCup = WaterCupModel( id: widget.cupToEdit?.id ?? Uuid().v4(), diff --git a/lib/presentation/water_monitor/widgets/hydration_tips_widget.dart b/lib/presentation/water_monitor/widgets/hydration_tips_widget.dart index df55886..7c49550 100644 --- a/lib/presentation/water_monitor/widgets/hydration_tips_widget.dart +++ b/lib/presentation/water_monitor/widgets/hydration_tips_widget.dart @@ -1,9 +1,11 @@ +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/core/utils/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/theme/colors.dart'; class HydrationTipsWidget extends StatelessWidget { @@ -30,26 +32,26 @@ class HydrationTipsWidget extends StatelessWidget { height: 24.h, ), SizedBox(width: 8.w), - "Tips to stay hydrated".needTranslation.toText16(isBold: true), + LocaleKeys.tipsToStayHydrated.tr(context: context).toText16(isBold: true), ], ), SizedBox(height: 8.h), - " • ${"Drink before you feel thirsty"}".needTranslation.toText12( + " • ${LocaleKeys.drinkBeforeYouFeelThirsty.tr(context: context)}".toText12( fontWeight: FontWeight.w500, color: AppColors.textColorLight, ), SizedBox(height: 4.h), - " • ${"Keep a refillable bottle next to you"}".needTranslation.toText12( + " • ${LocaleKeys.keepRefillableBottleNextToYou.tr(context: context)}".toText12( fontWeight: FontWeight.w500, color: AppColors.textColorLight, ), SizedBox(height: 4.h), - " • ${"Track your daily intake to stay motivated"}".needTranslation.toText12( + " • ${LocaleKeys.trackYourDailyIntakeToStayMotivated.tr(context: context)}".toText12( fontWeight: FontWeight.w500, color: AppColors.textColorLight, ), SizedBox(height: 4.h), - " • ${"Choose sparkling water instead of soda"}".needTranslation.toText12( + " • ${LocaleKeys.chooseSparklingWaterInsteadOfSoda.tr(context: context)}".toText12( fontWeight: FontWeight.w500, color: AppColors.textColorLight, ), diff --git a/lib/presentation/water_monitor/widgets/water_action_buttons_widget.dart b/lib/presentation/water_monitor/widgets/water_action_buttons_widget.dart index 2359904..115dd21 100644 --- a/lib/presentation/water_monitor/widgets/water_action_buttons_widget.dart +++ b/lib/presentation/water_monitor/widgets/water_action_buttons_widget.dart @@ -1,3 +1,4 @@ +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'; @@ -6,6 +7,7 @@ import 'package:hmg_patient_app_new/extensions/route_extensions.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/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/cup_bottomsheet_widgets.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:provider/provider.dart'; @@ -83,19 +85,19 @@ class WaterActionButtonsWidget extends StatelessWidget { context: context, onTap: () => showSwitchCupBottomSheet(context), overlayWidget: AppAssets.refreshIcon, - title: "Switch Cup".needTranslation, + title: LocaleKeys.switchCup.tr(context: context), icon: Utils.buildSvgWithAssets(icon: AppAssets.glassIcon, height: 24.w, width: 24.w), ), _buildActionButton( context: context, onTap: () async {}, - title: "Plain Water".needTranslation, + title: LocaleKeys.plainWater.tr(context: context), icon: Utils.buildSvgWithAssets(icon: AppAssets.glassIcon, height: 24.w, width: 24.w), ), _buildActionButton( context: context, onTap: () => context.navigateWithName(AppRoutes.waterMonitorSettingsPage), - title: "Settings".needTranslation, + title: LocaleKeys.settings.tr(context: context), icon: Icon( Icons.settings, color: AppColors.blueColor, diff --git a/lib/presentation/water_monitor/widgets/water_intake_summary_widget.dart b/lib/presentation/water_monitor/widgets/water_intake_summary_widget.dart index 137f6a3..ec796ab 100644 --- a/lib/presentation/water_monitor/widgets/water_intake_summary_widget.dart +++ b/lib/presentation/water_monitor/widgets/water_intake_summary_widget.dart @@ -1,7 +1,9 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.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/features/water_monitor/water_monitor_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/water_action_buttons_widget.dart'; import 'package:hmg_patient_app_new/presentation/water_monitor/widgets/water_bottle_widget.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -51,7 +53,6 @@ class WaterIntakeSummaryWidget extends StatelessWidget { if (!vm.nextDrinkTime.toLowerCase().contains('goal achieved')) // Show "Tomorrow" if nextDrinkTime contains "tomorrow", otherwise "Next Drink Time" (vm.nextDrinkTime.toLowerCase().contains('tomorrow') ? "Tomorrow" : "Next Drink Time") - .needTranslation .toText18(weight: FontWeight.w600, color: AppColors.textColor), // Extract only time if "tomorrow" is present, otherwise show as is @@ -61,14 +62,17 @@ class WaterIntakeSummaryWidget extends StatelessWidget { .toText32(weight: FontWeight.w600, color: AppColors.blueColor), SizedBox(height: 12.h), - _buildStatusColumn(title: "Your Goal".needTranslation, subTitle: "${goalMl}ml"), - SizedBox(height: 8.h), - _buildStatusColumn(title: "Remaining".needTranslation, subTitle: "${remaining}ml"), - SizedBox(height: 8.h), - _buildStatusColumn(title: "Completed".needTranslation, subTitle: completedPercent, subTitleColor: AppColors.successColor), - SizedBox(height: 8.h), + Row( + children: [ + _buildStatusColumn(title: LocaleKeys.yourGoal.tr(context: context), subTitle: "${goalMl}ml"), + SizedBox(width: 16.w), + _buildStatusColumn(title: LocaleKeys.remaining.tr(context: context), subTitle: "${remaining}ml"), + SizedBox(width: 16.w), + _buildStatusColumn(title: LocaleKeys.completed.tr(context: context), subTitle: completedPercent, subTitleColor: AppColors.successColor), + ], + ), _buildStatusColumn( - title: "Hydration Status".needTranslation, + title: LocaleKeys.hydrationStatus.tr(context: context), subTitle: vm.hydrationStatus, subTitleColor: vm.hydrationStatusColor, ), diff --git a/lib/widgets/app_language_change.dart b/lib/widgets/app_language_change.dart index de9cda5..67a52db 100644 --- a/lib/widgets/app_language_change.dart +++ b/lib/widgets/app_language_change.dart @@ -41,9 +41,9 @@ class _AppLanguageChangeState extends State { decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), child: Column( children: [ - languageItem("English".needTranslation, "en"), + languageItem("English", "en"), 1.divider, - languageItem("العربية".needTranslation, "ar"), + languageItem("العربية", "ar"), ], ), ), diff --git a/lib/widgets/appbar/collapsing_list_view.dart b/lib/widgets/appbar/collapsing_list_view.dart index 0580776..897d241 100644 --- a/lib/widgets/appbar/collapsing_list_view.dart +++ b/lib/widgets/appbar/collapsing_list_view.dart @@ -1,4 +1,5 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -8,6 +9,7 @@ import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/route_extensions.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/theme/colors.dart'; import '../../core/dependencies.dart'; @@ -250,7 +252,7 @@ class _ScrollAnimatedTitleState extends State { @override Widget build(BuildContext context) { - final isRtl = Directionality.of(context) == TextDirection.rtl; + final isRtl = Directionality.of(context) == TextDirection.RTL; return Container( height: (widget.preferredSize.height - _fontSize / 2).h, alignment: isRtl ? (widget.showBack ? Alignment.topRight : Alignment.centerRight) : (widget.showBack ? Alignment.topLeft : Alignment.centerLeft), @@ -269,12 +271,12 @@ class _ScrollAnimatedTitleState extends State { ), ).expanded, ...[ - if (widget.logout != null) actionButton(context, t, title: "Logout".needTranslation, icon: AppAssets.logout).onPress(widget.logout!), - if (widget.report != null) actionButton(context, t, title: "Feedback".needTranslation, icon: AppAssets.report_icon).onPress(widget.report!), - if (widget.history != null) actionButton(context, t, title: "History".needTranslation, icon: AppAssets.insurance_history_icon).onPress(widget.history!), - if (widget.instructions != null) actionButton(context, t, title: "Instructions".needTranslation, icon: AppAssets.requests).onPress(widget.instructions!), - if (widget.requests != null) actionButton(context, t, title: "Requests".needTranslation, icon: AppAssets.insurance_history_icon).onPress(widget.requests!), - if (widget.sendEmail != null) actionButton(context, t, title: "Send Email".needTranslation, icon: AppAssets.email).onPress(widget.sendEmail!), + if (widget.logout != null) actionButton(context, t, title: LocaleKeys.logout.tr(context: context), icon: AppAssets.logout).onPress(widget.logout!), + if (widget.report != null) actionButton(context, t, title: LocaleKeys.feedback.tr(context: context), icon: AppAssets.report_icon).onPress(widget.report!), + if (widget.history != null) actionButton(context, t, title: LocaleKeys.history.tr(context: context), icon: AppAssets.insurance_history_icon).onPress(widget.history!), + if (widget.instructions != null) actionButton(context, t, title: LocaleKeys.instructions.tr(context: context), icon: AppAssets.requests).onPress(widget.instructions!), + if (widget.requests != null) actionButton(context, t, title: LocaleKeys.requests.tr(context: context), icon: AppAssets.insurance_history_icon).onPress(widget.requests!), + if (widget.sendEmail != null) actionButton(context, t, title: LocaleKeys.sendEmail.tr(context: context), icon: AppAssets.email).onPress(widget.sendEmail!), if (widget.search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(widget.search!), if (widget.trailing != null) widget.trailing!, ] diff --git a/lib/widgets/appbar/collapsing_toolbar.dart b/lib/widgets/appbar/collapsing_toolbar.dart index 87cf15a..8bf1e4b 100644 --- a/lib/widgets/appbar/collapsing_toolbar.dart +++ b/lib/widgets/appbar/collapsing_toolbar.dart @@ -1,5 +1,6 @@ import 'dart:ui'; +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; @@ -8,6 +9,7 @@ import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/utils/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/theme/colors.dart'; import '../../core/dependencies.dart'; @@ -140,11 +142,11 @@ class _CollapsingToolbarState extends State { color: AppColors.blackColor, letterSpacing: -0.5), ).expanded, - if (widget.logout != null) actionButton(context, t, title: "Logout".needTranslation, icon: AppAssets.logout).onPress(widget.logout!), - if (widget.report != null) actionButton(context, t, title: "Report".needTranslation, icon: AppAssets.report_icon).onPress(widget.report!), - if (widget.history != null) actionButton(context, t, title: "History".needTranslation, icon: AppAssets.insurance_history_icon).onPress(widget.history!), - if (widget.instructions != null) actionButton(context, t, title: "Instructions".needTranslation, icon: AppAssets.requests).onPress(widget.instructions!), - if (widget.requests != null) actionButton(context, t, title: "Requests".needTranslation, icon: AppAssets.insurance_history_icon).onPress(widget.requests!), + if (widget.logout != null) actionButton(context, t, title: LocaleKeys.logout.tr(context: context), icon: AppAssets.logout).onPress(widget.logout!), + if (widget.report != null) actionButton(context, t, title: LocaleKeys.report.tr(context: context), icon: AppAssets.report_icon).onPress(widget.report!), + if (widget.history != null) actionButton(context, t, title: LocaleKeys.history.tr(context: context), icon: AppAssets.insurance_history_icon).onPress(widget.history!), + if (widget.instructions != null) actionButton(context, t, title: LocaleKeys.instructions.tr(context: context), icon: AppAssets.requests).onPress(widget.instructions!), + if (widget.requests != null) actionButton(context, t, title: LocaleKeys.requests.tr(context: context), icon: AppAssets.insurance_history_icon).onPress(widget.requests!), if (widget.search != null) Utils.buildSvgWithAssets(icon: AppAssets.search_icon).onPress(widget.search!).paddingOnly(right: 24), if (widget.trailing != null) widget.trailing!, ], diff --git a/lib/widgets/date_range_selector/date_range_calender.dart b/lib/widgets/date_range_selector/date_range_calender.dart index debc069..89725f3 100644 --- a/lib/widgets/date_range_selector/date_range_calender.dart +++ b/lib/widgets/date_range_selector/date_range_calender.dart @@ -71,7 +71,7 @@ class _DateRangeSelectorState extends State { children: [ fromDateComponent(), Text( - LocaleKeys.to.tr(), + LocaleKeys.to.tr(context: context), style: TextStyle( color: AppColors.calenderTextColor, fontSize: 14.h, @@ -168,7 +168,7 @@ class _DateRangeSelectorState extends State { children: [ Expanded( child: CustomButton( - text: LocaleKeys.cancel.tr(), + text: LocaleKeys.cancel.tr(context: context), onPressed: () { _calendarController.selectedRange = null; _calendarController.selectedDate = null; @@ -192,7 +192,7 @@ class _DateRangeSelectorState extends State { ), Expanded( child: CustomButton( - text: LocaleKeys.search.tr(), + text: LocaleKeys.search.tr(context: context), onPressed: () { Navigator.of(context).pop(); widget.onRangeSelected(model.fromDate, model.toDate); @@ -216,7 +216,7 @@ class _DateRangeSelectorState extends State { fromDateComponent() { return Consumer( builder: (_, model, __) { - return displayDate(LocaleKeys.startDate.tr(), + return displayDate(LocaleKeys.startDate.tr(context: context), model.getDateString(model.fromDate), model.fromDate == null); }, ); @@ -225,7 +225,7 @@ class _DateRangeSelectorState extends State { toDateComponent() { return Consumer( builder: (_, model, __) { - return displayDate(LocaleKeys.endDate.tr(), + return displayDate(LocaleKeys.endDate.tr(context: context), model.getDateString(model.toDate), model.toDate == null); }, ); @@ -270,7 +270,7 @@ class _DateRangeSelectorState extends State { spacing: 8.h, children: [ AppCustomChipWidget( - labelText: "This Week".needTranslation, + labelText: LocaleKeys.thisWeek.tr(context: context), backgroundColor: model.currentlySelectedRange == Range.WEEKLY ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.whiteColor, @@ -288,7 +288,7 @@ class _DateRangeSelectorState extends State { model.calculateDatesFromRange(); }), AppCustomChipWidget( - labelText: "Last Month".needTranslation, + labelText: LocaleKeys.lastMonth.tr(context: context), backgroundColor: model.currentlySelectedRange == Range.LAST_MONTH ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.whiteColor, @@ -306,7 +306,7 @@ class _DateRangeSelectorState extends State { model.calculateDatesFromRange(); }), AppCustomChipWidget( - labelText: "Last 6 Months".needTranslation, + labelText: LocaleKeys.lastSixMonths.tr(context: context), backgroundColor: model.currentlySelectedRange == Range.LAST_6MONTH ? AppColors.primaryRedColor.withOpacity(0.1) : AppColors.whiteColor, diff --git a/lib/widgets/family_files/family_file_add_widget.dart b/lib/widgets/family_files/family_file_add_widget.dart index 4840ba7..abc529b 100644 --- a/lib/widgets/family_files/family_file_add_widget.dart +++ b/lib/widgets/family_files/family_file_add_widget.dart @@ -77,7 +77,7 @@ class FamilyFileAddWidget extends StatelessWidget { ), SizedBox(height: 20.h), CustomButton( - text: "Verify the member".needTranslation, + text: LocaleKeys.pleaseVerify.tr(context: context), onPressed: () { FocusScope.of(context).unfocus(); if (ValidationUtils.isValidatedIdAndPhoneWithCountryValidation( diff --git a/lib/widgets/map/location_map_widget.dart b/lib/widgets/map/location_map_widget.dart index c0eb431..2a1ea65 100644 --- a/lib/widgets/map/location_map_widget.dart +++ b/lib/widgets/map/location_map_widget.dart @@ -1,9 +1,11 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/app_assets.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/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:maps_launcher/maps_launcher.dart'; @@ -154,7 +156,7 @@ class LocationMapWidget extends StatelessWidget { child: SizedBox( width: MediaQuery.of(context).size.width * 0.785, child: CustomButton( - text: "Get Directions".needTranslation, + text: LocaleKeys.getDirections.tr(context: context), onPressed: onDirectionsTap ?? _defaultLaunchDirections, backgroundColor: AppColors.textColor.withValues(alpha: 0.8), borderColor: AppColors.textColor.withValues(alpha: 0.01), diff --git a/lib/widgets/map/map_utility_screen.dart b/lib/widgets/map/map_utility_screen.dart index 19823da..cb3eb8e 100644 --- a/lib/widgets/map/map_utility_screen.dart +++ b/lib/widgets/map/map_utility_screen.dart @@ -1,3 +1,4 @@ +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'; @@ -5,6 +6,7 @@ import 'package:hmg_patient_app_new/core/utils/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/features/location/location_view_model.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/emergency_services/widgets/location_input_bottom_sheet.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -126,14 +128,14 @@ class MapUtilityScreen extends StatelessWidget { weight: FontWeight.w600, color: AppColors.textColor, ), - subTitleString.needTranslation.toText12( + subTitleString.toText12( fontWeight: FontWeight.w500, color: AppColors.greyTextColor, ) ], ), CustomButton( - text: confirmButtonString.needTranslation, + text: confirmButtonString, onPressed: () { if (onSubmitted != null) { onSubmitted!(); @@ -172,8 +174,8 @@ class MapUtilityScreen extends StatelessWidget { return SizedBox( width: MediaQuery.sizeOf(context).width, child: TextInputWidget( - labelText: "Enter Pickup Location Manually".needTranslation, - hintText: "Enter Pickup Location".needTranslation, + labelText: LocaleKeys.enterPickupLocationManually.tr(context: context), + hintText: LocaleKeys.enterPickupLocation.tr(context: context), controller: TextEditingController( text: vm.geocodeResponse?.results.first.formattedAddress ?? vm.selectedPrediction?.description, ), @@ -203,7 +205,7 @@ class MapUtilityScreen extends StatelessWidget { openLocationInputBottomSheet(BuildContext context) { context.read().flushSearchPredictions(); showCommonBottomSheetWithoutHeight( - title: "".needTranslation, + title: "", context, child: SizedBox( height: MediaQuery.sizeOf(context).height * .8, diff --git a/lib/widgets/time_picker_widget.dart b/lib/widgets/time_picker_widget.dart index 71d9ab2..bc996de 100644 --- a/lib/widgets/time_picker_widget.dart +++ b/lib/widgets/time_picker_widget.dart @@ -1,9 +1,11 @@ +import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/cupertino.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/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; +import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; @@ -150,7 +152,7 @@ class _TimePickerBottomSheetState extends State<_TimePickerBottomSheet> { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Select Time".needTranslation.toText18( + LocaleKeys.selectTime.tr(context: context).toText18( weight: FontWeight.w600, color: AppColors.textColor, ), @@ -318,7 +320,7 @@ class _TimePickerBottomSheetState extends State<_TimePickerBottomSheet> { Expanded( child: CustomButton( height: 56.h, - text: "Cancel".needTranslation, + text: LocaleKeys.cancel.tr(context: context), onPressed: () => Navigator.pop(context), textColor: AppColors.textColor, backgroundColor: AppColors.greyColor, @@ -329,7 +331,7 @@ class _TimePickerBottomSheetState extends State<_TimePickerBottomSheet> { Expanded( child: CustomButton( height: 56.h, - text: "Confirm".needTranslation, + text: LocaleKeys.confirm.tr(context: context), onPressed: () { Navigator.pop(context, _getCurrentTime()); },