From 2e9d665aaf9e881b3f01724fcb5f88341a2c4321 Mon Sep 17 00:00:00 2001 From: "Aamir.Muhammad" <> Date: Tue, 16 Jul 2024 16:04:06 +0300 Subject: [PATCH] Localization --- assets/langs/ar-SA.json | 42 ++++++- assets/langs/en-US.json | 41 +++++- lib/generated/codegen_loader.g.dart | 78 +++++++++++- lib/generated/locale_keys.g.dart | 37 ++++++ lib/views/advertisement/ads_detail_view.dart | 118 +++++++++--------- lib/views/advertisement/ads_filter_view.dart | 24 ++-- lib/views/advertisement/ads_list.dart | 11 +- .../advertisement/bottom_sheet_content.dart | 5 +- 8 files changed, 277 insertions(+), 79 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index 976aab4..f9773d1 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -438,7 +438,47 @@ "availableSlots": "المواعيد المتاحة", "bookAndPay": "الحجز والدفع", "reservationAmounts": "مبالغ الحجز", - "tax": "الضريبة" + "tax": "الضريبة", + "adsFilter": "تصفية الإعلانات", + "searchByCity": "البحث حسب المدينة", + "selectCity": "اختر المدينة", + "searchByBrandName": "البحث حسب اسم العلامة التجارية", + "selectVehicleBrand": "اختر علامة تجارية للسيارة", + "searchByVehicleYear": "البحث حسب سنة السيارة", + "selectYear": "اختر السنة", + "searchByAdOwner": "البحث حسب مالك الإعلان", + "selectOwner": "اختر المالك", + "search": "بحث", + "clearFilters": "مسح التصفية", + "book": "حجز", + "markAsSold": "وضع علامة تم البيع", + "deactivateAd": "إلغاء تفعيل الإعلان", + "doWantDeactivateAd": "هل تريد إلغاء تفعيل هذا الإعلان؟", + "stoptheBuyers": "سنتوقف عن عرض هذا الإعلان للمشترين", + "cancelReservation": "إلغاء الحجز", + "reasonForCancellation": "سبب الإلغاء", + "doWantCancelReservation?": "هل تريد إلغاء الحجز؟", + "yourAdVisibletoBuy": "سيتم إلغاء حجز إعلانك وسيكون هذا الإعلان مرئيًا للجميع مرة أخرى للشراء", + "completeDeal": "إتمام الصفقة", + "uploadBankReceipt": "تحميل إيصال البنك", + "notesForAdmin": "ملاحظات للإدارة", + "extendAd": "تمديد الإعلان", + "updateAdDetails": "هل تريد تحديث تفاصيل الإعلان", + "durationExtendingAd": "يمكنك تغيير مدة الإعلان والتفاصيل قبل تمديد الإعلان", + "waitingAdminsResponse": "في انتظار رد الإدارة", + "cancelledByOwner": "ألغيت من قبل المالك", + "cancelledByAdmin": "ألغيت من قبل الإدارة", + "reservationTimeOver": "انتهى وقت الحجز", + "paymentVerified": "تم التحقق من الدفع", + "rejectedFormAdmin": "تم الرفض من قبل الإدارة", + "waitingAdminPost": "في انتظار الإدارة للنشر", + "waitingAdminsApproval": "في انتظار موافقة الإدارة", + "sold": "تم البيع", + "noAdsShow": "لا توجد إعلانات لعرضها", + "damagePartList": "قائمة الأجزاء المتضررة" + + + } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 412b467..a45ca3c 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -439,7 +439,46 @@ "availableSlots":"Available Slots", "bookAndPay":"Book and Pay", "reservationAmounts":"Reservation Amounts", - "tax":"Tax" + "tax":"Tax", + "adsFilter": "Ads Filter", + "searchByCity":"Search By City", + "selectCity":"Select City", + "searchByBrandName":"Search By Brand Name", + "selectVehicleBrand":"Select Vehicle Brand", + "searchByVehicleYear":"Search By Vehicle Year", + "selectYear":"Select Year", + "searchByAdOwner":"Search By Ad Owner", + "selectOwner":"Select Owner", + "search":"Search", + "clearFilters":"Clear Filters", + "book":"Book", + "markAsSold":"Mark As Sold", + "deactivateAd":"Deactivate Ad", + "doWantDeactivateAd":"Do you want to the Deactivate this Ad?", + "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", + "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", + "notesForAdmin":"Notes For Admin", + "extendAd":"Extend Ad", + "updateAdDetails":"Do you want to update the Ad Details", + "durationExtendingAd":"You can change the ad duration and details before extending the ad", + "waitingAdminsResponse":"Waiting for Admins Response", + "cancelledByOwner":"Cancelled by Owner", + "cancelledByAdmin":"Cancelled by Admin", + "reservationTimeOver":"Reservation Time Over", + "paymentVerified":"Payment Verified", + "rejectedFormAdmin":"Rejected form Admin", + "waitingAdminPost":"Waiting for admin to post", + "waitingAdminsApproval":"Waiting for Admins Approval", + "sold":"Sold", + "noAdsShow":"No Ads to show", + "damagePartList":"Damage Part List" + + diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index 81ffbf5..0276b4f 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -454,7 +454,44 @@ class CodegenLoader extends AssetLoader{ "availableSlots": "المواعيد المتاحة", "bookAndPay": "الحجز والدفع", "reservationAmounts": "مبالغ الحجز", - "tax": "الضريبة" + "tax": "الضريبة", + "adsFilter": "تصفية الإعلانات", + "searchByCity": "البحث حسب المدينة", + "selectCity": "اختر المدينة", + "searchByBrandName": "البحث حسب اسم العلامة التجارية", + "selectVehicleBrand": "اختر علامة تجارية للسيارة", + "searchByVehicleYear": "البحث حسب سنة السيارة", + "selectYear": "اختر السنة", + "searchByAdOwner": "البحث حسب مالك الإعلان", + "selectOwner": "اختر المالك", + "search": "بحث", + "clearFilters": "مسح التصفية", + "book": "حجز", + "markAsSold": "وضع علامة تم البيع", + "deactivateAd": "إلغاء تفعيل الإعلان", + "doWantDeactivateAd": "هل تريد إلغاء تفعيل هذا الإعلان؟", + "stoptheBuyers": "سنتوقف عن عرض هذا الإعلان للمشترين", + "cancelReservation": "إلغاء الحجز", + "reasonForCancellation": "سبب الإلغاء", + "doWantCancelReservation?": "هل تريد إلغاء الحجز؟", + "yourAdVisibletoBuy": "سيتم إلغاء حجز إعلانك وسيكون هذا الإعلان مرئيًا للجميع مرة أخرى للشراء", + "completeDeal": "إتمام الصفقة", + "uploadBankReceipt": "تحميل إيصال البنك", + "notesForAdmin": "ملاحظات للإدارة", + "extendAd": "تمديد الإعلان", + "updateAdDetails": "هل تريد تحديث تفاصيل الإعلان", + "durationExtendingAd": "يمكنك تغيير مدة الإعلان والتفاصيل قبل تمديد الإعلان", + "waitingAdminsResponse": "في انتظار رد الإدارة", + "cancelledByOwner": "ألغيت من قبل المالك", + "cancelledByAdmin": "ألغيت من قبل الإدارة", + "reservationTimeOver": "انتهى وقت الحجز", + "paymentVerified": "تم التحقق من الدفع", + "rejectedFormAdmin": "تم الرفض من قبل الإدارة", + "waitingAdminPost": "في انتظار الإدارة للنشر", + "waitingAdminsApproval": "في انتظار موافقة الإدارة", + "sold": "تم البيع", + "noAdsShow": "لا توجد إعلانات لعرضها", + "damagePartList": "قائمة الأجزاء المتضررة" }; static const Map en_US = { "firstTimeLogIn": "First Time Log In", @@ -897,7 +934,44 @@ static const Map en_US = { "availableSlots": "Available Slots", "bookAndPay": "Book and Pay", "reservationAmounts": "Reservation Amounts", - "tax": "Tax" + "tax": "Tax", + "adsFilter": "Ads Filter", + "searchByCity": "Search By City", + "selectCity": "Select City", + "searchByBrandName": "Search By Brand Name", + "selectVehicleBrand": "Select Vehicle Brand", + "searchByVehicleYear": "Search By Vehicle Year", + "selectYear": "Select Year", + "searchByAdOwner": "Search By Ad Owner", + "selectOwner": "Select Owner", + "search": "Search", + "clearFilters": "Clear Filters", + "book": "Book", + "markAsSold": "Mark As Sold", + "deactivateAd": "Deactivate Ad", + "doWantDeactivateAd": "Do you want to the Deactivate this Ad?", + "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", + "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", + "notesForAdmin": "Notes For Admin", + "extendAd": "Extend Ad", + "updateAdDetails": "Do you want to update the Ad Details", + "durationExtendingAd": "You can change the ad duration and details before extending the ad", + "waitingAdminsResponse": "Waiting for Admins Response", + "cancelledByOwner": "Cancelled by Owner", + "cancelledByAdmin": "Cancelled by Admin", + "reservationTimeOver": "Reservation Time Over", + "paymentVerified": "Payment Verified", + "rejectedFormAdmin": "Rejected form Admin", + "waitingAdminPost": "Waiting for admin to post", + "waitingAdminsApproval": "Waiting for Admins Approval", + "sold": "Sold", + "noAdsShow": "No Ads to show", + "damagePartList": "Damage Part List" }; 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 8ecc7ca..83918f5 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -418,5 +418,42 @@ abstract class LocaleKeys { static const bookAndPay = 'bookAndPay'; static const reservationAmounts = 'reservationAmounts'; static const tax = 'tax'; + static const adsFilter = 'adsFilter'; + static const searchByCity = 'searchByCity'; + static const selectCity = 'selectCity'; + static const searchByBrandName = 'searchByBrandName'; + static const selectVehicleBrand = 'selectVehicleBrand'; + static const searchByVehicleYear = 'searchByVehicleYear'; + static const selectYear = 'selectYear'; + static const searchByAdOwner = 'searchByAdOwner'; + static const selectOwner = 'selectOwner'; + static const search = 'search'; + static const clearFilters = 'clearFilters'; + static const book = 'book'; + static const markAsSold = 'markAsSold'; + static const deactivateAd = 'deactivateAd'; + static const doWantDeactivateAd = 'doWantDeactivateAd'; + static const stoptheBuyers = 'stoptheBuyers'; + static const cancelReservation = 'cancelReservation'; + static const reasonForCancellation = 'reasonForCancellation'; + static const doWantCancelReservation? = 'doWantCancelReservation?'; + static const yourAdVisibletoBuy = 'yourAdVisibletoBuy'; + static const completeDeal = 'completeDeal'; + static const uploadBankReceipt = 'uploadBankReceipt'; + static const notesForAdmin = 'notesForAdmin'; + static const extendAd = 'extendAd'; + static const updateAdDetails = 'updateAdDetails'; + static const durationExtendingAd = 'durationExtendingAd'; + static const waitingAdminsResponse = 'waitingAdminsResponse'; + static const cancelledByOwner = 'cancelledByOwner'; + static const cancelledByAdmin = 'cancelledByAdmin'; + static const reservationTimeOver = 'reservationTimeOver'; + static const paymentVerified = 'paymentVerified'; + static const rejectedFormAdmin = 'rejectedFormAdmin'; + static const waitingAdminPost = 'waitingAdminPost'; + static const waitingAdminsApproval = 'waitingAdminsApproval'; + static const sold = 'sold'; + static const noAdsShow = 'noAdsShow'; + static const damagePartList = 'damagePartList'; } diff --git a/lib/views/advertisement/ads_detail_view.dart b/lib/views/advertisement/ads_detail_view.dart index 4d95308..49756ed 100644 --- a/lib/views/advertisement/ads_detail_view.dart +++ b/lib/views/advertisement/ads_detail_view.dart @@ -247,7 +247,7 @@ class _AdsDetailViewState extends State { ), Row( children: [ - (LocaleKeys.iban.tr()+": ").toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), + (LocaleKeys.iban.tr() + ": ").toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), (adVM.adsBankDetailsModel!.iban ?? "").toText( fontSize: 14, isBold: true, @@ -442,10 +442,10 @@ class BuildAdDetailsActionButtonForExploreAds extends StatelessWidget { ).paddingOnly(bottom: 2), 3.width, LocaleKeys.servicesReservingAd.tr().toText( - color: MyColors.adPendingStatusColor, - fontSize: 12, - isItalic: true, - ), + color: MyColors.adPendingStatusColor, + fontSize: 12, + isItalic: true, + ), ], ), 15.height, @@ -714,44 +714,44 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { ], ), const Divider(), - "Special Services".toText(fontSize: 16, isBold: true), + LocaleKeys.specialService.tr().toText(fontSize: 16, isBold: true), 5.height, Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Car insurance Service".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor, fontWeight: FontWeight.w500), - "To be Decided".toText(fontSize: 12, isBold: true), + LocaleKeys.carInsuranceService.tr().toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor, fontWeight: FontWeight.w500), + LocaleKeys.toBeDecided.tr().toText(fontSize: 12, isBold: true), ], ), 5.height, Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Registration & Car Plates".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), - "To be Decided".toText(fontSize: 12, isBold: true), + LocaleKeys.registrationCarPlates.tr().toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), + LocaleKeys.toBeDecided.tr().toText(fontSize: 12, isBold: true), ], ), 5.height, Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Home Delivery Service".toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), - "To be Decided".toText(fontSize: 12, isBold: true), + LocaleKeys.homeDeliveryService.tr().toText(fontSize: 14, isBold: true, color: MyColors.lightTextColor), + LocaleKeys.toBeDecided.tr().toText(fontSize: 12, isBold: true), ], ), 12.height, - "Special service charges will be added based on desired insurance and delivery Location".toText(fontSize: 12), + LocaleKeys.specialServicechargesInsuranceDeliveryLocation.tr().toText(fontSize: 12), 30.height, Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - "Total Amount ".toText(fontSize: 16, isBold: true), + LocaleKeys.totalAmount.tr().toText(fontSize: 16, isBold: true), Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ "34,500".toText(fontSize: 19, isBold: true), 2.width, - "SAR".toText(color: MyColors.lightTextColor, fontSize: 10, isBold: true).paddingOnly(bottom: 3), + LocaleKeys.sar.tr().toText(color: MyColors.lightTextColor, fontSize: 10, isBold: true).paddingOnly(bottom: 3), ], ) ], @@ -760,7 +760,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end, children: [ - "Estimated".toText(fontSize: 10, isBold: true), + LocaleKeys.estimated.tr().toText(fontSize: 10, isBold: true), ], ), 44.height, @@ -773,11 +773,11 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { size: 19, ).paddingOnly(bottom: 2), 3.width, - "Some services are mandatory while reserving the Ad.".toText( - color: MyColors.adPendingStatusColor, - fontSize: 12, - isItalic: true, - ), + LocaleKeys.servicesReservingAd.tr().toText( + color: MyColors.adPendingStatusColor, + fontSize: 12, + isItalic: true, + ), ], ), 15.height, @@ -786,7 +786,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { Expanded( child: ShowFillButton( maxHeight: 55, - title: "Complete Reservation", + title: LocaleKeys.completeReservation.tr(), onPressed: () { Navigator.pop(context); navigateWithName(context, AppRoutes.paymentMethodsView); @@ -842,7 +842,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { isFilled: false, borderColor: MyColors.darkPrimaryColor, maxHeight: 55, - title: "Book ${photoSpecialServiceModel.name}", + title: (LocaleKeys.book.tr() + " ${photoSpecialServiceModel.name}"), txtColor: MyColors.darkPrimaryColor, onPressed: () { onBookPhotographyServiceClicked(context, adDetailsModel: adDetailsModel); @@ -861,7 +861,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { backgroundColor: payButtonStatus ? MyColors.grey98Color.withOpacity(0.3) : MyColors.darkPrimaryColor, txtColor: payButtonStatus ? MyColors.lightTextColor : MyColors.white, isBold: false, - title: "Pay Now", + title: LocaleKeys.payNow.tr(), onPressed: () { if (photoSpecialServiceModel == null) { navigateWithName(context, AppRoutes.paymentMethodsView, arguments: PaymentTypes.ads); @@ -885,7 +885,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { Expanded( child: ShowFillButton( maxHeight: 55, - title: "Mark As Sold", + title: LocaleKeys.markAsSold.tr(), isBold: false, onPressed: () { adVM.markAdAsSold(context, adId: adDetailsModel.id!); @@ -902,17 +902,17 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { isFilled: false, borderColor: MyColors.redColor, maxHeight: 55, - title: "Deactivate Ad", + title: LocaleKeys.deactivateAd.tr(), txtColor: MyColors.redColor, onPressed: () { return actionConfirmationBottomSheet( context: context, - title: "Do you want to the Deactivate this Ad?".toText(fontSize: 28, isBold: true, letterSpacing: -1.44), - subtitle: "We will stop showing this ad to the buyers.", + title: LocaleKeys.doWantDeactivateAd.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44), + subtitle: LocaleKeys.stoptheBuyers.tr(), actionButtonYes: Expanded( child: ShowFillButton( maxHeight: 55, - title: "Yes", + title: LocaleKeys.yes.tr(), fontSize: 15, onPressed: () { Navigator.pop(context); @@ -925,7 +925,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { maxHeight: 55, isFilled: false, borderColor: MyColors.darkPrimaryColor, - title: "No", + title: LocaleKeys.no.tr(), txtColor: MyColors.darkPrimaryColor, fontSize: 15, onPressed: () { @@ -950,7 +950,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { enableDrag: true, builder: (BuildContext context) { return InfoBottomSheet( - title: "Cancel Reservation".toText(fontSize: 28, isBold: true, letterSpacing: -1.44), + title: LocaleKeys.cancelReservation.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44), description: Padding( padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), child: Consumer( @@ -967,26 +967,26 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { value: adVM.reservationCancelReason, errorValue: adVM.reservationCancelError, keyboardType: TextInputType.text, - hint: "Reason for cancellation", + hint: LocaleKeys.reasonForCancellation.tr(), onChanged: (v) => adVM.updateReservationCancelReason(v), ), ], ), 25.height, ShowFillButton( - title: "Submit", + title: LocaleKeys.submit.tr(), onPressed: () { bool status = adVM.validateReservationCancelReason(); if (status) { Navigator.pop(context); return actionConfirmationBottomSheet( context: context, - title: "Do you want to cancel the reservation?".toText(fontSize: 28, isBold: true, letterSpacing: -1.44), - subtitle: "Your ad reservation will be cancelled and this ad will be again visible to everyone to buy.", + title: LocaleKeys.doWantCancelReservation.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44), + subtitle: LocaleKeys.yourAdVisibletoBuy.tr(), actionButtonYes: Expanded( child: ShowFillButton( maxHeight: 55, - title: "Yes", + title: LocaleKeys.yes.tr(), fontSize: 15, onPressed: () { Navigator.pop(context); @@ -999,7 +999,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { maxHeight: 55, isFilled: false, borderColor: MyColors.darkPrimaryColor, - title: "No", + title: LocaleKeys.no.tr(), txtColor: MyColors.darkPrimaryColor, fontSize: 15, onPressed: () { @@ -1032,7 +1032,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { isFilled: false, fontSize: 16, maxHeight: 55, - title: "Cancel Reservation", + title: LocaleKeys.cancelReservation.tr(), onPressed: () { buildCancelReservationBottomSheet(context, adDetails: adDetails); }), @@ -1050,7 +1050,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { backgroundColor: MyColors.darkPrimaryColor, txtColor: MyColors.white, isBold: false, - title: "Complete Deal", + title: LocaleKeys.completeDeal.tr(), onPressed: () { buildCompleteDealBottomSheet(context, adDetails: adDetails); }), @@ -1066,7 +1066,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { enableDrag: true, builder: (BuildContext context) { return InfoBottomSheet( - title: "Upload Bank Receipt".toText(fontSize: 26, isBold: true, letterSpacing: -1.44), + title: LocaleKeys.uploadBankReceipt.tr().toText(fontSize: 26, isBold: true, letterSpacing: -1.44), description: Padding( padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), child: Consumer( @@ -1083,13 +1083,13 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { value: adVM.completeDealNotesForAdmin, errorValue: "", keyboardType: TextInputType.text, - hint: "Notes For Admin", + hint: LocaleKeys.notesForAdmin.tr(), onChanged: (v) => adVM.updateCompleteDealNotesForAdmin(v), ), ], ), 15.height, - "Attach File".toText(fontSize: 20, isBold: true, letterSpacing: -0.5), + LocaleKeys.attachFile.tr().toText(fontSize: 20, isBold: true, letterSpacing: -0.5), if (adVM.pickedReceiptPdfFiles.isNotEmpty) ...[ 16.height, PickedFilesContainer( @@ -1123,7 +1123,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { ], 15.height, ShowFillButton( - title: "Submit", + title: LocaleKeys.submit.tr(), onPressed: () { //Upload Attachment }, @@ -1146,17 +1146,17 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { child: ShowFillButton( fontSize: 16, maxHeight: 55, - title: "Extend Ad", + title: LocaleKeys.extendAd.tr(), onPressed: () { final AdVM adVM = context.read(); return actionConfirmationBottomSheet( context: context, - title: "Do you want to update the Ad Details?".toText(fontSize: 28, isBold: true, letterSpacing: -1.44), - subtitle: "You can change the ad duration and details before extending the ad.", + title: LocaleKeys.updateAdDetails.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44), + subtitle: LocaleKeys.durationExtendingAd.tr(), actionButtonYes: Expanded( child: ShowFillButton( maxHeight: 55, - title: "Yes", + title: LocaleKeys.yes.tr(), fontSize: 15, onPressed: () { Navigator.pop(context); @@ -1172,7 +1172,7 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { maxHeight: 55, isFilled: false, borderColor: MyColors.darkPrimaryColor, - title: "No", + title: LocaleKeys.no.tr(), txtColor: MyColors.darkPrimaryColor, fontSize: 15, onPressed: () { @@ -1195,31 +1195,31 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { Widget reservedAdActions(context, {required AdDetailsModel adDetailsModel, required AdVM adVM}) { switch (adDetailsModel.adReserveStatus) { case AdReserveStatus.defaultStatus: - return pendingForReviewAction(pendingText: "Waiting for Admins Response"); + return pendingForReviewAction(pendingText: LocaleKeys.waitingAdminsResponse.tr()); case AdReserveStatus.reserved: return cancelReservationAction(context, adDetails: adDetailsModel); case AdReserveStatus.cancelledByOwner: - return pendingForReviewAction(pendingText: "Cancelled by Owner"); + return pendingForReviewAction(pendingText: LocaleKeys.cancelledByOwner.tr()); case AdReserveStatus.cancelledByAdmin: - return pendingForReviewAction(pendingText: "Cancelled by Admin"); + return pendingForReviewAction(pendingText: LocaleKeys.cancelledByAdmin.tr()); case AdReserveStatus.timeOver: - return pendingForReviewAction(pendingText: "Reservation Time Over"); + return pendingForReviewAction(pendingText: LocaleKeys.reservationTimeOver.tr()); case AdReserveStatus.dealDone: if (adVM.adsBankDetailsModel != null) { return completeDealAction(context, adDetails: adDetailsModel); } - return pendingForReviewAction(pendingText: "Waiting for Admins Response"); + return pendingForReviewAction(pendingText: LocaleKeys.waitingAdminsResponse.tr()); case AdReserveStatus.fullPaymentVerified: - return pendingForReviewAction(pendingText: "Payment Verified"); + return pendingForReviewAction(pendingText: LocaleKeys.paymentVerified.tr()); default: - return pendingForReviewAction(pendingText: "Waiting for Admins Response"); + return pendingForReviewAction(pendingText: LocaleKeys.waitingAdminsResponse.tr()); } } @@ -1240,16 +1240,16 @@ class BuildAdDetailsActionButtonForMyAds extends StatelessWidget { case AdPostStatus.buyingService: case AdPostStatus.reserveCancel: case AdPostStatus.rejected: - return pendingForReviewAction(pendingText: "Rejected form admin"); + return pendingForReviewAction(pendingText: LocaleKeys.rejectedFormAdmin.tr()); case AdPostStatus.cancelled: case AdPostStatus.pendingForPost: - return pendingForReviewAction(pendingText: "Waiting for admin to post"); + return pendingForReviewAction(pendingText: LocaleKeys.waitingAdminPost.tr()); case AdPostStatus.pendingForReview: - return pendingForReviewAction(pendingText: "Waiting for Admins Approval"); + return pendingForReviewAction(pendingText: LocaleKeys.waitingAdminsApproval.tr()); case AdPostStatus.sold: - return pendingForReviewAction(pendingText: "Sold"); + return pendingForReviewAction(pendingText: LocaleKeys.sold.tr()); case AdPostStatus.expired: return expiredAdAction(context); diff --git a/lib/views/advertisement/ads_filter_view.dart b/lib/views/advertisement/ads_filter_view.dart index c7cf7a5..0316503 100644 --- a/lib/views/advertisement/ads_filter_view.dart +++ b/lib/views/advertisement/ads_filter_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/general_models/widgets_models.dart'; import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/view_models/ad_view_model.dart'; @@ -11,6 +12,7 @@ import 'package:mc_common_app/widgets/common_widgets/search_entity_widget.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'; +import 'package:easy_localization/easy_localization.dart'; class AdsFilterView extends StatelessWidget { const AdsFilterView({super.key}); @@ -19,7 +21,7 @@ class AdsFilterView extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: CustomAppBar( - title: "Ads Filter", + title: LocaleKeys.adsFilter.tr(), profileImageUrl: MyAssets.bnCar, isRemoveBackButton: false, isDrawerEnabled: false, @@ -41,7 +43,7 @@ class AdsFilterView extends StatelessWidget { children: [ 20.height, SearchEntityWidget( - title: "Search By City", + title: LocaleKeys.searchByCity.tr(), actionWidget: Builder(builder: (context) { List vehicleBrandsDrop = []; for (var element in adVM.vehicleCities) { @@ -51,7 +53,7 @@ class AdsFilterView extends StatelessWidget { (DropValue value) => adVM.updateSelectionVehicleCityId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true), list: vehicleBrandsDrop, dropdownValue: adVM.vehicleCityId.selectedId != -1 ? DropValue(adVM.vehicleCityId.selectedId, adVM.vehicleCityId.selectedOption, "") : null, - hint: "Select City", + hint: LocaleKeys.selectCity.tr(), errorValue: adVM.vehicleCityId.errorValue, ); }), @@ -61,7 +63,7 @@ class AdsFilterView extends StatelessWidget { ), const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7), SearchEntityWidget( - title: "Search By Brand Name", + title: LocaleKeys.searchByBrandName.tr(), actionWidget: Builder(builder: (context) { List vehicleBrandsDrop = []; for (var element in adVM.vehicleBrands) { @@ -71,7 +73,7 @@ class AdsFilterView extends StatelessWidget { (DropValue value) => adVM.updateSelectionVehicleBrandId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true), list: vehicleBrandsDrop, dropdownValue: adVM.vehicleBrandId.selectedId != -1 ? DropValue(adVM.vehicleBrandId.selectedId, adVM.vehicleBrandId.selectedOption, "") : null, - hint: "Select Vehicle Brand", + hint: LocaleKeys.selectVehicleBrand.tr(), errorValue: adVM.vehicleBrandId.errorValue, ); }), @@ -81,7 +83,7 @@ class AdsFilterView extends StatelessWidget { ), const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7), SearchEntityWidget( - title: "Search By Vehicle Year", + title: LocaleKeys.searchByVehicleYear.tr(), actionWidget: Builder(builder: (context) { List vehicleBrandsDrop = []; for (var element in adVM.vehicleModelYears) { @@ -91,7 +93,7 @@ class AdsFilterView extends StatelessWidget { (DropValue value) => adVM.updateSelectionVehicleModelYearId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true), list: vehicleBrandsDrop, dropdownValue: adVM.vehicleModelYearId.selectedId != -1 ? DropValue(adVM.vehicleModelYearId.selectedId, adVM.vehicleModelYearId.selectedOption, "") : null, - hint: "Select Year", + hint: LocaleKeys.selectYear.tr(), errorValue: adVM.vehicleModelYearId.errorValue, ); }), @@ -101,7 +103,7 @@ class AdsFilterView extends StatelessWidget { ), const Divider(thickness: 1.2).paddingOnly(top: 7, bottom: 7), SearchEntityWidget( - title: "Search By Ad Owner", + title: LocaleKeys.searchByAdOwner.tr(), actionWidget: Builder(builder: (context) { List vehicleOwnerDrop = []; for (var element in adVM.exploreAdsEnums) { @@ -111,7 +113,7 @@ class AdsFilterView extends StatelessWidget { (DropValue value) => adVM.updateSelectionVehicleAdOwnerId(SelectionModel(selectedId: value.id, selectedOption: value.value), isForSearch: true), list: vehicleOwnerDrop, dropdownValue: adVM.vehicleOwnerId.selectedId != -1 ? DropValue(adVM.vehicleOwnerId.selectedId, adVM.vehicleOwnerId.selectedOption, "") : null, - hint: "Select Owner", + hint: LocaleKeys.selectOwner.tr(), errorValue: adVM.vehicleOwnerId.errorValue, ); }), @@ -131,7 +133,7 @@ class AdsFilterView extends StatelessWidget { Expanded( child: ShowFillButton( maxHeight: 55, - title: "Search", + title: LocaleKeys.search.tr(), onPressed: () {}, backgroundColor: MyColors.darkPrimaryColor, txtColor: MyColors.white, @@ -143,7 +145,7 @@ class AdsFilterView extends StatelessWidget { 8.height, InkWell( onTap: () => adVM.clearAdsFilters(), - child: "Clear Filters".toText( + child: LocaleKeys.clearFilters.tr().toText( fontSize: 14, isBold: true, color: MyColors.darkPrimaryColor, diff --git a/lib/views/advertisement/ads_list.dart b/lib/views/advertisement/ads_list.dart index fcc35ec..80ec639 100644 --- a/lib/views/advertisement/ads_list.dart +++ b/lib/views/advertisement/ads_list.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/models/advertisment_models/ad_details_model.dart'; import 'package:mc_common_app/theme/colors.dart'; import 'package:mc_common_app/utils/navigator.dart'; @@ -10,6 +11,8 @@ import 'package:mc_common_app/utils/utils.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 BuildAdsList extends StatelessWidget { final List adsList; @@ -31,7 +34,7 @@ class BuildAdsList extends StatelessWidget { return Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - "No Ads to show.".toText(fontSize: 16, color: MyColors.lightTextColor), + LocaleKeys.noAdsShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor), ], ); } @@ -101,7 +104,7 @@ class AdCard extends StatelessWidget { (adDetails.vehicle!.vehicleTitle ?? "").toText(fontSize: 16, isBold: true), Row( children: [ - "Model:".toText( + (LocaleKeys.model.tr() + ":").toText( color: MyColors.lightTextColor, ), 2.width, @@ -110,7 +113,7 @@ class AdCard extends StatelessWidget { ), Row( children: [ - "Mileage:".toText( + (LocaleKeys.mileage.tr() + ":").toText( color: MyColors.lightTextColor, ), 2.width, @@ -146,7 +149,7 @@ class AdCard extends StatelessWidget { children: [ (adDetails.vehicle!.demandAmount!.toInt().toString()).toText(fontSize: 16, isBold: true), 2.width, - "SAR".toText( + LocaleKeys.sar.tr().toText( color: MyColors.lightTextColor, ), ], diff --git a/lib/views/advertisement/bottom_sheet_content.dart b/lib/views/advertisement/bottom_sheet_content.dart index 1b7a5b9..bf20cd6 100644 --- a/lib/views/advertisement/bottom_sheet_content.dart +++ b/lib/views/advertisement/bottom_sheet_content.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.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/advertisment_models/vehicle_details_models.dart'; import 'package:mc_common_app/models/general_models/widgets_models.dart'; import 'package:mc_common_app/theme/colors.dart'; @@ -12,6 +13,8 @@ import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:mc_common_app/widgets/txt_field.dart'; 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); @@ -40,7 +43,7 @@ class _BottomSheetListContentState extends State { Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - "Damage Part List".toText(fontSize: 24, isBold: true), + LocaleKeys.damagePartList.tr().toText(fontSize: 24, isBold: true), ], ), 8.height,