From 201cbd185ca2058956f8acd0038acf68f65cbaf2 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" <> Date: Wed, 17 Jul 2024 10:31:22 +0300 Subject: [PATCH] Localization --- assets/langs/ar-SA.json | 41 +++++++++- assets/langs/en-US.json | 44 +++++++++- lib/generated/codegen_loader.g.dart | 80 +++++++++++++++++-- lib/generated/locale_keys.g.dart | 36 ++++++++- .../advertisement/bottom_sheet_content.dart | 17 ++-- .../create_ad_progress_steps.dart | 10 ++- lib/views/advertisement/create_ad_view.dart | 19 +++-- .../advertisement/select_ad_type_view.dart | 25 +++--- .../appointments/appointment_detail_view.dart | 29 ++++--- .../appointments_filter_view.dart | 25 +++--- 10 files changed, 256 insertions(+), 70 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index f9773d1..6465e96 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -328,7 +328,7 @@ "vehiclePart": "جزء المركبة", "damagePartPictures": "صور الأجزاء المتضررة", "vehicleDamagePart": "جزء المركبة المتضرر", - "duration": "المدة", + "duration": ":المدة", "specialServices": "الخدمات الخاصة", "specialService": "خدمة خاصة", "adContactDetails": "تفاصيل الاتصال بالإعلان", @@ -457,7 +457,7 @@ "stoptheBuyers": "سنتوقف عن عرض هذا الإعلان للمشترين", "cancelReservation": "إلغاء الحجز", "reasonForCancellation": "سبب الإلغاء", - "doWantCancelReservation?": "هل تريد إلغاء الحجز؟", + "doWantCancelReservation": "هل تريد إلغاء الحجز؟", "yourAdVisibletoBuy": "سيتم إلغاء حجز إعلانك وسيكون هذا الإعلان مرئيًا للجميع مرة أخرى للشراء", "completeDeal": "إتمام الصفقة", "uploadBankReceipt": "تحميل إيصال البنك", @@ -475,7 +475,42 @@ "waitingAdminsApproval": "في انتظار موافقة الإدارة", "sold": "تم البيع", "noAdsShow": "لا توجد إعلانات لعرضها", - "damagePartList": "قائمة الأجزاء المتضررة" + "damagePartList": "قائمة الأجزاء المتضررة", + "searchPart": "البحث عن جزء", + "addSpecialService": "إضافة خدمة خاصة", + "vehicleVar": "السيارة", + "detailsVar": "التفاصيل", + "damageVar": "الضرر", + "partsVar": "الأجزاء", + "additional": "إضافي", + "review": "مراجعة", + "adVar": "الإعلان", + "updateAd": "تحديث الإعلان", + "createAd": "إنشاء إعلان", + "next": "التالي", + "submitAd": "إرسال الإعلان", + "selectAdType": "اختر نوع الإعلان", + "validUntilSubscriptionExpiration": "صالح حتى انتهاء الاشتراك", + "adsRemaining": "الإعلانات المتبقية", + "youLeftAdsGivenSubscription": "لقد بقي لديك 05 من 50 إعلانًا في الاشتراك.", + "updateSubscription": "تحديث الاشتراك", + "workInProgress": "العمل جارٍ", + "visitCompleted": "تمت الزيارة", + "youWantCancelAppointment": "هل تريد إلغاء هذا الموعد؟", + "appointmentCancelledCannotUndoAction": "سيتم إلغاء موعدك ولا يمكنك التراجع عن هذا الإجراء", + "appointment": "الموعد", + "rescheduleAppointment": "إعادة جدولة الموعد", + "payforAppointment": "دفع ثمن الموعد", + "appointmentsFilter": "تصفية المواعيد", + "searchByProvider": "البحث حسب المزود", + "selectProvider": "اختر المزود", + "searchByBranch": "البحث حسب الفرع", + "searchByCategory": "البحث حسب الفئة", + "selectCategory": "اختر الفئة", + "searchByService": "البحث حسب الخدمة", + "selectServices": "اختر الخدمات", + "modifyPackage": "تعديل الحزمة" + diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index a45ca3c..2e3fe63 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -328,7 +328,7 @@ "vehiclePart": "Vehicle Part", "damagePartPictures": "Damage Part Pictures", "vehicleDamagePart": "Vehicle Damage Part", - "duration": "Duration", + "duration": "Duration:", "specialServices": "Special Services", "specialService": "Special Service", "adContactDetails": "Ad Contact Details", @@ -458,7 +458,7 @@ "stoptheBuyers":"We will stop showing this ad to the buyers", "cancelReservation":"Cancel Reservation", "reasonForCancellation":"Reason for Cancellation", - "doWantCancelReservation?":"Do you want to cancel the reservation", + "doWantCancelReservation":"Do you want to cancel the reservation", "yourAdVisibletoBuy.":"Your ad reservation will be cancelled and this ad will be again visible to everyone to buy", "completeDeal":"Complete Deal", "uploadBankReceipt":"Upload Bank Receipt", @@ -476,7 +476,45 @@ "waitingAdminsApproval":"Waiting for Admins Approval", "sold":"Sold", "noAdsShow":"No Ads to show", - "damagePartList":"Damage Part List" + "damagePartList":"Damage Part List", + "searchPart":"Search Part", + "addSpecialService":"Add Special Service", + "vehicleVar":"Vehicle", + "detailsVar":"Details", + "damageVar":"Damage", + "partsVar": "Parts", + "additional":"Additional", + "review":"Review", + "adVar": "Ad", + "updateAd":"Update Ad", + "createAd":"Create Ad", + "next":"Next", + "submitAd":"Submit Ad", + "selectAdType":"Select Ad Type", + "validUntilSubscriptionExpiration":"Valid Until Subscription Expiration", + "adsRemaining ":"Ads Remaining", + "youLeftAdsGivenSubscription":"You have left with 05 out of 50 ads given in the subscription.", + "updateSubscription":"Update Subscription", + "workInProgress":"Work In Progress", + "visitCompleted":"Visit Completed", + "youWantCancelAppointment":"Do you want to cancel this appointment?", + "appointmentCancelledCannotUndoAction":"Your appointment will be cancelled and you cannot undo this action.", + "appointment":"Appointment", + "rescheduleAppointment":"Reschedule Appointment", + "payforAppointment":"Pay for Appointment", + "appointmentsFilter":"Appointments Filter", + "searchByProvider":"Search By Provider", + "selectProvider":"Select Provider", + "searchByBranch":"Search By Branch", + "searchByCategory":"Search By Category", + "selectCategory":"Select Category", + "searchByService":"Search By Service", + "selectServices":"Select Services", + "modifyPackage": "Modify Package" + + + + diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 0276b4f..daf3498 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -344,7 +344,7 @@ class CodegenLoader extends AssetLoader{ "vehiclePart": "جزء المركبة", "damagePartPictures": "صور الأجزاء المتضررة", "vehicleDamagePart": "جزء المركبة المتضرر", - "duration": "المدة", + "duration": ":المدة", "specialServices": "الخدمات الخاصة", "specialService": "خدمة خاصة", "adContactDetails": "تفاصيل الاتصال بالإعلان", @@ -473,7 +473,7 @@ class CodegenLoader extends AssetLoader{ "stoptheBuyers": "سنتوقف عن عرض هذا الإعلان للمشترين", "cancelReservation": "إلغاء الحجز", "reasonForCancellation": "سبب الإلغاء", - "doWantCancelReservation?": "هل تريد إلغاء الحجز؟", + "doWantCancelReservation": "هل تريد إلغاء الحجز؟", "yourAdVisibletoBuy": "سيتم إلغاء حجز إعلانك وسيكون هذا الإعلان مرئيًا للجميع مرة أخرى للشراء", "completeDeal": "إتمام الصفقة", "uploadBankReceipt": "تحميل إيصال البنك", @@ -491,7 +491,41 @@ class CodegenLoader extends AssetLoader{ "waitingAdminsApproval": "في انتظار موافقة الإدارة", "sold": "تم البيع", "noAdsShow": "لا توجد إعلانات لعرضها", - "damagePartList": "قائمة الأجزاء المتضررة" + "damagePartList": "قائمة الأجزاء المتضررة", + "searchPart": "البحث عن جزء", + "addSpecialService": "إضافة خدمة خاصة", + "vehicleVar": "السيارة", + "detailsVar": "التفاصيل", + "damageVar": "الضرر", + "partsVar": "الأجزاء", + "additional": "إضافي", + "review": "مراجعة", + "adVar": "الإعلان", + "updateAd": "تحديث الإعلان", + "createAd": "إنشاء إعلان", + "next": "التالي", + "submitAd": "إرسال الإعلان", + "selectAdType": "اختر نوع الإعلان", + "validUntilSubscriptionExpiration": "صالح حتى انتهاء الاشتراك", + "adsRemaining": "الإعلانات المتبقية", + "youLeftAdsGivenSubscription": "لقد بقي لديك 05 من 50 إعلانًا في الاشتراك.", + "updateSubscription": "تحديث الاشتراك", + "workInProgress": "العمل جارٍ", + "visitCompleted": "تمت الزيارة", + "youWantCancelAppointment": "هل تريد إلغاء هذا الموعد؟", + "appointmentCancelledCannotUndoAction": "سيتم إلغاء موعدك ولا يمكنك التراجع عن هذا الإجراء", + "appointment": "الموعد", + "rescheduleAppointment": "إعادة جدولة الموعد", + "payforAppointment": "دفع ثمن الموعد", + "appointmentsFilter": "تصفية المواعيد", + "searchByProvider": "البحث حسب المزود", + "selectProvider": "اختر المزود", + "searchByBranch": "البحث حسب الفرع", + "searchByCategory": "البحث حسب الفئة", + "selectCategory": "اختر الفئة", + "searchByService": "البحث حسب الخدمة", + "selectServices": "اختر الخدمات", + "modifyPackage": "تعديل الحزمة" }; static const Map en_US = { "firstTimeLogIn": "First Time Log In", @@ -823,7 +857,7 @@ static const Map en_US = { "vehiclePart": "Vehicle Part", "damagePartPictures": "Damage Part Pictures", "vehicleDamagePart": "Vehicle Damage Part", - "duration": "Duration", + "duration": "Duration:", "specialServices": "Special Services", "specialService": "Special Service", "adContactDetails": "Ad Contact Details", @@ -953,7 +987,7 @@ static const Map en_US = { "stoptheBuyers": "We will stop showing this ad to the buyers", "cancelReservation": "Cancel Reservation", "reasonForCancellation": "Reason for Cancellation", - "doWantCancelReservation?": "Do you want to cancel the reservation", + "doWantCancelReservation": "Do you want to cancel the reservation", "yourAdVisibletoBuy.": "Your ad reservation will be cancelled and this ad will be again visible to everyone to buy", "completeDeal": "Complete Deal", "uploadBankReceipt": "Upload Bank Receipt", @@ -971,7 +1005,41 @@ static const Map en_US = { "waitingAdminsApproval": "Waiting for Admins Approval", "sold": "Sold", "noAdsShow": "No Ads to show", - "damagePartList": "Damage Part List" + "damagePartList": "Damage Part List", + "searchPart": "Search Part", + "addSpecialService": "Add Special Service", + "vehicleVar": "Vehicle", + "detailsVar": "Details", + "damageVar": "Damage", + "partsVar": "Parts", + "additional": "Additional", + "review": "Review", + "adVar": "Ad", + "updateAd": "Update Ad", + "createAd": "Create Ad", + "next": "Next", + "submitAd": "Submit Ad", + "selectAdType": "Select Ad Type", + "validUntilSubscriptionExpiration": "Valid Until Subscription Expiration", + "adsRemaining ": "Ads Remaining", + "youLeftAdsGivenSubscription": "You have left with 05 out of 50 ads given in the subscription.", + "updateSubscription": "Update Subscription", + "workInProgress": "Work In Progress", + "visitCompleted": "Visit Completed", + "youWantCancelAppointment": "Do you want to cancel this appointment?", + "appointmentCancelledCannotUndoAction": "Your appointment will be cancelled and you cannot undo this action.", + "appointment": "Appointment", + "rescheduleAppointment": "Reschedule Appointment", + "payforAppointment": "Pay for Appointment", + "appointmentsFilter": "Appointments Filter", + "searchByProvider": "Search By Provider", + "selectProvider": "Select Provider", + "searchByBranch": "Search By Branch", + "searchByCategory": "Search By Category", + "selectCategory": "Select Category", + "searchByService": "Search By Service", + "selectServices": "Select Services", + "modifyPackage": "Modify Package" }; static const Map> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; } diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 83918f5..3551f58 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -436,7 +436,7 @@ abstract class LocaleKeys { static const stoptheBuyers = 'stoptheBuyers'; static const cancelReservation = 'cancelReservation'; static const reasonForCancellation = 'reasonForCancellation'; - static const doWantCancelReservation? = 'doWantCancelReservation?'; + static const doWantCancelReservation = 'doWantCancelReservation'; static const yourAdVisibletoBuy = 'yourAdVisibletoBuy'; static const completeDeal = 'completeDeal'; static const uploadBankReceipt = 'uploadBankReceipt'; @@ -455,5 +455,39 @@ abstract class LocaleKeys { static const sold = 'sold'; static const noAdsShow = 'noAdsShow'; static const damagePartList = 'damagePartList'; + static const searchPart = 'searchPart'; + static const addSpecialService = 'addSpecialService'; + static const vehicleVar = 'vehicleVar'; + static const detailsVar = 'detailsVar'; + static const damageVar = 'damageVar'; + static const partsVar = 'partsVar'; + static const additional = 'additional'; + static const review = 'review'; + static const adVar = 'adVar'; + static const updateAd = 'updateAd'; + static const createAd = 'createAd'; + static const next = 'next'; + static const submitAd = 'submitAd'; + static const selectAdType = 'selectAdType'; + static const validUntilSubscriptionExpiration = 'validUntilSubscriptionExpiration'; + static const adsRemaining = 'adsRemaining'; + static const youLeftAdsGivenSubscription = 'youLeftAdsGivenSubscription'; + static const updateSubscription = 'updateSubscription'; + static const workInProgress = 'workInProgress'; + static const visitCompleted = 'visitCompleted'; + static const youWantCancelAppointment = 'youWantCancelAppointment'; + static const appointmentCancelledCannotUndoAction = 'appointmentCancelledCannotUndoAction'; + static const appointment = 'appointment'; + static const rescheduleAppointment = 'rescheduleAppointment'; + static const payforAppointment = 'payforAppointment'; + static const appointmentsFilter = 'appointmentsFilter'; + static const searchByProvider = 'searchByProvider'; + static const selectProvider = 'selectProvider'; + static const searchByBranch = 'searchByBranch'; + static const searchByCategory = 'searchByCategory'; + static const selectCategory = 'selectCategory'; + static const searchByService = 'searchByService'; + static const selectServices = 'selectServices'; + static const modifyPackage = 'modifyPackage'; } diff --git a/lib/views/advertisement/bottom_sheet_content.dart b/lib/views/advertisement/bottom_sheet_content.dart index bf20cd6..33b8fca 100644 --- a/lib/views/advertisement/bottom_sheet_content.dart +++ b/lib/views/advertisement/bottom_sheet_content.dart @@ -15,7 +15,6 @@ import 'package:provider/provider.dart'; import 'package:sizer/sizer.dart'; import 'package:easy_localization/easy_localization.dart'; - class BottomSheetListContent extends StatefulWidget { const BottomSheetListContent({Key? key}) : super(key: key); @@ -50,7 +49,7 @@ class _BottomSheetListContentState extends State { TxtField( value: adVM.damagePartSearchValue, errorValue: "", - hint: "Search Part", + hint: LocaleKeys.searchPart.tr(), onChanged: (value) { adVM.onSearchChangedForDamagePart(value); }, @@ -121,7 +120,7 @@ class _BottomSheetListContentState extends State { SizedBox( width: double.infinity, child: ShowFillButton( - title: "Add Damage Part", + title: LocaleKeys.addDamagePart.tr(), onPressed: () { for (var value in adVM.vehicleDamageParts) { if (value.isChecked! && !value.isSelected!) { @@ -194,7 +193,7 @@ class BottomSheetAdSpecialServiceContent extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - "Add Special Service".toText(fontSize: 24, isBold: true), + LocaleKeys.addSpecialService.tr().toText(fontSize: 24, isBold: true), 8.height, Builder( builder: (context) { @@ -207,7 +206,7 @@ class BottomSheetAdSpecialServiceContent extends StatelessWidget { return DropdownField( (DropValue value) => adVM.updateVehicleAdsSpecialServicesId(SelectionModel(selectedId: value.id, selectedOption: value.value, itemPrice: value.subValue)), list: vehicleAdsSpecialServices, - hint: "Select Service", + hint: LocaleKeys.selectService.tr(), dropdownValue: adVM.vehicleAdsSpecialServicesId.selectedId != -1 ? DropValue(adVM.vehicleAdsSpecialServicesId.selectedId, adVM.vehicleAdsSpecialServicesId.selectedOption, "") : null, ); @@ -272,7 +271,7 @@ class BottomSheetAdSpecialServiceContent extends StatelessWidget { ), ], if (adVM.adSSTimeSlots.isNotEmpty) ...[ - "Available slots".toText(fontSize: 15, isBold: true), + LocaleKeys.availableSlots.tr().toText(fontSize: 15, isBold: true), 8.height, BuildTimeSlots( timeSlots: adVM.adSSTimeSlots, @@ -280,13 +279,13 @@ class BottomSheetAdSpecialServiceContent extends StatelessWidget { ), ], 22.height, - "Service Amount".toText(fontSize: 16, isBold: true, color: MyColors.lightTextColor), + LocaleKeys.serviceAmount.tr().toText(fontSize: 16, isBold: true, color: MyColors.lightTextColor), Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ adVM.vehicleAdsSpecialServicesId.itemPrice.toText(fontSize: 20, isBold: true), SizedBox(width: 1.w), - "SAR".toText(fontSize: 12, isBold: true, color: MyColors.lightTextColor).paddingOnly(bottom: 2), + LocaleKeys.sar.tr().toText(fontSize: 12, isBold: true, color: MyColors.lightTextColor).paddingOnly(bottom: 2), ], ), ], @@ -298,7 +297,7 @@ class BottomSheetAdSpecialServiceContent extends StatelessWidget { width: double.infinity, child: ShowFillButton( backgroundColor: !isButtonTappable(adVM) ? MyColors.lightTextColor.withOpacity(0.6) : MyColors.primaryColor, - title: "Add Service", + title: LocaleKeys.addService.tr(), onPressed: () { if (!isButtonTappable(adVM)) { return; diff --git a/lib/views/advertisement/create_ad_progress_steps.dart b/lib/views/advertisement/create_ad_progress_steps.dart index 391c034..fee89ac 100644 --- a/lib/views/advertisement/create_ad_progress_steps.dart +++ b/lib/views/advertisement/create_ad_progress_steps.dart @@ -2,11 +2,13 @@ import 'package:flutter/material.dart'; import 'package:mc_common_app/classes/consts.dart'; import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/extensions/string_extensions.dart'; +import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/view_models/ad_view_model.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:provider/provider.dart'; +import 'package:easy_localization/easy_localization.dart'; class CreateAdProgressSteps extends StatelessWidget { const CreateAdProgressSteps({Key? key}) : super(key: key); @@ -66,10 +68,10 @@ class CreateAdProgressSteps extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - buildStep(MyAssets.carIcon, "Vehicle \n Details", getProgressStepNumber(currentStep: adVM.currentProgressStep) >= 1), - buildStep(MyAssets.carHitIcon, "Damage \n Parts", getProgressStepNumber(currentStep: adVM.currentProgressStep) >= 2), - buildStep(MyAssets.clockIcon, "Additional \n Details", getProgressStepNumber(currentStep: adVM.currentProgressStep) >= 3), - buildStep(MyAssets.reviewIcon, "Review \n Ad", getProgressStepNumber(currentStep: adVM.currentProgressStep) >= 4), + buildStep(MyAssets.carIcon, (LocaleKeys.vehicleVar.tr() + " \n" + LocaleKeys.detailsVar.tr()), getProgressStepNumber(currentStep: adVM.currentProgressStep) >= 1), + buildStep(MyAssets.carHitIcon, (LocaleKeys.damageVar.tr() + " \n" + LocaleKeys.partsVar.tr()), getProgressStepNumber(currentStep: adVM.currentProgressStep) >= 2), + buildStep(MyAssets.clockIcon, (LocaleKeys.additional.tr() + " \n" + LocaleKeys.detailsVar.tr()), getProgressStepNumber(currentStep: adVM.currentProgressStep) >= 3), + buildStep(MyAssets.reviewIcon, (LocaleKeys.review.tr() + " \n"+ LocaleKeys.adVar.tr()), getProgressStepNumber(currentStep: adVM.currentProgressStep) >= 4), ], ), ], diff --git a/lib/views/advertisement/create_ad_view.dart b/lib/views/advertisement/create_ad_view.dart index 3a6619f..3d26ada 100644 --- a/lib/views/advertisement/create_ad_view.dart +++ b/lib/views/advertisement/create_ad_view.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:mc_common_app/extensions/int_extensions.dart'; +import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/navigator.dart'; @@ -13,6 +14,8 @@ import 'package:mc_common_app/widgets/button/show_fill_button.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:provider/provider.dart'; +import 'package:easy_localization/easy_localization.dart'; + class CreateAdView extends StatefulWidget { const CreateAdView({Key? key}) : super(key: key); @@ -34,7 +37,7 @@ class _CreateAdViewState extends State { Widget build(BuildContext context) { return Scaffold( appBar: CustomAppBar( - title: adVM.isAdEditEnabled ? "Update Ad": "Create Ad", + title: adVM.isAdEditEnabled ? LocaleKeys.updateAd.tr(): LocaleKeys.createAd.tr(), isRemoveBackButton: false, isDrawerEnabled: false, onBackButtonTapped: () => adVM.onBackButtonPressed(context), @@ -77,7 +80,7 @@ class BuildFooterButton extends StatelessWidget { return SizedBox( width: double.infinity, child: ShowFillButton( - title: "Next", + title: LocaleKeys.next.tr(), onPressed: () { adVm.updateCurrentStep(context); }, @@ -90,7 +93,7 @@ class BuildFooterButton extends StatelessWidget { child: ShowFillButton( txtColor: MyColors.black, maxHeight: 55, - title: "Cancel", + title: LocaleKeys.cancel.tr(), onPressed: () { adVm.resetValues(); pop(context); @@ -102,7 +105,7 @@ class BuildFooterButton extends StatelessWidget { Expanded( child: ShowFillButton( maxHeight: 55, - title: "Next", + title: LocaleKeys.next.tr(), onPressed: () { adVm.updateCurrentStep(context); }, @@ -118,7 +121,7 @@ class BuildFooterButton extends StatelessWidget { child: ShowFillButton( txtColor: MyColors.black, maxHeight: 55, - title: "Cancel", + title: LocaleKeys.cancel.tr(), onPressed: () { adVm.resetValues(); pop(context); @@ -130,7 +133,7 @@ class BuildFooterButton extends StatelessWidget { Expanded( child: ShowFillButton( maxHeight: 55, - title: "Next", + title: LocaleKeys.next.tr(), onPressed: () { adVm.updateCurrentStep(context); }, @@ -146,7 +149,7 @@ class BuildFooterButton extends StatelessWidget { child: ShowFillButton( txtColor: MyColors.black, maxHeight: 55, - title: "Cancel", + title: LocaleKeys.cancel.tr(), onPressed: () { adVm.resetValues(); pop(context); @@ -158,7 +161,7 @@ class BuildFooterButton extends StatelessWidget { Expanded( child: ShowFillButton( maxHeight: 55, - title: "Submit Ad", + title: LocaleKeys.submitAd.tr(), onPressed: () { adVm.updateCurrentStep(context); }, diff --git a/lib/views/advertisement/select_ad_type_view.dart b/lib/views/advertisement/select_ad_type_view.dart index f6f04a6..fd9dc9b 100644 --- a/lib/views/advertisement/select_ad_type_view.dart +++ b/lib/views/advertisement/select_ad_type_view.dart @@ -3,6 +3,7 @@ import 'package:mc_common_app/classes/consts.dart'; import 'package:mc_common_app/config/routes.dart'; import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/extensions/string_extensions.dart'; +import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/main.dart'; import 'package:mc_common_app/models/advertisment_models/vehicle_details_models.dart'; import 'package:mc_common_app/models/general_models/widgets_models.dart'; @@ -14,6 +15,8 @@ import 'package:mc_common_app/widgets/bottom_sheet.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:provider/provider.dart'; +import 'package:easy_localization/easy_localization.dart'; + class SelectAdTypeView extends StatelessWidget { final bool isProvider; @@ -61,7 +64,7 @@ class SelectAdTypeView extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: CustomAppBar( - title: "Select Ad Type", + title: LocaleKeys.selectAdType.tr(), profileImageUrl: MyAssets.bnCar, isRemoveBackButton: false, isDrawerEnabled: false, @@ -106,14 +109,14 @@ class SelectAdTypeView extends StatelessWidget { if (isProvider) ...[ Row( children: [ - "Duration: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true), - "Valid Until Subscription Expiration".toText(fontSize: 13, isBold: true), + LocaleKeys.duration.tr().toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true), + LocaleKeys.validUntilSubscriptionExpiration.tr() .toText(fontSize: 13, isBold: true), ], ).paddingOnly(top: 5, bottom: 5), ] else ...[ Row( children: [ - "Duration: ".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true), + LocaleKeys.duration.tr().toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true), adVM.vehicleAdDurationId.selectedOption.toText(fontSize: 13, isBold: true), const Icon(Icons.keyboard_arrow_down_sharp, color: MyColors.darkPrimaryColor, size: 20), ], @@ -127,7 +130,7 @@ class SelectAdTypeView extends StatelessWidget { 2.width, Padding( padding: const EdgeInsets.only(bottom: 4), - child: "SAR".toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true), + child: LocaleKeys.sar.tr().toText(fontSize: 12, color: MyColors.lightTextColor, isBold: true), ), ], ), @@ -154,21 +157,21 @@ class SelectAdTypeView extends StatelessWidget { Row( children: [ "5 of 10 ".toText(fontSize: 29, isBold: true, letterSpacing: 0, height: 1), - "Ads Remaining ".toText(fontSize: 17, color: MyColors.lightTextColor, isBold: true), + LocaleKeys.adsRemaining.tr().toText(fontSize: 17, color: MyColors.lightTextColor, isBold: true), ], ), - const Text.rich( + Text.rich( TextSpan( children: [ TextSpan( - text: "You have left with 05 out of 50 ads given in the subscription. ", - style: TextStyle( + text: LocaleKeys.youLeftAdsGivenSubscription.tr(), + style: const TextStyle( fontSize: 14, color: MyColors.lightTextColor, )), TextSpan( - text: "Update Subscription", - style: TextStyle( + text: LocaleKeys.updateSubscription.tr(), + style: const TextStyle( decoration: TextDecoration.underline, fontSize: 14, fontWeight: FontWeight.w600, diff --git a/lib/views/appointments/appointment_detail_view.dart b/lib/views/appointments/appointment_detail_view.dart index 65402f0..2729d56 100644 --- a/lib/views/appointments/appointment_detail_view.dart +++ b/lib/views/appointments/appointment_detail_view.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:mc_common_app/classes/consts.dart'; import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/extensions/string_extensions.dart'; +import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/models/appointments_models/appointment_list_model.dart'; import 'package:mc_common_app/models/services_models/service_model.dart'; import 'package:mc_common_app/theme/colors.dart'; @@ -13,6 +14,8 @@ import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/common_widgets/card_button_with_icon.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:provider/provider.dart'; +import 'package:easy_localization/easy_localization.dart'; + class AppointmentDetailView extends StatelessWidget { final AppointmentListModel appointmentListModel; @@ -47,7 +50,7 @@ class AppointmentDetailView extends StatelessWidget { color: MyColors.grey98Color.withOpacity(0.3), textColor: MyColors.lightTextColor, onPressed: () {}, - text: "Work In Progress", + text: LocaleKeys.workInProgress.tr(), ), ], ), @@ -68,7 +71,7 @@ class AppointmentDetailView extends StatelessWidget { ); } }, - text: "Pay Now", + text: LocaleKeys.payNow.tr(), ), ], ), @@ -90,7 +93,7 @@ class AppointmentDetailView extends StatelessWidget { onPressed: () { context.read().onConfirmAppointmentPressed(context: context, appointmentId: appointmentListModel.id); }, - text: "Confirm"), + text: LocaleKeys.confirm.tr()), ], ), ); @@ -112,7 +115,7 @@ class AppointmentDetailView extends StatelessWidget { color: MyColors.grey98Color.withOpacity(0.3), textColor: MyColors.lightTextColor, onPressed: () {}, - text: "Visit Completed", + text: LocaleKeys.visitCompleted.tr(), ), ], ), @@ -144,7 +147,7 @@ class AppointmentDetailView extends StatelessWidget { onPressed: () { context.read().onConfirmAppointmentPressed(context: context, appointmentId: appointmentListModel.id); }, - text: "Confirm"), + text: LocaleKeys.confirm.tr()), ], ), ); @@ -157,12 +160,12 @@ class AppointmentDetailView extends StatelessWidget { final appointmentsVm = context.read(); return actionConfirmationBottomSheet( context: context, - title: "Do you want to cancel this appointment?".toText(fontSize: 28, isBold: true, letterSpacing: -1.44), - subtitle: "Your appointment will be cancelled and you cannot undo this action.", + title: LocaleKeys.youWantCancelAppointment.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44), + subtitle: LocaleKeys.appointmentCancelledCannotUndoAction.tr(), actionButtonYes: Expanded( child: ShowFillButton( maxHeight: 55, - title: "Yes", + title: LocaleKeys.yes.tr(), fontSize: 15, onPressed: () { Navigator.pop(context); @@ -175,7 +178,7 @@ class AppointmentDetailView extends StatelessWidget { maxHeight: 55, isFilled: false, borderColor: MyColors.darkPrimaryColor, - title: "No", + title: LocaleKeys.no.tr(), txtColor: MyColors.darkPrimaryColor, fontSize: 15, onPressed: () { @@ -191,7 +194,7 @@ class AppointmentDetailView extends StatelessWidget { AppointmentsVM appointmentsVM = context.read(); return Scaffold( appBar: CustomAppBar( - title: "Appointment", + title: LocaleKeys.appointment.tr(), profileImageUrl: MyAssets.bnCar, isRemoveBackButton: false, isDrawerEnabled: false, @@ -254,7 +257,7 @@ class AppointmentDetailView extends StatelessWidget { children: [ ((service.currentTotalServicePrice).toString()).toText(fontSize: 25, isBold: true), 2.width, - "SAR".toText(color: MyColors.lightTextColor, fontSize: 16, isBold: true).paddingOnly(bottom: 5), + LocaleKeys.sar.tr().toText(color: MyColors.lightTextColor, fontSize: 16, isBold: true).paddingOnly(bottom: 5), const Icon(Icons.arrow_drop_down, size: 30) ], ).onPress(() => appointmentsVM.priceBreakDownClicked(context, service)), @@ -268,7 +271,7 @@ class AppointmentDetailView extends StatelessWidget { Row( children: [ CardButtonWithIcon( - title: "Reschedule Appointment", + title: LocaleKeys.rescheduleAppointment.tr(), onCardTapped: () { context.read().onRescheduleAppointmentPressed(context: context, appointmentListModel: appointmentListModel); }, @@ -277,7 +280,7 @@ class AppointmentDetailView extends StatelessWidget { if (appointmentListModel.appointmentStatusEnum == AppointmentStatusEnum.booked) ...[ 10.width, CardButtonWithIcon( - title: "Pay for Appointment", + title: LocaleKeys.payforAppointment.tr(), onCardTapped: () { context.read().onConfirmAppointmentPressed(context: context, appointmentId: appointmentListModel.id); }, diff --git a/lib/views/appointments/appointments_filter_view.dart b/lib/views/appointments/appointments_filter_view.dart index 59101fd..06650d3 100644 --- a/lib/views/appointments/appointments_filter_view.dart +++ b/lib/views/appointments/appointments_filter_view.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:mc_common_app/classes/consts.dart'; import 'package:mc_common_app/extensions/int_extensions.dart'; import 'package:mc_common_app/extensions/string_extensions.dart'; +import 'package:mc_common_app/generated/locale_keys.g.dart'; import 'package:mc_common_app/models/general_models/widgets_models.dart'; import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/utils/enums.dart'; @@ -12,7 +13,7 @@ import 'package:mc_common_app/view_models/appointments_view_model.dart'; import 'package:mc_common_app/widgets/button/show_fill_button.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/common_widgets/search_entity_widget.dart'; -import 'package:mc_common_app/widgets/common_widgets/slider_widget.dart'; +import 'package:easy_localization/easy_localization.dart'; import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:provider/provider.dart'; @@ -47,7 +48,7 @@ class _AppointmentsFilterViewState extends State { Widget build(BuildContext context) { return Scaffold( appBar: CustomAppBar( - title: "Appointments Filter", + title: LocaleKeys.appointmentsFilter.tr(), profileImageUrl: MyAssets.bnCar, isRemoveBackButton: false, isDrawerEnabled: false, @@ -69,7 +70,7 @@ class _AppointmentsFilterViewState extends State { children: [ 20.height, SearchEntityWidget( - title: "Search By Provider", + title: LocaleKeys.searchByProvider.tr(), actionWidget: Builder( builder: (context) { return DropdownField( @@ -78,7 +79,7 @@ class _AppointmentsFilterViewState extends State { dropdownValue: appointmentsVM.appointmentFilterSelectedProviderId.selectedId != -1 ? DropValue(appointmentsVM.appointmentFilterSelectedProviderId.selectedId, appointmentsVM.appointmentFilterSelectedProviderId.selectedOption, "") : null, - hint: "Select Provider", + hint: LocaleKeys.selectProvider.tr(), ); }, ), @@ -103,7 +104,7 @@ class _AppointmentsFilterViewState extends State { if (appointmentsVM.appointmentFilterProviderSearchHistory.isNotEmpty) ...[ const Divider(thickness: 1.2).paddingOnly(top: 5, bottom: 5), SearchEntityWidget( - title: "Search By Branch", + title: LocaleKeys.searchByBranch.tr(), actionWidget: Builder( builder: (context) { return DropdownField( @@ -112,7 +113,7 @@ class _AppointmentsFilterViewState extends State { dropdownValue: appointmentsVM.appointmentFilterSelectedBranchId.selectedId != -1 ? DropValue(appointmentsVM.appointmentFilterSelectedBranchId.selectedId, appointmentsVM.appointmentFilterSelectedBranchId.selectedOption, "") : null, - hint: "Select Branch", + hint: LocaleKeys.selectBranch.tr(), ); }, ), @@ -126,7 +127,7 @@ class _AppointmentsFilterViewState extends State { ], const Divider(thickness: 1.2).paddingOnly(top: 5, bottom: 5), SearchEntityWidget( - title: "Search By Category", + title: LocaleKeys.searchByCategory.tr(), actionWidget: Builder( builder: (context) { return DropdownField( @@ -135,7 +136,7 @@ class _AppointmentsFilterViewState extends State { dropdownValue: appointmentsVM.appointmentFilterSelectedCategoryId.selectedId != -1 ? DropValue(appointmentsVM.appointmentFilterSelectedCategoryId.selectedId, appointmentsVM.appointmentFilterSelectedCategoryId.selectedOption, "") : null, - hint: "Select Category", + hint: LocaleKeys.selectCategory.tr(), ); }, ), @@ -148,7 +149,7 @@ class _AppointmentsFilterViewState extends State { ), const Divider(thickness: 1.2).paddingOnly(top: 5, bottom: 5), SearchEntityWidget( - title: "Search By Service", + title: LocaleKeys.searchByService.tr(), actionWidget: Builder(builder: (context) { return DropdownField( (DropValue value) => appointmentsVM.updateAppointmentFilterSelectedServiceId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true), @@ -156,7 +157,7 @@ class _AppointmentsFilterViewState extends State { dropdownValue: appointmentsVM.appointmentFilterSelectedServiceId.selectedId != -1 ? DropValue(appointmentsVM.appointmentFilterSelectedServiceId.selectedId, appointmentsVM.appointmentFilterSelectedServiceId.selectedOption, "") : null, - hint: "Select Services", + hint: LocaleKeys.selectServices.tr(), ); }), historyContent: appointmentsVM.appointmentFilterServicesSearchHistory, @@ -175,7 +176,7 @@ class _AppointmentsFilterViewState extends State { Expanded( child: ShowFillButton( maxHeight: 55, - title: "Search", + title: LocaleKeys.search.tr(), onPressed: () { Navigator.pop(context); appointmentsVM.getAppointmentsBasedOnFilters(); @@ -190,7 +191,7 @@ class _AppointmentsFilterViewState extends State { 8.height, InkWell( onTap: () => appointmentsVM.clearAppointmentFilters(), - child: "Clear Filters".toText( + child: LocaleKeys.clearFilters.tr().toText( fontSize: 14, isBold: true, color: MyColors.darkPrimaryColor,