BASE: Initialize Localization.

This commit is contained in:
2025-12-03 18:21:19 +05:00
parent cf58d069ab
commit b04050384d
141 changed files with 1577 additions and 1419 deletions

View File

@@ -6,6 +6,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/constant/constant.dart';
import 'package:customer/models/gift_cards_model.dart';
import 'package:customer/themes/app_them_data.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_paypal/flutter_paypal.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:razorpay_flutter/razorpay_flutter.dart';
@@ -95,7 +96,7 @@ class GiftCardController extends GetxController {
if (double.parse(userModel.value.walletAmount.toString()) >= double.parse(amountController.value.text)) {
setOrder();
} else {
ShowToastDialog.showToast("You don't have sufficient wallet balance to purchase gift card".tr);
ShowToastDialog.showToast("You don't have sufficient wallet balance to purchase gift card".tr());
}
} else {
setOrder();
@@ -103,7 +104,7 @@ class GiftCardController extends GetxController {
}
Future<void> setOrder() async {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
GiftCardsOrderModel giftCardsOrderModel = GiftCardsOrderModel();
giftCardsOrderModel.id = const Uuid().v4();
giftCardsOrderModel.giftId = selectedGiftCard.value.id.toString();
@@ -129,8 +130,8 @@ class GiftCardController extends GetxController {
userId: FireStoreUtils.getCurrentUid(),
isTopup: false,
orderId: giftCardsOrderModel.id,
note: "Gift card purchase amount debited".tr,
paymentStatus: "success".tr);
note: "Gift card purchase amount debited".tr(),
paymentStatus: "success".tr());
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
if (value == true) {
@@ -141,7 +142,7 @@ class GiftCardController extends GetxController {
await FireStoreUtils.placeGiftCardOrder(giftCardsOrderModel);
ShowToastDialog.closeLoader();
Get.off(const HistoryGiftCard());
ShowToastDialog.showToast("Gift card Purchases successfully".tr);
ShowToastDialog.showToast("Gift card Purchases successfully".tr());
}
String generateGiftCode() {
@@ -328,7 +329,7 @@ class GiftCardController 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());
placeOrder();
});
} on StripeException catch (e) {
@@ -401,10 +402,10 @@ class GiftCardController 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());
placeOrder();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
}
});
} else {
@@ -429,14 +430,14 @@ class GiftCardController extends GetxController {
))!
.then((value) {
if (value) {
ShowToastDialog.showToast("Payment Successful!!".tr);
ShowToastDialog.showToast("Payment Successful!!".tr());
placeOrder();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
}
});
} else {
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
}
});
}
@@ -472,10 +473,10 @@ class GiftCardController extends GetxController {
final data = jsonDecode(response.body);
Get.to(MercadoPagoScreen(initialURl: data['data']['link']))!.then((value) {
if (value) {
ShowToastDialog.showToast("Payment Successful!!".tr);
ShowToastDialog.showToast("Payment Successful!!".tr());
placeOrder();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
}
});
} else {
@@ -503,11 +504,11 @@ class GiftCardController extends GetxController {
bool isDone = await Get.to(PayFastScreen(htmlData: value!, payFastSettingData: payFastModel.value));
if (isDone) {
Get.back();
ShowToastDialog.showToast("Payment successfully".tr);
ShowToastDialog.showToast("Payment successfully".tr());
placeOrder();
} else {
Get.back();
ShowToastDialog.showToast("Payment Failed".tr);
ShowToastDialog.showToast("Payment Failed".tr());
}
});
}
@@ -534,15 +535,15 @@ class GiftCardController extends GetxController {
note: "Contact us for any questions on your order.",
onSuccess: (Map params) async {
placeOrder();
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());
}),
),
);
@@ -654,7 +655,7 @@ class GiftCardController extends GetxController {
final data = jsonDecode(response.body);
if (data["body"]["txnToken"] == null || data["body"]["txnToken"].toString().isEmpty) {
Get.back();
ShowToastDialog.showToast("something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("something went wrong, please contact admin.".tr());
}
return GetPaymentTxtTokenModel.fromJson(data);
}
@@ -690,18 +691,18 @@ class GiftCardController extends GetxController {
void handlePaymentSuccess(PaymentSuccessResponse response) {
Get.back();
ShowToastDialog.showToast("Payment Successful!!".tr);
ShowToastDialog.showToast("Payment Successful!!".tr());
placeOrder();
}
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());
}
//Midtrans payment
@@ -714,10 +715,10 @@ class GiftCardController extends GetxController {
))!
.then((value) {
if (value == true) {
ShowToastDialog.showToast("Payment Successful!!".tr);
ShowToastDialog.showToast("Payment Successful!!".tr());
placeOrder();
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
}
});
}
@@ -749,7 +750,7 @@ class GiftCardController extends GetxController {
final responseData = jsonDecode(response.body);
return responseData['payment_url'];
} else {
ShowToastDialog.showToast("something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("something went wrong, please contact admin.".tr());
return '';
}
}
@@ -782,13 +783,13 @@ class GiftCardController extends GetxController {
))!
.then((value) {
if (value == true) {
ShowToastDialog.showToast("Payment Successful!!".tr);
ShowToastDialog.showToast("Payment Successful!!".tr());
placeOrder();
();
}
});
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
}
}
@@ -815,7 +816,7 @@ class GiftCardController extends GetxController {
// ignore: use_build_context_synchronously
return await webpayment(context: context, amountData: amount, currency: currency, orderIdData: orderId);
} else {
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
return '';
}
}
@@ -853,7 +854,7 @@ class GiftCardController extends GetxController {
return '';
}
} else {
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
return '';
}
}
@@ -877,11 +878,11 @@ class GiftCardController extends GetxController {
))!
.then((value) {
if (value == true) {
ShowToastDialog.showToast("Payment Successful!!".tr);
ShowToastDialog.showToast("Payment Successful!!".tr());
placeOrder();
();
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
}
});
}