BASE: Initialize Localization.
This commit is contained in:
@@ -40,6 +40,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:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart' as flutterMap;
|
||||
import 'package:flutter_paypal/flutter_paypal.dart';
|
||||
@@ -304,20 +305,20 @@ class CabBookingController extends GetxController {
|
||||
Marker(
|
||||
markerId: const MarkerId("pickup"),
|
||||
position: LatLng(pickupLat, pickupLng),
|
||||
infoWindow: InfoWindow(title: "Pickup Location".tr),
|
||||
infoWindow: InfoWindow(title: "Pickup Location".tr()),
|
||||
icon: departureIcon ?? BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen),
|
||||
),
|
||||
Marker(markerId: const MarkerId("driver"), position: LatLng(driverLat, driverLng), infoWindow: InfoWindow(title: "Driver at Pickup".tr), icon: taxiIcon ?? BitmapDescriptor.defaultMarker),
|
||||
Marker(markerId: const MarkerId("driver"), position: LatLng(driverLat, driverLng), infoWindow: InfoWindow(title: "Driver at Pickup".tr()), icon: taxiIcon ?? BitmapDescriptor.defaultMarker),
|
||||
]);
|
||||
} else if (order.status == Constant.orderInTransit) {
|
||||
markers.addAll([
|
||||
Marker(
|
||||
markerId: const MarkerId("destination"),
|
||||
position: LatLng(destLat, destLng),
|
||||
infoWindow: InfoWindow(title: "Destination Location".tr),
|
||||
infoWindow: InfoWindow(title: "Destination Location".tr()),
|
||||
icon: destinationIcon ?? BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueRed),
|
||||
),
|
||||
Marker(markerId: const MarkerId("driver"), position: LatLng(driverLat, driverLng), infoWindow: InfoWindow(title: "Driver Location".tr), icon: taxiIcon ?? BitmapDescriptor.defaultMarker),
|
||||
Marker(markerId: const MarkerId("driver"), position: LatLng(driverLat, driverLng), infoWindow: InfoWindow(title: "Driver Location".tr()), icon: taxiIcon ?? BitmapDescriptor.defaultMarker),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -403,7 +404,7 @@ class CabBookingController extends GetxController {
|
||||
if (selectedPaymentMethod.value == PaymentGateway.cod.name) {
|
||||
currentOrder.value.paymentMethod = selectedPaymentMethod.value;
|
||||
await FireStoreUtils.cabOrderPlace(currentOrder.value).then((value) {
|
||||
ShowToastDialog.showToast("Payment method changed".tr);
|
||||
ShowToastDialog.showToast("Payment method changed".tr());
|
||||
Get.back();
|
||||
Get.back();
|
||||
});
|
||||
@@ -437,7 +438,7 @@ class CabBookingController extends GetxController {
|
||||
}
|
||||
|
||||
await FireStoreUtils.cabOrderPlace(currentOrder.value).then((value) {
|
||||
ShowToastDialog.showToast("Payment successfully".tr);
|
||||
ShowToastDialog.showToast("Payment successfully".tr());
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
@@ -539,7 +540,7 @@ class CabBookingController extends GetxController {
|
||||
final markerId = MarkerId('Stop $index');
|
||||
|
||||
markers.removeWhere((marker) => marker.markerId == markerId);
|
||||
markers.add(Marker(markerId: markerId, infoWindow: InfoWindow(title: '${'Stop'.tr} ${String.fromCharCode(index + 65)}'), position: LatLng(lat, lng), icon: stopIcon!));
|
||||
markers.add(Marker(markerId: markerId, infoWindow: InfoWindow(title: '${'Stop'.tr()} ${String.fromCharCode(index + 65)}'), position: LatLng(lat, lng), icon: stopIcon!));
|
||||
|
||||
getDirections();
|
||||
}
|
||||
@@ -563,7 +564,7 @@ class CabBookingController extends GetxController {
|
||||
final LatLng pos = LatLng(lat, lng);
|
||||
final markerId = MarkerId(isDeparture ? 'Departure' : 'Destination');
|
||||
final icon = isDeparture ? departureIcon! : destinationIcon!;
|
||||
final title = isDeparture ? 'Departure'.tr : 'Destination'.tr;
|
||||
final title = isDeparture ? 'Departure'.tr() : 'Destination'.tr();
|
||||
|
||||
if (isDeparture) {
|
||||
departureLatLong.value = pos;
|
||||
@@ -1022,7 +1023,7 @@ class CabBookingController 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(
|
||||
@@ -1046,7 +1047,7 @@ class CabBookingController 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) {
|
||||
@@ -1112,10 +1113,10 @@ class CabBookingController 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 {
|
||||
@@ -1147,15 +1148,15 @@ class CabBookingController 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());
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -1179,14 +1180,14 @@ class CabBookingController 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());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1216,10 +1217,10 @@ class CabBookingController 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 {
|
||||
@@ -1247,11 +1248,11 @@ class CabBookingController 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());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1356,7 +1357,7 @@ class CabBookingController 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);
|
||||
}
|
||||
@@ -1389,18 +1390,18 @@ class CabBookingController 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) {
|
||||
@@ -1415,10 +1416,10 @@ class CabBookingController 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());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1443,7 +1444,7 @@ class CabBookingController 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 '';
|
||||
}
|
||||
}
|
||||
@@ -1468,13 +1469,13 @@ class CabBookingController extends GetxController {
|
||||
if (paymentURL.toString() != '') {
|
||||
Get.to(() => OrangeMoneyScreen(initialURl: paymentURL, accessToken: accessToken, amount: amount, orangePay: orangeMoneyModel.value, orderId: orderId, payToken: payToken))!.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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1497,7 +1498,7 @@ class CabBookingController 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 '';
|
||||
}
|
||||
}
|
||||
@@ -1534,7 +1535,7 @@ class CabBookingController extends GetxController {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -1553,11 +1554,11 @@ class CabBookingController extends GetxController {
|
||||
if (model.id != null) {
|
||||
Get.to(() => 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