BASE: Switch From EasyLocalization To GetX Localization.

This commit is contained in:
2025-12-04 16:56:39 +05:00
parent 157545f1c0
commit bf1d07a048
218 changed files with 2535 additions and 2313 deletions

View File

@@ -40,13 +40,13 @@ 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';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:get/get.dart' hide Trans;
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:http/http.dart' as http;
import 'package:latlong2/latlong.dart' as latlong;
@@ -393,7 +393,7 @@ 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(
@@ -403,7 +403,7 @@ class CabBookingController extends GetxController {
Marker(
markerId: const MarkerId("driver"),
position: LatLng(driverLat, driverLng),
infoWindow: InfoWindow(title: "Driver at Pickup".tr()),
infoWindow: InfoWindow(title: "Driver at Pickup".tr),
icon: taxiIcon ?? BitmapDescriptor.defaultMarker,
),
]);
@@ -412,7 +412,7 @@ class CabBookingController extends GetxController {
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(
@@ -422,7 +422,7 @@ class CabBookingController extends GetxController {
Marker(
markerId: const MarkerId("driver"),
position: LatLng(driverLat, driverLng),
infoWindow: InfoWindow(title: "Driver Location".tr()),
infoWindow: InfoWindow(title: "Driver Location".tr),
icon: taxiIcon ?? BitmapDescriptor.defaultMarker,
),
]);
@@ -527,7 +527,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();
});
@@ -566,7 +566,7 @@ class CabBookingController extends GetxController {
}
await FireStoreUtils.cabOrderPlace(currentOrder.value).then((value) {
ShowToastDialog.showToast("Payment successfully".tr());
ShowToastDialog.showToast("Payment successfully".tr);
Get.back();
});
}
@@ -699,7 +699,7 @@ class CabBookingController extends GetxController {
Marker(
markerId: markerId,
infoWindow: InfoWindow(
title: '${'Stop'.tr()} ${String.fromCharCode(index + 65)}',
title: '${'Stop'.tr} ${String.fromCharCode(index + 65)}',
),
position: LatLng(lat, lng),
icon: stopIcon!,
@@ -734,7 +734,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;
@@ -1362,7 +1362,7 @@ class CabBookingController 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(
@@ -1395,7 +1395,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) {
@@ -1478,10 +1478,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 {
@@ -1513,15 +1513,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);
},
),
),
@@ -1548,15 +1548,15 @@ 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(),
"Something went wrong, please contact admin.".tr,
);
}
});
@@ -1598,10 +1598,10 @@ class CabBookingController extends GetxController {
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 {
@@ -1635,11 +1635,11 @@ class CabBookingController extends GetxController {
);
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);
}
});
}
@@ -1767,7 +1767,7 @@ class CabBookingController 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,
);
}
return GetPaymentTxtTokenModel.fromJson(data);
@@ -1804,18 +1804,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) {
@@ -1833,10 +1833,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);
}
});
}
@@ -1877,7 +1877,7 @@ class CabBookingController extends GetxController {
return responseData['payment_url'];
} else {
ShowToastDialog.showToast(
"something went wrong, please contact admin.".tr(),
"something went wrong, please contact admin.".tr,
);
return '';
}
@@ -1920,13 +1920,13 @@ class CabBookingController 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);
}
}
@@ -1964,7 +1964,7 @@ class CabBookingController extends GetxController {
);
} else {
ShowToastDialog.showToast(
"Something went wrong, please contact admin.".tr(),
"Something went wrong, please contact admin.".tr,
);
return '';
}
@@ -2015,7 +2015,7 @@ class CabBookingController extends GetxController {
}
} else {
ShowToastDialog.showToast(
"Something went wrong, please contact admin.".tr(),
"Something went wrong, please contact admin.".tr,
);
return '';
}
@@ -2041,11 +2041,11 @@ class CabBookingController 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);
}
});
}