fix issues with changing lang

fatima_dev
Fatimah.Alshammari 2 weeks ago
parent 01be7d9428
commit 3a75781abb

@ -922,6 +922,6 @@
"downgrade": "تخفيض الباقة",
"current": "الحالية",
"adActiveDuration": "سيبقى إعلانك نشطًا لمدة {} يومًا، وبعد ذلك ستحتاج إلى تمديده ليبقى نشطًا.",
"discountOff": "خصم {}٪"
"discountOff": "خصم {} ٪"
}

@ -613,7 +613,7 @@ class CodegenLoader extends AssetLoader{
"requestAlreadyInProgress": "هذا الطلب قيد التقدم بالفعل.",
"acceptOfferConfirmation": "هل تريد قبول هذا العرض؟",
"acceptOfferConfirmationMessage": "سيتم قبول هذا العرض وستدفع المبلغ المطلوب للمشتري في وقت معين وإلا سيتم إلغاء هذا العرض.",
"noUpcomingAppointments": "لا مواعيد قادم..",
"noUpcomingAppointments": "لا توجد مواعيد قادمه..",
"addNewAppointment": "إضافة موعد جديد",
"myNearbyBranches": "فروعي القريبة",
"myRecentBranches": "فروعي الأخيرة",
@ -931,7 +931,14 @@ class CodegenLoader extends AssetLoader{
"numberOfShipping": "عدد الشحنات",
"loading": "جار التحميل...",
"pleaseSelectAccidentFree": "يرجى تحديد ما إذا كانت المركبة خالية من الحوادث",
"pleaseSelectMileageIncrease": "يرجى تحديد ما إذا كان يمكن زيادة المسافة المقطوعة"
"pleaseSelectMileageIncrease": "يرجى تحديد ما إذا كان يمكن زيادة المسافة المقطوعة",
"formatNeedsUpdate": "تنسيق الاعلان يحتاج الى تحديث",
"noAdsMatchesYourSearch": "لا توجد اعلانات تطابق بحثك",
"upgrade": "ترقية",
"downgrade": "تخفيض الباقة",
"current": "الحالية",
"adActiveDuration": "سيبقى إعلانك نشطًا لمدة {} يومًا، وبعد ذلك ستحتاج إلى تمديده ليبقى نشطًا.",
"discountOff": "خصم {} ٪"
};
static const Map<String,dynamic> _en_US = {
"firstTimeLogIn": "First Time Log In",
@ -1848,7 +1855,14 @@ static const Map<String,dynamic> _en_US = {
"androidApp": "Android",
"iosApp": "iOS",
"pleaseWait": "Please wait...",
"numberOfShipping": "Number of Shipping"
"numberOfShipping": "Number of Shipping",
"formatNeedsUpdate": "Ad format needs to be updated.",
"noAdsMatchesYourSearch": "No Ads that matches your search",
"upgrade": "Upgrade",
"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"
};
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": _ar_SA, "en_US": _en_US};
}

@ -899,10 +899,10 @@ abstract class LocaleKeys {
static const pleaseSelectMileageIncrease = 'pleaseSelectMileageIncrease';
static const formatNeedsUpdate = 'formatNeedsUpdate';
static const noAdsMatchesYourSearch = 'noAdsMatchesYourSearch';
static const upgrade = "upgrade";
static const downgrade = "downgrade";
static const current = "current";
static const adActiveDuration = "adActiveDuration";
static const discountOff = "discountOff";
static const upgrade = 'upgrade';
static const downgrade = 'downgrade';
static const current = 'current';
static const adActiveDuration = 'adActiveDuration';
static const discountOff = 'discountOff';
}

@ -989,3 +989,4 @@ class ServiceVM extends BaseVM {
}
}
}

