BASE: Imlement Localization In Auth.

This commit is contained in:
2025-12-03 15:25:19 +05:00
parent 2736727592
commit 3e18352abe
24 changed files with 3484 additions and 795 deletions

View File

@@ -0,0 +1,39 @@
class ConstTexts {
static String loginToExplore = "logintoExplore";
static String emailAddress = "emailAddress";
static String password = "password";
static String enterPassword = "enterPassword";
static String forgotPassword = "forgotPassword";
static String login = "login";
static String orContinueWith = "orContinueWith";
static String mobileNumber = "mobileNumber";
static String withGoogle = "withGoogle";
static String withApple = "withApple";
static String dontHaveAccount = "dontHaveAccount";
static String signUp = "signUp";
static String skip = "skip";
static String signUpToExplore = "signUpToExplore";
static String firstName = "firstName";
static String lastName = "lastName";
static String enterMobileNumber = "enterMobileNumber";
static String confirmPassword = "confirmPassword";
static String enterConfirmPassword = "enterConfirmPassword";
static String referralCode = "referralCode";
static String enterReferralCode = "enterReferralCode";
static String alreadyHaveAccount = "alreadyHaveAccount";
static String enterYourregisteredEmail = "enterYourregisteredEmail";
static String sendLink = "sendLink";
static String rememberPassword = "rememberPassword";
static String enterOtpSent = "enterOtpSent";
static String resendOTP = "resendOTP";
static String verify = "verify";
static String useYourMobileNumber = "useYourMobileNumber";
static String sendCode = "sendCode";
static String loginToExplore = "logintoExplore";
static String emailAddress = "emailAddress";
static String password = "password";
static String loginToExplore = "logintoExplore";
static String emailAddress = "emailAddress";
static String password = "password";
}

View File

