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

@@ -42,6 +42,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';
@@ -313,20 +314,20 @@ class IntercityHomeController 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),
]);
}
}
@@ -412,7 +413,7 @@ class IntercityHomeController 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();
});
@@ -433,8 +434,8 @@ class IntercityHomeController extends GetxController {
userId: FireStoreUtils.getCurrentUid(),
isTopup: false,
orderId: currentOrder.value.id,
note: "Cab Amount debited".tr,
paymentStatus: "success".tr,
note: "Cab Amount debited".tr(),
paymentStatus: "success".tr(),
serviceType: Constant.parcelServiceType,
);
@@ -446,7 +447,7 @@ class IntercityHomeController extends GetxController {
}
await FireStoreUtils.cabOrderPlace(currentOrder.value).then((value) {
ShowToastDialog.showToast("Payment successfully".tr);
ShowToastDialog.showToast("Payment successfully".tr());
Get.back();
});
}
@@ -572,7 +573,7 @@ class IntercityHomeController 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;
@@ -1031,7 +1032,7 @@ class IntercityHomeController 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(
@@ -1055,7 +1056,7 @@ class IntercityHomeController 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) {
@@ -1121,10 +1122,10 @@ class IntercityHomeController 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 {
@@ -1156,15 +1157,15 @@ class IntercityHomeController 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());
},
),
),
@@ -1188,14 +1189,14 @@ class IntercityHomeController 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());
}
});
}
@@ -1225,10 +1226,10 @@ class IntercityHomeController 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 {
@@ -1256,11 +1257,11 @@ class IntercityHomeController 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());
}
});
}
@@ -1365,7 +1366,7 @@ class IntercityHomeController 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);
}
@@ -1398,18 +1399,18 @@ class IntercityHomeController 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) {
@@ -1424,10 +1425,10 @@ class IntercityHomeController 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());
}
});
}
@@ -1452,7 +1453,7 @@ class IntercityHomeController 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 '';
}
}
@@ -1477,13 +1478,13 @@ class IntercityHomeController 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());
}
}
@@ -1506,7 +1507,7 @@ class IntercityHomeController 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 '';
}
}
@@ -1543,7 +1544,7 @@ class IntercityHomeController extends GetxController {
return '';
}
} else {
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
return '';
}
}
@@ -1562,11 +1563,11 @@ class IntercityHomeController 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());
}
});
}