BASE: Switch From EasyLocalization To GetX Localization.

This commit is contained in:
2025-12-04 16:56:39 +05:00
parent 157545f1c0
commit bf1d07a048
218 changed files with 2535 additions and 2313 deletions

View File

@@ -34,12 +34,12 @@ import 'package:customer/payment/xenditScreen.dart';
import 'package:customer/service/fire_store_utils.dart';
import 'package:customer/themes/show_toast_dialog.dart';
import 'package:customer/utils/preferences.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:flutter_paypal/flutter_paypal.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:get/get.dart' hide Trans;
import 'package:get/get.dart';
import 'package:http/http.dart' as http;
import 'package:intl/intl.dart';
import 'package:razorpay_flutter/razorpay_flutter.dart';
@@ -139,13 +139,13 @@ class MyCabBookingController extends GetxController {
String getLocalizedTabTitle(String tabKey) {
switch (tabKey) {
case "New":
return "New".tr();
return "New".tr;
case "On Going":
return "On Going".tr();
return "On Going".tr;
case "Completed":
return "Completed".tr();
return "Completed".tr;
case "Cancelled":
return "Cancelled".tr();
return "Cancelled".tr;
default:
return tabKey;
}
@@ -219,7 +219,7 @@ class MyCabBookingController extends GetxController {
if (selectedPaymentMethod.value == PaymentGateway.cod.name) {
selectedOrder.value.paymentMethod = selectedPaymentMethod.value;
await FireStoreUtils.cabOrderPlace(selectedOrder.value).then((value) {
ShowToastDialog.showToast("Payment method changed".tr());
ShowToastDialog.showToast("Payment method changed".tr);
Get.back();
});
} else {
@@ -237,8 +237,8 @@ class MyCabBookingController extends GetxController {
userId: FireStoreUtils.getCurrentUid(),
isTopup: false,
orderId: selectedOrder.value.id,
note: "Cab Amount debited".tr(),
paymentStatus: "success".tr(),
note: "Cab Amount debited".tr,
paymentStatus: "success".tr,
serviceType: Constant.parcelServiceType,
);
@@ -253,7 +253,7 @@ class MyCabBookingController extends GetxController {
}
selectedOrder.value.paymentStatus = true;
await FireStoreUtils.cabOrderPlace(selectedOrder.value).then((value) {
ShowToastDialog.showToast("Payment successfully".tr());
ShowToastDialog.showToast("Payment successfully".tr);
Get.back();
});
}
@@ -348,7 +348,7 @@ class MyCabBookingController extends GetxController {
if (paymentIntentData!.containsKey("error")) {
Get.back();
ShowToastDialog.showToast(
"Something went wrong, please contact admin.".tr(),
"Something went wrong, please contact admin.".tr,
);
} else {
await Stripe.instance.initPaymentSheet(
@@ -381,7 +381,7 @@ class MyCabBookingController extends GetxController {
Future<void> displayStripePaymentSheet({required String amount}) async {
try {
await Stripe.instance.presentPaymentSheet().then((value) {
ShowToastDialog.showToast("Payment successfully".tr());
ShowToastDialog.showToast("Payment successfully".tr);
completeOrder();
});
} on StripeException catch (e) {
@@ -464,10 +464,10 @@ class MyCabBookingController extends GetxController {
final data = jsonDecode(response.body);
Get.to(MercadoPagoScreen(initialURl: data['init_point']))!.then((value) {
if (value) {
ShowToastDialog.showToast("Payment Successful!!".tr());
ShowToastDialog.showToast("Payment Successful!!".tr);
completeOrder();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
}
});
} else {
@@ -499,15 +499,15 @@ class MyCabBookingController extends GetxController {
note: "Contact us for any questions on your order.",
onSuccess: (Map params) async {
completeOrder();
ShowToastDialog.showToast("Payment Successful!!".tr());
ShowToastDialog.showToast("Payment Successful!!".tr);
},
onError: (error) {
Get.back();
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
},
onCancel: (params) {
Get.back();
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
},
),
),
@@ -534,15 +534,15 @@ class MyCabBookingController extends GetxController {
),
)!.then((value) {
if (value) {
ShowToastDialog.showToast("Payment Successful!!".tr());
ShowToastDialog.showToast("Payment Successful!!".tr);
completeOrder();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
}
});
} else {
ShowToastDialog.showToast(
"Something went wrong, please contact admin.".tr(),
"Something went wrong, please contact admin.".tr,
);
}
});
@@ -585,10 +585,10 @@ class MyCabBookingController extends GetxController {
value,
) {
if (value) {
ShowToastDialog.showToast("Payment Successful!!".tr());
ShowToastDialog.showToast("Payment Successful!!".tr);
completeOrder();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
}
});
} else {
@@ -622,11 +622,11 @@ class MyCabBookingController extends GetxController {
);
if (isDone) {
Get.back();
ShowToastDialog.showToast("Payment successfully".tr());
ShowToastDialog.showToast("Payment successfully".tr);
completeOrder();
} else {
Get.back();
ShowToastDialog.showToast("Payment Failed".tr());
ShowToastDialog.showToast("Payment Failed".tr);
}
});
}
@@ -754,7 +754,7 @@ class MyCabBookingController extends GetxController {
data["body"]["txnToken"].toString().isEmpty) {
Get.back();
ShowToastDialog.showToast(
"something went wrong, please contact admin.".tr(),
"something went wrong, please contact admin.".tr,
);
}
return GetPaymentTxtTokenModel.fromJson(data);
@@ -791,18 +791,18 @@ class MyCabBookingController extends GetxController {
void handlePaymentSuccess(PaymentSuccessResponse response) {
Get.back();
ShowToastDialog.showToast("Payment Successful!!".tr());
ShowToastDialog.showToast("Payment Successful!!".tr);
completeOrder();
}
void handleExternalWaller(ExternalWalletResponse response) {
Get.back();
ShowToastDialog.showToast("Payment Processing!! via".tr());
ShowToastDialog.showToast("Payment Processing!! via".tr);
}
void handlePaymentError(PaymentFailureResponse response) {
Get.back();
ShowToastDialog.showToast("Payment Failed!!".tr());
ShowToastDialog.showToast("Payment Failed!!".tr);
}
bool isCurrentDateInRange(DateTime startDate, DateTime endDate) {
@@ -820,10 +820,10 @@ class MyCabBookingController extends GetxController {
if (url != '') {
Get.to(() => MidtransScreen(initialURl: url))!.then((value) {
if (value == true) {
ShowToastDialog.showToast("Payment Successful!!".tr());
ShowToastDialog.showToast("Payment Successful!!".tr);
completeOrder();
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
}
});
}
@@ -864,7 +864,7 @@ class MyCabBookingController extends GetxController {
return responseData['payment_url'];
} else {
ShowToastDialog.showToast(
"something went wrong, please contact admin.".tr(),
"something went wrong, please contact admin.".tr,
);
return '';
}
@@ -907,13 +907,13 @@ class MyCabBookingController extends GetxController {
),
)!.then((value) {
if (value == true) {
ShowToastDialog.showToast("Payment Successful!!".tr());
ShowToastDialog.showToast("Payment Successful!!".tr);
completeOrder();
();
}
});
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
}
}
@@ -951,7 +951,7 @@ class MyCabBookingController extends GetxController {
);
} else {
ShowToastDialog.showToast(
"Something went wrong, please contact admin.".tr(),
"Something went wrong, please contact admin.".tr,
);
return '';
}
@@ -1002,7 +1002,7 @@ class MyCabBookingController extends GetxController {
}
} else {
ShowToastDialog.showToast(
"Something went wrong, please contact admin.".tr(),
"Something went wrong, please contact admin.".tr,
);
return '';
}
@@ -1028,11 +1028,11 @@ class MyCabBookingController extends GetxController {
),
)!.then((value) {
if (value == true) {
ShowToastDialog.showToast("Payment Successful!!".tr());
ShowToastDialog.showToast("Payment Successful!!".tr);
completeOrder();
();
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
}
});
}