@ -81,20 +81,32 @@ class AppointmentServicePickBottomSheet extends StatelessWidget {
// ? DropValue(appointmentsVM.branchSelectedCategoryId.selectedId, appointmentsVM.branchSelectedCategoryId.selectedOption, "")
// : null,
// );
return DropdownField((DropValue value) => appointmentsVM.updateProviderCategoryId(
return DropdownField(
(DropValue value) => appointmentsVM.updateProviderCategoryId(
SelectionModel(
selectedId: value.id,
selectedOption: value.value,
itemPrice: value.subValue,
selectedOption: isArabic
? (value.subValue ?? value.value)
: value.value,
),
),
list: appointmentsVM.branchCategories,
hint: LocaleKeys.selectCategory.tr(),
dropdownValue: appointmentsVM.branchSelectedCategoryId.selectedId != -1
dropdownValue:
appointmentsVM.branchSelectedCategoryId.selectedId != -1 &&
appointmentsVM.branchCategories.any(
(item) =>
item.id ==
appointmentsVM.branchSelectedCategoryId.selectedId,
)
? appointmentsVM.branchCategories.firstWhere(
(item) => item.id == appointmentsVM.branchSelectedCategoryId.selectedId,)
(item) =>
item.id ==
appointmentsVM.branchSelectedCategoryId.selectedId,
)
: null,
isArabic: isArabic,
useSubValueForArabic: true,
);
},
),

@ -69,14 +69,29 @@ class CreateRequestPage extends StatelessWidget {
Builder(builder: (context) {
List<DropValue> requestTypeDrop = [];
for (var element in requestsVM.myRequestsTypeEnum) {
requestTypeDrop.add(DropValue(element.enumValue.toInt() ?? 0, element.enumValueStr ?? "", ""));
requestTypeDrop.add(DropValue(element.enumValue.toInt() ?? 0, element.enumValueStr ?? "", "",
valueN: element.enumValueStrN));
}
print("languge====== ${context.locale.languageCode}");
return DropdownField(
(DropValue value) => requestsVM.updateSelectionRequestTypeId(SelectionModel(selectedId: value.id, selectedOption: value.value)),
(DropValue value
) {
print(
"========== REQUEST TYPE SELECTED ==========");
print("id: ${value.id}");
print("value: ${value.value}");
print("valueN: ${value.valueN}");
print("subValue: ${value.subValue}");
requestsVM.updateSelectionRequestTypeId(
SelectionModel(selectedId: value.id,
selectedOption: value.value));
},
list: requestTypeDrop,
dropdownValue: requestsVM.requestTypeId.selectedId != -1 ? DropValue(requestsVM.requestTypeId.selectedId, requestsVM.requestTypeId.selectedOption, "") : null,
hint: LocaleKeys.requestType.tr(),
errorValue: requestsVM.requestTypeId.errorValue,
isArabic: context.locale.languageCode == "ar",
useValueNForArabic: true,
);
}),
],

@ -35,11 +35,13 @@ class DropdownField extends StatefulWidget {
final TextStyle? textStyle;
final bool isSelectAble;
final bool isArabic;
final bool useSubValueForArabic;
final bool useValueNForArabic;
const DropdownField(this.onSelect,
{super.key, this.hint, this.list, this.dropdownValue, this.onTap, this.errorValue = "", this.showAppointmentPickerVariant = false, this.textStyle, this.isSelectAble = true,
this.isArabic = false});
this.isArabic = false , this.useSubValueForArabic = false, this.useValueNForArabic = false});
@override
State<DropdownField> createState() => _DropdownFieldState();
@ -60,6 +62,11 @@ class _DropdownFieldState extends State<DropdownField> {
@override
Widget build(BuildContext context) {
dropdownValue = widget.dropdownValue;
print("========== DROPDOWN VALUE ==========");
print("IsArabic: ${widget.isSelectAble}");
print("listll: ${widget.list?.length}");
print("list: ${widget.list}");
return Column(
children: [
// Always show hint as label when provided
@ -126,7 +133,18 @@ class _DropdownFieldState extends State<DropdownField> {
return DropdownMenuItem<DropValue>(
value: value,
enabled: value.isEnabled ?? true,
child: value.value.toText(fontSize: 15, color: value.isEnabled == false ? MyColors.darkTextColor : null, fontWeight: MyFonts.Medium),
// child: value.value.toText(fontSize: 15, color: value.isEnabled == false ? MyColors.darkTextColor : null, fontWeight: MyFonts.Medium),
child: (widget.isArabic && widget.useValueNForArabic
? (value.valueN ?? value.value)
: widget.isArabic && widget.useSubValueForArabic
? value.subValue
: value.value)
.toText(
fontSize: 15,
color: value.isEnabled == false
? MyColors.darkTextColor
: null,
),
);
},
).toList(),

Loading…
Cancel
Save