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