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

@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:get/get.dart';
import 'package:http/http.dart' as http;
import '../../models/onprovider_order_model.dart';
@@ -72,7 +73,7 @@ class OnDemandPaymentController extends GetxController {
Future<void> placeOrder() async {
if (!isExtra) {
// Normal Order
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
onDemandOrderModel.value?.payment_method = selectedPaymentMethod.value;
onDemandOrderModel.value?.paymentStatus = onDemandOrderModel.value?.provider.priceUnit == "Fixed" && selectedPaymentMethod.value == "cod" ? false : true;
@@ -90,7 +91,7 @@ class OnDemandPaymentController extends GetxController {
await SendNotification.sendFcmMessage(Constant.bookingPlaced, providerUser.fcmToken ?? '', payLoad);
}
ShowToastDialog.showToast("OnDemand Service successfully booked".tr);
ShowToastDialog.showToast("OnDemand Service successfully booked".tr());
}
if (selectedPaymentMethod.value == PaymentGateway.wallet.name) {
WalletTransactionModel transactionModel = WalletTransactionModel(
@@ -102,8 +103,8 @@ class OnDemandPaymentController extends GetxController {
userId: FireStoreUtils.getCurrentUid(),
isTopup: false,
orderId: onDemandOrderModel.value!.id,
note: "Booking Amount debited".tr,
paymentStatus: "success".tr,
note: "Booking Amount debited".tr(),
paymentStatus: "success".tr(),
);
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
@@ -133,7 +134,7 @@ class OnDemandPaymentController extends GetxController {
isTopup: false,
orderId: onDemandOrderModel.value!.id,
note: "Booking Extra charge debited",
paymentStatus: "success".tr,
paymentStatus: "success".tr(),
);
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
@@ -156,7 +157,7 @@ class OnDemandPaymentController extends GetxController {
isTopup: true,
orderId: onDemandOrderModel.value?.id,
note: 'Extra Charge Amount Credited',
paymentStatus: "success".tr,
paymentStatus: "success".tr(),
);
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
@@ -252,7 +253,7 @@ class OnDemandPaymentController 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(
@@ -276,7 +277,7 @@ class OnDemandPaymentController 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) {
@@ -342,10 +343,10 @@ class OnDemandPaymentController 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 {
@@ -377,15 +378,15 @@ class OnDemandPaymentController 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());
},
),
),
@@ -412,14 +413,14 @@ class OnDemandPaymentController 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);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
}
});
}
@@ -445,10 +446,10 @@ class OnDemandPaymentController 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());
placeOrder();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
}
});
} else {
@@ -476,11 +477,11 @@ class OnDemandPaymentController 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());
placeOrder();
} else {
Get.back();
ShowToastDialog.showToast("Payment Failed".tr);
ShowToastDialog.showToast("Payment Failed".tr());
}
});
}
@@ -585,7 +586,7 @@ class OnDemandPaymentController 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);
}
@@ -618,18 +619,18 @@ class OnDemandPaymentController 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) {
@@ -644,10 +645,10 @@ class OnDemandPaymentController 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());
}
});
}
@@ -672,7 +673,7 @@ class OnDemandPaymentController 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 '';
}
}
@@ -702,12 +703,12 @@ class OnDemandPaymentController extends GetxController {
if (paymentURL.toString().isNotEmpty) {
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());
placeOrder();
}
});
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
}
}
@@ -726,13 +727,13 @@ class OnDemandPaymentController extends GetxController {
accessToken = responseData['access_token'] ?? '';
if (accessToken.isEmpty) {
ShowToastDialog.showToast("Failed to get access token".tr);
ShowToastDialog.showToast("Failed to get access token".tr());
return '';
}
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 '';
}
}
@@ -773,7 +774,7 @@ class OnDemandPaymentController extends GetxController {
return '';
}
} else {
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
return '';
}
}
@@ -800,13 +801,13 @@ class OnDemandPaymentController extends GetxController {
// () => 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());
// placeOrder();
// ();
// }
// });
// } else {
// ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
// ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
// }
// }
//
@@ -829,7 +830,7 @@ class OnDemandPaymentController 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 '';
// }
// }
@@ -870,7 +871,7 @@ class OnDemandPaymentController extends GetxController {
// return '';
// }
// } else {
// ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
// ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
// return '';
// }
// }
@@ -889,11 +890,11 @@ class OnDemandPaymentController 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());
placeOrder();
();
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
}
});
}

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());
}
});
}

View File

@@ -3,6 +3,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/vendor_model.dart';
import 'package:customer/widget/geoflutterfire/src/geoflutterfire.dart';
import 'package:dropdown_textfield/dropdown_textfield.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:geocoding/geocoding.dart';
@@ -101,10 +102,10 @@ class BookParcelController extends GetxController {
void onCameraClick(BuildContext context) {
final action = CupertinoActionSheet(
message: Text('Add your parcel image.'.tr, style: const TextStyle(fontSize: 15.0)),
message: Text('Add your parcel image.'.tr(), style: const TextStyle(fontSize: 15.0)),
actions: <Widget>[
CupertinoActionSheetAction(
child: Text('Choose image from gallery'.tr),
child: Text('Choose image from gallery'.tr()),
onPressed: () async {
Navigator.pop(context);
final imageList = await _picker.pickMultiImage();
@@ -114,7 +115,7 @@ class BookParcelController extends GetxController {
},
),
CupertinoActionSheetAction(
child: Text('Take a picture'.tr),
child: Text('Take a picture'.tr()),
onPressed: () async {
Navigator.pop(context);
final XFile? photo = await _picker.pickImage(source: ImageSource.camera);
@@ -124,7 +125,7 @@ class BookParcelController extends GetxController {
},
),
],
cancelButton: CupertinoActionSheetAction(child: Text('Cancel'.tr), onPressed: () => Navigator.pop(context)),
cancelButton: CupertinoActionSheetAction(child: Text('Cancel'.tr()), onPressed: () => Navigator.pop(context)),
);
showCupertinoModalPopup(context: context, builder: (context) => action);
}
@@ -147,38 +148,38 @@ class BookParcelController extends GetxController {
bool validateFields() {
if (senderNameController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter sender name".tr);
ShowToastDialog.showToast("Please enter sender name".tr());
return false;
} else if (senderMobileController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter sender mobile".tr);
ShowToastDialog.showToast("Please enter sender mobile".tr());
return false;
} else if (senderLocationController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter sender address".tr);
ShowToastDialog.showToast("Please enter sender address".tr());
return false;
} else if (receiverNameController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter receiver name".tr);
ShowToastDialog.showToast("Please enter receiver name".tr());
return false;
} else if (receiverMobileController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter receiver mobile".tr);
ShowToastDialog.showToast("Please enter receiver mobile".tr());
return false;
} else if (receiverLocationController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter receiver address".tr);
ShowToastDialog.showToast("Please enter receiver address".tr());
return false;
} else if (isScheduled.value) {
if (scheduledDate.value.isEmpty) {
ShowToastDialog.showToast("Please select scheduled date".tr);
ShowToastDialog.showToast("Please select scheduled date".tr());
return false;
} else if (scheduledTime.value.isEmpty) {
ShowToastDialog.showToast("Please select scheduled time".tr);
ShowToastDialog.showToast("Please select scheduled time".tr());
return false;
}
}
if (selectedWeight == null) {
ShowToastDialog.showToast("Please select parcel weight".tr);
ShowToastDialog.showToast("Please select parcel weight".tr());
return false;
} else if (senderLocation.value == null || receiverLocation.value == null) {
ShowToastDialog.showToast("Please select both sender and receiver locations".tr);
ShowToastDialog.showToast("Please select both sender and receiver locations".tr());
return false;
}
return true;
@@ -203,14 +204,14 @@ class BookParcelController extends GetxController {
}
if (distance.value < 0.5) {
ShowToastDialog.showToast("Sender's location to receiver's location should be more than 1 km.".tr);
ShowToastDialog.showToast("Sender's location to receiver's location should be more than 1 km.".tr());
return;
}
subTotal.value = (distance.value * double.parse(selectedWeight!.deliveryCharge.toString()));
goToCart();
} catch (e) {
ShowToastDialog.showToast("Something went wrong while booking.".tr);
ShowToastDialog.showToast("Something went wrong while booking.".tr());
debugPrint("bookNow error: $e");
}
}

View File

@@ -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());
}
});
}

