This commit is contained in:
Hamza-Ayed
2024-10-02 23:47:52 +03:00
parent 6f95dafd0b
commit 79b14ab9cc
9 changed files with 298 additions and 291 deletions

View File

@@ -54,8 +54,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 23 minSdk = 23
targetSdk = flutter.targetSdkVersion targetSdk = flutter.targetSdkVersion
versionCode = 101 versionCode = 103
versionName = '1.5.01' versionName = '1.5.03'
multiDexEnabled =true multiDexEnabled =true
} }

View File

@@ -126,6 +126,8 @@ class AppLink {
//-----------------Driver NotificationCaptain------------------ //-----------------Driver NotificationCaptain------------------
static String addNotificationCaptain = "$ride/notificationCaptain/add.php"; static String addNotificationCaptain = "$ride/notificationCaptain/add.php";
static String addWaitingRide = "$ride/notificationCaptain/addWaitingRide.php"; static String addWaitingRide = "$ride/notificationCaptain/addWaitingRide.php";
static String deleteAvailableRide =
"$ride/notificationCaptain/deleteAvailableRide.php";
static String updateWaitingRide = static String updateWaitingRide =
"$ride/notificationCaptain/updateWaitingTrip.php"; "$ride/notificationCaptain/updateWaitingTrip.php";
static String getRideWaiting = static String getRideWaiting =

View File

@@ -83,7 +83,7 @@ class FirebaseMessagesController extends GetxController {
FirebaseMessaging.onBackgroundMessage((RemoteMessage message) async { FirebaseMessaging.onBackgroundMessage((RemoteMessage message) async {
// if (message.notification!.title! == 'Order'.tr) { // if (message.notification!.title! == 'Order'.tr) {
// if (Platform.isAndroid) { // if (Platform.isAndroid) {
// NotificationController() // NotificationController1()
// .showNotification('Order'.tr, '', 'order', 'order_page_payload'); // .showNotification('Order'.tr, '', 'order', 'order_page_payload');
// } // }
// // await FirebaseMessagesController().showOverlayNotification(message); // // await FirebaseMessagesController().showOverlayNotification(message);
@@ -115,7 +115,7 @@ class FirebaseMessagesController extends GetxController {
Future<void> fireBaseTitles(RemoteMessage message) async { Future<void> fireBaseTitles(RemoteMessage message) async {
if (message.notification!.title! == 'Order'.tr) { if (message.notification!.title! == 'Order'.tr) {
if (Platform.isAndroid) { if (Platform.isAndroid) {
NotificationController().showNotification('Order'.tr, '', 'order', ''); NotificationController1().showNotification('Order'.tr, '', 'order', '');
} }
// await FirebaseMessagesController().showOverlayNotification(message); // await FirebaseMessagesController().showOverlayNotification(message);
var myListString = message.data['DriverList']; var myListString = message.data['DriverList'];
@@ -159,21 +159,22 @@ class FirebaseMessagesController extends GetxController {
} else if (message.notification!.title == 'Cancel') { } else if (message.notification!.title == 'Cancel') {
cancelTripDialog1(); cancelTripDialog1();
} else if (message.notification!.title! == 'token change') { } else if (message.notification!.title! == 'token change') {
NotificationController1() // NotificationController1()
.showNotification('token change'.tr, 'token change', 'cancel', ''); // .showNotification('token change'.tr, 'token change', 'cancel');
// GoogleSignInHelper.signOut(); // GoogleSignInHelper.signOut();
GoogleSignInHelper.signOut(); GoogleSignInHelper.signOut();
} else if (message.notification!.title! == 'message From passenger') { } else if (message.notification!.title! == 'message From passenger') {
if (Platform.isAndroid) { // print('sdfd');
NotificationController1() // if (Platform.isAndroid) {
.showNotification('message From passenger'.tr, ''.tr, 'tone2', ''); // NotificationController1()
} // .showNotification('message From passenger'.tr, ''.tr, 'tone2', '');
// }
passengerDialog(message.notification!.body!); passengerDialog(message.notification!.body!);
update(); update();
} else if (message.notification!.title! == 'face detect') { } else if (message.notification!.title! == 'face detect') {
if (Platform.isAndroid) { if (Platform.isAndroid) {
NotificationController() NotificationController1()
.showNotification('face detect'.tr, ''.tr, 'tone2', ''); .showNotification('face detect'.tr, ''.tr, 'tone2', '');
} }
String result0 = await faceDetector(); String result0 = await faceDetector();
@@ -203,7 +204,7 @@ class FirebaseMessagesController extends GetxController {
// Get.snackbar('Hi ,I will go now', '', // Get.snackbar('Hi ,I will go now', '',
// backgroundColor: AppColor.greenColor); // backgroundColor: AppColor.greenColor);
if (Platform.isAndroid) { if (Platform.isAndroid) {
NotificationController().showNotification( NotificationController1().showNotification(
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'tone2', ''); 'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'tone2', '');
} }
update(); update();
@@ -213,7 +214,7 @@ class FirebaseMessagesController extends GetxController {
var driverList = jsonDecode(myListString) as List<dynamic>; var driverList = jsonDecode(myListString) as List<dynamic>;
// if (Platform.isAndroid) { // if (Platform.isAndroid) {
if (Platform.isAndroid) { if (Platform.isAndroid) {
NotificationController().showNotification('Call Income'.tr, NotificationController1().showNotification('Call Income'.tr,
message.notification!.body!, 'iphone_ringtone', ''); message.notification!.body!, 'iphone_ringtone', '');
} }
// } // }
@@ -231,7 +232,7 @@ class FirebaseMessagesController extends GetxController {
var driverList = jsonDecode(myListString) as List<dynamic>; var driverList = jsonDecode(myListString) as List<dynamic>;
// if (Platform.isAndroid) { // if (Platform.isAndroid) {
if (Platform.isAndroid) { if (Platform.isAndroid) {
NotificationController().showNotification('Call Income'.tr, NotificationController1().showNotification('Call Income'.tr,
message.notification!.body!, 'iphone_ringtone', ''); message.notification!.body!, 'iphone_ringtone', '');
} }
// } // }
@@ -245,7 +246,7 @@ class FirebaseMessagesController extends GetxController {
} else if (message.notification!.title! == } else if (message.notification!.title! ==
"Criminal Document Required".tr) { "Criminal Document Required".tr) {
if (Platform.isAndroid) { if (Platform.isAndroid) {
NotificationController().showNotification( NotificationController1().showNotification(
"Criminal Document Required".tr, "Criminal Document Required".tr,
message.notification!.body!, message.notification!.body!,
'tone2', 'tone2',
@@ -262,7 +263,7 @@ class FirebaseMessagesController extends GetxController {
var myListString = message.data['passengerList']; var myListString = message.data['passengerList'];
var driverList = jsonDecode(myListString) as List<dynamic>; var driverList = jsonDecode(myListString) as List<dynamic>;
if (Platform.isAndroid) { if (Platform.isAndroid) {
NotificationController().showNotification( NotificationController1().showNotification(
'Call End'.tr, message.notification!.body!, 'tone2', ''); 'Call End'.tr, message.notification!.body!, 'tone2', '');
} }
// Assuming GetMaterialApp is initialized and context is valid for navigation // Assuming GetMaterialApp is initialized and context is valid for navigation
@@ -293,7 +294,7 @@ class FirebaseMessagesController extends GetxController {
}); });
} else if (message.notification!.title! == 'Order Applied'.tr) { } else if (message.notification!.title! == 'Order Applied'.tr) {
if (Platform.isAndroid) { if (Platform.isAndroid) {
NotificationController().showNotification( NotificationController1().showNotification(
'The order Accepted by another Driver'.tr, 'The order Accepted by another Driver'.tr,
'We regret to inform you that another driver has accepted this order.' 'We regret to inform you that another driver has accepted this order.'
.tr, .tr,

View File

@@ -32,8 +32,8 @@ class NotificationController extends GetxController {
// Create a notification channel // Create a notification channel
const AndroidNotificationChannel channel = AndroidNotificationChannel( const AndroidNotificationChannel channel = AndroidNotificationChannel(
'high_importance_channel', 'your channel id',
'High Importance Notifications', 'your channel name',
description: 'This channel is used for important notifications.', description: 'This channel is used for important notifications.',
importance: Importance.high, importance: Importance.high,
); );

View File

@@ -59,7 +59,7 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
} }
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
NotificationController().showNotification( NotificationController1().showNotification(
message.notification!.title.toString(), message.notification!.title.toString(),
message.notification!.body.toString(), message.notification!.body.toString(),
'order', 'order',
@@ -122,8 +122,8 @@ void main() async {
await FirebaseMessagesController().requestFirebaseMessagingPermission(); await FirebaseMessagesController().requestFirebaseMessagingPermission();
FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler); FirebaseMessaging.onBackgroundMessage(backgroundMessageHandler);
NotificationController().initNotifications(); NotificationController1().initNotifications();
NotificationController().initNotifications(); // NotificationController().initNotifications();
await Future.wait([ await Future.wait([
FirebaseMessagesController().getNotificationSettings(), FirebaseMessagesController().getNotificationSettings(),

View File

@@ -4,6 +4,7 @@ import 'package:SEFER/main.dart';
import 'package:SEFER/views/auth/captin/cards/egypt_card_a_i.dart'; import 'package:SEFER/views/auth/captin/cards/egypt_card_a_i.dart';
import 'package:SEFER/views/auth/captin/cards/sms_signup.dart'; import 'package:SEFER/views/auth/captin/cards/sms_signup.dart';
import 'package:SEFER/views/auth/captin/login_captin.dart'; import 'package:SEFER/views/auth/captin/login_captin.dart';
import 'package:SEFER/views/home/Captin/driver_map_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart';
import 'package:bubble_head/bubble.dart'; import 'package:bubble_head/bubble.dart';
@@ -143,7 +144,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
borderRadius: BorderRadius.circular(15)), borderRadius: BorderRadius.circular(15)),
child: IconButton( child: IconButton(
onPressed: () { onPressed: () {
NotificationController() NotificationController1()
.showNotification('Sefer Driver'.tr, ''.tr, '', ''); .showNotification('Sefer Driver'.tr, ''.tr, '', '');
final now = DateTime.now(); final now = DateTime.now();
DateTime? lastRequestTime = DateTime? lastRequestTime =
@@ -177,95 +178,95 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
), ),
), ),
), ),
AnimatedContainer( // AnimatedContainer(
duration: const Duration(microseconds: 200), // duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic, // width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration( // decoration: BoxDecoration(
color: AppColor.secondaryColor, // color: AppColor.secondaryColor,
border: Border.all(color: AppColor.blueColor), // border: Border.all(color: AppColor.blueColor),
borderRadius: BorderRadius.circular(15)), // borderRadius: BorderRadius.circular(15)),
child: Builder(builder: (context) { // child: Builder(builder: (context) {
return IconButton( // return IconButton(
onPressed: () async { // onPressed: () async {
// Get.to(() => EgyptCardAI()); // // Get.to(() => EgyptCardAI());
// print(box.read(BoxName.myList)); // // print(box.read(BoxName.myList));
List<String> d = [ // List<String> d = [
"30.003028,31.2419628", // "30.003028,31.2419628",
"30.0955661,31.2665336", // "30.0955661,31.2665336",
"160.00", // "160.00",
"25.92", // "25.92",
"1488", // "1488",
"16.93", // "16.93",
"114243034311436865474", // "114243034311436865474",
"113172279072358305645", // "113172279072358305645",
"hamza ayed", // "hamza ayed",
"rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3", // "rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3",
"+201023248456", // "+201023248456",
"1 min", // "1 min",
"1 m", // "1 m",
"false", // "false",
"QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9", // "QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9",
"0", // "0",
"238", // "238",
"false", // "false",
"114243034311436865474", // "114243034311436865474",
"1488", // "1488",
"startEnd", // "startEnd",
"30.049307749732176,31.274291574954987", // "30.049307749732176,31.274291574954987",
"", // "",
"", // "",
"", // "",
"", // "",
"17.73", // "17.73",
"0", // "0",
"hamzaayedflutter@gmail.com", // "hamzaayedflutter@gmail.com",
"الفسطاط، حي مصر القديمة، مصر", // "الفسطاط، حي مصر القديمة، مصر",
" الزاوية الحمراء، محافظة القاهرة، مصر", // " الزاوية الحمراء، محافظة القاهرة، مصر",
"Speed", // "Speed",
"8", // "8",
"5.00" // "5.00"
]; // ];
FirebaseMessagesController().sendNotificationToDriverMAP( // FirebaseMessagesController().sendNotificationToDriverMAP(
'Order'.tr, // 'Order'.tr,
'from: ', // 'from: ',
// jsonDecode(value)['message'].toString(), // // jsonDecode(value)['message'].toString(),
'fKBBB4_1R0q18-byySHUeG:APA91bHk2RmjjMt6eKr7KQnqh4CK02yW3H5E8g_beVcQFgiCG50j9KCtSU1O8PtvS_gA5xuJLhaorDV9AeslcyLFJFf302tICKMiKgsDP5pWkF5WXNw0-4NsoD-BnJxf0-Do9Vs1Zbpq', // 'fKBBB4_1R0q18-byySHUeG:APA91bHk2RmjjMt6eKr7KQnqh4CK02yW3H5E8g_beVcQFgiCG50j9KCtSU1O8PtvS_gA5xuJLhaorDV9AeslcyLFJFf302tICKMiKgsDP5pWkF5WXNw0-4NsoD-BnJxf0-Do9Vs1Zbpq',
d, // d,
'order.wav'); // 'order.wav');
// NotificationController() // // NotificationController()
// .showNotification('VIP Order'.tr, '', 'order', ''); // // .showNotification('VIP Order'.tr, '', 'order', '');
// try {} catch (e) { // // try {} catch (e) {
// print('Error showing overlay: $e'); // // print('Error showing overlay: $e');
// } // // }
// final Bubble _bubble = Bubble(showCloseButton: true); // // final Bubble _bubble = Bubble(showCloseButton: true);
// try { // // try {
// await _bubble.startBubbleHead(sendAppToBackground: false); // // await _bubble.startBubbleHead(sendAppToBackground: false);
// } on PlatformException { // // } on PlatformException {
// print('Failed to call startBubbleHead'); // // print('Failed to call startBubbleHead');
// } // // }
// Bubble().startBubbleHead(sendAppToBackground: true); // // Bubble().startBubbleHead(sendAppToBackground: true);
// } // // }
// Future<void> stopBubbleHead() async { // // Future<void> stopBubbleHead() async {
// try { // // try {
// await _bubble.stopBubbleHead(); // // await _bubble.stopBubbleHead();
// } on PlatformException { // // } on PlatformException {
// print('Failed to call stopBubbleHead'); // // print('Failed to call stopBubbleHead');
// } // // }
// } // // }
// // //
// // // send data to ovelay // // // // send data to ovelay
}, // },
icon: const Icon( // icon: const Icon(
FontAwesome5.grin_tears, // FontAwesome5.grin_tears,
size: 29, // size: 29,
color: AppColor.blueColor, // color: AppColor.blueColor,
), // ),
); // );
}), // }),
), // ),
AnimatedContainer( AnimatedContainer(
duration: const Duration(microseconds: 200), duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic, width: controller.widthMapTypeAndTraffic,
@@ -282,14 +283,16 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// // jsonDecode(value)['message'].toString(), // // jsonDecode(value)['message'].toString(),
// 'fKBBB4_1R0q18-byySHUeG:APA91bHk2RmjjMt6eKr7KQnqh4CK02yW3H5E8g_beVcQFgiCG50j9KCtSU1O8PtvS_gA5xuJLhaorDV9AeslcyLFJFf302tICKMiKgsDP5pWkF5WXNw0-4NsoD-BnJxf0-Do9Vs1Zbpq', // 'fKBBB4_1R0q18-byySHUeG:APA91bHk2RmjjMt6eKr7KQnqh4CK02yW3H5E8g_beVcQFgiCG50j9KCtSU1O8PtvS_gA5xuJLhaorDV9AeslcyLFJFf302tICKMiKgsDP5pWkF5WXNw0-4NsoD-BnJxf0-Do9Vs1Zbpq',
// 'order.wav'); // 'order.wav');
// NotificationController1().showNotification(
// 'sdf'.tr, NotificationController1().showNotification(
// 'We regret to inform you that another driver has accepted this order.' 'sdf'.tr,
// .tr, 'We regret to inform you that another driver has accepted this order.'
// '', .tr,
// ''); '',
'');
// requestLocationPermission(); // requestLocationPermission();
Get.to(() => SmsSignupEgypt()); // Get.to(() => PassengerLocationMapPage(),
// arguments: box.read(BoxName.rideArguments));
print(box.read(BoxName.tokenDriver)); print(box.read(BoxName.tokenDriver));
}, },
icon: const Icon( icon: const Icon(

View File

@@ -29,7 +29,7 @@ class PassengerInfoWindow extends StatelessWidget {
// left: 8, // left: 8,
child: AnimatedContainer( child: AnimatedContainer(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
height: Get.height * .4, height: Get.height * .35,
width: Get.width, width: Get.width,
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,
child: Padding( child: Padding(
@@ -366,191 +366,155 @@ class PassengerInfoWindow extends StatelessWidget {
), ),
], ],
), ),
controller.remainingTimeToPassenger != 0 controller.isRideBegin
? Stack( ? const SizedBox()
: Column(
children: [ children: [
LinearProgressIndicator( Row(
backgroundColor: AppColor.accentColor, mainAxisAlignment:
color: MainAxisAlignment.spaceAround,
controller.remainingTimeToPassenger <
60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 25,
borderRadius: BorderRadius.circular(15),
value: controller.progressToPassenger
.toDouble(),
),
Center(
child: Text(
controller
.stringRemainingTimeToPassenger,
style: AppStyle.title,
),
)
],
)
: controller.isRideBegin
? const SizedBox()
: Column(
children: [ children: [
Row( MyElevatedButton(
mainAxisAlignment: title: 'Start the Ride'.tr,
MainAxisAlignment.spaceAround, kolor: AppColor.greenColor,
children: [ onPressed: () {
MyElevatedButton( Get.defaultDialog(
title: 'Start the Ride'.tr, title:
kolor: AppColor.greenColor, 'Is the Passenger in your Car ?'
.tr,
titleStyle: AppStyle.title,
middleText:
"don't start trip if not"
.tr,
middleTextStyle:
AppStyle.title,
confirm: MyElevatedButton(
title: 'OK'.tr,
kolor:
AppColor.greenColor,
onPressed: () async {
await controller
.startRideFromDriver();
Get.back();
}),
cancel: MyElevatedButton(
title:
'No ,still Waiting.'
.tr,
kolor: AppColor.redColor,
onPressed: () {
Get.back();
}));
}),
controller.isArrivedSend
? MyElevatedButton(
title: 'I arrive you'.tr,
kolor: AppColor.yellowColor,
onPressed: () async {
if (controller
.calculateDistanceBetweenDriverAndPassengerLocation() <
40) {
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Hi ,I Arrive your site',
'I Arrive your site'
.tr,
controller
.tokenPassenger,
[],
'start.wav');
controller
.startTimerToShowDriverWaitPassengerDuration();
controller.isArrivedSend =
false;
} else {
Get.defaultDialog(
title:
'You are not in near to passenger location'
.tr,
middleText:
'please go to picker location exactly'
.tr,
confirm:
MyElevatedButton(
title: 'Ok'.tr,
onPressed: () {
Get.back();
}));
}
})
: const SizedBox()
],
),
controller.remainingTimeInPassengerLocatioWait <
300 &&
controller
.remainingTimeInPassengerLocatioWait !=
0
? Stack(
children: [
LinearProgressIndicator(
backgroundColor:
AppColor.greyColor,
color: controller
.remainingTimeInPassengerLocatioWait <
60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 25,
borderRadius:
BorderRadius.circular(15),
value: controller
.progressInPassengerLocationFromDriver
.toDouble(),
),
Center(
child: Text(
controller
.stringRemainingTimeWaitingPassenger,
style: AppStyle.title,
),
)
],
)
: controller.isdriverWaitTimeEnd
? MyElevatedButton(
title: 'You Can Cancel Trip And get Cost of Trip From'
.tr +
' ${AppInformation.appName}'
.tr,
kolor:
AppColor.deepPurpleAccent,
onPressed: () { onPressed: () {
Get.defaultDialog( Get.defaultDialog(
title: title:
'Is the Passenger in your Car ?' 'Are you sure to cancel?'
.tr, .tr,
titleStyle: titleStyle:
AppStyle.title, AppStyle.title,
middleText: middleText: '',
"don't start trip if not"
.tr,
middleTextStyle:
AppStyle.title,
confirm: MyElevatedButton( confirm: MyElevatedButton(
title: 'OK'.tr, title: 'Yes'.tr,
kolor: AppColor
.greenColor,
onPressed: () async { onPressed: () async {
await controller FirebaseMessagesController()
.startRideFromDriver(); .sendNotificationToPassengerToken(
Get.back(); 'Driver Cancel Your Trip',
}), 'You will be pay the cost to driver or we will get it from you on next trip'
cancel: MyElevatedButton( .tr,
title:
'No ,still Waiting.'
.tr,
kolor:
AppColor.redColor,
onPressed: () {
Get.back();
}));
}),
controller.isArrivedSend
? MyElevatedButton(
title: 'I arrive you'.tr,
kolor: AppColor.yellowColor,
onPressed: () async {
// Await the result of the distance calculation
double distanceToArrive =
await controller
.calculateDistanceBetweenDriverAndPassengerLocation();
if (distanceToArrive <
40) {
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Hi ,I Arrive your site',
'I Arrive your site'
.tr,
controller
.tokenPassenger,
[],
'start.wav');
controller
.startTimerToShowDriverWaitPassengerDuration();
controller
.isArrivedSend =
false;
} else {
Get.defaultDialog(
title:
'You are not in near to passenger location'
.tr,
middleText:
'please go to picker location exactly'
.tr,
confirm:
MyElevatedButton(
title:
'Ok'.tr,
onPressed:
() {
Get.back();
}));
}
})
: const SizedBox()
],
),
controller.remainingTimeInPassengerLocatioWait <
300 &&
controller
.remainingTimeInPassengerLocatioWait !=
0
? Stack(
children: [
LinearProgressIndicator(
backgroundColor:
AppColor.greyColor,
color: controller
.remainingTimeInPassengerLocatioWait <
60
? AppColor.redColor
: AppColor.greenColor,
minHeight: 25,
borderRadius:
BorderRadius.circular(
15),
value: controller
.progressInPassengerLocationFromDriver
.toDouble(),
),
Center(
child: Text(
controller
.stringRemainingTimeWaitingPassenger,
style: AppStyle.title,
),
)
],
)
: controller.isdriverWaitTimeEnd
? MyElevatedButton(
title: 'You Can Cancel Trip And get Cost of Trip From'
.tr +
' ${AppInformation.appName}'
.tr,
kolor: AppColor
.deepPurpleAccent,
onPressed: () {
Get.defaultDialog(
title:
'Are you sure to cancel?'
.tr,
titleStyle:
AppStyle.title,
middleText: '',
confirm:
MyElevatedButton(
title:
'Yes'.tr,
onPressed:
() async {
FirebaseMessagesController().sendNotificationToPassengerToken(
'Driver Cancel Your Trip',
'You will be pay the cost to driver or we will get it from you on next trip'
.tr,
controller
.tokenPassenger,
[],
'cancel.wav');
await controller
.addWaitingTimeCostFromPassengerToDriverWallet();
controller controller
.isdriverWaitTimeEnd = .tokenPassenger,
false; [],
})); 'cancel.wav');
}) await controller
: const SizedBox(), .addWaitingTimeCostFromPassengerToDriverWallet();
], controller
), .isdriverWaitTimeEnd =
false;
}));
})
: const SizedBox(),
],
),
], ],
), ),
), ),

View File

@@ -339,6 +339,8 @@ class OrderSpeedRequest extends StatelessWidget {
kolor: AppColor.greenColor, kolor: AppColor.greenColor,
title: 'Accept Order'.tr, title: 'Accept Order'.tr,
onPressed: () async { onPressed: () async {
Get.put(HomeCaptainController()).changeRideId();
box.write(BoxName.statusDriverLocation, 'on');
var res = await CRUD() var res = await CRUD()
.post(link: AppLink.updateStausFromSpeed, payload: { .post(link: AppLink.updateStausFromSpeed, payload: {
'id': myList[16], 'id': myList[16],
@@ -364,6 +366,34 @@ class OrderSpeedRequest extends StatelessWidget {
'status': 'Apply', 'status': 'Apply',
'driver_id': box.read(BoxName.driverID), 'driver_id': box.read(BoxName.driverID),
}); });
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'
});
// .then((value) { // .then((value) {
// var json = jsonDecode(res); // var json = jsonDecode(res);
if (res == "failure") { if (res == "failure") {

View File

@@ -146,6 +146,13 @@ class AvailableRidesPage extends StatelessWidget {
"This ride is already taken by another driver." "This ride is already taken by another driver."
.tr, .tr,
'', () { '', () {
CRUD().post(
link: AppLink.deleteAvailableRide,
payload: {'id': list['id']});
CRUD().post(
link:
'${AppLink.endPoint}/ride/notificationCaptain/deleteAvailableRide.php',
payload: {'id': list['id']});
Get.back(); Get.back();
}); });
} else if (jsonDecode(res)['status'] == } else if (jsonDecode(res)['status'] ==