BASE: Switch From EasyLocalization To GetX Localization.
This commit is contained in:
@@ -5,11 +5,11 @@ import 'dart:math' as maths;
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:customer/models/coupon_model.dart';
|
||||
import 'package:customer/models/wallet_transaction_model.dart';
|
||||
import 'package:easy_localization/easy_localization.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:image_picker/image_picker.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
@@ -136,7 +136,7 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> placeOrder() async {
|
||||
ShowToastDialog.showLoader("Please wait...".tr());
|
||||
ShowToastDialog.showLoader("Please wait...".tr);
|
||||
|
||||
try {
|
||||
List<String> parcelImages = [];
|
||||
@@ -207,7 +207,7 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
value,
|
||||
) async {
|
||||
ShowToastDialog.closeLoader();
|
||||
ShowToastDialog.showToast("Order placed successfully".tr());
|
||||
ShowToastDialog.showToast("Order placed successfully".tr);
|
||||
Get.offAll(
|
||||
() => OrderSuccessfullyPlaced(),
|
||||
arguments: {'parcelOrder': parcelOrder.value},
|
||||
@@ -216,7 +216,7 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
});
|
||||
} catch (e) {
|
||||
ShowToastDialog.closeLoader();
|
||||
ShowToastDialog.showToast("Something went wrong. Please try again.".tr());
|
||||
ShowToastDialog.showToast("Something went wrong. Please try again.".tr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ class ParcelOrderConfirmationController 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(
|
||||
@@ -357,7 +357,7 @@ class ParcelOrderConfirmationController 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) {
|
||||
@@ -440,10 +440,10 @@ class ParcelOrderConfirmationController 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 {
|
||||
@@ -480,17 +480,17 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
onSuccess: (Map params) async {
|
||||
debugPrint("✅ PayPal Payment Success: $params");
|
||||
placeOrder();
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
},
|
||||
onError: (error) {
|
||||
debugPrint("❌ PayPal Payment Error: $error");
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
|
||||
},
|
||||
onCancel: (params) {
|
||||
debugPrint("⚠️ PayPal Payment Canceled: $params");
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -521,15 +521,15 @@ class ParcelOrderConfirmationController 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);
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
@@ -559,15 +559,15 @@ class ParcelOrderConfirmationController 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(),
|
||||
"Something went wrong, please contact admin.".tr,
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -614,10 +614,10 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
bool isVerified = await verifyFlutterWavePayment(_ref!);
|
||||
|
||||
if (isVerified) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
placeOrder();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
|
||||
Get.back();
|
||||
}
|
||||
});
|
||||
@@ -676,11 +676,11 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
);
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -833,7 +833,7 @@ class ParcelOrderConfirmationController 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,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -866,7 +866,7 @@ class ParcelOrderConfirmationController 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);
|
||||
// }
|
||||
@@ -902,18 +902,18 @@ class ParcelOrderConfirmationController 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);
|
||||
}
|
||||
|
||||
bool isCurrentDateInRange(DateTime startDate, DateTime endDate) {
|
||||
@@ -931,10 +931,10 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
if (url != '') {
|
||||
Get.to(() => MidtransScreen(initialURl: url))!.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);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -975,7 +975,7 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
return responseData['payment_url'];
|
||||
} else {
|
||||
ShowToastDialog.showToast(
|
||||
"something went wrong, please contact admin.".tr(),
|
||||
"something went wrong, please contact admin.".tr,
|
||||
);
|
||||
return '';
|
||||
}
|
||||
@@ -1002,7 +1002,7 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
debugPrint('🟩 Starting OrangePay Payment...');
|
||||
debugPrint('💰 Amount: $amount | 🆔 Order ID: $id');
|
||||
|
||||
ShowToastDialog.showLoader("Initializing payment...".tr());
|
||||
ShowToastDialog.showLoader("Initializing payment...".tr);
|
||||
|
||||
var paymentURL = await fetchToken(
|
||||
context: context,
|
||||
@@ -1027,20 +1027,20 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
),
|
||||
)?.then((value) async {
|
||||
if (value == true) {
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr());
|
||||
ShowToastDialog.showToast("Payment Successful!!".tr);
|
||||
debugPrint('🎉 Payment Successful for Order ID: $orderId');
|
||||
|
||||
if (Get.isBottomSheetOpen ?? false) Get.back();
|
||||
await placeOrder();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
|
||||
debugPrint('⚠️ Payment flow closed without success.');
|
||||
|
||||
if (Get.isBottomSheetOpen ?? false) Get.back();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
|
||||
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
|
||||
if (Get.isBottomSheetOpen ?? false) Get.back();
|
||||
}
|
||||
}
|
||||
@@ -1086,7 +1086,7 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
} else {
|
||||
debugPrint('❌ Failed to fetch access token.');
|
||||
ShowToastDialog.showToast(
|
||||
"Something went wrong, please contact admin.".tr(),
|
||||
"Something went wrong, please contact admin.".tr,
|
||||
);
|
||||
return '';
|
||||
}
|
||||
@@ -1152,7 +1152,7 @@ class ParcelOrderConfirmationController extends GetxController {
|
||||
} else {
|
||||
debugPrint('❌ Payment request failed.');
|
||||
ShowToastDialog.showToast(
|
||||
"Something went wrong, please contact admin.".tr(),
|
||||
"Something went wrong, please contact admin.".tr,
|
||||
);
|
||||
return '';
|
||||
}
|
||||
@@ -1179,11 +1179,11 @@ class ParcelOrderConfirmationController 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user