View File

@@ -1,5 +1,6 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/cab_order_model.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../constant/collection_name.dart';
@@ -67,11 +68,11 @@ class CabReviewController extends GetxController {
/// Save / update review
Future<void> submitReview() async {
if (comment.value.text.trim().isEmpty || ratings.value == 0) {
ShowToastDialog.showToast("Please provide rating and comment".tr);
ShowToastDialog.showToast("Please provide rating and comment".tr());
return;
}
ShowToastDialog.showLoader("Submit in...".tr);
ShowToastDialog.showLoader("Submit in...".tr());
final user = await FireStoreUtils.getUserProfile(order.value?.driverId ?? '');

View File

@@ -13,6 +13,7 @@ import 'package:customer/models/user_model.dart';
import 'package:customer/models/vendor_model.dart';
import 'package:customer/themes/app_them_data.dart';
import 'package:customer/utils/preferences.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';
@@ -327,7 +328,7 @@ class CartController extends GetxController {
if (double.parse(userModel.value.walletAmount.toString()) >= totalAmount.value) {
setOrder();
} else {
ShowToastDialog.showToast("You don't have sufficient wallet balance to place order".tr);
ShowToastDialog.showToast("You don't have sufficient wallet balance to place order".tr());
}
} else {
setOrder();
@@ -335,13 +336,13 @@ class CartController extends GetxController {
}
Future<void> setOrder() async {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
if ((Constant.isSubscriptionModelApplied == true || Constant.sectionConstantModel?.adminCommision?.isEnabled == true) && vendorModel.value.subscriptionPlan != null) {
await FireStoreUtils.getVendorById(vendorModel.value.id!).then((vender) async {
if (vender?.subscriptionTotalOrders == '0' || vender?.subscriptionTotalOrders == null) {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("This vendor has reached their maximum order capacity. Please select a different vendor or try again later.".tr);
ShowToastDialog.showToast("This vendor has reached their maximum order capacity. Please select a different vendor or try again later.".tr());
return;
}
});
@@ -402,8 +403,8 @@ class CartController extends GetxController {
userId: FireStoreUtils.getCurrentUid(),
isTopup: false,
orderId: orderModel.id,
note: "Order Amount debited".tr,
paymentStatus: "success".tr,
note: "Order Amount debited".tr(),
paymentStatus: "success".tr(),
);
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
@@ -540,7 +541,7 @@ class CartController 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(
@@ -564,7 +565,7 @@ class CartController 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) {
@@ -630,10 +631,10 @@ class CartController 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 {
@@ -665,15 +666,15 @@ class CartController 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());
},
),
),
@@ -697,14 +698,14 @@ class CartController 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);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
}
});
}
@@ -734,10 +735,10 @@ class CartController 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());
placeOrder();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
}
});
} else {
@@ -765,11 +766,11 @@ class CartController 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());
placeOrder();
} else {
Get.back();
ShowToastDialog.showToast("Payment Failed".tr);
ShowToastDialog.showToast("Payment Failed".tr());
}
});
}
@@ -874,7 +875,7 @@ class CartController 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);
}
@@ -906,18 +907,18 @@ class CartController extends GetxController {
}
void handlePaymentSuccess(PaymentSuccessResponse response) {
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) {
@@ -932,10 +933,10 @@ class CartController 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());
}
});
}
@@ -960,7 +961,7 @@ class CartController 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 '';
}
}
@@ -985,13 +986,13 @@ class CartController 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());
placeOrder();
();
}
});
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
}
}
@@ -1014,7 +1015,7 @@ class CartController 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 '';
}
}
@@ -1051,7 +1052,7 @@ class CartController extends GetxController {
return '';
}
} else {
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
return '';
}
}
@@ -1070,11 +1071,11 @@ class CartController 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());
placeOrder();
();
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
}
});
}

View File

@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:image_picker/image_picker.dart';
import '../models/conversation_model.dart';
@@ -93,11 +94,11 @@ class ChatController extends GetxController {
if (url != null) {
if (url.mime.contains('image')) {
conversationModel.message = "sent a message".tr;
conversationModel.message = "sent a message".tr();
} else if (url.mime.contains('video')) {
conversationModel.message = "Sent a video".tr;
conversationModel.message = "Sent a video".tr();
} else if (url.mime.contains('audio')) {
conversationModel.message = "Sent a audio".tr;
conversationModel.message = "Sent a audio".tr();
}
}
@@ -136,7 +137,7 @@ class ChatController extends GetxController {
// sendMessage('', url, '', 'image');
// Get.back();
// } on PlatformException catch (e) {
// ShowToastDialog.showToast("${"failed_to_pick".tr} : \n $e");
// ShowToastDialog.showToast("${"failed_to_pick".tr()} : \n $e");
// }
// }
}

View File

@@ -1,3 +1,4 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../models/cab_order_model.dart';
@@ -21,7 +22,7 @@ class ComplainController extends GetxController {
order.value = args['order'] as CabOrderModel;
getComplain();
} else {
ShowToastDialog.showToast("Order data not found".tr);
ShowToastDialog.showToast("Order data not found".tr());
Get.back();
}
}
@@ -35,7 +36,7 @@ class ComplainController extends GetxController {
comment.value.text = data['description'] ?? '';
}
} catch (e) {
ShowToastDialog.showToast("Failed to load complaint".tr);
ShowToastDialog.showToast("Failed to load complaint".tr());
} finally {
isLoading.value = false;
}
@@ -44,12 +45,12 @@ class ComplainController extends GetxController {
Future<void> submitComplain() async {
// Validation
if (title.value.text.trim().isEmpty) {
ShowToastDialog.showToast("Please enter complaint title".tr);
ShowToastDialog.showToast("Please enter complaint title".tr());
return;
}
if (comment.value.text.trim().isEmpty) {
ShowToastDialog.showToast("Please enter complaint description".tr);
ShowToastDialog.showToast("Please enter complaint description".tr());
return;
}
@@ -72,15 +73,15 @@ class ComplainController extends GetxController {
);
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Your complaint has been submitted to admin".tr);
ShowToastDialog.showToast("Your complaint has been submitted to admin".tr());
Get.back();
} else {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Your complaint is already submitted".tr);
ShowToastDialog.showToast("Your complaint is already submitted".tr());
}
} catch (e) {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Something went wrong, please try again".tr);
ShowToastDialog.showToast("Something went wrong, please try again".tr());
} finally {
isLoading.value = false;
}

View File

@@ -4,6 +4,7 @@ import 'package:customer/constant/constant.dart';
import 'package:customer/models/dine_in_booking_model.dart';
import 'package:customer/models/favourite_model.dart';
import 'package:customer/models/vendor_model.dart';
import 'package:easy_localization/easy_localization.dart';
import '../screen_ui/multi_vendor_service/dine_in_booking/dine_in_booking_screen.dart';
import '../service/fire_store_utils.dart';
import 'package:flutter/material.dart';
@@ -34,9 +35,9 @@ class DineInRestaurantDetailsController extends GetxController {
String getLocalizedOccasion(String key) {
switch (key) {
case "Birthday":
return "Birthday".tr;
return "Birthday".tr();
case "Anniversary":
return "Anniversary".tr;
return "Anniversary".tr();
default:
return key;
}
@@ -61,7 +62,7 @@ class DineInRestaurantDetailsController extends GetxController {
}
Future<void> orderBook() async {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
DateTime dt = selectedDate.value.toDate();
String hour = DateFormat("kk:mm").format(DateFormat('hh:mm a').parse((Intl.getCurrentLocale() == "en_US") ? selectedTimeSlot.value : selectedTimeSlot.value.toLowerCase()));
@@ -91,7 +92,7 @@ class DineInRestaurantDetailsController extends GetxController {
ShowToastDialog.closeLoader();
Get.back();
Get.to(const DineInBookingScreen());
ShowToastDialog.showToast('Dine-In Request submitted successfully.'.tr);
ShowToastDialog.showToast('Dine-In Request submitted successfully.'.tr());
}
void getRecord() {

View File

@@ -1,6 +1,7 @@
import 'dart:io';
import 'package:customer/constant/constant.dart';
import 'package:customer/models/user_model.dart';
import 'package:easy_localization/easy_localization.dart';
import '../service/fire_store_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -42,7 +43,7 @@ class EditProfileController extends GetxController {
}
Future<void> saveData() async {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
if (Constant().hasValidUrl(profileImage.value) == false && profileImage.value.isNotEmpty) {
profileImage.value = await Constant.uploadUserImageToFireStorage(
File(profileImage.value),
@@ -71,7 +72,7 @@ class EditProfileController extends GetxController {
Get.back();
profileImage.value = image.path;
} on PlatformException catch (e) {
ShowToastDialog.showToast("${"failed_to_pick".tr} : \n $e");
ShowToastDialog.showToast("${"failed_to_pick".tr()} : \n $e");
}
}
}

View File

@@ -1,4 +1,5 @@
import 'package:customer/service/fire_store_utils.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -69,13 +70,13 @@ class EnterManuallyLocationController extends GetxController {
String getLocalizedSaveAs(String key) {
switch (key) {
case 'Home':
return 'Home'.tr;
return 'Home'.tr();
case 'Work':
return 'Work'.tr;
return 'Work'.tr();
case 'Hotel':
return 'Hotel'.tr;
return 'Hotel'.tr();
case 'Other':
return 'Other'.tr;
return 'Other'.tr();
default:
return key;
}

View File

@@ -9,6 +9,7 @@ import 'package:customer/models/favourite_model.dart';
import 'package:customer/models/vendor_category_model.dart';
import 'package:customer/models/vendor_model.dart';
import 'package:customer/utils/preferences.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
@@ -32,7 +33,7 @@ class FoodHomeController extends GetxController {
RxBool isLoading = true.obs;
RxBool isListView = true.obs;
RxBool isPopular = true.obs;
RxString selectedOrderTypeValue = "Delivery".tr.obs;
RxString selectedOrderTypeValue = "Delivery".tr().obs;
Rx<PageController> pageController = PageController(viewportFraction: 0.877).obs;
Rx<PageController> pageBottomController = PageController(viewportFraction: 0.877).obs;

View File

@@ -1,3 +1,4 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -11,17 +12,17 @@ class ForgotPasswordController extends GetxController {
final email = emailEditingController.value.text.trim();
if (email.isEmpty) {
ShowToastDialog.showToast("Please enter your email address.".tr);
ShowToastDialog.showToast("Please enter your email address.".tr());
return;
}
if (!GetUtils.isEmail(email)) {
ShowToastDialog.showToast("Please enter a valid email address.".tr);
ShowToastDialog.showToast("Please enter a valid email address.".tr());
return;
}
try {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
await FirebaseAuth.instance.sendPasswordResetEmail(email: email);
ShowToastDialog.closeLoader();
ShowToastDialog.showToast(
@@ -31,9 +32,9 @@ class ForgotPasswordController extends GetxController {
} on FirebaseAuthException catch (e) {
ShowToastDialog.closeLoader();
if (e.code == 'user-not-found') {
ShowToastDialog.showToast('No user found for that email.'.tr);
ShowToastDialog.showToast('No user found for that email.'.tr());
} else {
ShowToastDialog.showToast(e.message?.tr ?? "something_went_wrong".tr);
ShowToastDialog.showToast(e.message?.tr() ?? "something_went_wrong".tr());
}
}
}

View File

@@ -6,6 +6,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/constant/constant.dart';
import 'package:customer/models/gift_cards_model.dart';
import 'package:customer/themes/app_them_data.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_paypal/flutter_paypal.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:razorpay_flutter/razorpay_flutter.dart';
@@ -95,7 +96,7 @@ class GiftCardController extends GetxController {
if (double.parse(userModel.value.walletAmount.toString()) >= double.parse(amountController.value.text)) {
setOrder();
} else {
ShowToastDialog.showToast("You don't have sufficient wallet balance to purchase gift card".tr);
ShowToastDialog.showToast("You don't have sufficient wallet balance to purchase gift card".tr());
}
} else {
setOrder();
@@ -103,7 +104,7 @@ class GiftCardController extends GetxController {
}
Future<void> setOrder() async {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
GiftCardsOrderModel giftCardsOrderModel = GiftCardsOrderModel();
giftCardsOrderModel.id = const Uuid().v4();
giftCardsOrderModel.giftId = selectedGiftCard.value.id.toString();
@@ -129,8 +130,8 @@ class GiftCardController extends GetxController {
userId: FireStoreUtils.getCurrentUid(),
isTopup: false,
orderId: giftCardsOrderModel.id,
note: "Gift card purchase amount debited".tr,
paymentStatus: "success".tr);
note: "Gift card purchase amount debited".tr(),
paymentStatus: "success".tr());
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
if (value == true) {
@@ -141,7 +142,7 @@ class GiftCardController extends GetxController {
await FireStoreUtils.placeGiftCardOrder(giftCardsOrderModel);
ShowToastDialog.closeLoader();
Get.off(const HistoryGiftCard());
ShowToastDialog.showToast("Gift card Purchases successfully".tr);
ShowToastDialog.showToast("Gift card Purchases successfully".tr());
}
String generateGiftCode() {
@@ -328,7 +329,7 @@ class GiftCardController 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) {
@@ -401,10 +402,10 @@ class GiftCardController 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 {
@@ -429,14 +430,14 @@ class GiftCardController 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);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
}
});
}
@@ -472,10 +473,10 @@ class GiftCardController 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());
placeOrder();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
}
});
} else {
@@ -503,11 +504,11 @@ class GiftCardController 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());
placeOrder();
} else {
Get.back();
ShowToastDialog.showToast("Payment Failed".tr);
ShowToastDialog.showToast("Payment Failed".tr());
}
});
}
@@ -534,15 +535,15 @@ class GiftCardController 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());
}),
),
);
@@ -654,7 +655,7 @@ class GiftCardController 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);
}
@@ -690,18 +691,18 @@ class GiftCardController 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());
}
//Midtrans payment
@@ -714,10 +715,10 @@ class GiftCardController 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());
}
});
}
@@ -749,7 +750,7 @@ class GiftCardController 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 '';
}
}
@@ -782,13 +783,13 @@ class GiftCardController 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());
}
}
@@ -815,7 +816,7 @@ class GiftCardController 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 '';
}
}
@@ -853,7 +854,7 @@ class GiftCardController extends GetxController {
return '';
}
} else {
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
return '';
}
}
@@ -877,11 +878,11 @@ class GiftCardController 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());
}
});
}

View File

@@ -1,6 +1,7 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/constant/constant.dart';
import 'package:customer/models/gift_cards_order_model.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:share_plus/share_plus.dart';
import '../service/fire_store_utils.dart';
import 'package:get/get.dart';
@@ -32,7 +33,7 @@ class HistoryGiftCardController extends GetxController {
Future<void> share(String giftCode, String giftPin, String msg, String amount, Timestamp date) async {
await Share.share(
"${'Gift Code :'.tr} $giftCode\n${'Gift Pin :'.tr} $giftPin\n${'Price :'.tr} ${Constant.amountShow(amount: amount)}\n${'Expire Date :'.tr} ${date.toDate()}\n\n${'Message'.tr} : $msg",
"${'Gift Code :'.tr()} $giftCode\n${'Gift Pin :'.tr()} $giftPin\n${'Price :'.tr()} ${Constant.amountShow(amount: amount)}\n${'Expire Date :'.tr()} ${date.toDate()}\n\n${'Message'.tr()} : $msg",
);
}
}

View File

@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:customer/screen_ui/location_enable_screens/location_permission_screen.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -32,18 +33,18 @@ class LoginController extends GetxController {
final email = emailController.value.text.trim();
final password = passwordController.value.text.trim();
if (email.isEmpty || !email.contains('@')) {
ShowToastDialog.showToast("Please enter a valid email address".tr);
ShowToastDialog.showToast("Please enter a valid email address".tr());
return;
}
if (password.isEmpty) {
ShowToastDialog.showToast("Please enter your password".tr);
ShowToastDialog.showToast("Please enter your password".tr());
return;
}
try {
isLoading.value = true;
ShowToastDialog.showLoader("Logging in...".tr);
ShowToastDialog.showLoader("Logging in...".tr());
final credential = await FirebaseAuth.instance.signInWithEmailAndPassword(email: email, password: password);
@@ -68,23 +69,23 @@ class LoginController extends GetxController {
}
} else {
await FirebaseAuth.instance.signOut();
ShowToastDialog.showToast("This user is disabled. Please contact admin.".tr);
ShowToastDialog.showToast("This user is disabled. Please contact admin.".tr());
Get.offAll(() => const LoginScreen());
}
} else {
await FirebaseAuth.instance.signOut();
ShowToastDialog.showToast("This user does not exist in the customer app.".tr);
ShowToastDialog.showToast("This user does not exist in the customer app.".tr());
Get.offAll(() => const LoginScreen());
}
} on FirebaseAuthException catch (e) {
if (e.code == 'user-not-found') {
ShowToastDialog.showToast("No user found for that email.".tr);
ShowToastDialog.showToast("No user found for that email.".tr());
} else if (e.code == 'wrong-password') {
ShowToastDialog.showToast("Wrong password provided.".tr);
ShowToastDialog.showToast("Wrong password provided.".tr());
} else if (e.code == 'invalid-email') {
ShowToastDialog.showToast("Invalid email.".tr);
ShowToastDialog.showToast("Invalid email.".tr());
} else {
ShowToastDialog.showToast(e.message?.tr ?? "Login failed. Please try again.".tr);
ShowToastDialog.showToast(e.message?.tr() ?? "Login failed. Please try again.".tr());
}
} finally {
isLoading.value = false;
@@ -93,7 +94,7 @@ class LoginController extends GetxController {
}
Future<void> loginWithGoogle() async {
ShowToastDialog.showLoader("please wait...".tr);
ShowToastDialog.showLoader("please wait...".tr());
await signInWithGoogle().then((value) async {
ShowToastDialog.closeLoader();
if (value != null) {
@@ -131,12 +132,12 @@ class LoginController extends GetxController {
}
} else {
await FirebaseAuth.instance.signOut();
ShowToastDialog.showToast("This user is disabled. Please contact admin.".tr);
ShowToastDialog.showToast("This user is disabled. Please contact admin.".tr());
Get.offAll(() => const LoginScreen());
}
} else {
await FirebaseAuth.instance.signOut();
ShowToastDialog.showToast("This user does not exist in the customer app.".tr);
ShowToastDialog.showToast("This user does not exist in the customer app.".tr());
Get.offAll(() => const LoginScreen());
}
} else {
@@ -156,7 +157,7 @@ class LoginController extends GetxController {
}
Future<void> loginWithApple() async {
ShowToastDialog.showLoader("please wait...".tr);
ShowToastDialog.showLoader("please wait...".tr());
await signInWithApple().then((value) async {
ShowToastDialog.closeLoader();
if (value != null) {
@@ -197,12 +198,12 @@ class LoginController extends GetxController {
}
} else {
await FirebaseAuth.instance.signOut();
ShowToastDialog.showToast("This user is disabled. Please contact admin.".tr);
ShowToastDialog.showToast("This user is disabled. Please contact admin.".tr());
Get.offAll(() => const LoginScreen());
}
} else {
await FirebaseAuth.instance.signOut();
ShowToastDialog.showToast("This user does not exist in the customer app.".tr);
ShowToastDialog.showToast("This user does not exist in the customer app.".tr());
Get.offAll(() => const LoginScreen());
}
} else {

View File

@@ -1,4 +1,5 @@
import 'package:customer/themes/show_toast_dialog.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -18,12 +19,12 @@ class MobileLoginController extends GetxController {
final countryCode = countryCodeController.value.text.trim();
if (mobile.isEmpty || mobile.length != 10) {
ShowToastDialog.showToast("Please enter a valid 10-digit mobile number".tr);
ShowToastDialog.showToast("Please enter a valid 10-digit mobile number".tr());
return;
}
try {
ShowToastDialog.showLoader("Sending OTP...".tr);
ShowToastDialog.showLoader("Sending OTP...".tr());
await _auth.verifyPhoneNumber(
phoneNumber: '$countryCode$mobile',
@@ -33,9 +34,9 @@ class MobileLoginController extends GetxController {
verificationFailed: (FirebaseAuthException e) {
ShowToastDialog.closeLoader();
if (e.code == 'invalid-phone-number') {
ShowToastDialog.showToast("Invalid phone number".tr);
ShowToastDialog.showToast("Invalid phone number".tr());
} else {
ShowToastDialog.showToast(e.message ?? "OTP verification failed".tr);
ShowToastDialog.showToast(e.message ?? "OTP verification failed".tr());
}
},
codeSent: (String verificationId, int? resendToken) {
@@ -44,13 +45,13 @@ class MobileLoginController extends GetxController {
},
codeAutoRetrievalTimeout: (String verificationId) {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("OTP timed out. Please try again.".tr);
ShowToastDialog.showToast("OTP timed out. Please try again.".tr());
// Optional: Handle timeout
},
);
} catch (e) {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Something went wrong. Please try again.".tr);
ShowToastDialog.showToast("Something went wrong. Please try again.".tr());
}
}

View File

@@ -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());
}
});
}

View File

@@ -4,6 +4,7 @@ import 'package:customer/constant/constant.dart';
import 'package:customer/models/wallet_transaction_model.dart';
import 'package:customer/screen_ui/multi_vendor_service/wallet_screen/wallet_screen.dart';
import 'package:customer/themes/show_toast_dialog.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:get/get.dart';
import '../models/rental_order_model.dart';
import '../models/tax_model.dart';
@@ -111,7 +112,7 @@ class MyRentalBookingController extends GetxController {
if (selectedPaymentMethod.value == PaymentGateway.cod.name) {
selectedOrder.value.paymentMethod = selectedPaymentMethod.value;
await FireStoreUtils.rentalOrderPlace(selectedOrder.value).then((value) {
ShowToastDialog.showToast("Payment method changed".tr);
ShowToastDialog.showToast("Payment method changed".tr());
Get.back();
Get.back();
});
@@ -128,8 +129,8 @@ class MyRentalBookingController extends GetxController {
userId: FireStoreUtils.getCurrentUid(),
isTopup: false,
orderId: selectedOrder.value.id,
note: "Rental Amount debited".tr,
paymentStatus: "success".tr,
note: "Rental Amount debited".tr(),
paymentStatus: "success".tr(),
serviceType: Constant.parcelServiceType,
);
@@ -141,7 +142,7 @@ class MyRentalBookingController extends GetxController {
}
await FireStoreUtils.rentalOrderPlace(selectedOrder.value).then((value) {
ShowToastDialog.showToast("Payment successfully".tr);
ShowToastDialog.showToast("Payment successfully".tr());
Get.back();
Get.back();
});
@@ -204,17 +205,17 @@ class MyRentalBookingController extends GetxController {
isTopup: true,
// refund
orderId: order.id,
note: "Refund for cancelled booking".tr,
paymentStatus: "success".tr,
note: "Refund for cancelled booking".tr(),
paymentStatus: "success".tr(),
serviceType: Constant.parcelServiceType,
);
await FireStoreUtils.setWalletTransaction(walletTransaction);
await FireStoreUtils.updateUserWallet(amount: refundAmount.toString(), userId: FireStoreUtils.getCurrentUid());
}
ShowToastDialog.showToast("Booking cancelled successfully".tr);
ShowToastDialog.showToast("Booking cancelled successfully".tr());
} catch (e) {
ShowToastDialog.showToast("Failed to cancel booking: $e".tr);
ShowToastDialog.showToast("Failed to cancel booking: $e".tr());
} finally {
isLoading.value = false;
}

View File

@@ -2,6 +2,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/constant/constant.dart';
import 'package:customer/models/coupon_model.dart';
import 'package:customer/models/user_model.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
@@ -132,9 +133,9 @@ class OnDemandBookingController extends GetxController {
Future<void> confirmBooking(BuildContext context) async {
if (selectedAddress.value.getFullAddress().isEmpty) {
ShowToastDialog.showToast("Please enter address".tr);
ShowToastDialog.showToast("Please enter address".tr());
} else if (dateTimeController.value.text.isEmpty) {
ShowToastDialog.showToast("Please select time slot.".tr);
ShowToastDialog.showToast("Please select time slot.".tr());
} else {
UserModel? providerUser = await FireStoreUtils.getUserProfile(provider.value!.author!);
@@ -169,7 +170,7 @@ class OnDemandBookingController extends GetxController {
Get.to(() => OnDemandPaymentScreen(), arguments: {'onDemandOrderModel': Rxn<OnProviderOrderModel>(onDemandOrderModel), 'totalAmount': totalAmount.value, 'isExtra': false});
} else {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
OnProviderOrderModel onDemandOrder = OnProviderOrderModel(
otp: Constant.getReferralCode(),
authorID: FireStoreUtils.getCurrentUid(),
@@ -207,7 +208,7 @@ class OnDemandBookingController extends GetxController {
Get.offAll(const OnDemandDashboardScreen());
OnDemandDashboardController controller = Get.put(OnDemandDashboardController());
controller.selectedIndex.value = 2;
ShowToastDialog.showToast("OnDemand Service successfully booked".tr);
ShowToastDialog.showToast("OnDemand Service successfully booked".tr());
}
}
}

View File

@@ -2,6 +2,7 @@ import 'dart:developer';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/coupon_model.dart';
import 'package:customer/models/user_model.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import '../constant/constant.dart';
@@ -144,7 +145,7 @@ class OnDemandOrderDetailsController extends GetxController {
final order = onProviderOrder.value;
if (order == null) return;
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
try {
double total = 0.0;
@@ -186,7 +187,7 @@ class OnDemandOrderDetailsController extends GetxController {
isTopup: true,
orderId: order.id,
note: 'Booking Amount Refund',
paymentStatus: "success".tr,
paymentStatus: "success".tr(),
),
);
@@ -204,7 +205,7 @@ class OnDemandOrderDetailsController extends GetxController {
isTopup: false,
orderId: order.id,
note: 'Booking Amount Refund',
paymentStatus: "success".tr,
paymentStatus: "success".tr(),
),
);
}
@@ -224,7 +225,7 @@ class OnDemandOrderDetailsController extends GetxController {
isTopup: true,
orderId: order.id,
note: 'Admin commission refund',
paymentStatus: "success".tr,
paymentStatus: "success".tr(),
),
);
}
@@ -244,11 +245,11 @@ class OnDemandOrderDetailsController extends GetxController {
ShowToastDialog.closeLoader();
Get.back();
ShowToastDialog.showToast("Booking cancelled successfully".tr);
ShowToastDialog.showToast("Booking cancelled successfully".tr());
} catch (e, st) {
log("Cancel error: $e\n$st");
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Something went wrong".tr);
ShowToastDialog.showToast("Something went wrong".tr());
}
}
}

