4/16/1
This commit is contained in:
4
.env
4
.env
@@ -23,3 +23,7 @@ geminiApi=QOmqZsQYm08vOqjI7klVJfvP4WBFEoemjgy396iXrXlBl
|
||||
geminiApiMasa=QOmqZsQIdM4BRsKmaDJOP7dZp5-c6NWfch7PAlQXrXlBl
|
||||
agoraAppId=71880f2j636509j24y5294480y30u848XrXlBl
|
||||
agoraAppCertificate=j17q944u49390q758u1649448q2y6xfuXrXlBl
|
||||
usernamePayMob=37319104052XrXlBl
|
||||
passwordPayMob='g@nkD2#99!hD_.wXrXlBl'
|
||||
integrationIdPayMob=0552355XrXlBl
|
||||
payMobApikey='MDrGqKEWS1rVqHvEPDvPjJ7vZDBExrO7S3BEBgrlfUwTA3i5RnP5ZnvoL3M2S9rEBgrlNTdexH5pTPf7NJrvy1reZJv1Tn7zf7vTIDywjHg1C7Ley38HTDyNA3v7TPfdxJrax1rwPmPtMJyzqKEYZeghq3MuLUrFH3A1AgHcH15CZ9UaZTLOxnw0BTdzHHrBArisZerUMUUzZ1BnBeEijHvNjYLnS1BUICMhSmPhA15ifHyVqKEMHWyKLbyuIPvcH9UeL3vZyDf=XrXlBl'
|
||||
@@ -42,4 +42,12 @@ class AK {
|
||||
a.r(a.r(a.r(Env.payPalClientIdLive, cn), cC), cs);
|
||||
static final String payPalSecretLive =
|
||||
a.r(a.r(a.r(Env.payPalSecretLive, cn), cC), cs);
|
||||
static final String integrationIdPayMob =
|
||||
a.r(a.r(a.r(Env.integrationIdPayMob, cn), cC), cs);
|
||||
static final String passwordPayMob =
|
||||
a.r(a.r(a.r(Env.passwordPayMob, cn), cC), cs);
|
||||
static final String usernamePayMob =
|
||||
a.r(a.r(a.r(Env.usernamePayMob, cn), cC), cs);
|
||||
static final String payMobApikey =
|
||||
a.r(a.r(a.r(Env.payMobApikey, cn), cC), cs);
|
||||
}
|
||||
|
||||
@@ -190,6 +190,33 @@ class CRUD {
|
||||
}
|
||||
}
|
||||
|
||||
Future<dynamic> postPayMob({
|
||||
required String link,
|
||||
Map<String, dynamic>? payload,
|
||||
}) async {
|
||||
// String? basicAuthCredentials =
|
||||
// await storage.read(key: BoxName.basicAuthCredentials);
|
||||
var url = Uri.parse(
|
||||
link,
|
||||
);
|
||||
var response = await http.post(url,
|
||||
body: payload, headers: {'Content-Type': 'application/json'});
|
||||
print(response.request);
|
||||
print(payload);
|
||||
|
||||
var jsonData = jsonDecode(response.body);
|
||||
// print(jsonData);
|
||||
if (response.statusCode == 200) {
|
||||
if (jsonData['status'] == 'success') {
|
||||
return response.body;
|
||||
} else {
|
||||
return (jsonData['status']);
|
||||
}
|
||||
} else {
|
||||
return response.statusCode;
|
||||
}
|
||||
}
|
||||
|
||||
sendEmail(
|
||||
String link,
|
||||
Map<String, String>? payload,
|
||||
|
||||
@@ -248,19 +248,22 @@ class HomeCaptainController extends GetxController {
|
||||
}
|
||||
|
||||
getKazanPercent() async {
|
||||
var res = await CRUD().get(link: AppLink.getKazanPercent);
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getKazanPercent,
|
||||
payload: {'country': box.read(BoxName.countryCode).toString()},
|
||||
);
|
||||
if (res != 'failure') {
|
||||
kazan = double.parse(jsonDecode(res)['message'][0]['kazan']);
|
||||
naturePrice = double.parse(jsonDecode(res)['message'][0]['naturePrice']);
|
||||
heavyPrice = double.parse(jsonDecode(res)['message'][0]['heavyPrice']);
|
||||
latePrice = double.parse(jsonDecode(res)['message'][0]['latePrice']);
|
||||
comfortPrice =
|
||||
double.parse(jsonDecode(res)['message'][0]['comfortPrice']);
|
||||
speedPrice = double.parse(jsonDecode(res)['message'][0]['speedPrice']);
|
||||
deliveryPrice =
|
||||
double.parse(jsonDecode(res)['message'][0]['deliveryPrice']);
|
||||
mashwariPrice = double.parse(jsonDecode(res)['message'][0]['freePrice']);
|
||||
fuelPrice = double.parse(jsonDecode(res)['message'][0]['fuelPrice']);
|
||||
var json = jsonDecode(res);
|
||||
kazan = double.parse(json['message'][0]['kazan']);
|
||||
naturePrice = double.parse(json['message'][0]['naturePrice']);
|
||||
heavyPrice = double.parse(json['message'][0]['heavyPrice']);
|
||||
latePrice = double.parse(json['message'][0]['latePrice']);
|
||||
comfortPrice = double.parse(json['message'][0]['comfortPrice']);
|
||||
speedPrice = double.parse(json['message'][0]['speedPrice']);
|
||||
deliveryPrice = double.parse(json['message'][0]['deliveryPrice']);
|
||||
mashwariPrice = double.parse(json['message'][0]['freePrice']);
|
||||
fuelPrice = double.parse(json['message'][0]['fuelPrice']);
|
||||
print(json);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2489,17 +2489,16 @@ class MapPassengerController extends GetxController {
|
||||
);
|
||||
if (res != 'failure') {
|
||||
// print(jsonDecode(res));
|
||||
kazan = double.parse(jsonDecode(res)['message'][0]['kazan']);
|
||||
naturePrice = double.parse(jsonDecode(res)['message'][0]['naturePrice']);
|
||||
heavyPrice = double.parse(jsonDecode(res)['message'][0]['heavyPrice']);
|
||||
latePrice = double.parse(jsonDecode(res)['message'][0]['latePrice']);
|
||||
fuelPrice = double.parse(jsonDecode(res)['message'][0]['fuelPrice']);
|
||||
comfortPrice =
|
||||
double.parse(jsonDecode(res)['message'][0]['comfortPrice']);
|
||||
speedPrice = double.parse(jsonDecode(res)['message'][0]['speedPrice']);
|
||||
mashwariPrice = double.parse(jsonDecode(res)['message'][0]['freePrice']);
|
||||
deliveryPrice =
|
||||
double.parse(jsonDecode(res)['message'][0]['deliveryPrice']);
|
||||
var json = jsonDecode(res);
|
||||
kazan = double.parse(json['message'][0]['kazan']);
|
||||
naturePrice = double.parse(json['message'][0]['naturePrice']);
|
||||
heavyPrice = double.parse(json['message'][0]['heavyPrice']);
|
||||
latePrice = double.parse(json['message'][0]['latePrice']);
|
||||
comfortPrice = double.parse(json['message'][0]['comfortPrice']);
|
||||
speedPrice = double.parse(json['message'][0]['speedPrice']);
|
||||
deliveryPrice = double.parse(json['message'][0]['deliveryPrice']);
|
||||
mashwariPrice = double.parse(json['message'][0]['freePrice']);
|
||||
fuelPrice = double.parse(json['message'][0]['fuelPrice']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:SEFER/controller/home/map_passenger_controller.dart';
|
||||
import 'package:paymob_payment/paymob_payment.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/colors.dart';
|
||||
@@ -457,6 +458,42 @@ class PaymentController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> payWithPayMob(
|
||||
BuildContext context, String amount, currency) async {
|
||||
try {
|
||||
final PaymobResponse? response = await PaymobPayment.instance.pay(
|
||||
context: context,
|
||||
currency: currency, //"EGP",
|
||||
amountInCents: amount, // 19.00 EGP
|
||||
onPayment: (PaymobResponse response) {
|
||||
print('Success: ${response.success}');
|
||||
print('Transaction ID: ${response.transactionID}');
|
||||
print('Response Code: ${response.responseCode}');
|
||||
// print('Message: ${response.message}');
|
||||
},
|
||||
);
|
||||
|
||||
if (response!.responseCode == 'APPROVED') {
|
||||
Get.defaultDialog(
|
||||
title: 'Payment Successful',
|
||||
content: const Text('The payment was approved.'),
|
||||
);
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
title: 'Payment Failed',
|
||||
content:
|
||||
const Text('The payment was not approved. Please try again.'),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
Get.defaultDialog(
|
||||
title: 'Error',
|
||||
content: const Text('An error occurred during the payment process.'),
|
||||
);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
timestamp = now.millisecondsSinceEpoch;
|
||||
|
||||
129
lib/controller/payment/paymob.dart
Normal file
129
lib/controller/payment/paymob.dart
Normal file
@@ -0,0 +1,129 @@
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:dio/dio.dart' as dio;
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../constant/api_key.dart';
|
||||
import '../../main.dart';
|
||||
|
||||
class PaymobManager extends GetxController {
|
||||
String authanticationToken1 = "";
|
||||
String orderId1 = "";
|
||||
|
||||
Future<String> getPaymentKey(int amount, String currency) async {
|
||||
try {
|
||||
String authanticationToken = await _getAuthanticationToken();
|
||||
|
||||
int orderId = await _getOrderId(
|
||||
authanticationToken: authanticationToken,
|
||||
amount: (100 * amount).toString(),
|
||||
currency: currency,
|
||||
);
|
||||
|
||||
String paymentKey = await _getPaymentKey(
|
||||
authanticationToken: authanticationToken,
|
||||
amount: (100 * amount).toString(),
|
||||
currency: currency,
|
||||
orderId: orderId.toString(),
|
||||
);
|
||||
authanticationToken1 = authanticationToken.toString();
|
||||
orderId1 = orderId.toString();
|
||||
update();
|
||||
return paymentKey;
|
||||
} catch (e) {
|
||||
print("Exc==========================================");
|
||||
print(e.toString());
|
||||
throw Exception();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> payWithPayMob(int amount, String currency) async {
|
||||
String key = await PaymobManager().getPaymentKey(amount, currency);
|
||||
await launchUrl(
|
||||
Uri.parse(
|
||||
'https://accept.paymob.com/api/acceptance/iframes/837992?payment_token=$key'),
|
||||
);
|
||||
|
||||
// String paymentStatus = await _getStatusAfterPaid();
|
||||
}
|
||||
|
||||
Future<String> _getStatusAfterPaid() async {
|
||||
print(authanticationToken1);
|
||||
print(orderId1);
|
||||
final dio.Response response = await Dio().post(
|
||||
"https://accept.paymob.com/api/ecommerce/orders/transaction_inquiry",
|
||||
data: {
|
||||
"auth_token": authanticationToken1,
|
||||
"merchant_order_id": "970960",
|
||||
"order_id": orderId1
|
||||
});
|
||||
print(response.data);
|
||||
print(response.data['success']);
|
||||
return response.data["success"];
|
||||
}
|
||||
|
||||
Future<String> _getAuthanticationToken() async {
|
||||
final dio.Response response =
|
||||
await Dio().post("https://accept.paymob.com/api/auth/tokens", data: {
|
||||
"api_key": AK.payMobApikey,
|
||||
'username': AK.usernamePayMob,
|
||||
"password": AK.passwordPayMob,
|
||||
});
|
||||
return response.data["token"];
|
||||
}
|
||||
|
||||
Future<int> _getOrderId({
|
||||
required String authanticationToken,
|
||||
required String amount,
|
||||
required String currency,
|
||||
}) async {
|
||||
final dio.Response response = await Dio()
|
||||
.post("https://accept.paymob.com/api/ecommerce/orders", data: {
|
||||
"auth_token": authanticationToken,
|
||||
"amount_cents": amount,
|
||||
"currency": currency,
|
||||
"delivery_needed": "false",
|
||||
"items": [],
|
||||
});
|
||||
print('id is');
|
||||
print(response.data["id"]);
|
||||
return response.data["id"];
|
||||
}
|
||||
|
||||
Future<String> _getPaymentKey({
|
||||
required String authanticationToken,
|
||||
required String orderId,
|
||||
required String amount,
|
||||
required String currency,
|
||||
}) async {
|
||||
final dio.Response response = await Dio()
|
||||
.post("https://accept.paymob.com/api/acceptance/payment_keys", data: {
|
||||
"expiration": 200,
|
||||
"auth_token": authanticationToken.toString(),
|
||||
"order_id": orderId.toString(),
|
||||
"integration_id": int.parse(AK.integrationIdPayMob),
|
||||
"lock_order_when_paid": "false",
|
||||
"amount_cents": amount,
|
||||
"currency": currency,
|
||||
"billing_data": {
|
||||
"first_name": box.read(BoxName.nameDriver) ?? box.read(BoxName.name),
|
||||
"last_name": box.read(BoxName.lastNameDriver) ?? box.read(BoxName.name),
|
||||
"email": box.read(BoxName.emailDriver) ?? box.read(BoxName.email),
|
||||
"phone_number":
|
||||
box.read(BoxName.phoneDriver) ?? box.read(BoxName.phone),
|
||||
"apartment": "NA",
|
||||
"floor": "NA",
|
||||
"street": "NA",
|
||||
"building": "NA",
|
||||
"shipping_method": "NA",
|
||||
"postal_code": "NA",
|
||||
"city": "NA",
|
||||
"country": box.read(BoxName.countryCode),
|
||||
"state": "NA"
|
||||
},
|
||||
});
|
||||
|
||||
return response.data["token"];
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:background_location/background_location.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -9,6 +8,7 @@ import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:paymob_payment/paymob_payment.dart';
|
||||
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||
import 'constant/api_key.dart';
|
||||
import 'constant/box_name.dart';
|
||||
@@ -17,7 +17,6 @@ import 'constant/info.dart';
|
||||
import 'controller/firebase/firbase_messge.dart';
|
||||
import 'controller/firebase/local_notification.dart';
|
||||
import 'controller/functions/location_background_controller.dart';
|
||||
import 'controller/functions/location_controller.dart';
|
||||
import 'controller/local/local_controller.dart';
|
||||
import 'controller/local/translations.dart';
|
||||
import 'firebase_options.dart';
|
||||
@@ -26,6 +25,8 @@ import 'splash_screen_page.dart';
|
||||
|
||||
final box = GetStorage();
|
||||
const storage = FlutterSecureStorage();
|
||||
final PaymobPayment paymobPayment = PaymobPayment();
|
||||
|
||||
DbSql sql = DbSql.instance;
|
||||
@pragma('vm:entry-point')
|
||||
Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
@@ -82,6 +83,13 @@ void main() async {
|
||||
DeviceOrientation.portraitDown,
|
||||
]);
|
||||
}
|
||||
PaymobPayment.instance.initialize(
|
||||
apiKey: AK
|
||||
.payMobApikey, // from dashboard Select Settings -> Account Info -> API Key
|
||||
integrationID: int.parse(AK.integrationIdPayMob),
|
||||
userTokenExpiration: 200,
|
||||
iFrameID: 837992,
|
||||
);
|
||||
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
@@ -89,8 +89,10 @@ class RateDriverFromPassenger extends StatelessWidget {
|
||||
Text(
|
||||
'Exclusive offers and discounts always with the Sefer app'
|
||||
.tr,
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.redColor),
|
||||
style: AppStyle.title.copyWith(
|
||||
color: AppColor.redColor,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
@@ -84,6 +84,7 @@ class RatePassenger extends StatelessWidget {
|
||||
Text(
|
||||
'Exclusive offers and discounts always with the Sefer app'
|
||||
.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.redColor),
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:SEFER/constant/api_key.dart';
|
||||
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -196,64 +197,29 @@ class LoginCaptin extends StatelessWidget {
|
||||
displayFullTextOnTap: true,
|
||||
stopPauseOnTap: true,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
// // String v =
|
||||
// // await storage.read(key: BoxName.serverAPI) ?? '';
|
||||
// // print(v);
|
||||
// // sql.deleteAllData(TableName.faceDetectTimes);
|
||||
// AC credentials = AC();
|
||||
// String apiKey =
|
||||
// 'Qfrhx9d5YVHiy4uEuK4wiFc9kIuFFlvc5A6WVzPK';
|
||||
// // // // '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';
|
||||
// // credentials.gAK();
|
||||
// String? apiKeyf =
|
||||
// await storage.read(key: BoxName.chatGPTkey);
|
||||
// print(apiKeyf);
|
||||
// String convertedString = credentials.c(apiKey, s);
|
||||
// String convertedStrings = credentials.c(apiKey, s);
|
||||
// print('Converted String s: $convertedStrings');
|
||||
// String convertedStringC =
|
||||
// credentials.c(convertedStrings, c);
|
||||
// print('v: $v');
|
||||
// 'AAAAinYllCo:APA91bF1shTpzSsSxqbfY6c60D8zs1ZsdIsl9ix6nl7GDdjCqWPRK0G0ub5SqFdb1jDpQDvQPxGg-697MWLo0sy3oYImBwBLObyhk0GjtNzyr0PbE3hI-pOvhf8Vp1xgUgBmofbZYXkH'
|
||||
// 'AAAAinYllCo:APA91bF1shTpzSsSxqbfY6c60D8zs1ZsdIsl9ix6nl7GDdjCqWPRK0G0ub5SqFdb1jDpQDvQPxGg-697MWLo0sy3oYImBwBLObyhk0GjtNzyr0PbE3hI-pOvhf8Vp1xgUgBmofbZYXkH'
|
||||
// String convertedStringN = credentials.c(
|
||||
// credentials.c(
|
||||
// credentials.c(
|
||||
// 'ASCeQiScKwmkMyjlrr7l0tT57Br2yPRAgm5xZndjnusED53JA0us1DbqJaJXDVWFCtAHapjVqA5FEEPL',
|
||||
// cs),
|
||||
// cC),
|
||||
// cn);
|
||||
// print('Converted v: $convertedStringN');
|
||||
// //
|
||||
// String retrievedStringN =
|
||||
// credentials.r(convertedStringN, n);
|
||||
// print('Retrieved String: $retrievedStringN');
|
||||
// String retrievedStringC =
|
||||
// credentials.r(retrievedStringN, c);
|
||||
// print('Retrieved String: $retrievedStringC');
|
||||
|
||||
// String retrievedStringS = credentials.r(
|
||||
// credentials.r(
|
||||
// credentials.r(convertedStringN, cn), cC),
|
||||
// cs);
|
||||
// print('Retrieved String: $retrievedStringS');
|
||||
//
|
||||
// if (retrievedStringS == apiKey) {
|
||||
// print('same');
|
||||
// }
|
||||
// print(' AK is ' + AK.chatGPTkey); //
|
||||
//
|
||||
// print(' ENV is ' + Env.chatGPTkey); //
|
||||
// // print('storage is ' + v); //
|
||||
// print('storage is ' + apiKeyf!); //
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.close,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
),
|
||||
// IconButton(
|
||||
// onPressed: () async {
|
||||
// AC credentials = AC();
|
||||
// String apiKey = AK.payMobApikey;
|
||||
// String convertedStringN = credentials.c(
|
||||
// credentials.c(credentials.c(apiKey, cs), cC), cn);
|
||||
// print('Converted v: $convertedStringN');
|
||||
//
|
||||
// String retrievedStringS = credentials.r(
|
||||
// credentials.r(
|
||||
// credentials.r(convertedStringN, cn), cC),
|
||||
// cs);
|
||||
// print('Retrieved String: $retrievedStringS');
|
||||
// //
|
||||
// if (retrievedStringS == apiKey) {
|
||||
// print('same');
|
||||
// }
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// Icons.close,
|
||||
// color: AppColor.blueColor,
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:SEFER/controller/payment/paymob.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
@@ -52,18 +52,9 @@ class HomeCaptain extends StatelessWidget {
|
||||
orderRequestController.getRefusedOrderByCaptain(),
|
||||
icon: const Icon(Icons.get_app)),
|
||||
),
|
||||
GetBuilder<OrderRequestController>(
|
||||
builder: (orderRequestController) => MyCircleContainer(
|
||||
child: Text(
|
||||
orderRequestController.countRefuse.toString(),
|
||||
style: AppStyle.title,
|
||||
))),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
// NotificationController()
|
||||
// .showNotification('Order', 'hi this is', 'tone2');
|
||||
// Get.to(() => CallPage(callID: '111'));
|
||||
// MapDriverController().getDriverScam();
|
||||
PaymobManager().getPaymentKey(100, 'EGP');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.call,
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:vibration/vibration.dart';
|
||||
|
||||
import '../../../../constant/colors.dart';
|
||||
import '../../../../constant/style.dart';
|
||||
import '../../../../controller/home/captin/home_captain_controller.dart';
|
||||
import '../../../../controller/home/captin/map_driver_controller.dart';
|
||||
import '../../../widgets/elevated_btn.dart';
|
||||
|
||||
@@ -134,9 +135,15 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
||||
),
|
||||
Container(
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Text(
|
||||
mapDriverController.carType,
|
||||
style: AppStyle.title,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
print(Get.find<HomeCaptainController>()
|
||||
.comfortPrice);
|
||||
},
|
||||
child: Text(
|
||||
mapDriverController.carType,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -34,7 +34,7 @@ class MapPagePassenger extends StatelessWidget {
|
||||
child: Stack(
|
||||
children: [
|
||||
GoogleMapPassengerWidget(),
|
||||
leftMainMenuIcons(),
|
||||
leftMainMenuIcons(), PaymobPackage(),
|
||||
const PickerIconOnMap(),
|
||||
// PickerAnimtionContainerFormPlaces(),
|
||||
const MainBottomMenuMap(),
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:SEFER/controller/payment/payment_controller.dart';
|
||||
import 'package:SEFER/controller/payment/paymob.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:paymob_payment/paymob_payment.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/functions/tts.dart';
|
||||
import '../../../controller/home/map_passenger_controller.dart';
|
||||
import '../Captin/home_captain/driver_call_page.dart';
|
||||
|
||||
GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
final textToSpeechController = Get.put(TextToSpeechController());
|
||||
@@ -17,121 +17,146 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
builder: (controller) => Positioned(
|
||||
top: 85,
|
||||
left: 6,
|
||||
child: Column(
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.changeMapType();
|
||||
// Toast.show(context, 'This is a toast message!');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.satellite_alt,
|
||||
size: 29,
|
||||
child: Builder(builder: (context) {
|
||||
return Column(
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.changeMapType();
|
||||
// Toast.show(context, 'This is a toast message!');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.satellite_alt,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.changeMapTraffic();
|
||||
// Toast.show(context, 'This is a toast message!');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.streetview_sharp,
|
||||
size: 29,
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.changeMapTraffic();
|
||||
// Toast.show(context, 'This is a toast message!');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.streetview_sharp,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
// if (Platform.isIOS)
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.mapController?.animateCamera(
|
||||
CameraUpdate.newLatLng(LatLng(
|
||||
controller.passengerLocation.latitude,
|
||||
controller.passengerLocation.longitude)));
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.location_on,
|
||||
size: 29,
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
// if (Platform.isIOS)
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
controller.mapController?.animateCamera(
|
||||
CameraUpdate.newLatLng(LatLng(
|
||||
controller.passengerLocation.latitude,
|
||||
controller.passengerLocation.longitude)));
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.location_on,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
textToSpeechController.speakText(
|
||||
'''hello this is ${box.read(BoxName.name)}''');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.voice_chat,
|
||||
size: 29,
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
textToSpeechController.speakText(
|
||||
'''hello this is ${box.read(BoxName.name)}''');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.voice_chat,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
// NotificationController()
|
||||
// .showNotification('Order', 'hi this is', 'tone1');
|
||||
// Get.to(() => DriverCallPage());
|
||||
// print(controller.carLocationsModels);
|
||||
// controller.getKazanPercent();
|
||||
// PassengerCallPage(
|
||||
// channelName: '',
|
||||
// token: '',
|
||||
// remoteID: '',
|
||||
// )
|
||||
// Get.to(() => const CallPage());
|
||||
// print(box.read(BoxName.lang));
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.call,
|
||||
size: 29,
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () async {
|
||||
// await PaymobManager().payWithPayMob(100, 'EGP');
|
||||
await Get.find<PaymentController>()
|
||||
.payWithPayMob(context, '11', 'EGP');
|
||||
// Initiates a payment with a card using the FlutterPaymob instance
|
||||
|
||||
// NotificationController()
|
||||
// .showNotification('Order', 'hi this is', 'tone1');
|
||||
// Get.to(() => DriverCallPage());
|
||||
// print(controller.carLocationsModels);
|
||||
// controller.getKazanPercent();
|
||||
// PassengerCallPage(
|
||||
// channelName: '',
|
||||
// token: '',
|
||||
// remoteID: '',
|
||||
// )
|
||||
// Get.to(() => const CallPage());
|
||||
// print(box.read(BoxName.lang));
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.call,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
);
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
class PaymobPackage extends StatelessWidget {
|
||||
const PaymobPackage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
await Get.find<PaymentController>()
|
||||
.payWithPayMob(context, '11', 'EGP');
|
||||
},
|
||||
child: Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
child: Text('pay'),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,14 +305,14 @@ class CountryPicker extends StatelessWidget {
|
||||
final ProfileController controller = Get.put(ProfileController());
|
||||
|
||||
final List<String> countryOptions = [
|
||||
'Jordan'.tr,
|
||||
'USA'.tr,
|
||||
'Eygpt'.tr,
|
||||
'Turkey'.tr,
|
||||
'Saudi Arabia'.tr,
|
||||
'Qatar'.tr,
|
||||
'Bahrain'.tr,
|
||||
'Kuwait'.tr,
|
||||
'Jordan',
|
||||
'USA',
|
||||
'Egypt',
|
||||
'Turkey',
|
||||
'Saudi Arabia',
|
||||
'Qatar',
|
||||
'Bahrain',
|
||||
'Kuwait',
|
||||
];
|
||||
|
||||
CountryPicker({Key? key}) : super(key: key);
|
||||
@@ -341,27 +341,33 @@ class CountryPicker extends StatelessWidget {
|
||||
itemExtent: 32,
|
||||
onSelectedItemChanged: (int index) {
|
||||
controller.setCountry(countryOptions[index]);
|
||||
box.write(BoxName.countryCode,
|
||||
countryOptions[index]); // Save in English
|
||||
},
|
||||
children: List.generate(
|
||||
countryOptions.length,
|
||||
(index) => Center(
|
||||
child: Text(
|
||||
countryOptions[index],
|
||||
countryOptions[index]
|
||||
.tr, // Display translated if not English
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
MyElevatedButton(
|
||||
title: 'Select Country'.tr,
|
||||
onPressed: () {
|
||||
Get.find<LoginController>()
|
||||
.saveCountryCode(controller.selectedCountry.toString());
|
||||
box.write(
|
||||
BoxName.countryCode, controller.selectedCountry.toString());
|
||||
Get.off(LoginPage());
|
||||
})
|
||||
title: 'Select Country'.tr, // Use translated text for button
|
||||
onPressed: () {
|
||||
Get.find<LoginController>().saveCountryCode(controller
|
||||
.selectedCountry
|
||||
.toString()); // No conversion needed
|
||||
box.write(BoxName.countryCode,
|
||||
controller.selectedCountry); // Already saved in English
|
||||
Get.off(LoginPage());
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
16
pubspec.lock
16
pubspec.lock
@@ -361,6 +361,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.0.0"
|
||||
dio:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: dio
|
||||
sha256: "11e40df547d418cc0c4900a9318b26304e665da6fa4755399a9ff9efd09034b5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.4.3+1"
|
||||
envied:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -1464,6 +1472,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
paymob_payment:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: paymob_payment
|
||||
sha256: "5a7f6ef9c1d538b5bdff52e757f09a97755b0c0cabe9f5098a13cc005477584c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.0.1+1"
|
||||
permission_handler:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
||||
@@ -59,6 +59,8 @@ dependencies:
|
||||
background_location: ^0.13.0
|
||||
flutter_sound: ^9.2.13
|
||||
record: ^5.0.5
|
||||
dio: ^5.4.3+1
|
||||
paymob_payment: ^0.0.1+1
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user