This commit is contained in:
Hamza Aleghwairyeen
2024-03-30 13:28:23 +03:00
parent c853d89037
commit 6e417cbb75
7 changed files with 111 additions and 59 deletions

View File

@@ -500,7 +500,9 @@ update ui for totla results
isRideFinished = true; isRideFinished = true;
isRideStarted = false; isRideStarted = false;
isPriceWindow = false; isPriceWindow = false;
if (cartype == 'Comfort') {
totalCost = (price * rideTimerFromBegin).toString();
}
box.write(BoxName.statusDriverLocation, 'off'); box.write(BoxName.statusDriverLocation, 'off');
// changeRideToBeginToPassenger(); // changeRideToBeginToPassenger();
await CRUD().post(link: AppLink.updateRides, payload: { await CRUD().post(link: AppLink.updateRides, payload: {
@@ -586,6 +588,8 @@ update ui for totla results
} }
} }
int rideTimerFromBegin = 0;
double price = 0;
void rideIsBeginPassengerTimer() async { void rideIsBeginPassengerTimer() async {
// print('mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm'); // print('mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm');
// print(durationOfRideValue); // print(durationOfRideValue);
@@ -593,6 +597,12 @@ update ui for totla results
update(); update();
for (int i = 0; i <= durationOfRide; i++) { for (int i = 0; i <= durationOfRide; i++) {
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
recentDistanceToDash = Get.find<LocationController>().totalDistance;
rideTimerFromBegin = i;
price = rideTimerFromBegin ~/ 60 +
(recentDistanceToDash * 4); //todo from kazan
price = (price * .10) + price;
speed = Get.find<LocationController>().speed;
progressTimerRideBegin = i / durationOfRide; progressTimerRideBegin = i / durationOfRide;
remainingTimeTimerRideBegin = durationOfRide - i; remainingTimeTimerRideBegin = durationOfRide - i;
remainingTimeTimerRideBegin < 60 ? driverEndPage = 160 : 100; remainingTimeTimerRideBegin < 60 ? driverEndPage = 160 : 100;
@@ -646,6 +656,7 @@ update ui for totla results
double recentDistanceToDash = 0; double recentDistanceToDash = 0;
double recentAngelToMarker = 0; double recentAngelToMarker = 0;
double speed = 0;
void updateMarker() async { void updateMarker() async {
// Remove the existing marker with the ID `MyLocation`. // Remove the existing marker with the ID `MyLocation`.
markers.remove(MarkerId('MyLocation')); markers.remove(MarkerId('MyLocation'));
@@ -884,6 +895,7 @@ LIMIT
late Duration durationToAdd; late Duration durationToAdd;
int hours = 0; int hours = 0;
int minutes = 0; int minutes = 0;
late String cartype;
@override @override
void onInit() async { void onInit() async {
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY); mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
@@ -915,6 +927,7 @@ LIMIT
step4 = Get.arguments['step4']; step4 = Get.arguments['step4'];
passengerWalletBurc = Get.arguments['passengerWalletBurc']; passengerWalletBurc = Get.arguments['passengerWalletBurc'];
timeOfOrder = Get.arguments['timeOfOrder']; timeOfOrder = Get.arguments['timeOfOrder'];
cartype = Get.arguments['carType'];
var coords = passengerLocation.split(','); var coords = passengerLocation.split(',');
var coordDestination = passengerDestination.split(','); var coordDestination = passengerDestination.split(',');

View File

@@ -466,8 +466,8 @@ class MapPassengerController extends GetxController {
void sendWhatsapp(String to) async { void sendWhatsapp(String to) async {
// Get the driver's phone number. // Get the driver's phone number.
String driverPhone = // String driverPhone =
dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString(); // dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
// Format the message. // Format the message.
String message = String message =
@@ -845,6 +845,7 @@ class MapPassengerController extends GetxController {
box.read(BoxName.email).toString(), box.read(BoxName.email).toString(),
startNameAddress, startNameAddress,
endNameAddress, endNameAddress,
box.read(BoxName.carType),
]; ];
print(body); print(body);
FirebaseMessagesController().sendNotificationToDriverMapPolyline( FirebaseMessagesController().sendNotificationToDriverMapPolyline(
@@ -920,6 +921,7 @@ class MapPassengerController extends GetxController {
box.read(BoxName.email).toString(), box.read(BoxName.email).toString(),
startNameAddress, startNameAddress,
endNameAddress, endNameAddress,
box.read(BoxName.carType),
]; ];
print('driversToken'); print('driversToken');
print(driversToken); print(driversToken);

View File

@@ -27,6 +27,7 @@ class PassengerLocationMapPage extends StatelessWidget {
const PassengerInfoWindow(), const PassengerInfoWindow(),
driverEndRideBar(), driverEndRideBar(),
const SosConnect(), const SosConnect(),
speedCircle(),
const GoogleMapApp(), const GoogleMapApp(),
PricesWindow(), PricesWindow(),
], ],

View File

@@ -1,3 +1,4 @@
import 'package:SEFER/controller/functions/location_controller.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -17,7 +18,7 @@ GetBuilder<MapDriverController> driverEndRideBar() {
decoration: AppStyle.boxDecoration, decoration: AppStyle.boxDecoration,
height: mapDriverController.remainingTimeTimerRideBegin < 60 height: mapDriverController.remainingTimeTimerRideBegin < 60
? mapDriverController.driverEndPage = 160 ? mapDriverController.driverEndPage = 160
: 100, : 120,
width: 240, width: 240,
child: Column( child: Column(
children: [ children: [
@@ -54,11 +55,14 @@ GetBuilder<MapDriverController> driverEndRideBar() {
], ],
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Text(mapDriverController.recentAngelToMarker Text(
.toStringAsFixed(0)), 'Timer is ${mapDriverController.rideTimerFromBegin.toStringAsFixed(0)}'),
Text(mapDriverController.recentDistanceToDash Text(
.toStringAsFixed(0)) 'Distance is ${mapDriverController.recentDistanceToDash.toStringAsFixed(0)}'),
Text(
'Price is ${mapDriverController.price.toStringAsFixed(0)}')
], ],
), ),
mapDriverController.remainingTimeTimerRideBegin < 60 mapDriverController.remainingTimeTimerRideBegin < 60
@@ -102,3 +106,25 @@ GetBuilder<MapDriverController> driverEndRideBar() {
)) ))
: const SizedBox()); : const SizedBox());
} }
GetBuilder<MapDriverController> speedCircle() {
return GetBuilder<MapDriverController>(
builder: (mapDriverController) => mapDriverController.isRideStarted
? Positioned(
// left: 5,
bottom: 25,
right: 5,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: AppColor.redColor,
border: Border.all(width: 1)),
height: 60,
width: 60,
child: Text(
mapDriverController.speed.toStringAsFixed(0),
style: AppStyle.number,
),
))
: const SizedBox());
}

View File

@@ -84,7 +84,7 @@ class OrderRequestPage extends StatelessWidget {
title: 'Order Details'.tr, title: 'Order Details'.tr,
body: [ body: [
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 6),
child: ListView( child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@@ -200,59 +200,49 @@ class OrderRequestPage extends StatelessWidget {
width: Get.width * .9, width: Get.width * .9,
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Row( Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Column( Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Row( const Icon(
mainAxisAlignment: MainAxisAlignment.start, Icons.arrow_circle_up,
children: [ color: AppColor.greenColor,
const Icon(
Icons.arrow_circle_up,
color: AppColor.greenColor,
),
Text(
myList[12] + ' ' + ' (${myList[11]}) ',
style: AppStyle.title,
),
],
), ),
Text( Text(
myList[29], myList[12] + ' ' + ' (${myList[11]}) ',
style: AppStyle.title, style: AppStyle.title,
), ),
], ],
), ),
Text(
myList[29],
style: AppStyle.title,
),
], ],
), ),
Row( Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Column( Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Row( const Icon(
mainAxisAlignment: MainAxisAlignment.start, Icons.arrow_circle_up,
children: [ color: AppColor.greenColor,
const Icon(
Icons.arrow_circle_up,
color: AppColor.greenColor,
),
Text(
myList[5] + ' ' + ' (${myList[4]}) ',
style: AppStyle.title,
),
],
), ),
Text( Text(
myList[30], myList[5] + ' ' + ' (${myList[4]}) ',
style: AppStyle.title, style: AppStyle.title,
), ),
], ],
), ),
Text(
myList[30],
style: AppStyle.title,
),
], ],
), ),
], ],
@@ -361,6 +351,7 @@ class OrderRequestPage extends StatelessWidget {
'passengerWalletBurc': myList[26].toString(), 'passengerWalletBurc': myList[26].toString(),
'timeOfOrder': DateTime.now().toString(), 'timeOfOrder': DateTime.now().toString(),
'totalPassenger': myList[2].toString(), 'totalPassenger': myList[2].toString(),
'carType':myList[31].toString(),
}); });
}, },
), ),