View File

@@ -1,4 +1,5 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../constant/collection_name.dart';
@@ -111,7 +112,7 @@ class OnDemandReviewController extends GetxController {
}
Future<void> _providerReviewSubmit() async {
ShowToastDialog.showLoader("Submit in...".tr);
ShowToastDialog.showLoader("Submit in...".tr());
providerServiceModel.value!.reviewsCount = serviceReviewCount.value + 1;
providerServiceModel.value!.reviewsSum = serviceReviewSum.value + ratings.value;
@@ -142,7 +143,7 @@ class OnDemandReviewController extends GetxController {
}
Future<void> _workerReviewSubmit() async {
ShowToastDialog.showLoader("Submit in...".tr);
ShowToastDialog.showLoader("Submit in...".tr());
workerModel.value!.reviewsCount = workerReviewCount.value + 1;
workerModel.value!.reviewsSum = workerReviewSum.value + ratings.value;

View File

@@ -1,5 +1,6 @@
import 'package:customer/screen_ui/location_enable_screens/location_permission_screen.dart';
import 'package:customer/themes/show_toast_dialog.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -42,7 +43,7 @@ class OtpVerifyController extends GetxController {
codeSent: (String verificationId0, int? resendToken0) async {
verificationId.value = verificationId0;
resendToken.value = resendToken0!;
ShowToastDialog.showToast("OTP sent".tr);
ShowToastDialog.showToast("OTP sent".tr());
},
timeout: const Duration(seconds: 25),
forceResendingToken: resendToken.value,
@@ -55,12 +56,12 @@ class OtpVerifyController extends GetxController {
void verifyOtp() async {
if (otpController.value.text.length != 6) {
ShowToastDialog.showToast("Enter valid 6-digit OTP".tr);
ShowToastDialog.showToast("Enter valid 6-digit OTP".tr());
return;
}
try {
ShowToastDialog.showLoader("Verifying OTP...".tr);
ShowToastDialog.showLoader("Verifying OTP...".tr());
final credential = PhoneAuthProvider.credential(verificationId: verificationId.value, smsCode: otpController.value.text.trim());
@@ -91,7 +92,7 @@ class OtpVerifyController extends GetxController {
}
if (userModel.active == false) {
ShowToastDialog.showToast("This user is disabled".tr);
ShowToastDialog.showToast("This user is disabled".tr());
await _auth.signOut();
Get.offAll(() => const LoginScreen());
return;
@@ -110,7 +111,7 @@ class OtpVerifyController extends GetxController {
}
} catch (e) {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Invalid OTP or Verification Failed".tr);
ShowToastDialog.showToast("Invalid OTP or Verification Failed".tr());
}
}

View File

@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import '../constant/constant.dart';
@@ -81,7 +82,7 @@ class ParcelMyBookingController extends GetxController {
isLoading.value = true;
if (order.status != Constant.orderPlaced) {
ShowToastDialog.showToast("You can only cancel before pickup.".tr);
ShowToastDialog.showToast("You can only cancel before pickup.".tr());
return;
}
@@ -124,9 +125,9 @@ class ParcelMyBookingController extends GetxController {
await FireStoreUtils.updateUserWallet(amount: refundAmount.toString(), userId: FireStoreUtils.getCurrentUid());
}
ShowToastDialog.showToast("Order cancelled successfully".tr);
ShowToastDialog.showToast("Order cancelled successfully".tr());
} catch (e) {
ShowToastDialog.showToast("${'Failed to cancel order:'.tr} $e".tr);
ShowToastDialog.showToast("${'Failed to cancel order:'.tr()} $e".tr());
} finally {
isLoading.value = false;
}

View File

@@ -5,6 +5,7 @@ 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';
@@ -135,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 = [];
@@ -206,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},
@@ -215,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());
}
}
@@ -323,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(
@@ -356,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) {
@@ -439,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 {
@@ -479,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());
},
),
),
@@ -520,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());
// },
// ),
// ),
@@ -558,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(),
);
}
});
@@ -613,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();
}
});
@@ -675,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());
}
});
}
@@ -832,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(),
);
}
@@ -865,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);
// }
@@ -901,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) {
@@ -930,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());
}
});
}
@@ -974,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 '';
}
@@ -1001,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,
@@ -1026,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();
}
}
@@ -1085,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 '';
}
@@ -1151,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 '';
}
@@ -1178,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());
}
});
}

