From 560c7a35d08acad827e4ec4abbd82dbafaf73bda Mon Sep 17 00:00:00 2001 From: "Fatimah.Alshammari" Date: Tue, 22 Sep 2026 12:58:13 +0300 Subject: [PATCH] fix issues with changing lang --- assets/langs/ar-SA.json | 13 +++- assets/langs/en-US.json | 16 ++++- lib/extensions/string_extensions.dart | 71 +++++++++++++------ lib/generated/codegen_loader.g.dart | 26 ++++++- lib/generated/locale_keys.g.dart | 11 +++ lib/view_models/service_view_model.dart | 7 +- .../common_appointment_slider_widget.dart | 2 +- lib/widgets/common_widgets/filters_list.dart | 4 ++ 8 files changed, 121 insertions(+), 29 deletions(-) diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index db46675..6acd74e 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -922,6 +922,17 @@ "downgrade": "تخفيض الباقة", "current": "الحالية", "adActiveDuration": "سيبقى إعلانك نشطًا لمدة {} يومًا، وبعد ذلك ستحتاج إلى تمديده ليبقى نشطًا.", - "discountOff": "خصم {} ٪" + "discountOff": "خصم {} ٪", + "booked": "محجوز", + "confirmed": "مؤكد", + "rescheduled": "تمت إعادة الجدولة", + "upcoming": "قادم", + "workStarted": "بدأ العمل", + "past": "سابق", + "today": "اليوم", + "noAppointmentsMatchSearch": "لا توجد مواعيد تطابق بحثك", + "appts": "مواعيد", + "approvalPending": "بانتظار الموافقة", + "activateNow": "تفعيل الآن" } \ No newline at end of file diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index 592d394..94feba2 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -920,6 +920,20 @@ "downgrade": "Downgrade", "current": "Current", "adActiveDuration": "Your Ad will be active for {} Days and then you will need to extend it to keep it active.", - "discountOff": "{} % OFF" + "discountOff": "{} % OFF", + "booked": "Booked", + "confirmed": "Confirmed", + "rescheduled": "Rescheduled", + "upcoming": "Upcoming", + "workStarted": "Work Started", + "past": "Past", + "today": "Today", + "noAppointmentsMatchSearch": "No appointments that match your search", + "appts": "appts", + "approvalPending": "Approval Pending", + "activateNow": "Activate Now" + + + } \ No newline at end of file diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 09b6eec..3c5f9b7 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -361,41 +361,70 @@ extension AppointmentTypeEnumExtString on AppointmentTypeEnum { } } +// extension AppointmentStatusToString on AppointmentStatusEnum { +// String getAppointmentNameFromEnum() { +// switch (this) { +// case AppointmentStatusEnum.booked: +// return "Booked"; +// +// case AppointmentStatusEnum.confirmed: +// return "Confirmed"; +// +// case AppointmentStatusEnum.arrived: +// return "Arrived"; +// +// case AppointmentStatusEnum.cancelled: +// return "Canceled"; +// +// case AppointmentStatusEnum.rescheduled: +// return "Rescheduled"; +// +// case AppointmentStatusEnum.upcoming: +// return "Upcoming"; +// +// case AppointmentStatusEnum.workStarted: +// return "Work Started"; +// +// case AppointmentStatusEnum.visitCompleted: +// return "Visit Completed"; +// +// case AppointmentStatusEnum.past: +// return "Past"; +// +// case AppointmentStatusEnum.today: +// return "Today"; +// +// default: +// return "Booked"; +// } +// } +// } + extension AppointmentStatusToString on AppointmentStatusEnum { String getAppointmentNameFromEnum() { switch (this) { case AppointmentStatusEnum.booked: - return "Booked"; - + return LocaleKeys.booked.tr(); case AppointmentStatusEnum.confirmed: - return "Confirmed"; - + return LocaleKeys.confirmed.tr(); case AppointmentStatusEnum.arrived: - return "Arrived"; - + return LocaleKeys.arrived.tr(); case AppointmentStatusEnum.cancelled: - return "Canceled"; - + return LocaleKeys.canceled.tr(); case AppointmentStatusEnum.rescheduled: - return "Rescheduled"; - + return LocaleKeys.rescheduled.tr(); case AppointmentStatusEnum.upcoming: - return "Upcoming"; - + return LocaleKeys.upcoming.tr(); case AppointmentStatusEnum.workStarted: - return "Work Started"; - + return LocaleKeys.workStarted.tr(); case AppointmentStatusEnum.visitCompleted: - return "Visit Completed"; - + return LocaleKeys.visitCompleted.tr(); case AppointmentStatusEnum.past: - return "Past"; - + return LocaleKeys.past.tr(); case AppointmentStatusEnum.today: - return "Today"; - + return LocaleKeys.today.tr(); default: - return "Booked"; + return LocaleKeys.booked.tr(); } } } diff --git a/lib/generated/codegen_loader.g.dart b/lib/generated/codegen_loader.g.dart index e93ff85..a299a86 100644 --- a/lib/generated/codegen_loader.g.dart +++ b/lib/generated/codegen_loader.g.dart @@ -938,7 +938,18 @@ class CodegenLoader extends AssetLoader{ "downgrade": "تخفيض الباقة", "current": "الحالية", "adActiveDuration": "سيبقى إعلانك نشطًا لمدة {} يومًا، وبعد ذلك ستحتاج إلى تمديده ليبقى نشطًا.", - "discountOff": "خصم {} ٪" + "discountOff": "خصم {} ٪", + "booked": "محجوز", + "confirmed": "مؤكد", + "rescheduled": "تمت إعادة الجدولة", + "upcoming": "قادم", + "workStarted": "بدأ العمل", + "past": "سابق", + "today": "اليوم", + "noAppointmentsMatchSearch": "لا توجد مواعيد تطابق بحثك", + "appts": "مواعيد", + "approvalPending": "بانتظار الموافقة", + "activateNow": "تفعيل الآن" }; static const Map _en_US = { "firstTimeLogIn": "First Time Log In", @@ -1862,7 +1873,18 @@ static const Map _en_US = { "downgrade": "Downgrade", "current": "Current", "adActiveDuration": "Your Ad will be active for {} Days and then you will need to extend it to keep it active.", - "discountOff": "{} % OFF" + "discountOff": "{} % OFF", + "booked": "Booked", + "confirmed": "Confirmed", + "rescheduled": "Rescheduled", + "upcoming": "Upcoming", + "workStarted": "Work Started", + "past": "Past", + "today": "Today", + "noAppointmentsMatchSearch": "No appointments that match your search", + "appts": "appts", + "approvalPending": "Approval Pending", + "activateNow": "Activate Now" }; 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 b7239fe..47d88ac 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -904,5 +904,16 @@ abstract class LocaleKeys { static const current = 'current'; static const adActiveDuration = 'adActiveDuration'; static const discountOff = 'discountOff'; + static const booked = 'booked'; + static const confirmed = 'confirmed'; + static const rescheduled = 'rescheduled'; + static const upcoming = 'upcoming'; + static const workStarted = 'workStarted'; + static const past = 'past'; + static const today = 'today'; + static const noAppointmentsMatchSearch = 'noAppointmentsMatchSearch'; + static const appts = 'appts'; + static const approvalPending = 'approvalPending'; + static const activateNow = 'activateNow'; } diff --git a/lib/view_models/service_view_model.dart b/lib/view_models/service_view_model.dart index d482db3..67917f5 100644 --- a/lib/view_models/service_view_model.dart +++ b/lib/view_models/service_view_model.dart @@ -172,7 +172,7 @@ class ServiceVM extends BaseVM { CategoryData( id: element.categoryId, categoryName: element.categoryName, - categoryNameN: element.categoryName, + categoryNameN: element.categoryNameN, ), ); } @@ -197,10 +197,10 @@ class ServiceVM extends BaseVM { if (branchServiceEnums.isEmpty) { branchServiceEnums = await commonRepo.getEnumTypeValues(enumTypeID: AppEnums.branchServicesEnumId); } - branchServicesFilterOptions.clear(); for (int i = 0; i < branchServiceEnums.length; i++) { - branchServicesFilterOptions.add(FilterListModel(title: branchServiceEnums[i].enumValueStr, isSelected: false, id: branchServiceEnums[i].enumValue)); + branchServicesFilterOptions.add(FilterListModel(title: branchServiceEnums[i].enumValueStr, + titleN: branchServiceEnums[i].enumValueStrN,isSelected: false, id: branchServiceEnums[i].enumValue)); } } @@ -404,6 +404,7 @@ class ServiceVM extends BaseVM { Future getBranchAndServices() async { setState(ViewState.busy); branches = await branchRepo.getBranchAndServices(); + if (branches!.data == null) { homePageBranches = []; } else if (branches!.data!.serviceProviderBranch == null) { diff --git a/lib/views/appointments/widgets/common_appointment_slider_widget.dart b/lib/views/appointments/widgets/common_appointment_slider_widget.dart index 3ea047d..b064484 100644 --- a/lib/views/appointments/widgets/common_appointment_slider_widget.dart +++ b/lib/views/appointments/widgets/common_appointment_slider_widget.dart @@ -282,7 +282,7 @@ class AppointmentFragmentTileWidget extends StatelessWidget { if (appointmentListModel.appointmentServicesList!.length > 1) { servicesList.add( - showServices("+ ${appointmentListModel.appointmentServicesList!.length - 1} More", "", isMoreText: true), + showServices("+ ${appointmentListModel.appointmentServicesList!.length - 1} ${ LocaleKeys.more.tr()}", "", isMoreText: true), ); } return servicesList; diff --git a/lib/widgets/common_widgets/filters_list.dart b/lib/widgets/common_widgets/filters_list.dart index 1ecc653..9837134 100644 --- a/lib/widgets/common_widgets/filters_list.dart +++ b/lib/widgets/common_widgets/filters_list.dart @@ -38,6 +38,10 @@ class FiltersList extends StatelessWidget { itemCount: filterList.length, scrollDirection: Axis.horizontal, itemBuilder: (BuildContext context, int index) { + print("isArabic ===== $isArabic"); + print("title EN ===== ${filterList[index].title}"); + print("title AR ===== ${filterList[index].titleN}"); + print("--------------------"); return InkWell( onTap: () { onFilterTapped(index, filterList[index].id);