This commit is contained in:
Hamza-Ayed
2024-07-05 04:50:32 +03:00
parent b5bc36e4be
commit dc4677a6bf
21 changed files with 586 additions and 234 deletions

View File

@@ -10,6 +10,7 @@ import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../../../constant/char_map.dart';
import '../../../../../constant/colors.dart';
import '../../../../../constant/credential.dart';
import '../../../../../controller/functions/encrypt.dart';
import '../../../../../controller/functions/launch.dart';
import '../../../../Rate/ride_calculate_driver.dart';
import '../../../../../controller/functions/location_controller.dart';
@@ -30,19 +31,34 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// borderRadius: BorderRadius.circular(15)),
// child: IconButton(
// onPressed: () {
// AC credentials = AC();
// String apiKey = '4601103';
// String convertedStringN = credentials.c(
// credentials.c(credentials.c(apiKey, cs), cC), cn);
// print(convertedStringN);
// String retrievedStringS = credentials.r(
// credentials.r(credentials.r(convertedStringN, cn), cC),
// cs);
// print(retrievedStringS);
// //
// if (retrievedStringS == apiKey) {
// print('same');
// }
// // AC credentials = AC();
// String apiKey = 'mehmetDEV@2101';
// // String convertedStringN = credentials.c(
// // credentials.c(credentials.c(apiKey, cs), cC), cn);
// // print(convertedStringN);
// // String retrievedStringS = credentials.r(
// // credentials.r(credentials.r(convertedStringN, cn), cC),
// // cs);
// // print(retrievedStringS);
// // //
// // if (retrievedStringS == apiKey) {
// // print('same');
// // }
//
// // key.forEach((key, apiKey) {
// String encryptedApiKey = KeyEncryption.encryptKey(apiKey);
// print('Encrypted = $encryptedApiKey');
//
// String decryptedApiKey =
// KeyEncryption.decryptKey(encryptedApiKey);
// print('Decrypted : $decryptedApiKey');
//
// // if (decryptedApiKey == apiKey) {
// // print('Keys match for $decryptedApiKey');
// // } else {
// // // print('Keys do not match for $key');
// // }
// // });
// },
// icon: const Icon(
// FontAwesome.map_signs,

View File