@@ -96,11 +96,19 @@ class ParcelOrderConfirmationController extends GetxController {
subTotal.value = double.tryParse(parcelOrder.value.subTotal ?? '0') ?? 0.0;
if (selectedCouponModel.value.id != null) {
discount.value = Constant.calculateDiscount(amount: subTotal.value.toString(), offerModel: selectedCouponModel.value);
discount.value = Constant.calculateDiscount(
amount: subTotal.value.toString(),
offerModel: selectedCouponModel.value,
);
}
for (var element in Constant.taxList) {
taxAmount.value = (taxAmount.value + Constant.calculateTax(amount: (subTotal.value - discount.value).toString(), taxModel: element));
taxAmount.value =
(taxAmount.value +
Constant.calculateTax(
amount: (subTotal.value - discount.value).toString(),
taxModel: element,
));
}
print("Tax: ${taxAmount.value}");
@@ -133,25 +141,40 @@ class ParcelOrderConfirmationController extends GetxController {
List<String> parcelImages = [];
if (images.isNotEmpty) {
for (var image in images) {
final upload = await FireStoreUtils.uploadChatImageToFireStorage(File(image.path), Get.context!);
final upload = await FireStoreUtils.uploadChatImageToFireStorage(
File(image.path),
Get.context!,
);
parcelImages.add(upload.url);
}
}
parcelOrder.value.parcelImages = parcelImages;
parcelOrder.value.discount = discount.value.toString();
parcelOrder.value.discountType = selectedCouponModel.value.discountType.toString();
parcelOrder.value.discountLabel = selectedCouponModel.value.code.toString();
parcelOrder.value.adminCommission = Constant.sectionConstantModel?.adminCommision?.amount?.toString();
parcelOrder.value.adminCommissionType = Constant.sectionConstantModel?.adminCommision?.commissionType;
parcelOrder.value.discountType =
selectedCouponModel.value.discountType.toString();
parcelOrder.value.discountLabel =
selectedCouponModel.value.code.toString();
parcelOrder.value.adminCommission =
Constant.sectionConstantModel?.adminCommision?.amount?.toString();
parcelOrder.value.adminCommissionType =
Constant.sectionConstantModel?.adminCommision?.commissionType;
parcelOrder.value.status = Constant.orderPlaced;
parcelOrder.value.createdAt = Timestamp.now();
parcelOrder.value.author = userModel.value;
parcelOrder.value.authorID = FireStoreUtils.getCurrentUid();
parcelOrder.value.paymentMethod = paymentBy.value == "Receiver" ? "cod" : selectedPaymentMethod.value;
parcelOrder.value.paymentCollectByReceiver = paymentBy.value == "Receiver";
parcelOrder.value.senderZoneId = Constant.getZoneId(parcelOrder.value.senderLatLong!.latitude ?? 0.0, parcelOrder.value.senderLatLong!.longitude ?? 0.0);
parcelOrder.value.receiverZoneId = Constant.getZoneId(parcelOrder.value.receiverLatLong!.latitude ?? 0.0, parcelOrder.value.receiverLatLong!.longitude ?? 0.0);
parcelOrder.value.paymentMethod =
paymentBy.value == "Receiver" ? "cod" : selectedPaymentMethod.value;
parcelOrder.value.paymentCollectByReceiver =
paymentBy.value == "Receiver";
parcelOrder.value.senderZoneId = Constant.getZoneId(
parcelOrder.value.senderLatLong!.latitude ?? 0.0,
parcelOrder.value.senderLatLong!.longitude ?? 0.0,
);
parcelOrder.value.receiverZoneId = Constant.getZoneId(
parcelOrder.value.receiverLatLong!.latitude ?? 0.0,
parcelOrder.value.receiverLatLong!.longitude ?? 0.0,
);
if (selectedPaymentMethod.value == PaymentGateway.wallet.name) {
WalletTransactionModel transactionModel = WalletTransactionModel(
@@ -168,16 +191,26 @@ class ParcelOrderConfirmationController extends GetxController {
serviceType: Constant.parcelServiceType,
);
await FireStoreUtils.setWalletTransaction(transactionModel).then((value) async {
await FireStoreUtils.setWalletTransaction(transactionModel).then((
value,
) async {
if (value == true) {
await FireStoreUtils.updateUserWallet(amount: "-${totalAmount.value.toString()}", userId: FireStoreUtils.getCurrentUid());
await FireStoreUtils.updateUserWallet(
amount: "-${totalAmount.value.toString()}",
userId: FireStoreUtils.getCurrentUid(),
);
}
});
}
await FireStoreUtils.parcelOrderPlace(parcelOrder.value).then((value) async {
await FireStoreUtils.parcelOrderPlace(parcelOrder.value).then((
value,
) async {
ShowToastDialog.closeLoader();
ShowToastDialog.showToast("Order placed successfully".tr);
Get.offAll(() => OrderSuccessfullyPlaced(), arguments: {'parcelOrder': parcelOrder.value});
Get.offAll(
() => OrderSuccessfullyPlaced(),
arguments: {'parcelOrder': parcelOrder.value},
);
await FireStoreUtils.sendParcelBookEmail(orderModel: parcelOrder.value);
});
} catch (e) {
@@ -203,19 +236,45 @@ class ParcelOrderConfirmationController extends GetxController {
Future<void> getPaymentSettings() async {
await FireStoreUtils.getPaymentSettingsData().then((value) {
stripeModel.value = StripeModel.fromJson(jsonDecode(Preferences.getString(Preferences.stripeSettings)));
payPalModel.value = PayPalModel.fromJson(jsonDecode(Preferences.getString(Preferences.paypalSettings)));
payStackModel.value = PayStackModel.fromJson(jsonDecode(Preferences.getString(Preferences.payStack)));
mercadoPagoModel.value = MercadoPagoModel.fromJson(jsonDecode(Preferences.getString(Preferences.mercadoPago)));
flutterWaveModel.value = FlutterWaveModel.fromJson(jsonDecode(Preferences.getString(Preferences.flutterWave)));
paytmModel.value = PaytmModel.fromJson(jsonDecode(Preferences.getString(Preferences.paytmSettings)));
payFastModel.value = PayFastModel.fromJson(jsonDecode(Preferences.getString(Preferences.payFastSettings)));
razorPayModel.value = RazorPayModel.fromJson(jsonDecode(Preferences.getString(Preferences.razorpaySettings)));
midTransModel.value = MidTrans.fromJson(jsonDecode(Preferences.getString(Preferences.midTransSettings)));
orangeMoneyModel.value = OrangeMoney.fromJson(jsonDecode(Preferences.getString(Preferences.orangeMoneySettings)));
xenditModel.value = Xendit.fromJson(jsonDecode(Preferences.getString(Preferences.xenditSettings)));
walletSettingModel.value = WalletSettingModel.fromJson(jsonDecode(Preferences.getString(Preferences.walletSettings)));
cashOnDeliverySettingModel.value = CodSettingModel.fromJson(jsonDecode(Preferences.getString(Preferences.codSettings)));
stripeModel.value = StripeModel.fromJson(
jsonDecode(Preferences.getString(Preferences.stripeSettings)),
);
payPalModel.value = PayPalModel.fromJson(
jsonDecode(Preferences.getString(Preferences.paypalSettings)),
);
payStackModel.value = PayStackModel.fromJson(
jsonDecode(Preferences.getString(Preferences.payStack)),
);
mercadoPagoModel.value = MercadoPagoModel.fromJson(
jsonDecode(Preferences.getString(Preferences.mercadoPago)),
);
flutterWaveModel.value = FlutterWaveModel.fromJson(
jsonDecode(Preferences.getString(Preferences.flutterWave)),
);
paytmModel.value = PaytmModel.fromJson(
jsonDecode(Preferences.getString(Preferences.paytmSettings)),
);
payFastModel.value = PayFastModel.fromJson(
jsonDecode(Preferences.getString(Preferences.payFastSettings)),
);
razorPayModel.value = RazorPayModel.fromJson(
jsonDecode(Preferences.getString(Preferences.razorpaySettings)),
);
midTransModel.value = MidTrans.fromJson(
jsonDecode(Preferences.getString(Preferences.midTransSettings)),
);
orangeMoneyModel.value = OrangeMoney.fromJson(
jsonDecode(Preferences.getString(Preferences.orangeMoneySettings)),
);
xenditModel.value = Xendit.fromJson(
jsonDecode(Preferences.getString(Preferences.xenditSettings)),
);
walletSettingModel.value = WalletSettingModel.fromJson(
jsonDecode(Preferences.getString(Preferences.walletSettings)),
);
cashOnDeliverySettingModel.value = CodSettingModel.fromJson(
jsonDecode(Preferences.getString(Preferences.codSettings)),
);
if (walletSettingModel.value.isEnabled == true) {
selectedPaymentMethod.value = PaymentGateway.wallet.name;
@@ -257,20 +316,32 @@ class ParcelOrderConfirmationController extends GetxController {
Future<void> stripeMakePayment({required String amount}) async {
log(double.parse(amount).toStringAsFixed(0));
try {
Map<String, dynamic>? paymentIntentData = await createStripeIntent(amount: amount);
Map<String, dynamic>? paymentIntentData = await createStripeIntent(
amount: amount,
);
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(
paymentIntentClientSecret: paymentIntentData['client_secret'],
allowsDelayedPaymentMethods: false,
googlePay: const PaymentSheetGooglePay(merchantCountryCode: 'US', testEnv: true, currencyCode: "USD"),
googlePay: const PaymentSheetGooglePay(
merchantCountryCode: 'US',
testEnv: true,
currencyCode: "USD",
),
customFlow: true,
style: ThemeMode.system,
appearance: PaymentSheetAppearance(colors: PaymentSheetAppearanceColors(primary: AppThemeData.primary300)),
appearance: PaymentSheetAppearance(
colors: PaymentSheetAppearanceColors(
primary: AppThemeData.primary300,
),
),
merchantDisplayName: 'GoRide',
),
);
@@ -316,7 +387,10 @@ class ParcelOrderConfirmationController extends GetxController {
var response = await http.post(
Uri.parse('https://api.stripe.com/v1/payment_intents'),
body: body,
headers: {'Authorization': 'Bearer $stripeSecret', 'Content-Type': 'application/x-www-form-urlencoded'},
headers: {
'Authorization': 'Bearer $stripeSecret',
'Content-Type': 'application/x-www-form-urlencoded',
},
);
return jsonDecode(response.body);
@@ -326,8 +400,14 @@ class ParcelOrderConfirmationController extends GetxController {
}
//mercadoo
Future<Null> mercadoPagoMakePayment({required BuildContext context, required String amount}) async {
final headers = {'Authorization': 'Bearer ${mercadoPagoModel.value.accessToken}', 'Content-Type': 'application/json'};
Future<Null> mercadoPagoMakePayment({
required BuildContext context,
required String amount,
}) async {
final headers = {
'Authorization': 'Bearer ${mercadoPagoModel.value.accessToken}',
'Content-Type': 'application/json',
};
final body = jsonEncode({
"items": [
@@ -340,12 +420,20 @@ class ParcelOrderConfirmationController extends GetxController {
},
],
"payer": {"email": Constant.userModel?.email},
"back_urls": {"failure": "${Constant.globalUrl}payment/failure", "pending": "${Constant.globalUrl}payment/pending", "success": "${Constant.globalUrl}payment/success"},
"back_urls": {
"failure": "${Constant.globalUrl}payment/failure",
"pending": "${Constant.globalUrl}payment/pending",
"success": "${Constant.globalUrl}payment/success",
},
"auto_return": "approved",
// Automatically return after payment is approved
});
final response = await http.post(Uri.parse("https://api.mercadopago.com/checkout/preferences"), headers: headers, body: body);
final response = await http.post(
Uri.parse("https://api.mercadopago.com/checkout/preferences"),
headers: headers,
body: body,
);
if (response.statusCode == 200 || response.statusCode == 201) {
final data = jsonDecode(response.body);
@@ -375,8 +463,8 @@ class ParcelOrderConfirmationController extends GetxController {
sandboxMode: payPalModel.value.isLive == true ? false : true,
clientId: payPalModel.value.paypalClient ?? '',
secretKey: payPalModel.value.paypalSecret ?? '',
returnURL: "com.emart.customer://paypalpay",
cancelURL: "com.emart.customer://paypalcancel",
returnURL: "felix.fondex.uz://paypalpay",
cancelURL: "felix.fondex.uz://paypalcancel",
transactions: [
{
@@ -418,8 +506,8 @@ class ParcelOrderConfirmationController extends GetxController {
// secretKey: payPalModel.value.paypalSecret ?? '',
// returnURL: "https://success.emart.com/return",
// cancelURL: "https://cancel.emart.com/cancel",
// // returnURL: "com.emart.customer://paypalpay",
// // cancelURL: "com.emart.customer://paypalpay",
// // returnURL: "felix.fondex.uz://paypalpay",
// // cancelURL: "felix.fondex.uz://paypalpay",
// transactions: [
// {
// "amount": {
@@ -477,17 +565,25 @@ class ParcelOrderConfirmationController extends GetxController {
}
});
} else {
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast(
"Something went wrong, please contact admin.".tr,
);
}
});
}
///flutter wave Payment Method
Future<void> flutterWaveInitiatePayment({required BuildContext context, required String amount}) async {
Future<void> flutterWaveInitiatePayment({
required BuildContext context,
required String amount,
}) async {
setRef(); // make sure you generate reference
final url = Uri.parse('https://api.flutterwave.com/v3/payments');
final headers = {'Authorization': 'Bearer ${flutterWaveModel.value.secretKey}', 'Content-Type': 'application/json'};
final headers = {
'Authorization': 'Bearer ${flutterWaveModel.value.secretKey}',
'Content-Type': 'application/json',
};
final body = jsonEncode({
"tx_ref": _ref,
@@ -495,8 +591,15 @@ class ParcelOrderConfirmationController extends GetxController {
"currency": "NGN",
"redirect_url": "${Constant.globalUrl}payment/success",
"payment_options": "ussd, card, barter, payattitude",
"customer": {"email": Constant.userModel?.email.toString(), "phonenumber": Constant.userModel?.phoneNumber, "name": Constant.userModel?.fullName()},
"customizations": {"title": "Payment for Services", "description": "Payment for XYZ services"},
"customer": {
"email": Constant.userModel?.email.toString(),
"phonenumber": Constant.userModel?.phoneNumber,
"name": Constant.userModel?.fullName(),
},
"customizations": {
"title": "Payment for Services",
"description": "Payment for XYZ services",
},
});
final response = await http.post(url, headers: headers, body: body);
@@ -504,7 +607,9 @@ class ParcelOrderConfirmationController extends GetxController {
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
Get.to(MercadoPagoScreen(initialURl: data['data']['link']))!.then((value) async {
Get.to(MercadoPagoScreen(initialURl: data['data']['link']))!.then((
value,
) async {
bool isVerified = await verifyFlutterWavePayment(_ref!);
if (isVerified) {
@@ -522,13 +627,19 @@ class ParcelOrderConfirmationController extends GetxController {
Future<bool> verifyFlutterWavePayment(String txRef) async {
try {
final url = Uri.parse("https://api.flutterwave.com/v3/transactions/verify_by_reference?tx_ref=$txRef");
final headers = {'Authorization': 'Bearer ${flutterWaveModel.value.secretKey}', 'Content-Type': 'application/json'};
final url = Uri.parse(
"https://api.flutterwave.com/v3/transactions/verify_by_reference?tx_ref=$txRef",
);
final headers = {
'Authorization': 'Bearer ${flutterWaveModel.value.secretKey}',
'Content-Type': 'application/json',
};
final response = await http.get(url, headers: headers);
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
if (data['status'] == 'success' && data['data']['status'] == 'successful') {
if (data['status'] == 'success' &&
data['data']['status'] == 'successful') {
return true; // ✅ Payment confirmed
}
}
@@ -554,8 +665,14 @@ class ParcelOrderConfirmationController extends GetxController {
// payFast
void payFastPayment({required BuildContext context, required String amount}) {
PayStackURLGen.getPayHTML(payFastSettingData: payFastModel.value, amount: amount.toString(), userModel: Constant.userModel!).then((String? value) async {
bool isDone = await Get.to(PayFastScreen(htmlData: value!, payFastSettingData: payFastModel.value));
PayStackURLGen.getPayHTML(
payFastSettingData: payFastModel.value,
amount: amount.toString(),
userModel: Constant.userModel!,
).then((String? value) async {
bool isDone = await Get.to(
PayFastScreen(htmlData: value!, payFastSettingData: payFastModel.value),
);
if (isDone) {
Get.back();
ShowToastDialog.showToast("Payment successfully".tr);
@@ -576,26 +693,50 @@ class ParcelOrderConfirmationController extends GetxController {
final response = await http.post(
Uri.parse(getChecksum),
headers: {},
body: {"mid": paytmModel.value.paytmMID.toString(), "order_id": orderId, "key_secret": paytmModel.value.pAYTMMERCHANTKEY.toString()},
body: {
"mid": paytmModel.value.paytmMID.toString(),
"order_id": orderId,
"key_secret": paytmModel.value.pAYTMMERCHANTKEY.toString(),
},
);
final data = jsonDecode(response.body);
await verifyCheckSum(checkSum: data["code"], amount: amount, orderId: orderId).then((value) {
await verifyCheckSum(
checkSum: data["code"],
amount: amount,
orderId: orderId,
).then((value) {
initiatePayment(amount: amount, orderId: orderId).then((value) {
String callback = "";
if (paytmModel.value.isSandboxEnabled == true) {
callback = "${callback}https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=$orderId";
callback =
"${callback}https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=$orderId";
} else {
callback = "${callback}https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=$orderId";
callback =
"${callback}https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=$orderId";
}
GetPaymentTxtTokenModel result = value;
startTransaction(context, txnTokenBy: result.body.txnToken ?? '', orderId: orderId, amount: amount, callBackURL: callback, isStaging: paytmModel.value.isSandboxEnabled);
startTransaction(
context,
txnTokenBy: result.body.txnToken ?? '',
orderId: orderId,
amount: amount,
callBackURL: callback,
isStaging: paytmModel.value.isSandboxEnabled,
);
});
});
}
Future<void> startTransaction(context, {required String txnTokenBy, required orderId, required double amount, required callBackURL, required isStaging}) async {
Future<void> startTransaction(
context, {
required String txnTokenBy,
required orderId,
required double amount,
required callBackURL,
required isStaging,
}) async {
// try {
// var response = AllInOneSdk.startTransaction(
// paytmModel.value.paytmMID.toString(),
@@ -631,28 +772,44 @@ class ParcelOrderConfirmationController extends GetxController {
// }
}
Future verifyCheckSum({required String checkSum, required double amount, required orderId}) async {
Future verifyCheckSum({
required String checkSum,
required double amount,
required orderId,
}) async {
String getChecksum = "${Constant.globalUrl}payments/validatechecksum";
final response = await http.post(
Uri.parse(getChecksum),
headers: {},
body: {"mid": paytmModel.value.paytmMID.toString(), "order_id": orderId, "key_secret": paytmModel.value.pAYTMMERCHANTKEY.toString(), "checksum_value": checkSum},
body: {
"mid": paytmModel.value.paytmMID.toString(),
"order_id": orderId,
"key_secret": paytmModel.value.pAYTMMERCHANTKEY.toString(),
"checksum_value": checkSum,
},
);
final data = jsonDecode(response.body);
return data['status'];
}
Future<GetPaymentTxtTokenModel> initiatePayment({required double amount, required String orderId}) async {
Future<GetPaymentTxtTokenModel> initiatePayment({
required double amount,
required String orderId,
}) async {
String initiateURL = "${Constant.globalUrl}payments/initiatepaytmpayment";
String callback =
(paytmModel.value.isSandboxEnabled ?? false) ? "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=$orderId" : "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=$orderId";
(paytmModel.value.isSandboxEnabled ?? false)
? "https://securegw-stage.paytm.in/theia/paytmCallback?ORDER_ID=$orderId"
: "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=$orderId";
print("INITIATE PAYMENT CALL:");
print("MID: ${paytmModel.value.paytmMID}");
print("OrderId: $orderId");
print("Amount: $amount");
print("Env: ${(paytmModel.value.isSandboxEnabled ?? false) ? "STAGING" : "LIVE"}");
print(
"Env: ${(paytmModel.value.isSandboxEnabled ?? false) ? "STAGING" : "LIVE"}",
);
final response = await http.post(
Uri.parse(initiateURL),
@@ -671,9 +828,12 @@ class ParcelOrderConfirmationController extends GetxController {
log("Paytm Initiate Response: ${response.body}");
final data = jsonDecode(response.body);
if (data["body"]["txnToken"] == null || data["body"]["txnToken"].toString().isEmpty) {
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);
@@ -723,7 +883,10 @@ class ParcelOrderConfirmationController extends GetxController {
'description': 'wallet Topup',
'retry': {'enabled': true, 'max_count': 1},
'send_sms_hash': true,
'prefill': {'contact': Constant.userModel?.phoneNumber, 'email': Constant.userModel?.email},
'prefill': {
'contact': Constant.userModel?.phoneNumber,
'email': Constant.userModel?.email,
},
'external': {
'wallets': ['paytm'],
},
@@ -758,7 +921,10 @@ class ParcelOrderConfirmationController extends GetxController {
}
//Midtrans payment
Future<void> midtransMakePayment({required String amount, required BuildContext context}) async {
Future<void> midtransMakePayment({
required String amount,
required BuildContext context,
}) async {
await createPaymentLink(amount: amount).then((url) {
ShowToastDialog.closeLoader();
if (url != '') {
@@ -776,15 +942,30 @@ class ParcelOrderConfirmationController extends GetxController {
Future<String> createPaymentLink({required var amount}) async {
var ordersId = const Uuid().v1();
final url = Uri.parse(midTransModel.value.isSandbox! ? 'https://api.sandbox.midtrans.com/v1/payment-links' : 'https://api.midtrans.com/v1/payment-links');
final url = Uri.parse(
midTransModel.value.isSandbox!
? 'https://api.sandbox.midtrans.com/v1/payment-links'
: 'https://api.midtrans.com/v1/payment-links',
);
final response = await http.post(
url,
headers: {'Accept': 'application/json', 'Content-Type': 'application/json', 'Authorization': generateBasicAuthHeader(midTransModel.value.serverKey!)},
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': generateBasicAuthHeader(
midTransModel.value.serverKey!,
),
},
body: jsonEncode({
'transaction_details': {'order_id': ordersId, 'gross_amount': double.parse(amount.toString()).toInt()},
'transaction_details': {
'order_id': ordersId,
'gross_amount': double.parse(amount.toString()).toInt(),
},
'usage_limit': 2,
"callbacks": {"finish": "https://www.google.com?merchant_order_id=$ordersId"},
"callbacks": {
"finish": "https://www.google.com?merchant_order_id=$ordersId",
},
}),
);
@@ -792,7 +973,9 @@ class ParcelOrderConfirmationController 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 '';
}
}
@@ -809,7 +992,10 @@ class ParcelOrderConfirmationController extends GetxController {
static String orderId = '';
static String amount = '';
Future<void> orangeMakePayment({required String amount, required BuildContext context}) async {
Future<void> orangeMakePayment({
required String amount,
required BuildContext context,
}) async {
reset();
var id = const Uuid().v4();
debugPrint('🟩 Starting OrangePay Payment...');
@@ -817,14 +1003,28 @@ class ParcelOrderConfirmationController extends GetxController {
ShowToastDialog.showLoader("Initializing payment...".tr);
var paymentURL = await fetchToken(context: context, orderId: id, amount: amount, currency: 'USD');
var paymentURL = await fetchToken(
context: context,
orderId: id,
amount: amount,
currency: 'USD',
);
ShowToastDialog.closeLoader();
if (paymentURL.toString().isNotEmpty) {
debugPrint('✅ Payment URL fetched successfully: $paymentURL');
Get.to(() => OrangeMoneyScreen(initialURl: paymentURL, accessToken: accessToken, amount: amount, orangePay: orangeMoneyModel.value, orderId: orderId, payToken: payToken))?.then((value) async {
Get.to(
() => OrangeMoneyScreen(
initialURl: paymentURL,
accessToken: accessToken,
amount: amount,
orangePay: orangeMoneyModel.value,
orderId: orderId,
payToken: payToken,
),
)?.then((value) async {
if (value == true) {
ShowToastDialog.showToast("Payment Successful!!".tr);
debugPrint('🎉 Payment Successful for Order ID: $orderId');
@@ -844,16 +1044,27 @@ class ParcelOrderConfirmationController extends GetxController {
}
}
Future fetchToken({required String orderId, required String currency, required BuildContext context, required String amount}) async {
Future fetchToken({
required String orderId,
required String currency,
required BuildContext context,
required String amount,
}) async {
const String apiUrl = 'https://api.orange.com/oauth/v3/token';
final Map<String, String> requestBody = {'grant_type': 'client_credentials'};
final Map<String, String> requestBody = {
'grant_type': 'client_credentials',
};
debugPrint('🔐 Fetching access token from Orange API...');
debugPrint('📡 POST $apiUrl');
final response = await http.post(
Uri.parse(apiUrl),
headers: {'Authorization': "Basic ${orangeMoneyModel.value.auth!}", 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json'},
headers: {
'Authorization': "Basic ${orangeMoneyModel.value.auth!}",
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
},
body: requestBody,
);
@@ -865,19 +1076,34 @@ class ParcelOrderConfirmationController extends GetxController {
accessToken = responseData['access_token'];
debugPrint('✅ Access Token Received: $accessToken');
return await webpayment(context: context, amountData: amount, currency: currency, orderIdData: orderId);
return await webpayment(
context: context,
amountData: amount,
currency: currency,
orderIdData: orderId,
);
} else {
debugPrint('❌ Failed to fetch access token.');
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast(
"Something went wrong, please contact admin.".tr,
);
return '';
}
}
Future webpayment({required String orderIdData, required BuildContext context, required String currency, required String amountData}) async {
Future webpayment({
required String orderIdData,
required BuildContext context,
required String currency,
required String amountData,
}) async {
orderId = orderIdData;
amount = amountData;
String apiUrl = orangeMoneyModel.value.isSandbox == true ? 'https://api.orange.com/orange-money-webpay/dev/v1/webpayment' : 'https://api.orange.com/orange-money-webpay/cm/v1/webpayment';
String apiUrl =
orangeMoneyModel.value.isSandbox == true
? 'https://api.orange.com/orange-money-webpay/dev/v1/webpayment'
: 'https://api.orange.com/orange-money-webpay/cm/v1/webpayment';
// ✅ Ensure amount formatted correctly
String formattedAmount = double.parse(amountData).toStringAsFixed(2);
@@ -900,7 +1126,11 @@ class ParcelOrderConfirmationController extends GetxController {
final response = await http.post(
Uri.parse(apiUrl),
headers: {'Authorization': 'Bearer $accessToken', 'Content-Type': 'application/json', 'Accept': 'application/json'},
headers: {
'Authorization': 'Bearer $accessToken',
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: json.encode(requestBody),
);
@@ -920,7 +1150,9 @@ class ParcelOrderConfirmationController extends GetxController {
}
} else {
debugPrint('❌ Payment request failed.');
ShowToastDialog.showToast("Something went wrong, please contact admin.".tr);
ShowToastDialog.showToast(
"Something went wrong, please contact admin.".tr,
);
return '';
}
}
@@ -938,7 +1170,13 @@ class ParcelOrderConfirmationController extends GetxController {
await createXenditInvoice(amount: amount).then((model) {
ShowToastDialog.closeLoader();
if (model.id != null) {
Get.to(() => XenditScreen(initialURl: model.invoiceUrl ?? '', transId: model.id ?? '', apiKey: xenditModel.value.apiKey!.toString()))!.then((value) {
Get.to(
() => XenditScreen(
initialURl: model.invoiceUrl ?? '',
transId: model.id ?? '',
apiKey: xenditModel.value.apiKey!.toString(),
),
)!.then((value) {
if (value == true) {
ShowToastDialog.showToast("Payment Successful!!".tr);
placeOrder();
@@ -955,7 +1193,9 @@ class ParcelOrderConfirmationController extends GetxController {
const url = 'https://api.xendit.co/v2/invoices';
var headers = {
'Content-Type': 'application/json',
'Authorization': generateBasicAuthHeader(xenditModel.value.apiKey!.toString()),
'Authorization': generateBasicAuthHeader(
xenditModel.value.apiKey!.toString(),
),
// 'Cookie': '__cf_bm=yERkrx3xDITyFGiou0bbKY1bi7xEwovHNwxV1vCNbVc-1724155511-1.0.1.1-jekyYQmPCwY6vIJ524K0V6_CEw6O.dAwOmQnHtwmaXO_MfTrdnmZMka0KZvjukQgXu5B.K_6FJm47SGOPeWviQ',
};
@@ -968,7 +1208,11 @@ class ParcelOrderConfirmationController extends GetxController {
});
try {
final response = await http.post(Uri.parse(url), headers: headers, body: body);
final response = await http.post(
Uri.parse(url),
headers: headers,
body: body,
);
if (response.statusCode == 200 || response.statusCode == 201) {
XenditModel model = XenditModel.fromJson(jsonDecode(response.body));

View File

@@ -1,7 +1,8 @@
// File generated by FlutterFire CLI.
// ignore_for_file: type=lint
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
/// Default [FirebaseOptions] for use with your Firebase apps.
///
@@ -18,7 +19,7 @@ class DefaultFirebaseOptions {
if (kIsWeb) {
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for web - '
'you can reconfigure this by running the FlutterFire CLI again.',
'you can reconfigure this by running the FlutterFire CLI again.',
);
}
switch (defaultTargetPlatform) {
@@ -29,17 +30,17 @@ class DefaultFirebaseOptions {
case TargetPlatform.macOS:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for macos - '
'you can reconfigure this by running the FlutterFire CLI again.',
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
'you can reconfigure this by running the FlutterFire CLI again.',
'you can reconfigure this by running the FlutterFire CLI again.',
);
case TargetPlatform.linux:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for linux - '
'you can reconfigure this by running the FlutterFire CLI again.',
'you can reconfigure this by running the FlutterFire CLI again.',
);
default:
throw UnsupportedError(
@@ -64,8 +65,8 @@ class DefaultFirebaseOptions {
projectId: 'fondexuzb',
databaseURL: 'https://fondexuzb-default-rtdb.firebaseio.com',
storageBucket: 'fondexuzb.firebasestorage.app',
iosClientId: '893074789710-pv12m4nhe82a4ueg9sb2pgt42r0e5da3.apps.googleusercontent.com',
iosBundleId: 'com.emart.customer',
iosClientId:
'893074789710-pv12m4nhe82a4ueg9sb2pgt42r0e5da3.apps.googleusercontent.com',
iosBundleId: 'felix.fondex.uz',
);
}
}

View File

@@ -1,3 +1,5 @@
import 'package:customer/constant/const_texts.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -36,7 +38,7 @@ class ForgotPasswordScreen extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Skip".tr,
ConstTexts.skip.tr(),
style: AppThemeData.mediumTextStyle(
color:
isDark
@@ -72,8 +74,7 @@ class ForgotPasswordScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Enter your registered email to receive a reset link."
.tr,
ConstTexts.enterYourregisteredEmail.tr(),
style: AppThemeData.boldTextStyle(
fontSize: 24,
color:
@@ -84,14 +85,14 @@ class ForgotPasswordScreen extends StatelessWidget {
),
const SizedBox(height: 24),
TextFieldWidget(
title: "Email Address*".tr,
hintText: "jerome014@gmail.com",
title: ConstTexts.emailAddress.tr(),
hintText: "abdusalom@gmail.com",
controller: controller.emailEditingController.value,
),
const SizedBox(height: 30),
RoundedButtonFill(
borderRadius: 10.r,
title: "Send Link".tr,
title: ConstTexts.sendLink.tr(),
onPress: controller.forgotPassword,
color:
isDark
@@ -111,7 +112,7 @@ class ForgotPasswordScreen extends StatelessWidget {
child: Center(
child: Text.rich(
TextSpan(
text: "Remember Password?".tr,
text: ConstTexts.rememberPassword.tr(),
style: AppThemeData.mediumTextStyle(
color:
isDark
@@ -120,7 +121,7 @@ class ForgotPasswordScreen extends StatelessWidget {
),
children: [
TextSpan(
text: "Log in".tr,
text: ConstTexts.login.tr(),
style: AppThemeData.mediumTextStyle(
color: AppThemeData.ecommerce300,
decoration: TextDecoration.underline,

View File

@@ -1,7 +1,9 @@
import 'dart:io';
import 'package:customer/constant/const_texts.dart';
import 'package:customer/screen_ui/auth_screens/sign_up_screen.dart';
import 'package:customer/screen_ui/location_enable_screens/location_permission_screen.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -36,7 +38,7 @@ class LoginScreen extends StatelessWidget {
child: Row(
children: [
Text(
"Skip".tr,
ConstTexts.skip.tr(),
style: AppThemeData.mediumTextStyle(
color:
isDark
@@ -70,8 +72,8 @@ class LoginScreen extends StatelessWidget {
children: [
const SizedBox(height: 20),
Text(
"Log in to explore your all in one vendor app favourites and shop effortlessly."
.tr,
ConstTexts.loginToExplore.tr()
,
style: AppThemeData.boldTextStyle(
fontSize: 24,
color:
@@ -82,15 +84,15 @@ class LoginScreen extends StatelessWidget {
),
const SizedBox(height: 24),
TextFieldWidget(
title: "Email Address*".tr,
hintText: "jerome014@gmail.com",
title: ConstTexts.emailAddress.tr(),
hintText: "abdusalom@gmail.com",
controller: controller.emailController.value,
focusNode: controller.emailFocusNode,
),
const SizedBox(height: 15),
TextFieldWidget(
title: "Password*".tr,
hintText: "Enter password".tr,
title: ConstTexts.password.tr(),
hintText: ConstTexts.enterPassword.tr(),
controller: controller.passwordController.value,
obscureText: controller.passwordVisible.value,
focusNode: controller.passwordFocusNode,
@@ -132,7 +134,7 @@ class LoginScreen extends StatelessWidget {
() => const ForgotPasswordScreen(),
),
child: Text(
"Forgot Password".tr,
ConstTexts.forgotPassword.tr(),
style: AppThemeData.semiBoldTextStyle(
color: AppThemeData.info400,
),
@@ -142,7 +144,7 @@ class LoginScreen extends StatelessWidget {
const SizedBox(height: 20),
RoundedButtonFill(
borderRadius: 10.r,
title: "Log in".tr,
title: ConstTexts.login.tr(),
onPress: controller.loginWithEmail,
color:
isDark
@@ -167,7 +169,7 @@ class LoginScreen extends StatelessWidget {
),
const SizedBox(width: 15),
Text(
"or continue with".tr,
ConstTexts.orContinueWith.tr(),
style: AppThemeData.regularTextStyle(
color:
isDark
@@ -191,7 +193,7 @@ class LoginScreen extends StatelessWidget {
const SizedBox(height: 25),
RoundedButtonFill(
borderRadius: 10.r,
title: "Mobile number".tr,
title: ConstTexts.mobileNumber.tr(),
onPress:
() => Get.to(() => const MobileLoginScreen()),
isRight: false,
@@ -217,7 +219,7 @@ class LoginScreen extends StatelessWidget {
Expanded(
child: RoundedButtonFill(
borderRadius: 10.r,
title: "with Google".tr,
title: ConstTexts.withGoogle.tr(),
textColor:
isDark
? AppThemeData.grey100
@@ -241,7 +243,7 @@ class LoginScreen extends StatelessWidget {
? Expanded(
child: RoundedButtonFill(
borderRadius: 10.r,
title: "with Apple".tr,
title: ConstTexts.withApple.tr(),
isCenter: true,
textColor:
isDark
@@ -272,7 +274,7 @@ class LoginScreen extends StatelessWidget {
child: Center(
child: Text.rich(
TextSpan(
text: "Didn't have an account?".tr,
text: ConstTexts.dontHaveAccount.tr(),
style: AppThemeData.mediumTextStyle(
color:
isDark
@@ -281,7 +283,7 @@ class LoginScreen extends StatelessWidget {
),
children: [
TextSpan(
text: "Sign up".tr,
text: ConstTexts.signUp.tr(),
style: AppThemeData.mediumTextStyle(
color: AppThemeData.ecommerce300,
decoration: TextDecoration.underline,

View File

@@ -1,6 +1,8 @@
import 'package:country_code_picker/country_code_picker.dart';
import 'package:customer/constant/const_texts.dart';
import 'package:customer/screen_ui/auth_screens/sign_up_screen.dart';
import 'package:customer/screen_ui/location_enable_screens/location_permission_screen.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -53,7 +55,7 @@ class MobileLoginScreen extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Skip".tr,
ConstTexts.skip.tr(),
style: AppThemeData.mediumTextStyle(
color:
isDark
@@ -89,8 +91,7 @@ class MobileLoginScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Use your mobile number to Log in easily and securely."
.tr,
ConstTexts.useYourMobileNumber.tr(),
style: AppThemeData.boldTextStyle(
fontSize: 24,
color:
@@ -101,8 +102,8 @@ class MobileLoginScreen extends StatelessWidget {
),
const SizedBox(height: 25),
TextFieldWidget(
title: "Mobile Number*".tr,
hintText: "Enter Mobile number".tr,
title: ConstTexts.mobileNumber.tr(),
hintText: ConstTexts.enterMobileNumber.tr(),
controller: controller.mobileController.value,
textInputType:
const TextInputType.numberWithOptions(
@@ -181,7 +182,7 @@ class MobileLoginScreen extends StatelessWidget {
const SizedBox(height: 30),
RoundedButtonFill(
borderRadius: 10.r,
title: "Send Code".tr,
title: ConstTexts.sendCode.tr(),
onPress: controller.sendOtp,
color:
isDark
@@ -206,7 +207,7 @@ class MobileLoginScreen extends StatelessWidget {
),
const SizedBox(width: 15),
Text(
"or continue with".tr,
ConstTexts.orContinueWith.tr(),
style: AppThemeData.regularTextStyle(
color:
isDark
@@ -228,7 +229,7 @@ class MobileLoginScreen extends StatelessWidget {
const SizedBox(height: 25),
RoundedButtonFill(
borderRadius: 10.r,
title: "Email address".tr,
title: ConstTexts.emailAddress.tr(),
onPress: () => Get.to(() => const SignUpScreen()),
isRight: false,
isCenter: true,
@@ -256,7 +257,7 @@ class MobileLoginScreen extends StatelessWidget {
child: Center(
child: Text.rich(
TextSpan(
text: "Didn't have an account?".tr,
text: ConstTexts.dontHaveAccount.tr(),
style: AppThemeData.mediumTextStyle(
color:
isDark
@@ -265,7 +266,7 @@ class MobileLoginScreen extends StatelessWidget {
),
children: [
TextSpan(
text: "Sign up".tr,
text: ConstTexts.signUp.tr(),
style: AppThemeData.mediumTextStyle(
color: AppThemeData.ecommerce300,
decoration: TextDecoration.underline,

View File

@@ -1,4 +1,6 @@
import 'package:customer/constant/const_texts.dart';
import 'package:customer/screen_ui/auth_screens/sign_up_screen.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@@ -49,7 +51,7 @@ class OtpVerificationScreen extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Skip".tr,
ConstTexts.skip.tr(),
style: AppThemeData.mediumTextStyle(
color:
isDark
@@ -85,7 +87,7 @@ class OtpVerificationScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"${"Enter the OTP sent to your mobile".tr} ${controller.countryCode} ${controller.maskPhoneNumber(controller.phoneNumber.value)}",
"${ConstTexts.enterOtpSent.tr()} ${controller.countryCode} ${controller.maskPhoneNumber(controller.phoneNumber.value)}",
style: AppThemeData.boldTextStyle(
fontSize: 24,
color:
@@ -163,7 +165,7 @@ class OtpVerificationScreen extends StatelessWidget {
controller.sendOTP();
},
child: Text(
"Resend OTP".tr,
ConstTexts.resendOTP.tr(),
style: AppThemeData.semiBoldTextStyle(
color: AppThemeData.info400,
fontSize: 16,
@@ -178,7 +180,7 @@ class OtpVerificationScreen extends StatelessWidget {
/// Verify Button
RoundedButtonFill(
borderRadius: 10.r,
title: "Verify".tr,
title: ConstTexts.verify.tr(),
onPress: controller.verifyOtp,
color:
isDark
@@ -198,7 +200,7 @@ class OtpVerificationScreen extends StatelessWidget {
child: Center(
child: Text.rich(
TextSpan(
text: "Didn't have an account?".tr,
text: ConstTexts.dontHaveAccount.tr(),
style: AppThemeData.mediumTextStyle(
color:
isDark
@@ -207,7 +209,7 @@ class OtpVerificationScreen extends StatelessWidget {
),
children: [
TextSpan(
text: "Sign up".tr,
text: ConstTexts.signUp.tr(),
style: AppThemeData.mediumTextStyle(
color: AppThemeData.ecommerce300,
decoration: TextDecoration.underline,

View File

@@ -1,5 +1,7 @@
import 'package:country_code_picker/country_code_picker.dart';
import 'package:customer/constant/const_texts.dart';
import 'package:customer/screen_ui/location_enable_screens/location_permission_screen.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -34,14 +36,33 @@ class SignUpScreen extends StatelessWidget {
onPressed: () {
Get.to(() => LocationPermissionScreen());
},
style: TextButton.styleFrom(padding: const EdgeInsets.symmetric(horizontal: 12), minimumSize: const Size(0, 40), tapTargetSize: MaterialTapTargetSize.shrinkWrap),
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(horizontal: 12),
minimumSize: const Size(0, 40),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text("Skip".tr, style: AppThemeData.mediumTextStyle(color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500)),
Text(
ConstTexts.skip.tr(),
style: AppThemeData.mediumTextStyle(
color:
isDark
? AppThemeData.greyDark500
: AppThemeData.grey500,
),
),
Padding(
padding: const EdgeInsets.only(top: 2),
child: Icon(Icons.arrow_forward_ios, size: 16, color: isDark ? AppThemeData.greyDark500 : AppThemeData.grey500),
child: Icon(
Icons.arrow_forward_ios,
size: 16,
color:
isDark
? AppThemeData.greyDark500
: AppThemeData.grey500,
),
),
],
),
@@ -57,62 +78,125 @@ class SignUpScreen extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Sign up to explore all our services and start shopping, riding, and more.".tr,
style: AppThemeData.boldTextStyle(fontSize: 24, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
ConstTexts.signUpToExplore.tr(),
style: AppThemeData.boldTextStyle(
fontSize: 24,
color:
isDark
? AppThemeData.greyDark900
: AppThemeData.grey900,
),
),
const SizedBox(height: 24),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: TextFieldWidget(title: "First Name*".tr, hintText: "Jerome".tr, controller: controller.firstNameController.value)),
Expanded(
child: TextFieldWidget(
title: ConstTexts.firstName.tr(),
hintText: "Abdusalom",
controller: controller.firstNameController.value,
),
),
const SizedBox(width: 10),
Expanded(child: TextFieldWidget(title: "Last Name*".tr, hintText: "Bell".tr, controller: controller.lastNameController.value)),
Expanded(
child: TextFieldWidget(
title: ConstTexts.lastName.tr(),
hintText: "G'ayratov",
controller: controller.lastNameController.value,
),
),
],
),
const SizedBox(height: 15),
TextFieldWidget(
title: "Email Address*".tr,
hintText: "jerome014@gmail.com",
title: ConstTexts.emailAddress.tr(),
hintText: "abdusalom@gmail.com",
controller: controller.emailController.value,
focusNode: controller.emailFocusNode,
),
const SizedBox(height: 15),
TextFieldWidget(
title: "Mobile Number*".tr,
hintText: "Enter Mobile number".tr,
enable: controller.type.value == "mobileNumber" ? false : true,
title: ConstTexts.mobileNumber.tr(),
hintText: ConstTexts.enterMobileNumber.tr(),
enable:
controller.type.value == "mobileNumber"
? false
: true,
controller: controller.mobileController.value,
textInputType: const TextInputType.numberWithOptions(signed: true, decimal: true),
textInputType: const TextInputType.numberWithOptions(
signed: true,
decimal: true,
),
textInputAction: TextInputAction.done,
inputFormatters: [FilteringTextInputFormatter.allow(RegExp('[0-9]')), LengthLimitingTextInputFormatter(10)],
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp('[0-9]')),
LengthLimitingTextInputFormatter(10),
],
prefix: Row(
mainAxisSize: MainAxisSize.min,
children: [
CountryCodePicker(
onChanged: (value) {
controller.countryCodeController.value.text = value.dialCode ?? Constant.defaultCountryCode;
controller.countryCodeController.value.text =
value.dialCode ?? Constant.defaultCountryCode;
},
initialSelection: controller.countryCodeController.value.text.isNotEmpty ? controller.countryCodeController.value.text : Constant.defaultCountryCode,
initialSelection:
controller
.countryCodeController
.value
.text
.isNotEmpty
? controller
.countryCodeController
.value
.text
: Constant.defaultCountryCode,
showCountryOnly: false,
showOnlyCountryWhenClosed: false,
alignLeft: false,
enabled: controller.type.value != "mobileNumber",
textStyle: TextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : Colors.black),
dialogTextStyle: TextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
searchStyle: TextStyle(fontSize: 16, color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900),
dialogBackgroundColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
textStyle: TextStyle(
fontSize: 16,
color:
isDark
? AppThemeData.greyDark900
: Colors.black,
),
dialogTextStyle: TextStyle(
fontSize: 16,
color:
isDark
? AppThemeData.greyDark900
: AppThemeData.grey900,
),
searchStyle: TextStyle(
fontSize: 16,
color:
isDark
? AppThemeData.greyDark900
: AppThemeData.grey900,
),
dialogBackgroundColor:
isDark
? AppThemeData.surfaceDark
: AppThemeData.surface,
padding: EdgeInsets.zero,
),
// const Icon(Icons.keyboard_arrow_down_rounded, size: 24, color: AppThemeData.grey400),
Container(height: 24, width: 1, color: AppThemeData.grey400),
Container(
height: 24,
width: 1,
color: AppThemeData.grey400,
),
const SizedBox(width: 4),
],
),
),
const SizedBox(height: 15),
TextFieldWidget(
title: "Password*".tr,
hintText: "Enter password".tr,
title: ConstTexts.password.tr(),
hintText: ConstTexts.enterPassword.tr(),
controller: controller.passwordController.value,
obscureText: controller.passwordVisible.value,
focusNode: controller.passwordFocusNode,
@@ -120,78 +204,142 @@ class SignUpScreen extends StatelessWidget {
padding: const EdgeInsets.all(12),
child: InkWell(
onTap: () {
controller.passwordVisible.value = !controller.passwordVisible.value;
controller.passwordVisible.value =
!controller.passwordVisible.value;
},
child:
controller.passwordVisible.value
? SvgPicture.asset(
"assets/icons/ic_password_show.svg",
colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey300 : AppThemeData.grey600, BlendMode.srcIn),
colorFilter: ColorFilter.mode(
isDark
? AppThemeData.grey300
: AppThemeData.grey600,
BlendMode.srcIn,
),
)
: SvgPicture.asset(
"assets/icons/ic_password_close.svg",
colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey300 : AppThemeData.grey600, BlendMode.srcIn),
colorFilter: ColorFilter.mode(
isDark
? AppThemeData.grey300
: AppThemeData.grey600,
BlendMode.srcIn,
),
),
),
),
),
const SizedBox(height: 15),
TextFieldWidget(
title: "Confirm Password*".tr,
hintText: "Enter confirm password".tr,
title: ConstTexts.confirmPassword.tr(),
hintText: ConstTexts.enterConfirmPassword.tr(),
controller: controller.confirmPasswordController.value,
obscureText: controller.conformPasswordVisible.value,
suffix: Padding(
padding: const EdgeInsets.all(12),
child: InkWell(
onTap: () {
controller.conformPasswordVisible.value = !controller.conformPasswordVisible.value;
controller.conformPasswordVisible.value =
!controller.conformPasswordVisible.value;
},
child:
controller.conformPasswordVisible.value
? SvgPicture.asset(
"assets/icons/ic_password_show.svg",
colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey300 : AppThemeData.grey600, BlendMode.srcIn),
colorFilter: ColorFilter.mode(
isDark
? AppThemeData.grey300
: AppThemeData.grey600,
BlendMode.srcIn,
),
)
: SvgPicture.asset(
"assets/icons/ic_password_close.svg",
colorFilter: ColorFilter.mode(isDark ? AppThemeData.grey300 : AppThemeData.grey600, BlendMode.srcIn),
colorFilter: ColorFilter.mode(
isDark
? AppThemeData.grey300
: AppThemeData.grey600,
BlendMode.srcIn,
),
),
),
),
),
const SizedBox(height: 15),
TextFieldWidget(title: "Referral Code".tr, hintText: "Enter referral code".tr, controller: controller.referralController.value),
TextFieldWidget(
title: ConstTexts.referralCode.tr(),
hintText: ConstTexts.enterReferralCode.tr(),
controller: controller.referralController.value,
),
const SizedBox(height: 40),
RoundedButtonFill(
borderRadius: 10.r,
title: "Sign up".tr,
borderRadius: 10.r,
title: ConstTexts.signUp.tr(),
onPress: () => controller.signUp(),
color: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900,
textColor: isDark ? AppThemeData.surfaceDark : AppThemeData.surface,
color:
isDark
? AppThemeData.greyDark900
: AppThemeData.grey900,
textColor:
isDark
? AppThemeData.surfaceDark
: AppThemeData.surface,
),
const SizedBox(height: 25),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(width: 52, height: 1, color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey300),
Container(
width: 52,
height: 1,
color:
isDark
? AppThemeData.greyDark400
: AppThemeData.grey300,
),
const SizedBox(width: 15),
Text("or continue with".tr, style: AppThemeData.regularTextStyle(color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey400)),
Text(
ConstTexts.orContinueWith.tr(),
style: AppThemeData.regularTextStyle(
color:
isDark
? AppThemeData.greyDark400
: AppThemeData.grey400,
),
),
const SizedBox(width: 15),
Container(width: 52, height: 1, color: isDark ? AppThemeData.greyDark400 : AppThemeData.grey300),
Container(
width: 52,
height: 1,
color:
isDark
? AppThemeData.greyDark400
: AppThemeData.grey300,
),
],
),
const SizedBox(height: 25),
RoundedButtonFill(
borderRadius: 10.r,
title: "Mobile number".tr,
borderRadius: 10.r,
title: ConstTexts.mobileNumber.tr(),
onPress: () => Get.to(() => const MobileLoginScreen()),
isRight: false,
isCenter: true,
icon: Icon(Icons.mobile_friendly_outlined, size: 20, color: isDark ? AppThemeData.greyDark900 : null),
icon: Icon(
Icons.mobile_friendly_outlined,
size: 20,
color: isDark ? AppThemeData.greyDark900 : null,
),
//Image.asset(AppAssets.icMessage, width: 20, height: 18, color: isDark ? AppThemeData.greyDark900 : null),
color: isDark ? AppThemeData.greyDark200 : AppThemeData.grey200,
textColor: isDark ? AppThemeData.greyDark900 : AppThemeData.grey900,
color:
isDark
? AppThemeData.greyDark200
: AppThemeData.grey200,
textColor:
isDark
? AppThemeData.greyDark900
: AppThemeData.grey900,
),
const SizedBox(height: 25),
Padding(
@@ -199,11 +347,16 @@ class SignUpScreen extends StatelessWidget {
child: Center(
child: Text.rich(
TextSpan(
text: "Already have an account?".tr,
style: AppThemeData.mediumTextStyle(color: isDark ? AppThemeData.greyDark800 : AppThemeData.grey800),
text: ConstTexts.alreadyHaveAccount.tr(),
style: AppThemeData.mediumTextStyle(
color:
isDark
? AppThemeData.greyDark800
: AppThemeData.grey800,
),
children: [
TextSpan(
text: "Log in".tr,
text: ConstTexts.login.tr(),
style: AppThemeData.mediumTextStyle(
color: AppThemeData.ecommerce300,
decoration: TextDecoration.underline,

View File

@@ -92,8 +92,8 @@ class CabBookingScreen extends StatelessWidget {
'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName:
Platform.isAndroid
? "com.emart.customer"
: "com.emart.customer.ios",
? "felix.fondex.uz"
: "felix.fondex.uz.ios",
),
flutterMap.MarkerLayer(
markers: controller.osmMarker,
@@ -1408,7 +1408,6 @@ class CabBookingScreen extends StatelessWidget {
),
),
const SizedBox(height: 10),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
@@ -1636,6 +1635,7 @@ class CabBookingScreen extends StatelessWidget {
),
),
const SizedBox(height: 20),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
@@ -1778,7 +1778,13 @@ class CabBookingScreen extends StatelessWidget {
),
SizedBox(width: 10.w),
Text(
controller.selectedPaymentMethod.value == "cod" ? "Наличными" : controller.selectedPaymentMethod.value.tr,
controller.selectedPaymentMethod.value ==
"cod"
? "Наличными"
: controller
.selectedPaymentMethod
.value
.tr,
textAlign: TextAlign.start,
style: AppThemeData.boldTextStyle(
fontSize: 16,
@@ -1853,13 +1859,13 @@ class CabBookingScreen extends StatelessWidget {
SizedBox(height: 30),
Text(
"Waiting for driver....".tr,
style: AppThemeData.boldTextStyle(
fontSize: 18.sp,
color:
isDark
? AppThemeData.greyDark900
: AppThemeData.darkGrey,
),
style: AppThemeData.boldTextStyle(
fontSize: 18.sp,
color:
isDark
? AppThemeData.greyDark900
: AppThemeData.darkGrey,
),
),
Image.asset('assets/loader.gif', width: 250),
RoundedButtonFill(
@@ -2946,12 +2952,16 @@ class CabBookingScreen extends StatelessWidget {
borderRadius: BorderRadius.circular(8),
),
),
child: value == PaymentGateway.click || value == PaymentGateway.payme ? Image.asset(image) : Padding(
padding: EdgeInsets.all(
value.name == "payFast" ? 0 : 8.0,
),
child: Image.asset(image),
),
child:
value == PaymentGateway.click ||
value == PaymentGateway.payme
? Image.asset(image)
: Padding(
padding: EdgeInsets.all(
value.name == "payFast" ? 0 : 8.0,
),
child: Image.asset(image),
),
),
const SizedBox(width: 10),
value.name == "wallet"
@@ -2996,7 +3006,9 @@ class CabBookingScreen extends StatelessWidget {
)
: Expanded(
child: Text(
value.name == "cod" ? "Наличными" : value.name.capitalizeString(),
value.name == "cod"
? "Наличными"
: value.name.capitalizeString(),
textAlign: TextAlign.start,
style: AppThemeData.semiBoldTextStyle(
fontSize: 16,

File diff suppressed because it is too large Load Diff

View File

@@ -31,7 +31,7 @@ class LiveTrackingScreen extends StatelessWidget {
mapController: controller.osmMapController,
options: flutterMap.MapOptions(initialCenter: controller.driverCurrent.value, initialZoom: 14),
children: [
flutterMap.TileLayer(urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', userAgentPackageName: 'com.emart.customer'),
flutterMap.TileLayer(urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', userAgentPackageName: 'felix.fondex.uz'),
if (controller.routePoints.isNotEmpty) flutterMap.PolylineLayer(polylines: [flutterMap.Polyline(points: controller.routePoints, strokeWidth: 5.0, color: Colors.blue)]),
flutterMap.MarkerLayer(markers: controller.orderModel.value.id == null ? [] : controller.osmMarkers),
],

View File

@@ -83,7 +83,11 @@ class FireStoreUtils {
static FirebaseFirestore fireStore = FirebaseFirestore.instance;
static String getCurrentUid() {
return auth.FirebaseAuth.instance.currentUser!.uid;
final user = auth.FirebaseAuth.instance.currentUser;
if(user != null){
return user.uid;
}
return "hello";
}
static Future<bool> isLogin() async {

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../controllers/theme_controller.dart';
import 'app_them_data.dart';
@@ -121,7 +122,7 @@ class _TextFieldWidgetState extends State<TextFieldWidget> {
errorBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: const BorderSide(color: Colors.red)),
disabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(8), borderSide: BorderSide(color: borderColor)),
hintText: widget.hintText.tr,
hintStyle: AppThemeData.regularTextStyle(fontSize: 14, color: hintColor),
hintStyle: AppThemeData.regularTextStyle(fontSize: 14.sp, color: hintColor),
),
),
],

View File

@@ -44,7 +44,7 @@ class MapPickerPage extends StatelessWidget {
options: MapOptions(
initialCenter:
controller.pickedPlace.value?.coordinates ??
LatLng(20.5937, 78.9629), // Default India center
LatLng(41.3775, 64.5853), // Default UZB center
initialZoom: 13,
onTap: (tapPos, latlng) {
controller.addLatLngOnly(latlng);
@@ -180,7 +180,8 @@ class MapPickerPage extends StatelessWidget {
title: "Confirm Location".tr,
color: AppThemeData.mainColor,
textColor: AppThemeData.grey50,
height: 4.h,
borderRadius: 12,
height: 6,
onPress: () async {
final selected = controller.pickedPlace.value;
if (selected != null) {