From 39af08ddc3cea7750d2f3f525b3a585d033ecccf Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Fri, 16 Jan 2026 13:03:04 +0300 Subject: [PATCH 1/2] 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), ], ); } -- 2.30.2 From 5feacfaf27bcb46a34f76abe31ca56a05f502ba2 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 18 Jan 2026 10:45:17 +0300 Subject: [PATCH 2/2] 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()); }, -- 2.30.2