View File

@@ -434,6 +434,7 @@ class OrderSpeedRequest extends StatelessWidget {
'passengerWalletBurc': myList[26].toString(), 'passengerWalletBurc': myList[26].toString(),
'timeOfOrder': DateTime.now().toString(), 'timeOfOrder': DateTime.now().toString(),
'totalPassenger': myList[2].toString(), 'totalPassenger': myList[2].toString(),
'carType': myList[31].toString(),
}); });
} }
}); });

View File

@@ -146,29 +146,47 @@ class GoogleMapPassengerWidget extends StatelessWidget {
markers: { markers: {
if (controller.statusRide != 'Apply' || if (controller.statusRide != 'Apply' ||
!controller.rideTimerBegin) !controller.rideTimerBegin)
for (var carLocation in controller.carLocationsModels) for (var i = 0;
controller
.dataCarsLocationByPassenger['message'].length;
i++)
Marker( Marker(
// anchor: const Offset(4, 4), // anchor: const Offset(4, 4),
position: LatLng( position: LatLng(
carLocation.latitude, double.parse(controller
carLocation.longitude, .datadriverCarsLocationToPassengerAfterApplied[
), 'message'][i]['latitude']),
double.parse(controller
.datadriverCarsLocationToPassengerAfterApplied[
'message'][i]['longitude'])),
icon: controller.carIcon, icon: controller.carIcon,
markerId: MarkerId(carLocation.toString()), markerId: MarkerId(controller
rotation: carLocation.heading, .datadriverCarsLocationToPassengerAfterApplied[
), /////////////////// 'message'][i]['longitude']
.toString()),
rotation: double.parse(controller
.datadriverCarsLocationToPassengerAfterApplied[
'message'][i]['heading']),
),
// controller.carMarrkerAplied, // controller.carMarrkerAplied,
if (controller.statusRide == 'Apply') if (controller.statusRide == 'Apply')
for (var carLocation // for (var carLocation
in controller.driverCarsLocationToPassengerAfterApplied) // in controller.driverCarsLocationToPassengerAfterApplied)
Marker( Marker(
// anchor: const Offset(4, 4), // anchor: const Offset(4, 4),
position: carLocation, position: LatLng(
icon: controller.carIcon, double.parse(controller.datadriverCarsLocationToPassengerAfterApplied['message']
rotation: double.parse(controller [0]['latitude']),
.datadriverCarsLocationToPassengerAfterApplied[ double.parse(controller.datadriverCarsLocationToPassengerAfterApplied['message']
'message'][0]['latitude']), [0]['longitude'])), //carLocation,
markerId: MarkerId(carLocation.toString())), icon: controller.carIcon,
rotation: double.parse(
controller.datadriverCarsLocationToPassengerAfterApplied['message']
[0]['heading']),
markerId: MarkerId(controller
.datadriverCarsLocationToPassengerAfterApplied['message']
[0]['longitude']
.toString())),
for (int i = 1; for (int i = 1;
i < controller.coordinatesWithoutEmpty.length - 1; i < controller.coordinatesWithoutEmpty.length - 1;
i++) i++)