View File

@@ -3,6 +3,7 @@ import 'package:customer/models/rating_model.dart';
import 'package:customer/models/wallet_transaction_model.dart';
import 'package:customer/screen_ui/multi_vendor_service/wallet_screen/wallet_screen.dart';
import 'package:customer/themes/show_toast_dialog.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import '../constant/constant.dart';
@@ -87,7 +88,7 @@ class ParcelOrderDetailsController extends GetxController {
}
Future<void> cancelParcelOrder() async {
ShowToastDialog.showLoader("Cancelling order...".tr);
ShowToastDialog.showLoader("Cancelling order...".tr());
parcelOrder.value.status = Constant.orderCancelled;
if (parcelOrder.value.paymentMethod?.toLowerCase() != "cod") {
WalletTransactionModel walletTransaction = WalletTransactionModel(
@@ -113,7 +114,7 @@ class ParcelOrderDetailsController extends GetxController {
await FireStoreUtils.parcelOrderPlace(parcelOrder.value);
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Order cancelled successfully".tr);
ShowToastDialog.showToast("Order cancelled successfully".tr());
Get.back(result: true);
}

View File

@@ -1,5 +1,6 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/parcel_order_model.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../models/rating_model.dart';
@@ -70,11 +71,11 @@ class ParcelReviewController extends GetxController {
/// Save / update review
Future<void> submitReview() async {
if (comment.value.text.trim().isEmpty || ratings.value == 0) {
ShowToastDialog.showToast("Please provide rating and comment".tr);
ShowToastDialog.showToast("Please provide rating and comment".tr());
return;
}
ShowToastDialog.showLoader("Submit in...".tr);
ShowToastDialog.showLoader("Submit in...".tr());
final user = await FireStoreUtils.getUserProfile(order.value?.driverId ?? '');

View File

@@ -6,6 +6,7 @@ import 'package:customer/models/order_model.dart';
import 'package:customer/models/product_model.dart';
import 'package:customer/models/vendor_category_model.dart';
import 'package:customer/models/vendor_model.dart';
import 'package:easy_localization/easy_localization.dart';
import '../models/rating_model.dart';
import '../models/review_attribute_model.dart';
import '../service/fire_store_utils.dart';
@@ -118,7 +119,7 @@ class RateProductController extends GetxController {
Future<void> saveRating() async {
if (ratings.value != 0.0) {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
productModel.value.reviewsCount = productReviewCount.value + 1;
productModel.value.reviewsSum = productReviewSum.value + ratings.value;
productModel.value.reviewAttributes = reviewProductAttributes;
@@ -171,10 +172,10 @@ class RateProductController extends GetxController {
await FireStoreUtils.updateVendor(vendorModel.value);
await FireStoreUtils.setProduct(productModel.value);
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Rating saved successfully.".tr);
ShowToastDialog.showToast("Rating saved successfully.".tr());
Get.back();
} else {
ShowToastDialog.showToast("Please add rate for food item.".tr);
ShowToastDialog.showToast("Please add rate for food item.".tr());
}
}

View File

@@ -5,6 +5,7 @@ import 'package:customer/models/coupon_model.dart';
import 'package:customer/models/rental_order_model.dart';
import 'package:customer/service/fire_store_utils.dart';
import 'package:customer/themes/show_toast_dialog.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -71,7 +72,7 @@ class RentalConformationController extends GetxController {
}
Future<void> placeOrder() async {
ShowToastDialog.showLoader("Placing booking...".tr);
ShowToastDialog.showLoader("Placing booking...".tr());
rentalOrderModel.value.discount = discount.value.toString();
rentalOrderModel.value.couponCode = selectedCouponModel.value.code;
rentalOrderModel.value.couponId = selectedCouponModel.value.id;
@@ -79,7 +80,7 @@ class RentalConformationController extends GetxController {
rentalOrderModel.value.otpCode = (maths.Random().nextInt(9000) + 1000).toString();
await FireStoreUtils.rentalOrderPlace(rentalOrderModel.value).then((value) async {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Order placed successfully".tr);
ShowToastDialog.showToast("Order placed successfully".tr());
Get.offAll(const RentalDashboardScreen());
CabRentalDashboardControllers controller = Get.put(CabRentalDashboardControllers());
controller.selectedIndex.value = 1;

View File

@@ -7,6 +7,7 @@ import 'package:customer/models/user_model.dart';
import 'package:customer/models/vendor_model.dart';
import 'package:customer/screen_ui/rental_service/rental_conformation_screen.dart';
import 'package:customer/widget/geoflutterfire/src/geoflutterfire.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';
@@ -81,7 +82,7 @@ class RentalHomeController extends GetxController {
sourceTextEditController.value.text = address;
}
} catch (e) {
ShowToastDialog.showToast("Unable to fetch current location".tr);
ShowToastDialog.showToast("Unable to fetch current location".tr());
}
}

View File

@@ -35,6 +35,7 @@ import 'package:customer/screen_ui/multi_vendor_service/wallet_screen/wallet_scr
import 'package:customer/themes/app_them_data.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_paypal/flutter_paypal.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
@@ -163,7 +164,7 @@ class RentalOrderDetailsController extends GetxController {
totalAmount.value = (subTotal.value - discount.value) + taxAmount.value;
} catch (e) {
ShowToastDialog.showToast("${'Failed to calculate total:'.tr} $e");
ShowToastDialog.showToast("${'Failed to calculate total:'.tr()} $e");
}
}
@@ -171,7 +172,7 @@ class RentalOrderDetailsController extends GetxController {
if (selectedPaymentMethod.value == PaymentGateway.cod.name) {
order.value.paymentMethod = selectedPaymentMethod.value;
await FireStoreUtils.rentalOrderPlace(order.value).then((value) {
ShowToastDialog.showToast("Payment method changed".tr);
ShowToastDialog.showToast("Payment method changed".tr());
Get.back();
Get.back();
});
@@ -201,7 +202,7 @@ class RentalOrderDetailsController extends GetxController {
}
await FireStoreUtils.rentalOrderPlace(order.value).then((value) {
ShowToastDialog.showToast("Payment successfully".tr);
ShowToastDialog.showToast("Payment successfully".tr());
Get.back();
Get.back();
});
@@ -245,10 +246,10 @@ class RentalOrderDetailsController extends GetxController {
await FireStoreUtils.setWalletTransaction(walletTransaction);
await FireStoreUtils.updateUserWallet(amount: refundAmount.toString(), userId: FireStoreUtils.getCurrentUid());
}
ShowToastDialog.showToast("Booking cancelled successfully".tr);
ShowToastDialog.showToast("Booking cancelled successfully".tr());
Get.back();
} catch (e) {
ShowToastDialog.showToast("${'Failed to cancel booking:'.tr} $e".tr);
ShowToastDialog.showToast("${'Failed to cancel booking:'.tr()} $e".tr());
} finally {
isLoading.value = false;
}
@@ -329,7 +330,7 @@ class RentalOrderDetailsController 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(
@@ -353,7 +354,7 @@ class RentalOrderDetailsController 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) {
@@ -419,10 +420,10 @@ class RentalOrderDetailsController 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 {
@@ -454,15 +455,15 @@ class RentalOrderDetailsController 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());
},
),
),
@@ -489,14 +490,14 @@ class RentalOrderDetailsController 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());
}
});
}
@@ -526,10 +527,10 @@ class RentalOrderDetailsController 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 {
@@ -557,11 +558,11 @@ class RentalOrderDetailsController 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());
}
});
}
@@ -666,7 +667,7 @@ class RentalOrderDetailsController 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);
}
@@ -699,18 +700,18 @@ class RentalOrderDetailsController 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) {
@@ -725,10 +726,10 @@ class RentalOrderDetailsController 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());
}
});
}
@@ -753,7 +754,7 @@ class RentalOrderDetailsController 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 '';
}
}
@@ -778,13 +779,13 @@ class RentalOrderDetailsController 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());
}
}
@@ -807,7 +808,7 @@ class RentalOrderDetailsController 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 '';
}
}
@@ -844,7 +845,7 @@ class RentalOrderDetailsController extends GetxController {
return '';
}
} else {
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
return '';
}
}
@@ -862,10 +863,10 @@ class RentalOrderDetailsController 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());
}
});
}

