diff --git a/android/app/build.gradle b/android/app/build.gradle
index 5b5a27b..06655d8 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -54,8 +54,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 23
targetSdk = flutter.targetSdkVersion
- versionCode = 120
- versionName = '1.5.20'
+ versionCode = 124
+ versionName = '1.5.24'
multiDexEnabled =true
}
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 0da6cd8..fb7ca5d 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -35,7 +35,7 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 79
+ 81
CFBundleSignature
????
CFBundleURLTypes
@@ -50,7 +50,7 @@
CFBundleVersion
- 4.0.79
+ 4.0.81
FirebaseAppDelegateProxyEnabled
NO
GMSApiKey
diff --git a/lib/constant/box_name.dart b/lib/constant/box_name.dart
index 83a2bed..527f404 100644
--- a/lib/constant/box_name.dart
+++ b/lib/constant/box_name.dart
@@ -22,6 +22,7 @@ class BoxName {
static const String statusDriverLocation = "statusDriverLocation";
static const String rideStatus = "rideStatus";
static const String nameArabic = "nameArabic";
+ static const String carYear = "carYear";
static const String password = "password";
static const String isVerified = '0';
static const String arrivalTime = "arrivalTime";
@@ -44,6 +45,7 @@ class BoxName {
static const String passengerID = "pasengerID";
static const String phone = "phone";
static const String phoneDriver = "phoneDriver";
+ static const String is_claimed = "is_claimed";
static const String lastOtpTime = "lastOtpTime";
static const String bankCodeDriver = "bankCodeDriver";
static const String accountBankNumberDriver = "accountBankNumberDriver";
diff --git a/lib/constant/links.dart b/lib/constant/links.dart
index c3d52cc..4c4a860 100644
--- a/lib/constant/links.dart
+++ b/lib/constant/links.dart
@@ -54,6 +54,7 @@ class AppLink {
"$walletDriver/getDriverWeekPaymentMove.php";
static String getDriversWallet = "$walletDriver/get.php";
static String addDriversWalletPoints = "$walletDriver/add.php";
+ static String addpromotionDriver = "$walletDriver/promotionDriver.php";
static String deleteDriversWallet = "$walletDriver/delete.php";
static String updateDriversWallet = "$walletDriver/update.php";
@@ -75,6 +76,7 @@ class AppLink {
static String addRides = "$ride/rides/add.php";
static String getRides = "$ride/rides/get.php";
static String getMishwari = "$ride/mishwari/get.php";
+ static String getMishwariDriver = "$ride/mishwari/getDriver.php";
static String getTripCountByCaptain = "$ride/rides/getTripCountByCaptain.php";
static String getRideOrderID = "$ride/rides/getRideOrderID.php";
static String getRideStatus = "$ride/rides/getRideStatus.php";
@@ -273,6 +275,7 @@ class AppLink {
static String auth = '$server/auth';
static String login = "$auth/login.php";
static String signUp = "$auth/signup.php";
+ static String updateDriverClaim = "$auth/captin/updateDriverClaim.php";
static String sendVerifyEmail = "$auth/sendVerifyEmail.php";
static String passengerRemovedAccountEmail =
"$auth/passengerRemovedAccountEmail.php";
diff --git a/lib/controller/auth/captin/invit_controller.dart b/lib/controller/auth/captin/invit_controller.dart
index 44bd80b..c4f36e0 100644
--- a/lib/controller/auth/captin/invit_controller.dart
+++ b/lib/controller/auth/captin/invit_controller.dart
@@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/links.dart';
+import 'package:SEFER/controller/firebase/local_notification.dart';
import 'package:SEFER/controller/functions/crud.dart';
import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
import 'package:SEFER/views/widgets/mydialoug.dart';
@@ -159,21 +160,32 @@ Download the SEFER app now and enjoy your ride!
//claim your gift
if (driverInvitationData[index]['isGiftToken'].toString() == '0') {
Get.back();
- await Get.find()
- .addDriverWallet('paymentMethod', '500');
- // add for invitor too
- await Get.find().addDriverWalletToInvitor(
- 'paymentMethod',
- driverInvitationData[index]['driverInviterId'],
- '500');
await CRUD().post(
link: AppLink.updateInviteDriver,
payload: {'id': driverInvitationData[index]['id']});
+ await Get.find().addDriverPayment(
+ 'paymentMethod',
+ '500',
+ '',
+ );
+ // add for invitor too
+ await Get.find().addDriverWalletToInvitor(
+ 'paymentMethod',
+ driverInvitationData[index]['driverInviterId'],
+ '500',
+ );
+ await Get.find()
+ .addSeferWallet('giftInvitation', '-1000');
NotificationCaptainController().addNotificationCaptain(
driverInvitationData[index]['driverInviterId'].toString(),
"You have got a gift for invitation".tr,
'${"You have 500".tr} ${'LE'}',
false);
+ NotificationController().showNotification(
+ "You have got a gift for invitation".tr,
+ '${"You have 500".tr} ${'LE'}',
+ 'tone1',
+ '');
} else {
Get.back();
MyDialog().getDialog("You have got a gift".tr,
@@ -188,12 +200,12 @@ Download the SEFER app now and enjoy your ride!
void onSelectPassengerInvitation(int index) async {
MyDialog().getDialog(
- driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 6
+ driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 3
? '${'When'.tr} ${driverInvitationDataToPassengers[index]['passengerName']} ${"complete, you can claim your gift".tr} '
: 'You deserve the gift'.tr,
'${driverInvitationDataToPassengers[index]['passengerName']} ${driverInvitationDataToPassengers[index]['countOfInvitDriver']} / 6 ${'Trip'.tr}',
() async {
- if (driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 6) {
+ if (driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 3) {
Get.back();
} else {
// Claim the gift if 100 trips are completed
@@ -203,7 +215,7 @@ Download the SEFER app now and enjoy your ride!
Get.back();
// Add wallet to the inviter
await Get.find()
- .addDriverWallet('paymentMethod', '50');
+ .addDriverWallet('paymentMethod', '50', '50');
// add for invitor too
await Get.find().addDriverWalletToInvitor(
'paymentMethod',
diff --git a/lib/controller/auth/captin/login_captin_controller.dart b/lib/controller/auth/captin/login_captin_controller.dart
index feb195e..36b6f34 100644
--- a/lib/controller/auth/captin/login_captin_controller.dart
+++ b/lib/controller/auth/captin/login_captin_controller.dart
@@ -145,7 +145,9 @@ class LoginDriverController extends GetxController {
box.write(BoxName.phoneVerified,
jsonDecoeded['data'][0]['is_verified'].toString());
box.write(BoxName.phoneDriver, jsonDecoeded['data'][0]['phone']);
+ box.write(BoxName.is_claimed, jsonDecoeded['data'][0]['is_claimed']);
box.write(BoxName.nameArabic, jsonDecoeded['data'][0]['name_arabic']);
+ box.write(BoxName.carYear, jsonDecoeded['data'][0]['year']);
box.write(
BoxName.bankCodeDriver, jsonDecoeded['data'][0]['bankCode']);
box.write(BoxName.accountBankNumberDriver,
diff --git a/lib/controller/auth/captin/register_captin_controller.dart b/lib/controller/auth/captin/register_captin_controller.dart
index 0b35f9b..d6c1355 100644
--- a/lib/controller/auth/captin/register_captin_controller.dart
+++ b/lib/controller/auth/captin/register_captin_controller.dart
@@ -269,12 +269,8 @@ class RegisterCaptainController extends GetxController {
update();
}
-// Show error message in case of invalid phone number
- void _showErrorMessage(String message) {
- mySnackeBarError(message);
- }
-
verifySMSCode() async {
+ // var loginDriverController = Get.put(LoginDriverController());
if (formKey3.currentState!.validate()) {
var res = await CRUD().post(link: AppLink.verifyOtpDriver, payload: {
'phone_number': '+2${phoneController.text}',
@@ -285,24 +281,16 @@ class RegisterCaptainController extends GetxController {
box.write(BoxName.phoneDriver, '+2${phoneController.text}');
box.write(BoxName.phoneVerified, '1');
- // var res1 = await CRUD().post(
- // link: AppLink.updateAccountBank,
- // payload: {'phone': '+2${phoneController.text}'});
- // if (res1 != 'failure') {
- Get.find().isGoogleLogin == true
- ? await Get.put(LoginDriverController())
- .loginUsingCredentialsWithoutGoogle(
- Get.find()
- .passwordController
- .text
- .toString(),
- box.read(BoxName.emailDriver).toString(),
- )
- : await Get.put(LoginDriverController()).loginUsingCredentials(
- box.read(BoxName.driverID).toString(),
- box.read(BoxName.emailDriver).toString(),
- );
- // Get.to(EgyptCardAI());
+ // loginDriverController.isGoogleLogin == true
+ // ? await loginDriverController.loginUsingCredentialsWithoutGoogle(
+ // loginDriverController.passwordController.text.toString(),
+ // box.read(BoxName.emailDriver).toString(),
+ // )
+ // : await loginDriverController.loginUsingCredentials(
+ // box.read(BoxName.driverID).toString(),
+ // box.read(BoxName.emailDriver).toString(),
+ // );
+ Get.to(EgyptCardAI());
// } else {
// Get.snackbar('title', 'message');
// }
diff --git a/lib/controller/firebase/local_notification.dart b/lib/controller/firebase/local_notification.dart
index c689aad..cf47f89 100644
--- a/lib/controller/firebase/local_notification.dart
+++ b/lib/controller/firebase/local_notification.dart
@@ -383,6 +383,70 @@ class NotificationController extends GetxController {
print('Notifications scheduled every 5 seconds');
}
+ void showTimerNotification(String title, String message, String tone) async {
+ final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
+ FlutterLocalNotificationsPlugin();
+
+ // Setup Android notification
+ final AndroidNotificationDetails android = AndroidNotificationDetails(
+ 'high_importance_channel',
+ 'High Importance Notifications',
+ importance: Importance.max,
+ priority: Priority.high,
+ showWhen: false,
+ sound: RawResourceAndroidNotificationSound(
+ tone), // tone without the file extension
+ );
+
+ // Setup iOS notification
+ const DarwinNotificationDetails ios = DarwinNotificationDetails(
+ sound: 'default',
+ presentAlert: true,
+ presentBadge: true,
+ presentSound: true,
+ );
+
+ final NotificationDetails details =
+ NotificationDetails(android: android, iOS: ios);
+
+ // Request permission on Android
+ if (Platform.isAndroid) {
+ if (await Permission.scheduleExactAlarm.isDenied) {
+ if (await Permission.scheduleExactAlarm.request().isGranted) {
+ print('SCHEDULE_EXACT_ALARM permission granted');
+ } else {
+ print('SCHEDULE_EXACT_ALARM permission denied');
+ return;
+ }
+ }
+ }
+
+ // Timer duration (e.g., 120 seconds countdown)
+ int countdown = 12;
+
+ // Display the notification initially with the full countdown time
+
+ // Timer to update the notification every second
+ Timer.periodic(const Duration(seconds: 1), (timer) async {
+ // if (countdown > 0) {
+ // Update the existing notification with the updated countdown
+
+ // Decrease the countdown by 1
+ countdown--;
+ // } else {
+ // // Cancel the timer when the countdown reaches zero
+ // timer.cancel();
+ // }
+ });
+ await flutterLocalNotificationsPlugin.show(
+ 0,
+ title,
+ '$message Remaining: $countdown seconds', // Initial message
+ details,
+ );
+ print('Notification will update every second');
+ }
+
// Callback when the notification is tapped
void onDidReceiveNotificationResponse(NotificationResponse response) {
handleNotificationResponse(response);
@@ -448,7 +512,7 @@ class NotificationController extends GetxController {
if (orderData is List && orderData.length == 34) {
closeOverLay();
Get.put(HomeCaptainController()).changeRideId();
- Get.to(() => OrderSpeedRequest(), arguments: {'myListString': data});
+ Get.to(() => OrderRequestPage(), arguments: {'myListString': data});
} else {
Log.print('Invalid order data');
}
diff --git a/lib/controller/functions/crud.dart b/lib/controller/functions/crud.dart
index d0ee70c..bdee8b5 100644
--- a/lib/controller/functions/crud.dart
+++ b/lib/controller/functions/crud.dart
@@ -233,7 +233,7 @@ class CRUD {
Log.print('response: ${response.body}');
// Log.print('response: ${response.statusCode}');
// Log.print('response: ${response.reasonPhrase}');
- // Log.print('response: ${payload}');
+ Log.print('response: ${payload}');
var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) {
if (jsonData['status'] == 'success') {
diff --git a/lib/controller/functions/gemeni.dart b/lib/controller/functions/gemeni.dart
index 517ef49..ea207eb 100644
--- a/lib/controller/functions/gemeni.dart
+++ b/lib/controller/functions/gemeni.dart
@@ -258,7 +258,7 @@ class AI extends GetxController {
await addRegistrationCarEgypt();
if (isCarSaved && isDriverSaved) {
- DeviceController().getDeviceSerialNumber();
+ // DeviceController().getDeviceSerialNumber();
box.write(BoxName.phoneVerified, '1');
Get.offAll(() => HomeCaptain());
// Get.offAll(() => HomeCaptain());
@@ -312,7 +312,7 @@ class AI extends GetxController {
'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified',
'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified',
'password':
- Get.find().passwordController.text.isEmpty
+ Get.put(LoginDriverController()).passwordController.text.isEmpty
? box.read(BoxName.emailDriver).toString()
: Get.find()
.passwordController
diff --git a/lib/controller/functions/location_controller.dart b/lib/controller/functions/location_controller.dart
index 9131754..74c3177 100644
--- a/lib/controller/functions/location_controller.dart
+++ b/lib/controller/functions/location_controller.dart
@@ -75,16 +75,41 @@ class LocationController extends GetxController {
isActive = Get.find().isActive;
if (isActive) {
- if (double.parse(totalPoints) > -3000) {
+ if (double.parse(totalPoints) > -300) {
await getLocation();
+ print(
+ 'Latitude: ${myLocation.latitude}, Longitude: ${myLocation.longitude}');
- // Determine the area based on current location
+// Determine the area
String area =
getLocationArea(myLocation.latitude, myLocation.longitude);
print('Determined Area: $area');
String endpoint;
+ switch (area) {
+ case 'Cairo':
+ print('Area matched: Cairo');
+ box.write(BoxName.serverChosen, AppLink.seferCairoServer);
+ endpoint = AppLink.addCarsLocationCairoEndpoint;
+ break;
+ case 'Giza':
+ print('Area matched: Giza');
+ box.write(BoxName.serverChosen, AppLink.seferGizaServer);
+ endpoint = AppLink.addCarsLocationGizaEndpoint;
+ break;
+ case 'Alexandria':
+ print('Area matched: Alexandria');
+ box.write(
+ BoxName.serverChosen, AppLink.seferAlexandriaServer);
+ endpoint = AppLink.addCarsLocationAlexandriaEndpoint;
+ break;
+ default:
+ print('Unknown location area. Fallback to Cairo');
+ endpoint = AppLink.addCarsLocationCairoEndpoint;
+ box.write(BoxName.serverChosen, AppLink.seferCairoServer);
+ }
+ Log.print('Final Endpoint: $endpoint');
switch (area) {
case 'Cairo':
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
diff --git a/lib/controller/functions/overlay_permisssion.dart b/lib/controller/functions/overlay_permisssion.dart
index 057e55e..881ea38 100644
--- a/lib/controller/functions/overlay_permisssion.dart
+++ b/lib/controller/functions/overlay_permisssion.dart
@@ -1,15 +1,18 @@
import 'dart:io';
+import 'package:SEFER/constant/links.dart';
+import 'package:SEFER/controller/functions/crud.dart';
import 'package:SEFER/views/widgets/mydialoug.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_confetti/flutter_confetti.dart';
import 'package:flutter_overlay_window/flutter_overlay_window.dart';
import 'package:get/get.dart';
import 'package:location/location.dart';
-// import 'package:permission_handler/permission_handler.dart';
import '../../constant/box_name.dart';
import '../../main.dart';
-import '../../print.dart';
import '../auth/captin/login_captin_controller.dart';
+import '../home/payment/captain_wallet_controller.dart';
Future getPermissionOverlay() async {
if (Platform.isAndroid) {
@@ -28,6 +31,27 @@ Future getPermissionOverlay() async {
}
}
+Future showDriverGiftClaim(BuildContext context) async {
+ if (box.read(BoxName.is_claimed).toString() == '0' ||
+ box.read(BoxName.is_claimed) == null) {
+ MyDialog().getDialog('You have gift 300 L.E'.tr, 'text', () async {
+ var res = await CRUD().post(link: AppLink.updateDriverClaim, payload: {
+ 'driverId': box.read(BoxName.driverID),
+ });
+ if (res != 'failure') {
+ Get.find()
+ .addDriverWallet('new driver', '300', '300');
+ Confetti.launch(
+ context,
+ options:
+ const ConfettiOptions(particleCount: 100, spread: 70, y: 0.6),
+ );
+ }
+ Get.back();
+ });
+ }
+}
+
Future closeOverlayIfFound() async {
if (Platform.isAndroid) {
bool isOverlayActive = await FlutterOverlayWindow.isActive();
diff --git a/lib/controller/home/captin/home_captain_controller.dart b/lib/controller/home/captin/home_captain_controller.dart
index e772c48..1c2993a 100644
--- a/lib/controller/home/captin/home_captain_controller.dart
+++ b/lib/controller/home/captin/home_captain_controller.dart
@@ -89,7 +89,7 @@ class HomeCaptainController extends GetxController {
isActive = !isActive;
if (isActive) {
- if (double.parse(totalPoints) > -3000) {
+ if (double.parse(totalPoints) > -300) {
locationController.startLocationUpdates();
// locationBackController.startBackLocation();
activeStartTime = DateTime.now();
diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart
index dade0c3..dc9d54c 100644
--- a/lib/controller/home/captin/map_driver_controller.dart
+++ b/lib/controller/home/captin/map_driver_controller.dart
@@ -173,19 +173,20 @@ class MapDriverController extends GetxController {
cancelTripFromDriverAfterApplied() async {
if (formKeyCancel.currentState!.validate()) {
+ FirebaseMessagesController().sendNotificationToDriverMAP(
+ "Cancel Trip from driver",
+ "Trip Cancelled from driver. We are looking for a new driver. Please wait."
+ .tr,
+ tokenPassenger,
+ [],
+ 'cancel.wav',
+ );
await CRUD().post(
link: "${AppLink.seferCairoServer}/ride/rides/update.php",
payload: {
"id": rideId.toString(), // Convert to String
"status": 'CancelFromDriverAfterApply'
});
- if (AppLink.endPoint != AppLink.seferCairoServer) {
- CRUD()
- .post(link: "${AppLink.endPoint}/ride/rides/update.php", payload: {
- "id": rideId.toString(), // Convert to String
- "status": 'CancelFromDriverAfterApply'
- });
- }
await CRUD().post(
link:
"${AppLink.seferCairoServer}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
@@ -196,6 +197,11 @@ class MapDriverController extends GetxController {
"notes": cancelTripCotroller.text.toString()
});
if (AppLink.endPoint != AppLink.seferCairoServer) {
+ CRUD()
+ .post(link: "${AppLink.endPoint}/ride/rides/update.php", payload: {
+ "id": rideId.toString(), // Convert to String
+ "status": 'CancelFromDriverAfterApply'
+ });
CRUD().post(
link:
"${AppLink.endPoint}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
@@ -206,14 +212,6 @@ class MapDriverController extends GetxController {
"notes": cancelTripCotroller.text.toString()
});
}
- FirebaseMessagesController().sendNotificationToDriverMAP(
- "Cancel Trip from driver".tr,
- "Trip Cancelled from driver. We are looking for a new driver. Please wait."
- .tr,
- tokenPassenger,
- [],
- 'cancel.wav',
- );
sql.insertData({
'order_id': rideId,
@@ -221,7 +219,7 @@ class MapDriverController extends GetxController {
'driver_id': box.read(BoxName.driverID).toString(),
}, TableName.driverOrdersRefuse);
Get.find().getRefusedOrderByCaptain();
- Get.offAll(HomeCaptain());
+ Get.offAll(() => HomeCaptain());
}
}
@@ -550,21 +548,21 @@ class MapDriverController extends GetxController {
Get.find().myLocation.longitude,
);
MyDialog().getDialog('Are you sure to exit ride ?'.tr, '', () {
- if (distanceToDestination > 900 ||
- (double.parse(distance.toString()) < 1000 &&
- distanceToDestination > 150)) {
- Get.back();
- finishRideFromDriver1();
- } else {
- Get.back();
- if (distanceToDestination <= 150) {
- // todo add scam from start point and dont move
- // finishRideFromDriver1();
- }
- MyDialog().getDialog('you are not moved yet !'.tr, '', () {
- Get.back();
- });
- }
+ // if (distanceToDestination > 900 ||
+ // (double.parse(distance.toString()) < 1000 &&
+ // distanceToDestination > 150)) {
+ Get.back();
+ finishRideFromDriver1();
+ // } else {
+ // Get.back();
+ // if (distanceToDestination <= 150) {
+ // // todo add scam from start point and dont move
+ // // finishRideFromDriver1();
+ // }
+ // MyDialog().getDialog('you are not moved yet !'.tr, '', () {
+ // Get.back();
+ // });
+ // }
});
}
@@ -598,7 +596,7 @@ class MapDriverController extends GetxController {
box.write(BoxName.rideStatus, 'Finished');
// Get.find().changeToAppliedRide('Finished');
// Get.find().update();
- totalCost = price < 30
+ totalCost = price < 20
? carType != 'Comfort' && carType != 'Mishwar Vip' && carType != 'Lady'
? '20'
: '30'
@@ -662,7 +660,8 @@ class MapDriverController extends GetxController {
}
double pointsSubtraction = 0;
- pointsSubtraction = double.parse(paymentAmount) * (-1);
+ pointsSubtraction =
+ double.parse(paymentAmount) * (-1) * .08; //for 300 from 3000
var paymentToken2 =
await generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
var res = await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
diff --git a/lib/controller/home/captin/order_request_controller.dart b/lib/controller/home/captin/order_request_controller.dart
index 9a1c1bd..04be8da 100644
--- a/lib/controller/home/captin/order_request_controller.dart
+++ b/lib/controller/home/captin/order_request_controller.dart
@@ -1,12 +1,14 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
+import 'package:flutter_overlay_window/flutter_overlay_window.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/links.dart';
import 'package:SEFER/main.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'dart:math' as math;
import '../../../constant/box_name.dart';
+import '../../../print.dart';
import '../../functions/audio_controller.dart';
import '../../functions/crud.dart';
import '../../functions/location_controller.dart';
@@ -15,7 +17,7 @@ import 'home_captain_controller.dart';
class OrderRequestController extends GetxController {
double progress = 0;
double progressSpeed = 0;
- int duration = 11;
+ int duration = 15;
int durationSpeed = 20;
int remainingTime = 0;
int remainingTimeSpeed = 0;
@@ -30,12 +32,17 @@ class OrderRequestController extends GetxController {
late int minutes;
@override
- void onInit() {
+ Future onInit() async {
// AudioController audioController = Get.put(AudioController());
-
+ print('onInit called');
+ await initilizeOrderPage();
+ bool isOverlayActive = await FlutterOverlayWindow.isActive();
+ if (isOverlayActive) {
+ await FlutterOverlayWindow.closeOverlay();
+ }
// audioController.playAudio();
// getRefusedOrderByCaptain();
- initilizeOrderPage();
+
addCustomStartIcon();
addCustomEndIcon();
@@ -51,34 +58,41 @@ class OrderRequestController extends GetxController {
late double lngPassengerLocation;
late double lngPassengerDestination;
late double latPassengerDestination;
- initilizeOrderPage() {
- final myListString = arguments['myListString'];
- // final myList = arguments['DriverList'];
- if (arguments['DriverList'] == null || arguments['DriverList'].isEmpty) {
+
+ Future initilizeOrderPage() async {
+ final myListString = Get.arguments['myListString'];
+
+ if (Get.arguments['DriverList'] == null ||
+ Get.arguments['DriverList'].isEmpty) {
myList = jsonDecode(myListString);
+ Log.print('myList: ${myList}');
} else {
- myList = arguments['DriverList'];
+ myList = Get.arguments['DriverList'];
+ Log.print('myList1: ${myList}');
}
- body = arguments['body'];
- Duration durationToAdd = Duration(seconds: int.parse(myList[4]));
+ body = Get.arguments['body'];
+ Duration durationToAdd =
+ Duration(seconds: (double.tryParse(myList[4]) ?? 0).toInt());
hours = durationToAdd.inHours;
minutes = (durationToAdd.inMinutes % 60).round();
startTimerSpeed(myList[6].toString(), body.toString());
- var coords = myList[0].split(',');
- var coordDestination = myList[1].split(',');
-// Parse to double
- latPassengerLocation = double.parse(coords[0]);
- lngPassengerLocation = double.parse(coords[1]);
- latPassengerDestination = double.parse(coordDestination[0]);
- lngPassengerDestination = double.parse(coordDestination[1]);
+ // Instead of splitting, directly use the values from the list
+ // First coordinate pair is at index 0 and 1
+ latPassengerLocation = double.tryParse(myList[0]) ?? 0.0;
+ lngPassengerLocation = double.tryParse(myList[1]) ?? 0.0;
+
+ // Second coordinate pair is at index 2 and 3
+ latPassengerDestination = double.tryParse(myList[2]) ?? 0.0;
+ lngPassengerDestination = double.tryParse(myList[3]) ?? 0.0;
pointsDirection = [
LatLng(latPassengerLocation, lngPassengerLocation),
LatLng(latPassengerDestination, lngPassengerDestination)
- ]; // Calculate the midpoint between the two points
- // Calculate the minimum and maximum latitude and longitude values
+ ];
+
+ // Calculate bounds
double minLatitude =
math.min(pointsDirection[0].latitude, pointsDirection[1].latitude);
double maxLatitude =
@@ -87,17 +101,18 @@ class OrderRequestController extends GetxController {
math.min(pointsDirection[0].longitude, pointsDirection[1].longitude);
double maxLongitude =
math.max(pointsDirection[0].longitude, pointsDirection[1].longitude);
-// Create a bounding box using the calculated values
+
bounds = LatLngBounds(
southwest: LatLng(minLatitude, minLongitude),
northeast: LatLng(maxLatitude, maxLongitude),
);
+
update();
}
- getRideDEtailsForBackgroundOrder() async {
+ getRideDEtailsForBackgroundOrder(String rideId) async {
await CRUD().get(link: AppLink.getRidesDetails, payload: {
- 'id': box.read(BoxName.myList)[2].toString(),
+ 'id': rideId,
});
}
@@ -193,20 +208,14 @@ class OrderRequestController extends GetxController {
'status': 'Refused',
'driver_id': box.read(BoxName.driverID),
});
- CRUD().post(
- link: '${AppLink.seferAlexandriaServer}/rides/update.php',
- payload: {
- 'id': orderID,
- // 'rideTimeStart': DateTime.now().toString(),
- 'status': 'Refused',
- 'driver_id': box.read(BoxName.driverID),
- });
- CRUD().post(link: '${AppLink.seferGizaServer}/rides/update.php', payload: {
- 'id': orderID,
- // 'rideTimeStart': DateTime.now().toString(),
- 'status': 'Refused',
- 'driver_id': box.read(BoxName.driverID),
- });
+ if (AppLink.endPoint != AppLink.seferCairoServer) {
+ CRUD().post(link: '${AppLink.endPoint}/rides/update.php', payload: {
+ 'id': orderID,
+ // 'rideTimeStart': DateTime.now().toString(),
+ 'status': 'Refused',
+ 'driver_id': box.read(BoxName.driverID),
+ });
+ }
// applied = true;
// if (box.read(BoxName.gender).toString() != 'Female') {
@@ -252,41 +261,24 @@ class OrderRequestController extends GetxController {
'distance': distance,
'duration': duration,
});
- CRUD().post(
- link:
- '${AppLink.seferAlexandriaServer}/notificationCaptain/addWaitingRide.php',
- payload: {
- 'id': orderID,
- 'start_location': startLocation,
- 'end_location': endLocation,
- 'date': date,
- 'time': time,
- 'price': price,
- 'passenger_id': passengerId,
- 'status': status,
- 'carType': carType,
- 'passengerRate': passengerRate,
- 'price_for_passenger': priceForPassenger,
- 'distance': distance,
- 'duration': duration,
- });
- CRUD().post(
- link:
- '${AppLink.seferGizaServer}/notificationCaptain/addWaitingRide.php',
- payload: {
- 'id': orderID,
- 'start_location': startLocation,
- 'end_location': endLocation,
- 'date': date,
- 'time': time,
- 'price': price,
- 'passenger_id': passengerId,
- 'status': status,
- 'carType': carType,
- 'passengerRate': passengerRate,
- 'price_for_passenger': priceForPassenger,
- 'distance': distance,
- 'duration': duration,
- });
+ if (AppLink.endPoint != AppLink.seferCairoServer) {
+ CRUD().post(
+ link: '${AppLink.endPoint}/notificationCaptain/addWaitingRide.php',
+ payload: {
+ 'id': orderID,
+ 'start_location': startLocation,
+ 'end_location': endLocation,
+ 'date': date,
+ 'time': time,
+ 'price': price,
+ 'passenger_id': passengerId,
+ 'status': status,
+ 'carType': carType,
+ 'passengerRate': passengerRate,
+ 'price_for_passenger': priceForPassenger,
+ 'distance': distance,
+ 'duration': duration,
+ });
+ }
}
}
diff --git a/lib/controller/home/payment/captain_wallet_controller.dart b/lib/controller/home/payment/captain_wallet_controller.dart
index 9f004b0..c825dc0 100644
--- a/lib/controller/home/payment/captain_wallet_controller.dart
+++ b/lib/controller/home/payment/captain_wallet_controller.dart
@@ -1,8 +1,8 @@
import 'dart:convert';
-import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/firebase/firbase_messge.dart';
+import 'package:SEFER/controller/firebase/local_notification.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:SEFER/views/widgets/error_snakbar.dart';
import 'package:flutter/material.dart';
@@ -32,27 +32,34 @@ class CaptainWalletController extends GetxController {
payFromBudget() async {
if (formKey.currentState!.validate()) {
- var pointFromBudget = box.read(BoxName.countryCode) == 'Jordan'
- ? int.parse((amountFromBudgetController.text)) * 100
- : int.parse((amountFromBudgetController.text));
+ var pointFromBudget = int.parse((amountFromBudgetController.text));
- await addDriverPaymentPoints('fromBudgetToPoints',
- int.parse((amountFromBudgetController.text)) * -1);
- var paymentToken3 = await generateToken(
- (int.parse(amountFromBudgetController.text) * -1).toString());
+ // await getPaymentId('fromBudgetToPoints',
+ // int.parse((amountFromBudgetController.text)) * -1);
+ var paymentToken3 =
+ await generateToken((pointFromBudget * -1).toString());
+ var paymentID = await getPaymentId(
+ 'fromBudgetToPoints', (pointFromBudget * -1).toString());
await CRUD().post(link: AppLink.addDrivePayment, payload: {
- 'amount': (int.parse(amountFromBudgetController.text) * -1).toString(),
+ 'amount': (pointFromBudget * -1).toString(),
'rideId': paymentID.toString(),
'payment_method': 'myBudget',
'passengerID': 'myBudgetToPoint',
'token': paymentToken3,
'driverID': box.read(BoxName.driverID).toString(),
});
- Future.delayed(const Duration(seconds: 2));
- await addDriverWallet('fromBudget', pointFromBudget.toString());
+ Future.delayed(const Duration(seconds: 1));
+ await addDriverWallet(
+ 'fromBudget', pointFromBudget.toString(), pointFromBudget.toString());
update();
Get.back();
await refreshCaptainWallet();
+ NotificationController().showNotification(
+ 'You have successfully charged your account'.tr,
+ '$pointFromBudget ${'has been added to your budget'.tr}',
+ 'tone1',
+ '',
+ );
}
}
@@ -148,8 +155,8 @@ class CaptainWalletController extends GetxController {
return d['message'];
}
- late String paymentID;
- Future addDriverPaymentPoints(String paymentMethod, amount) async {
+ // late String paymentID;
+ Future getPaymentId(String paymentMethod, amount) async {
// paymentToken = await generateToken(amount);
var res = await CRUD().post(link: AppLink.addDriverPaymentPoints, payload: {
'driverID': box.read(BoxName.driverID).toString(),
@@ -157,12 +164,13 @@ class CaptainWalletController extends GetxController {
'payment_method': paymentMethod.toString(),
});
var d = jsonDecode(res);
- paymentID = d['message'].toString();
- return paymentID;
+ // paymentID = d['message'].toString();
+ return d['message'];
}
- Future addDriverWallet(String paymentMethod, point) async {
- paymentToken = await generateToken(point);
+ Future addDriverWallet(String paymentMethod, point, count) async {
+ paymentToken = await generateToken(count);
+ var paymentID = await getPaymentId(paymentMethod, point);
await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
'driverID': box.read(BoxName.driverID).toString(),
'paymentID': paymentID.toString(),
@@ -172,15 +180,66 @@ class CaptainWalletController extends GetxController {
});
}
+ Future addDriverPayment(String paymentMethod, point, wayPay) async {
+ paymentToken = await generateToken(point);
+ var paymentID = await getPaymentId(paymentMethod, point.toString());
+ await CRUD().post(link: AppLink.addDrivePayment, payload: {
+ 'amount': point.toString(),
+ 'rideId': paymentID.toString(),
+ 'payment_method': paymentMethod,
+ 'passengerID': wayPay,
+ 'token': paymentToken,
+ 'driverID': box.read(BoxName.driverID).toString(),
+ });
+ }
+
+ Future addDriverWalletFromPromo(String paymentMethod, point) async {
+ var resPromotion =
+ await CRUD().post(link: AppLink.addpromotionDriver, payload: {
+ 'driver_id': box.read(BoxName.driverID).toString(),
+ 'payment_amount': point,
+ 'timePromo': paymentMethod,
+ });
+ if (resPromotion != 'failure') {
+ paymentToken = await generateToken(point);
+ var paymentID = await getPaymentId(paymentMethod, point.toString());
+ var res = await CRUD().post(link: AppLink.addDrivePayment, payload: {
+ 'amount': point,
+ 'rideId': paymentID.toString(),
+ 'payment_method': paymentMethod.toString(),
+ 'passengerID': paymentMethod,
+ 'token': paymentToken,
+ 'driverID': box.read(BoxName.driverID).toString(),
+ });
+ if (res != 'failure') {
+ String title = 'wallet_updated'.tr; // Notification title
+ String message = '${'wallet_credited_message'.tr} $point';
+ String tone = 'default_tone'.tr; // Notification tone or sound
+ String payLoad =
+ 'wallet_updated'; // Additional data payload for the notification
+
+ Get.find()
+ .showNotification(title, message, tone, payLoad);
+ }
+ } else {
+ Get.back();
+ mySnackeBarError(
+ "A promotion record for this driver already exists for today.".tr);
+ }
+ }
+
Future addDriverWalletToInvitor(String paymentMethod, driverID, point) async {
paymentToken = await generateToken(point);
- await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
+ var paymentID = await getPaymentId(paymentMethod, point.toString());
+ await CRUD().post(link: AppLink.addDrivePayment, payload: {
'driverID': driverID,
- 'paymentID': paymentID.toString(),
'amount': point,
'token': paymentToken,
- 'paymentMethod': paymentMethod.toString(),
+ 'rideId': paymentID.toString(),
+ 'payment_method': paymentMethod.toString(),
+ 'passengerID': paymentMethod,
});
+ await addSeferWallet(paymentMethod, (double.parse(point) * -1).toString());
}
Future addSeferWallet(String paymentMethod, String point) async {
@@ -195,10 +254,11 @@ class CaptainWalletController extends GetxController {
}
Future addTransferDriversWallet(String paymentMethod1, paymentMethod2) async {
- paymentID = await addDriverPaymentPoints(
- paymentMethod1, amountFromBudgetController.text);
+ var paymentID =
+ await getPaymentId(paymentMethod1, amountFromBudgetController.text);
paymentToken = await generateToken(
(int.parse(amountFromBudgetController.text) * -1).toString());
+
await CRUD().post(link: AppLink.addDrivePayment, payload: {
'amount': (int.parse(amountFromBudgetController.text) * -1).toString(),
'rideId': paymentID.toString(),
@@ -208,15 +268,15 @@ class CaptainWalletController extends GetxController {
'driverID': box.read(BoxName.driverID).toString(),
});
- paymentID = await addDriverPaymentPoints(paymentMethod2,
+ paymentID = await getPaymentId(paymentMethod2,
(int.parse(amountFromBudgetController.text) - 5).toString());
paymentToken = await generateToken(amountFromBudgetController.text);
var res1 =
await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
'driverID': amountToNewDriverMap[0]['id'].toString(),
'paymentID': paymentID.toString(),
- 'amount': ((int.parse(amountFromBudgetController.text) - 5) /
- kazan) // double.parse(kazan) .08 for egypt
+ 'amount': ((int.parse(amountFromBudgetController.text) - 5))
+ // kazan) // double.parse(kazan) .08 for egypt
.toStringAsFixed(
0), // this will convert buddget to poitns by kazan .08
diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart
index fc8f915..a02481c 100644
--- a/lib/controller/local/translations.dart
+++ b/lib/controller/local/translations.dart
@@ -4,6 +4,18 @@ class MyTranslation extends Translations {
@override
Map> get keys => {
"ar": {
+ 'Passenger Information': 'معلومات الراكب',
+ 'Name': 'الاسم',
+ "wallet_updated": "تم تحديث المحفظة",
+ "wallet_credited_message": "تم إضافة",
+ "default_tone": "النغمة الافتراضية",
+ "No orders available": "لا توجد طلبات متوفرة",
+ 'Phone': 'رقم الهاتف',
+ "A promotion record for this driver already exists for today.":
+ "يوجد بالفعل سجل ترويج لهذا السائق لهذا اليوم.",
+ 'Gender': 'الجنس',
+ 'time Selected': 'الوقت المختار',
+ 'Ride Status': 'حالة الرحلة',
'If you need any help or have questions, this is the right place to do that. You are welcome!':
'إذا كنت بحاجة إلى أي مساعدة أو لديك أي أسئلة، فهذا هو المكان المناسب لذلك. أهلاً وسهلاً بك!',
'ID Mismatch': "عدم تطابق الرقم التعريفي",
@@ -52,7 +64,10 @@ class MyTranslation extends Translations {
"incorrect_document_title": "وثيقة غير صحيحة",
"incorrect_document_message":
"الرجاء تحميل {expected} الصحيحة. تم الكشف عن {detected}.",
- "driver_license": "رخصة_القيادة",
+ "driver_license": "رخصة_القيادة", "minute": "دقيقة",
+ "kilometer": "كم",
+ "You have successfully charged your account": "تم شحن حسابك بنجاح",
+ "has been added to your budget": "تمت إضافته إلى ميزانيتك",
"id_front": "هوية_أمامية",
"id_back": "هوية_خلفية",
"car_back": "سيارة_خلفية",
@@ -139,6 +154,7 @@ class MyTranslation extends Translations {
"Central Bank Of Egypt": "البنك المركزي المصري",
"ATTIJARIWAFA BANK Egypt": "البنك التجاري وفا مصر",
"Morning Promo": "بونص الصباح",
+ 'You have gift 300 L.E': "لديك هدية بقيمة 300 جنيه.",
"VIP Order": "طلب VIP", "VIP Order Accepted": "تم قبول طلب VIP.",
"The driver accepted your trip": "السائق قبل رحلتك.",
"this is count of your all trips in the morning promo today from 7:00am-10:00am":
@@ -156,8 +172,8 @@ class MyTranslation extends Translations {
"Please enter a health insurance status.":
"يرجى إدخال حالة التأمين الصحي",
"Sefer Driver": "سفر السائق",
- "The 3000 points equal 3000 L.E for you \nSo go and gain your money":
- "3000 نقطة تساوي 3000 جنيه لك \nلذا اذهب واحصل على أموالك",
+ "The 300 points equal 300 L.E for you \nSo go and gain your money":
+ "300 نقطة تساوي 300 جنيه لك \nلذا اذهب واحصل على أموالك",
"Info": "معلومات",
"You dont have money in your Wallet": "ليس لديك أموال في محفظتك",
"You dont have money in your Wallet or you should less transfer 5 LE to activate":
@@ -564,7 +580,7 @@ Store your money with us and receive it in your bank as a monthly salary.''':
"before": "قبل",
'SEFER': 'سفر',
"Code not approved": "الرمز غير موافق عليه",
- "3000 LE": "3000 جنيه مصري",
+ "300 LE": "300 جنيه مصري",
"Do you have an invitation code from another driver?":
"هل لديك كود دعوة من سائق آخر؟",
"Paste the code here": "الصق الكود هنا",
@@ -1118,11 +1134,10 @@ Store your money with us and receive it in your bank as a monthly salary.''':
"Share Trip Details": "شارك تفاصيل الرحلة",
"Car Plate is": "لوحة السيارة",
'L.E': 'ج.م',
- "the 3000 points equal 3000 L.E for you":
- "الـ 3000 نقطة تعادل 3000 جنيه مصري بالنسبة لك",
+ "the 300 points equal 300 L.E for you":
+ "الـ 300 نقطة تعادل 300 جنيه مصري بالنسبة لك",
"So go and gain your money": "انطلق واكسب مالك",
- "the 3000 points equal 3000 L.E":
- "الـ 3000 نقطة تساوي 3000 جنيه مصري",
+ "the 300 points equal 300 L.E": "الـ 300 نقطة تساوي 300 جنيه مصري",
"The payment was not approved. Please try again.":
"لم يتم الموافقة على الدفع. يرجى المحاولة مرة أخرى.",
"Payment Failed": "تعذرت عملية الدفع",
@@ -1146,8 +1161,8 @@ Store your money with us and receive it in your bank as a monthly salary.''':
' is ON for this month': ' لهذا الشهر ',
"Origin": "الأصل",
"Destination": "مكان الوصول",
- 'the 3000 points equal 3000 L.E for you \nSo go and gain your money':
- "ال3000 نقطة تعادل 3000 ج.م لك، فاذهب واكسب مالك.",
+ 'the 300 points equal 300 L.E for you \nSo go and gain your money':
+ "ال300 نقطة تعادل 300 ج.م لك، فاذهب واكسب مالك.",
"Driver Name": "اسم السائق",
"Driver Car Plate": "لوحة سيارة السائق",
"Available for rides": "الرحلات المتوفرة",
diff --git a/lib/controller/notification/ride_available_controller.dart b/lib/controller/notification/ride_available_controller.dart
index 1801e3b..989cf4b 100644
--- a/lib/controller/notification/ride_available_controller.dart
+++ b/lib/controller/notification/ride_available_controller.dart
@@ -2,9 +2,7 @@ import 'dart:convert';
import 'dart:math';
import 'package:SEFER/constant/box_name.dart';
-import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/functions/location_controller.dart';
-import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
@@ -18,21 +16,55 @@ class RideAvailableController extends GetxController {
Map rideAvailableMap = {};
late LatLng southwest;
late LatLng northeast;
- LatLngBounds calculateBounds(
- double centerLat, double centerLng, double radius) {
- // double radius = 4000; // 10 km in meters
+ // LatLngBounds calculateBounds(
+ // double centerLat, double centerLng, double radius) {
+ // // double radius = 4000; // 10 km in meters
- southwest = LatLng(
- centerLat - (radius / 111000),
- centerLng - (radius / (111000 * cos(centerLat))),
+ // southwest = LatLng(
+ // centerLat - (radius / 111000),
+ // centerLng - (radius / (111000 * cos(centerLat))),
+ // );
+
+ // northeast = LatLng(
+ // centerLat + (radius / 111000),
+ // centerLng + (radius / (111000 * cos(centerLat))),
+ // );
+
+ // return LatLngBounds(southwest: southwest, northeast: northeast);
+ // }
+
+ LatLngBounds calculateBounds(double lat, double lng, double radiusInMeters) {
+ const double earthRadius = 6378137.0; // Earth's radius in meters
+
+ double latDelta = (radiusInMeters / earthRadius) * (180 / pi);
+ double lngDelta =
+ (radiusInMeters / (earthRadius * cos(pi * lat / 180))) * (180 / pi);
+
+ double minLat = lat - latDelta;
+ double maxLat = lat + latDelta;
+
+ double minLng = lng - lngDelta;
+ double maxLng = lng + lngDelta;
+
+ // Ensure the latitude is between -90 and 90
+ minLat = max(-90.0, minLat);
+ maxLat = min(90.0, maxLat);
+
+ // Ensure the longitude is between -180 and 180
+ minLng = (minLng + 180) % 360 - 180;
+ maxLng = (maxLng + 180) % 360 - 180;
+
+ // Ensure the bounds are in the correct order
+ if (minLng > maxLng) {
+ double temp = minLng;
+ minLng = maxLng;
+ maxLng = temp;
+ }
+
+ return LatLngBounds(
+ southwest: LatLng(minLat, minLng),
+ northeast: LatLng(maxLat, maxLng),
);
-
- northeast = LatLng(
- centerLat + (radius / 111000),
- centerLng + (radius / (111000 * cos(centerLat))),
- );
-
- return LatLngBounds(southwest: southwest, northeast: northeast);
}
getRideAvailable() async {
diff --git a/lib/controller/payment/payment_controller.dart b/lib/controller/payment/payment_controller.dart
index 04b49fc..a537506 100644
--- a/lib/controller/payment/payment_controller.dart
+++ b/lib/controller/payment/payment_controller.dart
@@ -591,12 +591,12 @@ class PaymentController extends GetxController {
billingData: PaymobBillingDataWallet(),
onPayment: (PaymobResponseWallet response) {},
);
- Log.print('message: ${response!.message}');
- Log.print('responseCode: ${response.responseCode}');
- Log.print('success: ${response.success}');
- Log.print('transactionID: ${response.transactionID}');
- if (response.responseCode.toString() == '200' &&
- response.success == true) {
+ // Log.print('message: ${response!.message}');
+ // Log.print('responseCode: ${response.responseCode}');
+ // Log.print('success: ${response.success}');
+ // Log.print('transactionID: ${response.transactionID}');
+ if (response!.success == true &&
+ response.message.toString() == 'Approved') {
// Log.print('transactionID wewer: ${response.transactionID}');
Toast.show(context, 'Payment Successful'.tr, AppColor.greenColor);
method();
diff --git a/lib/controller/rate/rate_conroller.dart b/lib/controller/rate/rate_conroller.dart
index 4cd172d..0b9f6bd 100644
--- a/lib/controller/rate/rate_conroller.dart
+++ b/lib/controller/rate/rate_conroller.dart
@@ -128,31 +128,26 @@ class RateController extends GetxController {
middleText: '',
confirm: MyElevatedButton(title: 'Ok', onPressed: () => Get.back()));
} else {
- await CRUD()
- .post(link: "${AppLink.seferCairoServer}/rate/add.php", payload: {
- 'passenger_id': passengerId,
- 'driverID': box.read(BoxName.driverID).toString(),
- 'rideId': rideId,
- 'rating': selectedRateItemId.toString(),
- 'comment': comment.text,
- });
- CRUD().post(
- link: "${AppLink.seferAlexandriaServer}/rate/add.php",
+ await CRUD().post(
+ link: "${AppLink.seferCairoServer}/ride/rate/add.php",
payload: {
'passenger_id': passengerId,
'driverID': box.read(BoxName.driverID).toString(),
- 'rideId': rideId,
+ 'rideId': rideId.toString(),
'rating': selectedRateItemId.toString(),
- 'comment': comment.text,
+ 'comment': comment.text ?? 'none',
});
- CRUD().post(link: AppLink.seferGizaServer, payload: {
- 'passenger_id': passengerId,
- 'driverID': box.read(BoxName.driverID).toString(),
- 'rideId': rideId,
- 'rating': selectedRateItemId.toString(),
- 'comment': comment.text,
- });
- await CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, {
+ if (AppLink.endPoint != AppLink.seferCairoServer) {
+ CRUD().post(link: "${AppLink.endPoint}/ride/rate/add.php", payload: {
+ 'passenger_id': passengerId,
+ 'driverID': box.read(BoxName.driverID).toString(),
+ 'rideId': rideId.toString(),
+ 'rating': selectedRateItemId.toString(),
+ 'comment': comment.text ?? 'none',
+ });
+ }
+
+ CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, {
'startLocation':
Get.find().passengerLocation.toString(),
'endLocation':
diff --git a/lib/main.dart b/lib/main.dart
index 1f0421b..2ae85cf 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -60,12 +60,7 @@ Future backgroundMessageHandler(RemoteMessage message) async {
Log.print('Error decoding JSON: $e');
myList = [];
}
- NotificationController().showNotification(
- message.notification!.title.toString(),
- message.notification!.body.toString(),
- 'order',
- myListString,
- );
+
await Future.delayed(const Duration(seconds: 1));
bool isOverlayActive = await FlutterOverlayWindow.isActive();
@@ -82,6 +77,12 @@ Future backgroundMessageHandler(RemoteMessage message) async {
width: WindowSize.matchParent,
startPosition: const OverlayPosition(0, -150),
);
+ NotificationController().showNotification(
+ message.notification!.title.toString(),
+ message.notification!.body.toString(),
+ 'order',
+ myListString,
+ );
await FlutterOverlayWindow.shareData(myList);
}
diff --git a/lib/views/auth/captin/invite_driver_screen.dart b/lib/views/auth/captin/invite_driver_screen.dart
index 3cca4d6..76c61ed 100644
--- a/lib/views/auth/captin/invite_driver_screen.dart
+++ b/lib/views/auth/captin/invite_driver_screen.dart
@@ -465,7 +465,7 @@ class InviteScreen extends StatelessWidget {
),
const SizedBox(height: 4),
Text(
- '$countOfInvitDriver / 6 ${'Trip'.tr}', // Show trips completed
+ '$countOfInvitDriver / 3 ${'Trip'.tr}', // Show trips completed
style: const TextStyle(
fontSize: 13,
color: CupertinoColors.secondaryLabel,
diff --git a/lib/views/home/Captin/home_captain/home_captin.dart b/lib/views/home/Captin/home_captain/home_captin.dart
index 693645c..bab8260 100644
--- a/lib/views/home/Captin/home_captain/home_captin.dart
+++ b/lib/views/home/Captin/home_captain/home_captin.dart
@@ -41,9 +41,9 @@ class HomeCaptain extends StatelessWidget {
closeOverlayIfFound();
checkForUpdate(context);
getPermissionOverlay();
-
+ showDriverGiftClaim(context);
// getPermissionLocation1();
- await showFirstTimeOfferNotification(context);
+ // await showFirstTimeOfferNotification(context);
});
return Scaffold(
appBar: AppBar(
@@ -424,7 +424,7 @@ showFirstTimeOfferNotification(BuildContext context) async {
borderRadius: BorderRadius.circular(15),
),
child: Text(
- '3000 LE'.tr,
+ '300 LE'.tr,
style: const TextStyle(
color: Colors.white,
fontSize: 25,
diff --git a/lib/views/home/Captin/home_captain/widget/connect.dart b/lib/views/home/Captin/home_captain/widget/connect.dart
index a8a7b9e..efaf37e 100644
--- a/lib/views/home/Captin/home_captain/widget/connect.dart
+++ b/lib/views/home/Captin/home_captain/widget/connect.dart
@@ -7,7 +7,6 @@ import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
import '../../../../../constant/style.dart';
import '../../../../widgets/elevated_btn.dart';
import '../../../../../controller/home/captin/home_captain_controller.dart';
-import '../../../../../controller/home/captin/order_request_controller.dart';
class ConnectWidget extends StatelessWidget {
const ConnectWidget({
@@ -27,14 +26,14 @@ class ConnectWidget extends StatelessWidget {
builder: (homeCaptainController) => int.parse(
homeCaptainController.countRefuse) >
3 ||
- double.parse(captainWalletController.totalPoints) < -3000
+ double.parse(captainWalletController.totalPoints) < -300
? CupertinoButton(
onPressed: () {
Get.defaultDialog(
// backgroundColor: CupertinoColors.destructiveRed,
barrierDismissible: false,
title: double.parse(captainWalletController.totalPoints) <
- -3000
+ -300
? 'You dont have Points'.tr
: 'You Are Stopped For this Day !'.tr,
titleStyle: AppStyle.title,
@@ -44,7 +43,7 @@ class ConnectWidget extends StatelessWidget {
onPressed: () async {
double.parse(
captainWalletController.totalPoints) <
- -3000
+ -300
? await Get.find()
.speakText(
'You must be recharge your Account'
@@ -58,7 +57,7 @@ class ConnectWidget extends StatelessWidget {
),
Text(
double.parse(captainWalletController.totalPoints) <
- -3000
+ -300
? 'You must be recharge your Account'.tr
: 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
.tr,
@@ -68,7 +67,7 @@ class ConnectWidget extends StatelessWidget {
),
confirm:
double.parse(captainWalletController.totalPoints) <
- -3000
+ -300
? MyElevatedButton(
title: 'Recharge my Account'.tr,
onPressed: () {
diff --git a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart
index bf29453..20fbfa2 100644
--- a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart
+++ b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart
@@ -1,6 +1,8 @@
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/controller/firebase/local_notification.dart';
import 'package:SEFER/main.dart';
+import 'package:SEFER/views/home/Captin/orderCaptin/order_request_page.dart';
+import 'package:SEFER/views/home/Captin/orderCaptin/order_speed_request.dart';
import 'package:SEFER/views/home/Captin/orderCaptin/vip_order_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart';
@@ -9,6 +11,8 @@ import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../../../constant/colors.dart';
+import '../../../../../controller/home/payment/captain_wallet_controller.dart';
+import '../../../../../print.dart';
import '../../../../Rate/ride_calculate_driver.dart';
import '../../../../../controller/functions/location_controller.dart';
@@ -175,32 +179,29 @@ GetBuilder leftMainMenuCaptainIcons() {
),
// Platform.isAndroid
// ?
- AnimatedContainer(
- duration: const Duration(microseconds: 200),
- width: controller.widthMapTypeAndTraffic,
- decoration: BoxDecoration(
- color: AppColor.secondaryColor,
- border: Border.all(color: AppColor.blueColor),
- borderRadius: BorderRadius.circular(15)),
- child: Builder(builder: (context) {
- return IconButton(
- onPressed: () async {
- // mySnakeBarError('ad');
- Get.to(() => VipOrderPage(), arguments: {
- 'myListString': 'myListString',
- 'DriverList': 'myList',
- // 'PolylineJson': myPoints,
- 'body': 'message.notification!.body'
- });
- },
- icon: const Icon(
- FontAwesome5.window_close,
- size: 29,
- color: AppColor.blueColor,
- ),
- );
- }),
- ),
+ int.parse(box.read(BoxName.carYear).toString()) > 2023
+ ? AnimatedContainer(
+ duration: const Duration(microseconds: 200),
+ width: controller.widthMapTypeAndTraffic,
+ decoration: BoxDecoration(
+ color: AppColor.secondaryColor,
+ border: Border.all(color: AppColor.blueColor),
+ borderRadius: BorderRadius.circular(15)),
+ child: Builder(builder: (context) {
+ return IconButton(
+ onPressed: () async {
+ // mySnakeBarError('ad');
+ Get.to(() => VipOrderPage());
+ },
+ icon: const Icon(
+ Octicons.watch,
+ size: 29,
+ color: AppColor.blueColor,
+ ),
+ );
+ }),
+ )
+ : const SizedBox(),
// : const SizedBox(),
// AnimatedContainer(
// duration: const Duration(microseconds: 200),
@@ -212,84 +213,84 @@ GetBuilder leftMainMenuCaptainIcons() {
// child: Builder(builder: (context) {
// return IconButton(
// onPressed: () async {
- // // Get.to(() => LoginCaptin());
- // // print(box.read(BoxName.myList));
- // // Bubble().startBubbleHead(sendAppToBackground: true);
- // List d = [
- // "30.003028,31.2419628",
- // "30.0955661,31.2665336",
- // "160.00",
- // "25.92",
- // "1488",
- // "16.93",
- // "114243034311436865474",
- // "113172279072358305645",
- // "hamza ayed",
- // "rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3",
- // "+201023248456",
- // "1 min",
- // "1 m",
- // "false",
- // "QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9",
- // "0",
- // "238",
- // "false",
- // "114243034311436865474",
- // "1488",
- // "startEnd",
- // "30.049307749732176,31.274291574954987",
- // "",
- // "",
- // "",
- // "",
- // "17.73",
- // "0",
- // "hamzaayedflutter@gmail.com",
- // "الفسطاط، حي مصر القديمة، مصر",
- // " الزاوية الحمراء، محافظة القاهرة، مصر",
- // "Speed",
- // "8",
- // "5.00"
- // ];
-
- // box.write(BoxName.rideArguments, {
- // 'passengerLocation': d[0].toString(),
- // 'passengerDestination': d[1].toString(),
- // 'Duration': d[4].toString(),
- // 'totalCost': d[26].toString(),
- // 'Distance': d[5].toString(),
- // 'name': d[8].toString(),
- // 'phone': d[10].toString(),
- // 'email': d[28].toString(),
- // 'WalletChecked': d[13].toString(),
- // 'tokenPassenger': d[9].toString(),
- // 'direction':
- // 'https://www.google.com/maps/dir/${d[0]}/${d[1]}/',
- // 'DurationToPassenger': d[15].toString(),
- // 'rideId': d[16].toString(),
- // 'passengerId': d[7].toString(),
- // 'driverId': d[18].toString(),
- // 'durationOfRideValue': d[19].toString(),
- // 'paymentAmount': d[2].toString(),
- // 'paymentMethod':
- // d[13].toString() == 'true' ? 'visa' : 'cash',
- // 'isHaveSteps': d[20].toString(),
- // 'step0': d[21].toString(),
- // 'step1': d[22].toString(),
- // 'step2': d[23].toString(),
- // 'step3': d[24].toString(),
- // 'step4': d[25].toString(),
- // 'passengerWalletBurc': d[26].toString(),
- // 'timeOfOrder': DateTime.now().toString(),
- // 'totalPassenger': d[2].toString(),
- // 'carType': d[31].toString(),
- // 'kazan': d[32].toString(),
- // 'startNameLocation': d[29].toString(),
- // 'endNameLocation': d[30].toString(),
- // });
- // Get.to(() => PassengerLocationMapPage(),
- // arguments: box.read(BoxName.rideArguments));
- // // Get.offAll(() => HomeCaptainController());
+ // NotificationController()
+ // .showTimerNotification('title', 'message', 'tone1');
+ // // Get.to(() => OrderRequestPage(), arguments: {
+ // // 'myListString': [
+ // // "30.1068014,31.244621",
+ // // "30.0664345,31.2857709",
+ // // "68.56",
+ // // "25.92",
+ // // "1445",
+ // // "11.29",
+ // // "114243034311436865474",
+ // // "114243034311436865474",
+ // // "sefer app",
+ // // "cAVvCAywQvm6LUAqF2E3sU:APA91bHusGWWBwlaKQ6A4idNTVzvakCxtFxPPrHwVR2ycMZK5IP27Tf-RDnUypure0NVGxdFf6npAV7bi4_KWZP-UKJ0Pz3lUogWWbtzO9bIPJgBP3SPCvA",
+ // // "+201023248456",
+ // // "0",
+ // // "0",
+ // // "true",
+ // // "fbeWrFqeQMqorzVU9-2mIa:APA91bHWIcbxzsk3C-w7fiAZ0NRRpPuAmRgNjduS2oQ5lZ7jFEMhA7gfWQLyRWfnhcjmUA9GByyzoLxcfvb7VhcL9zSgo15hVG4DMyJ_k5di1I3oii5Pe9w",
+ // // "0",
+ // // "1087",
+ // // "false",
+ // // "114243034311436865474",
+ // // "1445",
+ // // "startEnd",
+ // // "30.08517654446625,31.27303797751665",
+ // // "",
+ // // "",
+ // // "",
+ // // "",
+ // // "13.98",
+ // // "0",
+ // // "sefertraveling@gmail.com",
+ // // "5 مصر اسكندريه، شبرا الخيمة، قسم أول شبرا الخيمة، محافظة القليوبية 6210011، مصر",
+ // // "12 مدرسة العباسية الميكانيكية، السرايات، الوايلى، محافظة القاهرة 4391080، مصر",
+ // // "Speed",
+ // // "8",
+ // // "5.00"
+ // // ],
+ // // 'DriverList': [
+ // // "30.1068014,31.244621",
+ // // "30.0664345,31.2857709",
+ // // "68.56",
+ // // "25.92",
+ // // "1445",
+ // // "11.29",
+ // // "114243034311436865474",
+ // // "114243034311436865474",
+ // // "sefer app",
+ // // "cAVvCAywQvm6LUAqF2E3sU:APA91bHusGWWBwlaKQ6A4idNTVzvakCxtFxPPrHwVR2ycMZK5IP27Tf-RDnUypure0NVGxdFf6npAV7bi4_KWZP-UKJ0Pz3lUogWWbtzO9bIPJgBP3SPCvA",
+ // // "+201023248456",
+ // // "0",
+ // // "0",
+ // // "true",
+ // // "fbeWrFqeQMqorzVU9-2mIa:APA91bHWIcbxzsk3C-w7fiAZ0NRRpPuAmRgNjduS2oQ5lZ7jFEMhA7gfWQLyRWfnhcjmUA9GByyzoLxcfvb7VhcL9zSgo15hVG4DMyJ_k5di1I3oii5Pe9w",
+ // // "0",
+ // // "1087",
+ // // "false",
+ // // "114243034311436865474",
+ // // "1445",
+ // // "startEnd",
+ // // "30.08517654446625,31.27303797751665",
+ // // "",
+ // // "",
+ // // "",
+ // // "",
+ // // "13.98",
+ // // "0",
+ // // "sefertraveling@gmail.com",
+ // // "5 مصر اسكندريه، شبرا الخيمة، قسم أول شبرا الخيمة، محافظة القليوبية 6210011، مصر",
+ // // "12 مدرسة العباسية الميكانيكية، السرايات، الوايلى، محافظة القاهرة 4391080، مصر",
+ // // "Speed",
+ // // "8",
+ // // "5.00"
+ // // ],
+ // // // 'PolylineJson': myPoints,
+ // // // 'body': message.notification!.body
+ // // });
// },
// icon: const Icon(
// FontAwesome5.grin_tears,
@@ -299,7 +300,7 @@ GetBuilder leftMainMenuCaptainIcons() {
// );
// }),
// ),
- // ,
+
const SizedBox(
height: 5,
),
diff --git a/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart b/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart
index e7402de..22ff7f8 100644
--- a/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart
+++ b/lib/views/home/Captin/mapDriverWidgets/google_driver_map_page.dart
@@ -23,7 +23,7 @@ class GoogleDriverMap extends StatelessWidget {
builder: (controller) => Column(
children: [
SizedBox(
- height: Get.height * .6,
+ height: Get.height * .92,
child: GoogleMap(
onMapCreated: controller.onMapCreated,
zoomControlsEnabled: true,
diff --git a/lib/views/home/Captin/orderCaptin/order_request_page.dart b/lib/views/home/Captin/orderCaptin/order_request_page.dart
index eb88165..dc09ad4 100644
--- a/lib/views/home/Captin/orderCaptin/order_request_page.dart
+++ b/lib/views/home/Captin/orderCaptin/order_request_page.dart
@@ -8,7 +8,6 @@ import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/controller/firebase/firbase_messge.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/Captin/driver_map_page.dart';
-import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'dart:math' as math;
import '../../../../constant/colors.dart';
@@ -19,47 +18,44 @@ import '../../../../controller/functions/launch.dart';
import '../../../../controller/home/captin/order_request_controller.dart';
import '../../../widgets/elevated_btn.dart';
-class OrderRequestPage extends StatelessWidget {
+class OrderRequestPage extends StatefulWidget {
OrderRequestPage({super.key});
- OrderRequestController orderRequestController =
+
+ @override
+ State createState() => _OrderRequestPageState();
+}
+
+class _OrderRequestPageState extends State {
+ final OrderRequestController orderRequestController =
Get.put(OrderRequestController());
- // res = orderRequestController.res;
@override
Widget build(BuildContext context) {
final arguments = Get.arguments;
- // String res = '';
final myListString = arguments['myListString'];
var myList;
- // Check if 'DriverList' is null or empty
- if (arguments['DriverList'] == null || arguments['DriverList'].isEmpty) {
- myList = jsonDecode(myListString);
- } else {
- myList = arguments['DriverList'];
- }
+ // Determine the list to use
+ myList = arguments['DriverList'] == null || arguments['DriverList'].isEmpty
+ ? jsonDecode(myListString)
+ : arguments['DriverList'];
- Duration durationToAdd = Duration(seconds: int.parse(myList[4]));
- int hours = durationToAdd.inHours;
- int minutes = (durationToAdd.inMinutes % 60).round();
- orderRequestController.startTimer(
- myList[6].toString(),
- myList[16].toString(),
- );
+ // Parse coordinates
var cords = myList[0].split(',');
var cordDestination = myList[1].split(',');
-// Parse to double
double latPassengerLocation = double.parse(cords[0]);
double lngPassengerLocation = double.parse(cords[1]);
double latPassengerDestination = double.parse(cordDestination[0]);
double lngPassengerDestination = double.parse(cordDestination[1]);
+ // Create points for route
List pointsDirection = [
LatLng(latPassengerLocation, lngPassengerLocation),
LatLng(latPassengerDestination, lngPassengerDestination)
- ]; // Calculate the midpoint between the two points
- // Calculate the minimum and maximum latitude and longitude values
+ ];
+
+ // Calculate bounding box
double minLatitude =
math.min(pointsDirection[0].latitude, pointsDirection[1].latitude);
double maxLatitude =
@@ -68,482 +64,531 @@ class OrderRequestPage extends StatelessWidget {
math.min(pointsDirection[0].longitude, pointsDirection[1].longitude);
double maxLongitude =
math.max(pointsDirection[0].longitude, pointsDirection[1].longitude);
-// Create a bounding box using the calculated values
+
LatLngBounds bounds = LatLngBounds(
southwest: LatLng(minLatitude, minLongitude),
northeast: LatLng(maxLatitude, maxLongitude),
);
- // void addCustomStartIcon() async {
-// Create the marker with the resized image
+
+ // Start timer and calculate fuel consumption
+ orderRequestController.startTimer(
+ myList[6].toString(),
+ myList[16].toString(),
+ );
orderRequestController.calculateConsumptionFuel();
- // }
- // orderRequestController.calculateConsumptionFuel();
-
- return MyScafolld(
- title: 'Special Order'.tr,
- body: [
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 6),
- child: Container(
- color: const Color.fromARGB(255, 210, 201, 201),
- child: ListView(
- // crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- // SizedBox(height: 200, child: Text(pointsList.toString())),
- // Text(message.notification!.body.toString()),
- SizedBox(
- height: Get.height * .33,
- child: GoogleMap(
- initialCameraPosition: CameraPosition(
- zoom: 12,
- target: Get.find().myLocation),
- cameraTargetBounds: CameraTargetBounds(bounds),
- myLocationButtonEnabled: true,
- trafficEnabled: true,
- buildingsEnabled: true,
- mapToolbarEnabled: true,
- myLocationEnabled: true,
- markers: {
- Marker(
- markerId: MarkerId('MyLocation'.tr),
- position: LatLng(
- latPassengerLocation, lngPassengerLocation),
- draggable: true,
- icon: orderRequestController.startIcon),
- Marker(
- markerId: MarkerId('Destination'.tr),
- position: LatLng(latPassengerDestination,
- lngPassengerDestination),
- draggable: true,
- icon: orderRequestController.endIcon),
- },
- polylines: {
- Polyline(
- zIndex: 1,
- consumeTapEvents: true,
- geodesic: true,
- endCap: Cap.buttCap,
- startCap: Cap.buttCap,
- visible: true,
- polylineId: const PolylineId('routeOrder'),
- points: pointsDirection,
- color: AppColor.primaryColor,
- width: 2,
- ),
- },
+ return Scaffold(
+ body: Stack(
+ children: [
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 6),
+ child: Container(
+ color: const Color.fromARGB(255, 241, 238, 238),
+ child: ListView(
+ children: [
+ SizedBox(
+ height: Get.height * .33,
+ child: GoogleMap(
+ initialCameraPosition: CameraPosition(
+ zoom: 12,
+ target: Get.find().myLocation,
+ ),
+ cameraTargetBounds: CameraTargetBounds(bounds),
+ myLocationButtonEnabled: true,
+ trafficEnabled: false,
+ buildingsEnabled: false,
+ mapToolbarEnabled: true,
+ myLocationEnabled: true,
+ markers: {
+ Marker(
+ markerId: MarkerId('MyLocation'.tr),
+ position:
+ LatLng(latPassengerLocation, lngPassengerLocation),
+ draggable: true,
+ icon: orderRequestController.startIcon,
+ ),
+ Marker(
+ markerId: MarkerId('Destination'.tr),
+ position: LatLng(
+ latPassengerDestination, lngPassengerDestination),
+ draggable: true,
+ icon: orderRequestController.endIcon,
+ ),
+ },
+ polylines: {
+ Polyline(
+ zIndex: 1,
+ consumeTapEvents: true,
+ geodesic: true,
+ endCap: Cap.buttCap,
+ startCap: Cap.buttCap,
+ visible: true,
+ polylineId: const PolylineId('routeOrder'),
+ points: pointsDirection,
+ color: AppColor.primaryColor,
+ width: 2,
+ ),
+ },
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Card(
+ elevation: 3,
+ color: myList[20].toString() == 'haveSteps'
+ ? AppColor.greenColor
+ : AppColor.secondaryColor,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ TextButton.icon(
+ onPressed: () {
+ String mapUrl =
+ 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
+ showInBrowser(mapUrl);
+ },
+ icon: const Icon(Icons.map),
+ label: myList[20].toString() == 'haveSteps'
+ ? Text(
+ 'Trip has Steps'.tr,
+ style: AppStyle.title,
+ )
+ : Text('Payment Method'.tr,
+ style: AppStyle.title)),
+ Container(
+ padding: const EdgeInsets.symmetric(
+ vertical: 8, horizontal: 12),
+ decoration: AppStyle.boxDecoration.copyWith(
+ color: myList[13].toString() == 'true'
+ ? AppColor.deepPurpleAccent
+ : AppColor.greenColor,
+ borderRadius: BorderRadius.circular(8),
+ boxShadow: [
+ const BoxShadow(
+ color: Colors.black12,
+ blurRadius: 4,
+ offset: Offset(2, 2),
+ ),
+ ],
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(
+ myList[13].toString() == 'true'
+ ? Icons.credit_card
+ : Icons.money,
+ color: Colors.white,
+ size: 20,
+ ),
+ const SizedBox(width: 8),
+ Text(
+ myList[13].toString() == 'true'
+ ? 'Visa'
+ : 'Cash',
+ style: AppStyle.title
+ .copyWith(color: Colors.white),
+ ),
+ ],
+ ),
+ )
+ ],
),
),
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: Card(
- elevation: 3,
- color: myList[20].toString() == 'haveSteps'
- ? AppColor.greenColor
- : AppColor.secondaryColor,
+ ),
+ Container(
+ decoration: AppStyle.boxDecoration1,
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
- TextButton.icon(
- onPressed: () {
- String mapUrl =
- 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
- showInBrowser(mapUrl);
- },
- icon: const Icon(Icons.map),
- label: myList[20].toString() == 'haveSteps'
- ? Text(
- 'Trip has Steps'.tr,
- style: AppStyle.title,
- )
- : Text('Payment Method'.tr,
- style: AppStyle.title)),
- Container(
- decoration: AppStyle.boxDecoration.copyWith(
- color: myList[13].toString() == 'true'
- ? AppColor.deepPurpleAccent
- : AppColor.greenColor,
- ),
- child: myList[13].toString() ==
- 'true' //Visa or Cash Method from notify to driver
- ? Text(
- 'Visa',
- style: AppStyle.title,
- )
- : Text('Cash', style: AppStyle.title),
- )
- ],
- ),
- ),
- ),
-
- Container(
- decoration: AppStyle.boxDecoration1,
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Text(
- double.parse(myList[2]).toStringAsFixed(2),
- style: AppStyle.headTitle2,
- ),
- AnimatedContainer(
+ Text(
+ double.parse(myList[2]).toStringAsFixed(2),
+ style: AppStyle.headTitle2,
+ ),
+ AnimatedContainer(
+ duration: const Duration(seconds: 5),
+ curve: Curves.easeInOut,
+ child: AnimatedSize(
duration: const Duration(seconds: 5),
curve: Curves.easeInOut,
- child: AnimatedSize(
- duration: const Duration(seconds: 5),
- curve: Curves.easeInOut,
- child: myList[31].toString() == 'Comfort'
- ? Column(
- mainAxisAlignment:
- MainAxisAlignment.spaceAround,
- children: [
- const Icon(
- Icons.ac_unit,
- color: AppColor.blueColor,
- size: 50,
- ),
- Text(
- 'Air condition Trip'.tr,
- style: AppStyle.subtitle,
- ),
- ],
- )
- : const SizedBox(),
- ),
+ child: myList[31].toString() == 'Comfort'
+ ? Column(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceAround,
+ children: [
+ const Icon(
+ Icons.ac_unit,
+ color: AppColor.blueColor,
+ size: 50,
+ ),
+ Text(
+ 'Air condition Trip'.tr,
+ style: AppStyle.subtitle,
+ ),
+ ],
+ )
+ : const SizedBox(),
+ ),
+ ),
+ Text(
+ myList[31].toString().tr,
+ style: AppStyle.title
+ .copyWith(color: AppColor.greenColor),
+ ),
+ ],
+ )),
+ ),
+ const SizedBox(
+ height: 5,
+ ),
+ Container(
+ height: Get.height * .25,
+ width: Get.width * .9,
+ decoration: AppStyle.boxDecoration1,
+ child: Padding(
+ padding:
+ const EdgeInsets.symmetric(horizontal: 5, vertical: 1),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ const Icon(
+ Icons.arrow_circle_up,
+ color: AppColor.greenColor,
+ ),
+ Row(
+ children: [
+ const Icon(Icons.access_time,
+ color: Colors.grey, size: 16),
+ const SizedBox(width: 4),
+ Text(
+ '${(double.parse(myList[12]) / 60).toStringAsFixed(0)} ${'minute'.tr}',
+ style: AppStyle.title.copyWith(
+ fontWeight: FontWeight.bold,
+ fontSize: 14,
+ color: Colors.black),
+ ),
+ const SizedBox(width: 8),
+ const Icon(Icons.directions_car,
+ color: Colors.grey, size: 16),
+ const SizedBox(width: 4),
+ Text(
+ '${(double.parse(myList[11]) / 1000).toStringAsFixed(1)} ${'kilometer'.tr}',
+ style: AppStyle.title.copyWith(
+ fontWeight: FontWeight.bold,
+ fontSize: 14,
+ color: Colors.black),
+ ),
+ ],
+ )
+ ],
),
Text(
- myList[31].toString().tr,
- style: AppStyle.title
- .copyWith(color: AppColor.greenColor),
+ myList[29],
+ style: AppStyle.title,
),
],
- )),
- ),
- const SizedBox(
- height: 5,
- ),
- Container(
- height: Get.height * .15,
- width: Get.width * .9,
- decoration: AppStyle.boxDecoration1,
- child: Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 5, vertical: 1),
- child: ListView(
- // mainAxisAlignment: MainAxisAlignment.spaceBetween,
- // crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- const Icon(
- Icons.arrow_circle_up,
- color: AppColor.greenColor,
- ),
- Text(
- myList[12] + ' ' + ' (${myList[11]}) ',
- style: AppStyle.title,
- ),
- ],
- ),
- Text(
- myList[29],
- style: AppStyle.title,
- ),
- ],
- ),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- const Icon(
- Icons.arrow_circle_down,
- color: AppColor.redColor,
- ),
- Text(
- myList[5] + ' ' + ' (${myList[4]}) ',
- style: AppStyle.title,
- ),
- ],
- ),
- Text(
- myList[30],
- style: AppStyle.title,
- ),
- ],
- ),
- ],
- ),
- ),
- ),
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: RichText(
- text: TextSpan(
- text: "Passenger name: "
- .tr, // Changed text to be more generic
- style: AppStyle.subtitle,
- children: [
- TextSpan(
- text: myList[8],
- style: AppStyle
- .title), // Assuming myList[8] holds passenger name
- TextSpan(text: ' (', style: AppStyle.subtitle),
- TextSpan(
- text: myList[33].toString(),
- style: AppStyle
- .title), // Assuming 'rate' holds the passenger rate
- TextSpan(text: ' ⭐)', style: AppStyle.subtitle),
- ],
- ),
- ),
- ),
-
- Padding(
- padding: const EdgeInsets.all(4),
- child: Container(
- color: AppColor.greenColor.withOpacity(.5),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- RichText(
- text: TextSpan(
- text: 'Cost Of Trip IS '.tr,
- style: AppStyle.title,
+ ),
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ // mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
children: [
- TextSpan(
- text: myList[26],
- style: AppStyle.headTitle2),
+ const Icon(
+ Icons.arrow_circle_down,
+ color: AppColor.redColor,
+ ),
+ // Text(
+ // '${(double.parse(myList[4]) / 60).toStringAsFixed(1)} min (${(double.parse(myList[5])).toStringAsFixed(1)} km)',
+ // style: AppStyle.title,
+ // ),
+ Row(
+ children: [
+ const Icon(Icons.access_time,
+ color: Colors.grey, size: 16),
+ const SizedBox(width: 4),
+ Text(
+ '${(double.parse(myList[4]) / 60).toStringAsFixed(0)} ${'minute'.tr}',
+ style: AppStyle.title.copyWith(
+ fontWeight: FontWeight.bold,
+ fontSize: 14,
+ color: Colors.black),
+ ),
+ const SizedBox(width: 8),
+ const Icon(Icons.directions_car,
+ color: Colors.grey, size: 16),
+ const SizedBox(width: 4),
+ Text(
+ '${(double.parse(myList[5])).toStringAsFixed(1)} ${'kilometer'.tr}',
+ style: AppStyle.title.copyWith(
+ fontWeight: FontWeight.bold,
+ fontSize: 14,
+ color: Colors.black),
+ ),
+ ],
+ )
],
),
- ),
- RichText(
- text: TextSpan(
- text: 'Total net'.tr,
+ Text(
+ myList[30],
style: AppStyle.title,
- children: [
- TextSpan(
- text: (double.parse(myList[2]) -
- double.parse(myList[32]))
- .toStringAsFixed(2),
- style: AppStyle.headTitle2),
- ],
),
- ),
- ],
- ),
- ),
- ),
-
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- MyElevatedButton(
- kolor: AppColor.greenColor,
- title: 'Accept Order'.tr,
- onPressed: () async {
- Get.put(HomeCaptainController()).changeRideId();
- box.write(BoxName.statusDriverLocation, 'on');
- orderRequestController.endTimer();
- orderRequestController.changeApplied();
- await CRUD().postFromDialogue(
- link: AppLink.addDriverOrder,
- payload: {
- 'driver_id': myList[6].toString(),
- // box.read(BoxName.driverID).toString(),
- 'order_id': myList[16].toString(),
- 'status': 'Apply'
- });
- CRUD().postFromDialogue(
- link:
- '${AppLink.seferAlexandriaServer}/driver_order/add.php',
- payload: {
- 'driver_id': myList[6].toString(),
- // box.read(BoxName.driverID).toString(),
- 'order_id': myList[16].toString(),
- 'status': 'Apply'
- });
-
- CRUD().postFromDialogue(
- link:
- '${AppLink.seferGizaServer}/driver_order/add.php',
- payload: {
- 'driver_id': myList[6].toString(),
- // box.read(BoxName.driverID).toString(),
- 'order_id': myList[16].toString(),
- 'status': 'Apply'
- });
-
- ///
- var res = await CRUD().post(
- link: AppLink.updateRideAndCheckIfApplied,
- payload: {
- 'id': myList[16],
- 'rideTimeStart': DateTime.now().toString(),
- 'status': 'Apply',
- 'driver_id': myList[6].toString(),
- });
- CRUD().post(
- link:
- '${AppLink.seferAlexandriaServer}/rides/updateRideAndCheckIfApplied.php',
- payload: {
- 'id': myList[16],
- 'rideTimeStart': DateTime.now().toString(),
- 'status': 'Apply',
- 'driver_id': myList[6].toString(),
- });
- CRUD().post(
- link:
- '${AppLink.seferAlexandriaServer}/rides/updateRideAndCheckIfApplied.php',
- payload: {
- 'id': myList[16],
- 'rideTimeStart': DateTime.now().toString(),
- 'status': 'Apply',
- 'driver_id': myList[6].toString(),
- });
- if (res == 'failure') {
- MyDialog().getDialog(
- "This ride is already applied by another driver."
- .tr,
- '', () {
- Get.back();
- });
- } else {
- List bodyToPassenger = [
- myList[6].toString(), //driver id
- myList[8].toString(), // driver name
- myList[9].toString(), //token driver
- ];
- FirebaseMessagesController()
- .sendNotificationToPassengerToken(
- 'Apply Ride'.tr,
- 'your ride is applied'.tr,
- // arguments['DriverList'][9].toString(),
- myList[9].toString(),
- // box.read(BoxName.tokenDriver).toString(),
- bodyToPassenger,
- 'start.wav');
- Get.back();
- box.write(BoxName.rideArguments, {
- 'passengerLocation': myList[0].toString(),
- 'passengerDestination': myList[1].toString(),
- 'Duration': myList[4].toString(),
- 'totalCost': myList[26].toString(),
- 'Distance': myList[5].toString(),
- 'name': myList[8].toString(),
- 'phone': myList[10].toString(),
- 'email': myList[28].toString(),
- 'WalletChecked': myList[13].toString(),
- 'tokenPassenger': myList[9].toString(),
- 'direction':
- 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
- 'DurationToPassenger': myList[15].toString(),
- 'rideId': myList[16].toString(),
- 'passengerId': myList[7].toString(),
- 'driverId': myList[18].toString(),
- 'durationOfRideValue': myList[19].toString(),
- 'paymentAmount': myList[2].toString(),
- 'paymentMethod': myList[13].toString() == 'true'
- ? 'visa'
- : 'cash',
- 'isHaveSteps': myList[20].toString(),
- 'step0': myList[21].toString(),
- 'step1': myList[22].toString(),
- 'step2': myList[23].toString(),
- 'step3': myList[24].toString(),
- 'step4': myList[25].toString(),
- 'passengerWalletBurc': myList[26].toString(),
- 'timeOfOrder': DateTime.now().toString(),
- 'totalPassenger': myList[2].toString(),
- 'carType': myList[31].toString(),
- 'kazan': myList[32].toString(),
- 'startNameLocation': myList[29].toString(),
- 'endNameLocation': myList[30].toString(),
- });
- 'passengerID =${box.read(BoxName.rideArguments)}';
- Get.to(() => PassengerLocationMapPage(),
- arguments: box.read(BoxName.rideArguments));
- }
- // Get.back();
- },
- ),
- GetBuilder(
- builder: (timerController) {
- final isNearEnd = timerController.remainingTime <=
- 5; // Define a threshold for "near end"
-
- return Stack(
- alignment: Alignment.center,
- children: [
- CircularProgressIndicator(
- value: timerController.progress,
- // Set the color based on the "isNearEnd" condition
- color: isNearEnd ? Colors.red : Colors.blue,
- ),
- Text(
- '${timerController.remainingTime}',
- style: AppStyle.number,
- ),
- ],
- );
- },
- ),
- MyElevatedButton(
- title: 'Refuse Order'.tr,
- onPressed: () async {
- orderRequestController.endTimer();
- List bodyToPassenger = [
- box.read(BoxName.driverID).toString(),
- box.read(BoxName.nameDriver).toString(),
- box.read(BoxName.tokenDriver).toString(),
- ];
-
- FirebaseMessagesController()
- .sendNotificationToPassengerToken(
- 'Order Under Review'.tr,
- '${box.read(BoxName.nameDriver)} ${'is reviewing your order. They may need more information or a higher price.'.tr}',
- myList[9].toString(),
- bodyToPassenger,
- 'notification.wav');
-
- orderRequestController.refuseOrder(
- myList[16].toString(),
- );
- orderRequestController.addRideToNotificationDriverString(
- myList[16].toString(),
- myList[29].toString(),
- myList[30].toString(),
- '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day}',
- '${DateTime.now().hour}:${DateTime.now().minute}',
- myList[2].toString(),
- myList[7].toString(),
- 'wait',
- myList[31].toString(),
- myList[33].toString(),
- myList[2].toString(),
- myList[5].toString(),
- myList[4].toString()); //duration
- },
- kolor: AppColor.redColor,
+ ],
),
],
),
- )
- ],
- ),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Row(
+ children: [
+ const Icon(Icons.person, size: 20, color: Colors.grey),
+ const SizedBox(width: 8),
+ Expanded(
+ child: RichText(
+ text: TextSpan(
+ text: "${'Passenger name: '.tr} ",
+ style: AppStyle.subtitle,
+ children: [
+ TextSpan(
+ text: myList[8],
+ style: AppStyle.title
+ .copyWith(fontWeight: FontWeight.bold),
+ ),
+ TextSpan(
+ text: ' (',
+ style: AppStyle.subtitle,
+ ),
+ TextSpan(
+ text: myList[33].toString(),
+ style: AppStyle.title
+ .copyWith(color: Colors.amber),
+ ),
+ const WidgetSpan(
+ child: Icon(
+ Icons.star,
+ size: 16,
+ color: Colors.amber,
+ ),
+ ),
+ TextSpan(
+ text: ')',
+ style: AppStyle.subtitle,
+ ),
+ ],
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ MyElevatedButton(
+ kolor: AppColor.greenColor,
+ title: 'Accept Order'.tr,
+ onPressed: () async {
+ Get.put(HomeCaptainController()).changeRideId();
+ box.write(BoxName.statusDriverLocation, 'on');
+ orderRequestController.endTimer();
+ orderRequestController.changeApplied();
+ await CRUD().postFromDialogue(
+ link: AppLink.addDriverOrder,
+ payload: {
+ 'driver_id': myList[6].toString(),
+ // box.read(BoxName.driverID).toString(),
+ 'order_id': myList[16].toString(),
+ 'status': 'Apply'
+ });
+ CRUD().postFromDialogue(
+ link:
+ '${AppLink.seferAlexandriaServer}/driver_order/add.php',
+ payload: {
+ 'driver_id': myList[6].toString(),
+ // box.read(BoxName.driverID).toString(),
+ 'order_id': myList[16].toString(),
+ 'status': 'Apply'
+ });
+
+ CRUD().postFromDialogue(
+ link:
+ '${AppLink.seferGizaServer}/driver_order/add.php',
+ payload: {
+ 'driver_id': myList[6].toString(),
+ // box.read(BoxName.driverID).toString(),
+ 'order_id': myList[16].toString(),
+ 'status': 'Apply'
+ });
+
+ ///
+ var res = await CRUD().post(
+ link: AppLink.updateRideAndCheckIfApplied,
+ payload: {
+ 'id': myList[16],
+ 'rideTimeStart': DateTime.now().toString(),
+ 'status': 'Apply',
+ 'driver_id': myList[6].toString(),
+ });
+ if (AppLink.endPoint != AppLink.seferCairoServer) {
+ CRUD().post(
+ link:
+ '${AppLink.endPoint}/rides/updateRideAndCheckIfApplied.php',
+ payload: {
+ 'id': myList[16],
+ 'rideTimeStart': DateTime.now().toString(),
+ 'status': 'Apply',
+ 'driver_id': myList[6].toString(),
+ });
+ }
+
+ if (res == 'failure') {
+ MyDialog().getDialog(
+ "This ride is already applied by another driver."
+ .tr,
+ '', () {
+ Get.back();
+ });
+ } else {
+ List bodyToPassenger = [
+ myList[6].toString(), //driver id
+ myList[8].toString(), // driver name
+ myList[9].toString(), //token driver
+ ];
+ FirebaseMessagesController()
+ .sendNotificationToPassengerToken(
+ 'Apply Ride'.tr,
+ 'your ride is applied'.tr,
+ // arguments['DriverList'][9].toString(),
+ myList[9].toString(),
+ // box.read(BoxName.tokenDriver).toString(),
+ bodyToPassenger,
+ 'start.wav');
+ Get.back();
+ box.write(BoxName.rideArguments, {
+ 'passengerLocation': myList[0].toString(),
+ 'passengerDestination': myList[1].toString(),
+ 'Duration': myList[4].toString(),
+ 'totalCost': myList[26].toString(),
+ 'Distance': myList[5].toString(),
+ 'name': myList[8].toString(),
+ 'phone': myList[10].toString(),
+ 'email': myList[28].toString(),
+ 'WalletChecked': myList[13].toString(),
+ 'tokenPassenger': myList[9].toString(),
+ 'direction':
+ 'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
+ 'DurationToPassenger': myList[15].toString(),
+ 'rideId': myList[16].toString(),
+ 'passengerId': myList[7].toString(),
+ 'driverId': myList[18].toString(),
+ 'durationOfRideValue': myList[19].toString(),
+ 'paymentAmount': myList[2].toString(),
+ 'paymentMethod': myList[13].toString() == 'true'
+ ? 'visa'
+ : 'cash',
+ 'isHaveSteps': myList[20].toString(),
+ 'step0': myList[21].toString(),
+ 'step1': myList[22].toString(),
+ 'step2': myList[23].toString(),
+ 'step3': myList[24].toString(),
+ 'step4': myList[25].toString(),
+ 'passengerWalletBurc': myList[26].toString(),
+ 'timeOfOrder': DateTime.now().toString(),
+ 'totalPassenger': myList[2].toString(),
+ 'carType': myList[31].toString(),
+ 'kazan': myList[32].toString(),
+ 'startNameLocation': myList[29].toString(),
+ 'endNameLocation': myList[30].toString(),
+ });
+ 'passengerID =${box.read(BoxName.rideArguments)}';
+ Get.to(() => PassengerLocationMapPage(),
+ arguments: box.read(BoxName.rideArguments));
+ }
+ // Get.back();
+ },
+ ),
+ GetBuilder(
+ builder: (timerController) {
+ final isNearEnd = timerController.remainingTime <=
+ 5; // Define a threshold for "near end"
+
+ return Stack(
+ alignment: Alignment.center,
+ children: [
+ CircularProgressIndicator(
+ value: timerController.progress,
+ // Set the color based on the "isNearEnd" condition
+ color: isNearEnd ? Colors.red : Colors.blue,
+ ),
+ Text(
+ '${timerController.remainingTime}',
+ style: AppStyle.number,
+ ),
+ ],
+ );
+ },
+ ),
+ MyElevatedButton(
+ title: 'Refuse Order'.tr,
+ onPressed: () async {
+ orderRequestController.endTimer();
+ List bodyToPassenger = [
+ box.read(BoxName.driverID).toString(),
+ box.read(BoxName.nameDriver).toString(),
+ box.read(BoxName.tokenDriver).toString(),
+ ];
+
+ FirebaseMessagesController()
+ .sendNotificationToPassengerToken(
+ 'Order Under Review'.tr,
+ '${box.read(BoxName.nameDriver)} ${'is reviewing your order. They may need more information or a higher price.'.tr}',
+ myList[9].toString(),
+ bodyToPassenger,
+ 'notification.wav');
+
+ orderRequestController.refuseOrder(
+ myList[16].toString(),
+ );
+ orderRequestController.addRideToNotificationDriverString(
+ myList[16].toString(),
+ myList[29].toString(),
+ myList[30].toString(),
+ '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day}',
+ '${DateTime.now().hour}:${DateTime.now().minute}',
+ myList[2].toString(),
+ myList[7].toString(),
+ 'wait',
+ myList[31].toString(),
+ myList[33].toString(),
+ myList[2].toString(),
+ myList[5].toString(),
+ myList[4].toString()); //duration
+ },
+ kolor: AppColor.redColor,
+ ),
+ ],
+ ),
+ )
+ ],
),
- )
- ],
- isleading: false);
+ ),
+ )
+ ],
+ ));
}
void checkRideStatus() async {}
diff --git a/lib/views/home/Captin/orderCaptin/order_speed_request.dart b/lib/views/home/Captin/orderCaptin/order_speed_request.dart
index 4b46d93..3a220eb 100644
--- a/lib/views/home/Captin/orderCaptin/order_speed_request.dart
+++ b/lib/views/home/Captin/orderCaptin/order_speed_request.dart
@@ -23,17 +23,6 @@ class OrderSpeedRequest extends StatelessWidget {
Get.put(OrderRequestController());
@override
Widget build(BuildContext context) {
- // void addCustomStartIcon() async {
-// Create the marker with the resized image
- // orderRequestController.initilizeOrderPage();
-
- // }
- // double mpg = 0;
- // calculateConsumptionFuel() {
- // mpg = Get.find().fuelPrice /
- // 12; //todo in register car add mpg in box
- // }
-
return GetBuilder(
builder: (orderRequestController) {
return MyScafolld(
@@ -188,7 +177,7 @@ class OrderSpeedRequest extends StatelessWidget {
height: 5,
),
Container(
- height: Get.height * .22,
+ height: Get.height * .3,
width: Get.width * .9,
decoration: AppStyle.boxDecoration1,
child: Padding(
diff --git a/lib/views/home/Captin/orderCaptin/vip_order_page.dart b/lib/views/home/Captin/orderCaptin/vip_order_page.dart
index cf1fe8d..ae13aa7 100644
--- a/lib/views/home/Captin/orderCaptin/vip_order_page.dart
+++ b/lib/views/home/Captin/orderCaptin/vip_order_page.dart
@@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../../main.dart';
+import '../../../../print.dart';
class VipOrderPage extends StatelessWidget {
const VipOrderPage({super.key});
@@ -19,10 +20,58 @@ class VipOrderPage extends StatelessWidget {
title: 'VIP Order'.tr,
body: [
GetBuilder(builder: (vipOrderController) {
+ if (vipOrderController.isLoading) {
+ return const Center(
+ child: CircularProgressIndicator(),
+ );
+ }
+
+ if (vipOrderController.tripData.isEmpty) {
+ return Center(
+ child: Text('No orders available'.tr),
+ );
+ }
+ final order = vipOrderController.tripData[0];
+ Log.print('order: ${order}');
return SafeArea(
+ child: Padding(
+ padding: const EdgeInsets.all(8.0),
child: Column(
- children: [],
- ));
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ // Passenger Section
+ _buildSectionTitle('Passenger Information'.tr),
+ _buildInfoCard(
+ children: [
+ _buildDetailRow('Name'.tr,
+ '${order['passengerName'] ?? 'Unknown'} ${order['passengerLastName'] ?? ''}'),
+ _buildDetailRow(
+ 'Phone'.tr, order['passengerPhone'] ?? 'Unknown'),
+ _buildDetailRow(
+ 'Gender'.tr, order['passengergender'] ?? 'Unknown'),
+ _buildDetailRow('time Selected'.tr,
+ order['timeSelected'] ?? 'Unknown'),
+ _buildDetailRow(
+ 'Ride Status'.tr, order['status'] ?? 'Unknown'),
+ // _buildDetailRow('Ride Status'.tr,
+ // vipOrderController.myList[4] ?? 'Unknown'),
+ IconButton(
+ onPressed: () {
+ // print(vipOrderController.myList);
+ },
+ icon: const Icon(Icons.add),
+ ),
+ ],
+ ),
+
+ const SizedBox(height: 24),
+
+ // Action Buttons
+ _buildActionButtons(context),
+ ],
+ ),
+ ),
+ );
})
],
isleading: true,
@@ -30,39 +79,158 @@ class VipOrderPage extends StatelessWidget {
}
}
+Widget _buildSectionTitle(String title) {
+ return Padding(
+ padding: const EdgeInsets.only(bottom: 8.0),
+ child: Text(
+ title,
+ style: const TextStyle(
+ fontSize: 18,
+ fontWeight: FontWeight.bold,
+ color: Colors.black87,
+ ),
+ ),
+ );
+}
+
+Widget _buildInfoCard({required List children}) {
+ return Container(
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.circular(12),
+ boxShadow: [
+ BoxShadow(
+ color: Colors.grey.withOpacity(0.2),
+ spreadRadius: 1,
+ blurRadius: 5,
+ offset: const Offset(0, 3),
+ ),
+ ],
+ ),
+ child: Padding(
+ padding: const EdgeInsets.all(16.0),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: children,
+ ),
+ ),
+ );
+}
+
+Widget _buildDetailRow(String label, String value) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 8.0),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ flex: 2,
+ child: Text(
+ label,
+ style: const TextStyle(
+ fontWeight: FontWeight.bold,
+ color: Colors.black87,
+ ),
+ ),
+ ),
+ Expanded(
+ flex: 3,
+ child: Text(
+ value,
+ style: const TextStyle(color: Colors.black54),
+ ),
+ ),
+ ],
+ ),
+ );
+}
+
+Widget _buildActionButtons(BuildContext context) {
+ return Row(
+ children: [
+ Expanded(
+ child: ElevatedButton(
+ onPressed: () => _onReject(context),
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Colors.red,
+ padding: const EdgeInsets.symmetric(vertical: 16),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(12),
+ ),
+ ),
+ child: Text(
+ 'Reject'.tr,
+ style: const TextStyle(
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(width: 16),
+ Expanded(
+ child: ElevatedButton(
+ onPressed: () => _onApply(context),
+ style: ElevatedButton.styleFrom(
+ backgroundColor: Colors.green,
+ padding: const EdgeInsets.symmetric(vertical: 16),
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(12),
+ ),
+ ),
+ child: Text(
+ 'Apply'.tr,
+ style: const TextStyle(
+ color: Colors.white,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ ),
+ ],
+ );
+}
+
+void _onReject(BuildContext context) {
+ ScaffoldMessenger.of(context).showSnackBar(
+ const SnackBar(
+ content: Text('Ride Rejected'),
+ backgroundColor: Colors.red,
+ ),
+ );
+}
+
+void _onApply(BuildContext context) {
+ // TODO: Implement application logic
+ ScaffoldMessenger.of(context).showSnackBar(
+ const SnackBar(
+ content: Text('Ride Applied'),
+ backgroundColor: Colors.green,
+ ),
+ );
+}
+
class VipOrderController extends GetxController {
bool isLoading = false;
- final arguments = Get.arguments;
- late String body;
List tripData = [];
- var myList;
-
- initilize() {
- final myListString = arguments['myListString'];
-
- if (arguments['DriverList'] == null || arguments['DriverList'].isEmpty) {
- myList = jsonDecode(myListString);
- } else {
- myList = arguments['DriverList'];
- }
-
- body = arguments['body'];
- update();
- }
fetchOrder() async {
- var res = await CRUD().get(link: AppLink.getMishwari, payload: {
+ isLoading = true; // Set loading state
+ update(); // Notify listeners
+ var res = await CRUD().get(link: AppLink.getMishwariDriver, payload: {
'driverId': box.read(BoxName.driverID).toString(),
});
if (res != 'failure') {
tripData = jsonDecode(res)['message'];
- update();
+ } else {
+ tripData = [];
}
+ isLoading = false; // Loading complete
+ update(); // Notify listeners
}
@override
void onInit() async {
- await initilize();
fetchOrder();
super.onInit();
}
diff --git a/lib/views/home/my_wallet/points_captain.dart b/lib/views/home/my_wallet/points_captain.dart
index 2b7bbf7..40901db 100644
--- a/lib/views/home/my_wallet/points_captain.dart
+++ b/lib/views/home/my_wallet/points_captain.dart
@@ -49,10 +49,10 @@ class PointsCaptain extends StatelessWidget {
box.read(BoxName.countryCode) == 'Egypt'
? 'EGP'
: 'JOD', () async {
- await captainWalletController.addDriverPaymentPoints(
- 'visa-in', pricePoint);
+ // await captainWalletController.getPaymentId(
+ // 'visa-in', pricePoint);
await captainWalletController.addDriverWallet(
- 'visa-in', countPoint);
+ 'visa-in', countPoint, pricePoint);
await captainWalletController.addSeferWallet(
'visa-in', pricePoint.toString());
await captainWalletController
@@ -93,12 +93,11 @@ class PointsCaptain extends StatelessWidget {
box.read(BoxName.countryCode) == 'Egypt'
? 'EGP'
: 'JOD', () async {
+ // await captainWalletController
+ // .getPaymentId('visa-in', pricePoint);
await captainWalletController
- .addDriverPaymentPoints(
- 'visa-in', pricePoint);
- await captainWalletController
- .addDriverWallet(
- 'visa-in', countPoint);
+ .addDriverWallet('visa-in',
+ countPoint, pricePoint);
await captainWalletController
.addSeferWallet(
'visa-in', pricePoint.toString());
@@ -115,10 +114,10 @@ class PointsCaptain extends StatelessWidget {
: await paymentController.makePaymentStripe(pricePoint,
box.read(BoxName.countryCode) == 'Jordan' ? 'jod' : 'egp',
() async {
- await captainWalletController.addDriverPaymentPoints(
- 'visa-in', pricePoint);
+ // await captainWalletController.getPaymentId(
+ // 'visa-in', pricePoint);
await captainWalletController.addDriverWallet(
- 'visa-in', countPoint);
+ 'visa-in', countPoint, pricePoint);
await captainWalletController.getCaptainWalletFromBuyPoints();
});
},
diff --git a/lib/views/home/my_wallet/walet_captain.dart b/lib/views/home/my_wallet/walet_captain.dart
index fc285a2..e9e7487 100644
--- a/lib/views/home/my_wallet/walet_captain.dart
+++ b/lib/views/home/my_wallet/walet_captain.dart
@@ -55,11 +55,11 @@ class WalletCaptain extends StatelessWidget {
double.parse(captainWalletController
.totalPoints
.toString()) >
- -3000
+ -300
? AppColor.yellowColor
: double.parse(captainWalletController.totalPoints
.toString()) <
- -3000
+ -300
? AppColor.redColor
: AppColor.greenColor,
child: InkWell(
@@ -70,7 +70,7 @@ class WalletCaptain extends StatelessWidget {
return CupertinoAlertDialog(
title: Text('Info'.tr),
content: Text(
- 'The 3000 points equal 3000 L.E for you \nSo go and gain your money'
+ 'The 300 points equal 300 L.E for you \nSo go and gain your money'
.tr,
),
actions: [
@@ -99,7 +99,7 @@ class WalletCaptain extends StatelessWidget {
const SizedBox(height: 10),
if (double.parse(captainWalletController.totalPoints
.toString()) <
- -3000)
+ -300)
CupertinoButton.filled(
child: Text('Charge your Account'.tr),
onPressed: () {
@@ -193,6 +193,7 @@ class WalletCaptain extends StatelessWidget {
children: [
_buildPromoCard(
title: 'Morning Promo'.tr,
+ timePromo: 'Morning Promo',
count: captainWalletController
.walletDate['message'][0]
['morning_count'],
@@ -204,6 +205,7 @@ class WalletCaptain extends StatelessWidget {
const SizedBox(
height: 16), // Add space between the cards
_buildPromoCard(
+ timePromo: 'Afternoon Promo',
title: 'Afternoon Promo'.tr,
count: captainWalletController
.walletDate['message'][0]
@@ -308,12 +310,18 @@ class WalletCaptain extends StatelessWidget {
Widget _buildPromoCard(
{required String title,
+ required timePromo,
required int count,
required int maxCount,
required String description}) {
return InkWell(
onTap: () {
- MyDialog().getDialog(title, description, () {
+ MyDialog().getDialog(title, description, () async {
+ if (count == 5) {
+ Get.find()
+ .addDriverWalletFromPromo(timePromo, 50);
+ }
+
Get.back();
});
},
@@ -443,25 +451,25 @@ class WalletCaptain extends StatelessWidget {
kolor: AppColor.greyColor,
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 5 : 80,
countPoint:
- box.read(BoxName.countryCode) == 'Jordan' ? '3000' : '1000',
+ box.read(BoxName.countryCode) == 'Jordan' ? '3000' : '80',
),
PointsCaptain(
kolor: AppColor.bronze,
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 10 : 200,
countPoint:
- box.read(BoxName.countryCode) == 'Jordan' ? '1040' : '2500',
+ box.read(BoxName.countryCode) == 'Jordan' ? '1040' : '210',
),
PointsCaptain(
kolor: AppColor.goldenBronze,
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 22 : 400,
countPoint:
- box.read(BoxName.countryCode) == 'Jordan' ? '23000' : '5100',
+ box.read(BoxName.countryCode) == 'Jordan' ? '23000' : '450',
),
PointsCaptain(
kolor: AppColor.gold,
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 50 : 1000,
countPoint:
- box.read(BoxName.countryCode) == 'Jordan' ? '55000' : '130000',
+ box.read(BoxName.countryCode) == 'Jordan' ? '55000' : '1100',
),
],
),
diff --git a/lib/views/home/profile/profile_captain.dart b/lib/views/home/profile/profile_captain.dart
index 3409167..95bffe7 100644
--- a/lib/views/home/profile/profile_captain.dart
+++ b/lib/views/home/profile/profile_captain.dart
@@ -1,5 +1,6 @@
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
+import 'package:SEFER/views/auth/captin/criminal_documents_page.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:SEFER/views/widgets/mycircular.dart';
import 'package:flutter/material.dart';
@@ -52,8 +53,17 @@ class ProfileCaptain extends StatelessWidget {
Get.to(() => CaptainsCars());
},
),
+ const SizedBox(
+ height: 5,
+ ),
+ MyElevatedButton(
+ title: 'Add criminal page'.tr,
+ onPressed: () async {
+ Get.to(() => CriminalDocumemtPage());
+ },
+ ),
SizedBox(
- height: Get.height * .8,
+ height: Get.height * .7,
child: DriverProfileCard(
driverId:
controller.captainProfileData['driverID'] ??
diff --git a/pubspec.lock b/pubspec.lock
index 8bb52d5..ed84713 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -566,6 +566,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.3.3"
+ flutter_confetti:
+ dependency: "direct main"
+ description:
+ name: flutter_confetti
+ sha256: "22fc66984c17aea73e3cd300666609c4581176c00c31d4513b1e16758f75cb08"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.3.4"
flutter_contacts:
dependency: "direct main"
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 179d613..405b3a9 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -87,6 +87,7 @@ dependencies:
googleapis_auth: ^1.6.0
video_player: ^2.9.2
youtube_player_flutter: ^9.0.4
+ flutter_confetti: ^0.3.0
dev_dependencies:
flutter_test: