BASE: Initialize Localization.
This commit is contained in:
@@ -34,6 +34,7 @@ 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';
|
||||
@@ -112,13 +113,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;
|
||||
}
|
||||
@@ -185,7 +186,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 {
|
||||
@@ -203,8 +204,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,
|
||||
);
|
||||
|
||||
@@ -214,7 +215,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();
|
||||
});
|
||||
}
|
||||
@@ -280,7 +281,7 @@ class MyCabBookingController extends GetxController {
|
||||
log("stripe Responce====>$paymentIntentData");
|
||||
if (paymentIntentData!.containsKey("error")) {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
} else {
|
||||
await Stripe.instance.initPaymentSheet(
|
||||
paymentSheetParameters: SetupPaymentSheetParameters(
|
||||
@@ -304,7 +305,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) {
|
||||
@@ -374,10 +375,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 {
|
||||
@@ -409,15 +410,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());
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -444,14 +445,14 @@ 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);
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -481,10 +482,10 @@ class MyCabBookingController 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());
|
||||
completeOrder();
|
||||
} else {
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
|
||||
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -514,11 +515,11 @@ class MyCabBookingController 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());
|
||||
completeOrder();
|
||||
} else {
|
||||
Get.back();
|
||||
ShowToastDialog.showToast("Payment Failed".tr);
|
||||
ShowToastDialog.showToast("Payment Failed".tr());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -635,7 +636,7 @@ class MyCabBookingController 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);
|
||||
}
|
||||
@@ -668,18 +669,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) {
|
||||
@@ -694,10 +695,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());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -728,7 +729,7 @@ class MyCabBookingController 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 '';
|
||||
}
|
||||
}
|
||||
@@ -762,13 +763,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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -795,7 +796,7 @@ class MyCabBookingController 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 '';
|
||||
}
|
||||
}
|
||||
@@ -840,7 +841,7 @@ class MyCabBookingController extends GetxController {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -861,11 +862,11 @@ class MyCabBookingController extends GetxController {
|
||||
() => XenditScreen(initialURl: model.invoiceUrl ?? '', transId: model.id ?? '', apiKey: xenditModel.value.apiKey!.toString()),
|
||||
)!.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());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user