View File

@@ -1,4 +1,5 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../constant/collection_name.dart';
@@ -71,11 +72,11 @@ class RentalReviewController extends GetxController {
/// Save / update review
Future<void> submitReview() async {
if (comment.value.text.trim().isEmpty || ratings.value == 0) {
ShowToastDialog.showToast("Please provide rating and comment".tr);
ShowToastDialog.showToast("Please provide rating and comment".tr());
return;
}
ShowToastDialog.showLoader("Submit in...".tr);
ShowToastDialog.showLoader("Submit in...".tr());
final user = await FireStoreUtils.getUserProfile(order.value?.driverId ?? '');

View File

@@ -12,6 +12,7 @@ import 'package:customer/models/currency_model.dart';
import 'package:customer/themes/app_them_data.dart';
import 'package:customer/themes/round_button_fill.dart';
import 'package:customer/themes/show_toast_dialog.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:firebase_auth/firebase_auth.dart' as auth;
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -75,7 +76,7 @@ class ServiceListController extends GetxController {
SectionModel sectionModel,
) async {
try {
ShowToastDialog.showLoader("Please wait...".tr);
ShowToastDialog.showLoader("Please wait...".tr());
Constant.sectionConstantModel = sectionModel;
AppThemeData.primary300 = Color(
int.tryParse(sectionModel.color?.replaceFirst("#", "0xff") ?? '') ??
@@ -160,7 +161,7 @@ class ServiceListController extends GetxController {
children: [
Text(
"If you select this Section/Service, your previously added items will be removed from the cart."
.tr,
.tr(),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
@@ -170,7 +171,7 @@ class ServiceListController extends GetxController {
child: RoundedButtonFill(
borderRadius: 10.r,
height: 5.5,
title: "Cancel".tr,
title: "Cancel".tr(),
onPress: () {
Get.back();
},
@@ -182,7 +183,7 @@ class ServiceListController extends GetxController {
Expanded(
child: RoundedButtonFill(
borderRadius: 10.r,
title: "OK".tr,
title: "OK".tr(),
height: 5.5,
onPress: () async {
DatabaseHelper.instance.deleteAllCartProducts();

View File

@@ -1,6 +1,7 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:customer/models/user_model.dart';
import 'package:customer/screen_ui/location_enable_screens/location_permission_screen.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:firebase_auth/firebase_auth.dart' as auth;
@@ -65,7 +66,7 @@ class SignUpController extends GetxController {
try {
if (!_validateInputs()) return;
ShowToastDialog.showLoader("Creating account...".tr);
ShowToastDialog.showLoader("Creating account...".tr());
if (type.value == "mobileNumber") {
await _signUpWithMobile();
@@ -77,29 +78,29 @@ class SignUpController extends GetxController {
} catch (e, st) {
ShowToastDialog.closeLoader();
debugPrint("SIGNUP OUTER EXCEPTION: $e\n$st");
ShowToastDialog.showToast("${'signup_failed'.tr}: $e");
ShowToastDialog.showToast("${'signup_failed'.tr()}: $e");
}
}
/// Validation Logic
bool _validateInputs() {
if (firstNameController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter first name".tr);
ShowToastDialog.showToast("Please enter first name".tr());
return false;
} else if (lastNameController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter last name".tr);
ShowToastDialog.showToast("Please enter last name".tr());
return false;
} else if (emailController.value.text.isEmpty || !emailController.value.text.isEmail) {
ShowToastDialog.showToast("Please enter a valid email address".tr);
ShowToastDialog.showToast("Please enter a valid email address".tr());
return false;
} else if (mobileController.value.text.isEmpty) {
ShowToastDialog.showToast("Please enter a valid phone number".tr);
ShowToastDialog.showToast("Please enter a valid phone number".tr());
return false;
} else if (passwordController.value.text.length < 6) {
ShowToastDialog.showToast("Password must be at least 6 characters".tr);
ShowToastDialog.showToast("Password must be at least 6 characters".tr());
return false;
} else if (passwordController.value.text != confirmPasswordController.value.text) {
ShowToastDialog.showToast("Password and Confirm password do not match".tr);
ShowToastDialog.showToast("Password and Confirm password do not match".tr());
return false;
}
return true;
@@ -120,17 +121,17 @@ class SignUpController extends GetxController {
} on auth.FirebaseAuthException catch (e) {
debugPrint("FirebaseAuthException caught: code=${e.code}, message=${e.message}");
if (e.code == 'email-already-in-use') {
ShowToastDialog.showToast("Email already in use".tr);
ShowToastDialog.showToast("Email already in use".tr());
} else if (e.code == 'weak-password') {
ShowToastDialog.showToast("Password is too weak".tr);
ShowToastDialog.showToast("Password is too weak".tr());
} else if (e.code == 'invalid-email') {
ShowToastDialog.showToast("Invalid email address".tr);
ShowToastDialog.showToast("Invalid email address".tr());
} else {
ShowToastDialog.showToast(e.message ?? "signup_failed".tr);
ShowToastDialog.showToast(e.message ?? "signup_failed".tr());
}
} catch (e) {
debugPrint("Something went wrong: ${e.toString()}");
ShowToastDialog.showToast("${'something_went_wrong'.tr}: ${e.toString()}");
ShowToastDialog.showToast("${'something_went_wrong'.tr()}: ${e.toString()}");
}
}
@@ -147,7 +148,7 @@ class SignUpController extends GetxController {
_navigateBasedOnAddress(userModel.value);
} catch (e) {
ShowToastDialog.showToast("${'signup_failed'.tr}: $e");
ShowToastDialog.showToast("${'signup_failed'.tr()}: $e");
}
}

View File

@@ -17,6 +17,7 @@ import 'package:customer/models/payment_model/xendit.dart';
import 'package:customer/models/user_model.dart';
import 'package:customer/models/wallet_transaction_model.dart';
import 'package:customer/themes/app_them_data.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_paypal/flutter_paypal.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:razorpay_flutter/razorpay_flutter.dart';
@@ -131,7 +132,7 @@ class WalletController extends GetxController {
}
});
ShowToastDialog.showToast("Amount Top-up successfully".tr);
ShowToastDialog.showToast("Amount Top-up successfully".tr());
}
// Strip
@@ -142,7 +143,7 @@ class WalletController 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(
@@ -166,7 +167,7 @@ class WalletController 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());
walletTopUp();
});
} on StripeException catch (e) {
@@ -231,14 +232,14 @@ class WalletController 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());
walletTopUp();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
}
});
} else {
ShowToastDialog.showToast("Something want wrong please contact administrator".tr);
ShowToastDialog.showToast("Something want wrong please contact administrator".tr());
print('Error creating preference: ${response.body}');
return null;
}
@@ -266,15 +267,15 @@ class WalletController extends GetxController {
note: "Contact us for any questions on your order.",
onSuccess: (Map params) async {
walletTopUp();
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());
},
),
),
@@ -298,14 +299,14 @@ class WalletController extends GetxController {
),
)!.then((value) {
if (value) {
ShowToastDialog.showToast("Payment Successful!!".tr);
ShowToastDialog.showToast("Payment Successful!!".tr());
walletTopUp();
} 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());
}
});
}
@@ -335,10 +336,10 @@ class WalletController 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());
walletTopUp();
} else {
ShowToastDialog.showToast("Payment UnSuccessful!!".tr);
ShowToastDialog.showToast("Payment UnSuccessful!!".tr());
}
});
} else {
@@ -366,11 +367,11 @@ class WalletController 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());
walletTopUp();
} else {
Get.back();
ShowToastDialog.showToast("Payment Failed".tr);
ShowToastDialog.showToast("Payment Failed".tr());
}
});
}
@@ -402,18 +403,18 @@ class WalletController extends GetxController {
}
void handlePaymentSuccess(PaymentSuccessResponse response) {
ShowToastDialog.showToast("Payment Successful!!".tr);
ShowToastDialog.showToast("Payment Successful!!".tr());
walletTopUp();
}
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());
}
//Midtrans payment
@@ -423,10 +424,10 @@ class WalletController extends GetxController {
if (url != '') {
Get.to(() => MidtransScreen(initialURl: url))!.then((value) {
if (value == true) {
ShowToastDialog.showToast("Payment Successful!!".tr);
ShowToastDialog.showToast("Payment Successful!!".tr());
walletTopUp();
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
}
});
}
@@ -451,7 +452,7 @@ class WalletController 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 '';
}
}
@@ -476,12 +477,12 @@ class WalletController 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());
walletTopUp();
}
});
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
}
}
@@ -501,7 +502,7 @@ class WalletController extends GetxController {
accessToken = responseData['access_token'];
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 '';
}
}
@@ -540,7 +541,7 @@ class WalletController extends GetxController {
return '';
}
} else {
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr());
return '';
}
}
@@ -559,10 +560,10 @@ class WalletController 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());
walletTopUp();
} else {
ShowToastDialog.showToast("Payment Unsuccessful!!".tr);
ShowToastDialog.showToast("Payment Unsuccessful!!".tr());
}
});
}