This commit is contained in:
Hamza-Ayed
2024-02-22 16:19:45 +03:00
parent 9d839f02ae
commit a9f557ca83
85 changed files with 9196 additions and 494 deletions

View File

@@ -2,7 +2,6 @@ import 'dart:convert';
import 'dart:io';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:get/get.dart';
import 'package:http/http.dart' as http;
import 'package:SEFER/controller/functions/crud.dart';
@@ -18,10 +17,10 @@ import '../../main.dart';
import '../../views/Rate/rate_captain.dart';
import '../../views/home/Captin/home_captain/home_captin.dart';
import '../../views/home/map_page_passenger.dart';
import '../../views/home/map_widget.dart/call_passenger_page.dart';
import '../../views/home/profile/promos_passenger_page.dart';
import '../../views/home/Captin/orderCaptin/order_request_page.dart';
import '../home/map_passenger_controller.dart';
import '../home/payment/captain_wallet_controller.dart';
import '../payment/payment_controller.dart';
import 'local_notification.dart';
@@ -150,7 +149,7 @@ class FirebaseMessagesController extends GetxController {
driverID = myList[2].toString();
NotificationController().showNotification(
'Apply Order', 'Driver Applied the Ride for You'.tr, 'order');
'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order');
// driverAppliedTripSnakBar();
} else if (message.notification!.title! == 'Promo') {
NotificationController()
@@ -203,6 +202,19 @@ class FirebaseMessagesController extends GetxController {
'rideId': driverList[1].toString(),
});
}
} else if (message.notification!.title! == 'Call Income') {
var myListString = message.data['passengerList'];
var driverList = jsonDecode(myListString) as List<dynamic>;
NotificationController().showNotification(
'Driver Finish Trip'.tr,
message.notification!.body!,
'order',
);
Get.to(() => PassengerCallPage(
channelName: driverList[1].toString(),
token: driverList[0].toString(),
remoteID: driverList[2].toString(),
));
} else if (message.notification!.title! == 'Driver Cancel Your Trip') {
// Get.snackbar(
// 'You will be pay the cost to driver or we will get it from you on next trip'
@@ -222,7 +234,7 @@ class FirebaseMessagesController extends GetxController {
SnackbarController driverAppliedTripSnakBar() {
return Get.snackbar(
'Driver Applied the Ride for You'.tr,
'message',
'',
colorText: AppColor.greenColor,
duration: const Duration(seconds: 3),
snackPosition: SnackPosition.TOP,
@@ -302,7 +314,7 @@ class FirebaseMessagesController extends GetxController {
if (res != 'failure') {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'You Have Tips',
'${tip.toString()}\$ tips\nTotal is ${tip + (Get.find<MapPassengerController>().totalPassenger)}',
'${'${tip.toString()}\$${' tips\nTotal is'.tr}'} ${tip + (Get.find<MapPassengerController>().totalPassenger)}',
driverList[2].toString(),
);
}
@@ -518,7 +530,7 @@ class DriverTipWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Your fee is ${Get.find<MapPassengerController>().totalPassenger.toStringAsFixed(2)}'),
'${'Your fee is '.tr}${Get.find<MapPassengerController>().totalPassenger.toStringAsFixed(2)}'),
Text('Do you want to pay Tips for this Driver'.tr),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
@@ -528,7 +540,7 @@ class DriverTipWidget extends StatelessWidget {
box.write(BoxName.tipPercentage, '0.05');
Toast.show(
context,
'Tip is ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
'${'Tip is '.tr}${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor);
},
child: Container(
@@ -546,7 +558,7 @@ class DriverTipWidget extends StatelessWidget {
box.write(BoxName.tipPercentage, '0.10');
Toast.show(
context,
'Tip is ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
'${'Tip is'.tr} ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor);
},
child: Container(
@@ -564,7 +576,7 @@ class DriverTipWidget extends StatelessWidget {
box.write(BoxName.tipPercentage, '0.15');
Toast.show(
context,
'Tip is ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
'${'Tip is'.tr} ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor);
},
child: Container(
@@ -582,7 +594,7 @@ class DriverTipWidget extends StatelessWidget {
box.write(BoxName.tipPercentage, '0.20');
Toast.show(
context,
'Tip is ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
'${'Tip is'.tr} ${(Get.find<MapPassengerController>().totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
AppColor.blueColor);
},
child: Container(