@@ -92,6 +92,7 @@ class PassengerInfoWindow extends StatelessWidget {
AppStyle.title,
content: SizedBox(
height: Get.height * .5,
width: Get.width * .6,
child: ListView(
// mainAxisAlignment:
// MainAxisAlignment
@@ -100,8 +101,7 @@ class PassengerInfoWindow extends StatelessWidget {
InkWell(
onTap: () {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'message From Driver'
.tr,
'message From Driver',
"Where are you, sir?"
.tr,
controller
@@ -132,8 +132,7 @@ class PassengerInfoWindow extends StatelessWidget {
InkWell(
onTap: () {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'message From Driver'
.tr,
'message From Driver',
"I've been trying to reach you but your phone is off."
.tr,
controller
@@ -164,8 +163,7 @@ class PassengerInfoWindow extends StatelessWidget {
InkWell(
onTap: () {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'message From Driver'
.tr,
'message From Driver',
"Please don't be late, I'm waiting for you at the specified location."
.tr,
controller
@@ -196,8 +194,7 @@ class PassengerInfoWindow extends StatelessWidget {
InkWell(
onTap: () {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'message From Driver'
.tr,
'message From Driver',
"Please don't be late"
.tr,
controller
@@ -226,7 +223,8 @@ class PassengerInfoWindow extends StatelessWidget {
height: 5,
),
SizedBox(
width: 335,
width: Get.width *
.5,
child: Row(
mainAxisAlignment:
MainAxisAlignment
@@ -237,8 +235,8 @@ class PassengerInfoWindow extends StatelessWidget {
.formKey2,
child:
SizedBox(
width:
300,
width: Get.width *
.4,
child: MyTextForm(
controller:
controller.messageToPassenger,
@@ -250,7 +248,7 @@ class PassengerInfoWindow extends StatelessWidget {
onPressed:
() {
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'message From Driver'.tr,
'message From Driver',
controller.messageToPassenger.text,
controller.tokenPassenger,
'ding.wav');

View File

@@ -1,4 +1,5 @@
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
import 'package:SEFER/views/widgets/mydialoug.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
@@ -33,8 +34,6 @@ class OrderRequestPage extends StatelessWidget {
orderRequestController.startTimer(myList[6].toString(), body.toString());
var coords = myList[0].split(',');
var coordDestination = myList[1].split(',');
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
// Parse to double
double latPassengerLocation = double.parse(coords[0]);
@@ -64,20 +63,6 @@ class OrderRequestPage extends StatelessWidget {
// Create the marker with the resized image
orderRequestController.calculateConsumptionFuel();
ImageConfiguration config = ImageConfiguration(
size: const Size(25, 25), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png',
mipmaps: false)
.then((value) {
startIcon = value;
});
ImageConfiguration config1 = ImageConfiguration(
size: const Size(25, 25), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config1, 'assets/images/b.png',
mipmaps: false)
.then((value) {
endIcon = value;
});
// }
// orderRequestController.calculateConsumptionFuel();
@@ -92,7 +77,7 @@ class OrderRequestPage extends StatelessWidget {
// SizedBox(height: 200, child: Text(pointsList.toString())),
// Text(message.notification!.body.toString()),
SizedBox(
height: Get.height * .3,
height: Get.height * .33,
child: GoogleMap(
initialCameraPosition: CameraPosition(
zoom: 12,
@@ -109,13 +94,13 @@ class OrderRequestPage extends StatelessWidget {
position: LatLng(
latPassengerLocation, lngPassengerLocation),
draggable: true,
icon: startIcon),
icon: orderRequestController.startIcon),
Marker(
markerId: MarkerId('Destination'.tr),
position: LatLng(
latPassengerDestination, lngPassengerDestination),
draggable: true,
icon: endIcon),
icon: orderRequestController.endIcon),
},
polylines: {
Polyline(
@@ -155,7 +140,7 @@ class OrderRequestPage extends StatelessWidget {
'Trip has Steps'.tr,
style: AppStyle.title,
)
: Text('Rouats of Trip'.tr,
: Text('Routs of Trip'.tr,
style: AppStyle.title)),
Container(
color: myList[13].toString() == 'true'
@@ -209,12 +194,12 @@ class OrderRequestPage extends StatelessWidget {
)),
),
Container(
height: Get.height * .2,
height: Get.height * .15,
width: Get.width * .9,
decoration: AppStyle.boxDecoration1,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
child: ListView(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
children: [
@@ -287,7 +272,7 @@ class OrderRequestPage extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(4),
child: Container(
color: AppColor.deepPurpleAccent,
color: AppColor.greenColor.withOpacity(.5),
child: RichText(
text: TextSpan(
text: 'Cost Of Trip IS '.tr,
@@ -321,68 +306,78 @@ class OrderRequestPage extends StatelessWidget {
'order_id': body.toString(),
'status': 'Apply'
});
await CRUD()
.post(link: AppLink.updateRides, payload: {
'id': myList[16],
'rideTimeStart': DateTime.now().toString(),
'status': 'Apply',
'driver_id': box.read(BoxName.driverID),
});
var res = await CRUD().post(
link: AppLink.updateRideAndCheckIfApplied,
payload: {
'id': myList[16],
'rideTimeStart': DateTime.now().toString(),
'status': 'Apply',
'driver_id': box.read(BoxName.driverID),
});
if (res == 'failure') {
MyDialog().getDialog(
"This ride is already applied by another driver."
.tr,
'', () {
Get.back();
});
} else {
List<String> bodyToPassenger = [
box.read(BoxName.driverID).toString(),
box.read(BoxName.nameDriver).toString(),
box.read(BoxName.tokenDriver).toString(),
];
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Apply Ride',
'your ride is applied'.tr,
// arguments['DriverList'][9].toString(),
arguments['DriverList'][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();
List<String> bodyToPassenger = [
box.read(BoxName.driverID).toString(),
box.read(BoxName.nameDriver).toString(),
box.read(BoxName.tokenDriver).toString(),
];
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Apply Ride',
'your ride is applied'.tr,
// arguments['DriverList'][9].toString(),
arguments['DriverList'][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));
},
),
GetBuilder<OrderRequestController>(
@@ -451,6 +446,6 @@ class OrderRequestPage extends StatelessWidget {
),
)
],
isleading: true);
isleading: false);
}
}

View File

@@ -37,8 +37,6 @@ class OrderSpeedRequest extends StatelessWidget {
myList[6].toString(), body.toString());
var coords = myList[0].split(',');
var coordDestination = myList[1].split(',');
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
// Parse to double
double latPassengerLocation = double.parse(coords[0]);
@@ -68,20 +66,6 @@ class OrderSpeedRequest extends StatelessWidget {
// Create the marker with the resized image
orderRequestController.calculateConsumptionFuel();
ImageConfiguration config = ImageConfiguration(
size: const Size(25, 25), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png',
mipmaps: false)
.then((value) {
startIcon = value;
});
ImageConfiguration config1 = ImageConfiguration(
size: const Size(25, 25), devicePixelRatio: Get.pixelRatio);
BitmapDescriptor.fromAssetImage(config1, 'assets/images/b.png',
mipmaps: false)
.then((value) {
endIcon = value;
});
// }
// double mpg = 0;
// calculateConsumptionFuel() {
@@ -98,7 +82,7 @@ class OrderSpeedRequest extends StatelessWidget {
// SizedBox(height: 200, child: Text(pointsList.toString())),
// Text(message.notification!.body.toString()),
SizedBox(
height: Get.height * .2,
height: Get.height * .33,
child: GoogleMap(
initialCameraPosition: CameraPosition(
zoom: 12,
@@ -115,13 +99,13 @@ class OrderSpeedRequest extends StatelessWidget {
position:
LatLng(latPassengerLocation, lngPassengerLocation),
draggable: true,
icon: startIcon),
icon: orderRequestController.startIcon),
Marker(
markerId: MarkerId('Destination'.tr),
position: LatLng(
latPassengerDestination, lngPassengerDestination),
draggable: true,
icon: endIcon),
icon: orderRequestController.endIcon),
},
polylines: {
Polyline(
@@ -161,7 +145,7 @@ class OrderSpeedRequest extends StatelessWidget {
'Trip has Steps'.tr,
style: AppStyle.title,
)
: Text('Rouats of Trip'.tr,
: Text('Routs of Trip'.tr,
style: AppStyle.title)),
Container(
color: myList[13].toString() == 'true'
@@ -191,6 +175,21 @@ class OrderSpeedRequest extends StatelessWidget {
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: myList[31].toString() == 'Comfort'
? const Icon(
Icons.ac_unit,
color: AppColor.blueColor,
size: 50,
)
: const SizedBox(),
),
),
Text(
myList[31].toString(),
style: AppStyle.title
@@ -200,12 +199,12 @@ class OrderSpeedRequest extends StatelessWidget {
)),
),
Container(
height: Get.height * .2,
height: Get.height * .15,
width: Get.width * .9,
decoration: AppStyle.boxDecoration1,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
child: ListView(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,