10/26/1
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
|
||||
import 'package:SEFER/controller/home/captin/order_request_controller.dart';
|
||||
import 'package:SEFER/views/widgets/mydialoug.dart';
|
||||
import 'package:bubble_head/bubble.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -303,9 +305,6 @@ class MapDriverController extends GetxController {
|
||||
box.read(BoxName.name).toString(),
|
||||
tokenPassenger,
|
||||
'start.wav');
|
||||
if (box.read(BoxName.googlaMapApp) == true) {
|
||||
await openGoogleMapFromDriverToPassenger();
|
||||
}
|
||||
}
|
||||
|
||||
bool isSocialPressed = false;
|
||||
@@ -346,6 +345,7 @@ class MapDriverController extends GetxController {
|
||||
}
|
||||
|
||||
void startRideFromStartApp() {
|
||||
// if (box.read(BoxName.rideStatus) == 'Begin') {
|
||||
changeRideToBeginToPassenger();
|
||||
isPassengerInfoWindow = false;
|
||||
isRideStarted = true;
|
||||
@@ -354,6 +354,8 @@ class MapDriverController extends GetxController {
|
||||
timeWaitingPassenger = 0;
|
||||
box.write(BoxName.statusDriverLocation, 'on');
|
||||
update();
|
||||
// }
|
||||
|
||||
// rideIsBeginPassengerTimer();
|
||||
}
|
||||
|
||||
@@ -398,20 +400,15 @@ class MapDriverController extends GetxController {
|
||||
// var d = jsonDecode(res);
|
||||
|
||||
update();
|
||||
Get.back();
|
||||
// Start updating location and moving camera
|
||||
// updateLocation();
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Your are far from passenger location'.tr,
|
||||
middleText:
|
||||
'go to your passenger location before\nPassenger cancel trip'.tr,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok',
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}),
|
||||
);
|
||||
Get.back();
|
||||
MyDialog().getDialog('Your are far from passenger location'.tr,
|
||||
'go to your passenger location before\nPassenger cancel trip'.tr, () {
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,15 +483,10 @@ class MapDriverController extends GetxController {
|
||||
await calculateDistanceBetweenDriverAndPassengerLocation();
|
||||
|
||||
if (distance2 > 60) {
|
||||
Get.defaultDialog(
|
||||
title: 'Your are far from passenger location'.tr,
|
||||
middleText:
|
||||
'go to your passenger location before\nPassenger cancel trip'.tr,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok',
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
MyDialog().getDialog('Your are far from passenger location'.tr,
|
||||
'go to your passenger location before\nPassenger cancel trip'.tr, () {
|
||||
Get.back();
|
||||
});
|
||||
} else {
|
||||
double costOfWaiting5Minute = box.read(BoxName.countryCode) == 'Egypt'
|
||||
? (distanceBetweenDriverAndPassengerWhenConfirm * .08) + (5 * 1)
|
||||
@@ -559,36 +551,22 @@ class MapDriverController extends GetxController {
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
);
|
||||
Get.defaultDialog(
|
||||
title: 'Are you sure to exit ride ?'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
kolor: AppColor.greenColor,
|
||||
onPressed: () {
|
||||
if (distanceToDestination > 900 ||
|
||||
(double.parse(distance) < 1000 &&
|
||||
distanceToDestination > 500)) {
|
||||
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();
|
||||
});
|
||||
}
|
||||
}),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Cancel'.tr,
|
||||
kolor: Colors.red,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
}));
|
||||
MyDialog().getDialog('Are you sure to exit ride ?'.tr, '', () {
|
||||
if (distanceToDestination > 900 ||
|
||||
(double.parse(distance) < 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();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String paymentToken = '';
|
||||
@@ -736,17 +714,12 @@ class MapDriverController extends GetxController {
|
||||
isPassengerInfoWindow = false;
|
||||
clearPolyline();
|
||||
update();
|
||||
Get.defaultDialog(
|
||||
title: 'Order Cancelled'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
middleText: 'Order Cancelled by Passenger'.tr,
|
||||
middleTextStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
Get.offAll(HomeCaptain());
|
||||
},
|
||||
),
|
||||
MyDialog().getDialog(
|
||||
'Order Cancelled'.tr,
|
||||
'Order Cancelled by Passenger'.tr,
|
||||
() {
|
||||
Get.offAll(HomeCaptain());
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -827,29 +800,25 @@ class MapDriverController extends GetxController {
|
||||
: (i ~/ 60) * (latePrice + .5) * 2 + (price);
|
||||
}
|
||||
price = carType == 'Comfort' // || carType == 'Free Ride'
|
||||
? (i ~/ 60) * (latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) * (latePrice + .5)
|
||||
? (latePrice + 0.5) * ((i ~/ 60) - int.parse(duration)) + price
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) * (latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) * (latePrice + .5)
|
||||
? (latePrice + 0.5) * ((i ~/ 60) - int.parse(duration)) +
|
||||
price
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) * (latePrice + .5) +
|
||||
(price) -
|
||||
int.parse(duration) * (latePrice + .5)
|
||||
? (latePrice + 0.5) * ((i ~/ 60) - int.parse(duration)) +
|
||||
price
|
||||
: price;
|
||||
} else if (currentTime.hour >= 14 && currentTime.hour <= 17) {
|
||||
price = carType == 'Comfort' // || carType == 'Free Ride'
|
||||
? (i ~/ 60) * (Get.find<HomeCaptainController>().heavyPrice) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().heavyPrice + .5)
|
||||
? Get.find<HomeCaptainController>().heavyPrice *
|
||||
((i ~/ 60) - int.parse(duration)) +
|
||||
price -
|
||||
(0.5 * int.parse(duration))
|
||||
: carType == 'Lady'
|
||||
? (i ~/ 60) * (Get.find<HomeCaptainController>().heavyPrice) +
|
||||
(price) -
|
||||
int.parse(duration) *
|
||||
(Get.find<HomeCaptainController>().heavyPrice + .5)
|
||||
? Get.find<HomeCaptainController>().heavyPrice *
|
||||
((i ~/ 60) - int.parse(duration)) +
|
||||
price -
|
||||
(0.5 * int.parse(duration))
|
||||
: carType == 'RayehGaiComfort'
|
||||
? (i ~/ 60) *
|
||||
(Get.find<HomeCaptainController>().heavyPrice) +
|
||||
@@ -1191,11 +1160,21 @@ class MapDriverController extends GetxController {
|
||||
late String startNameLocation;
|
||||
late String endNameLocation;
|
||||
|
||||
Future<void> runGoogleMapDirectly() async {
|
||||
if (box.read(BoxName.googlaMapApp) == true) {
|
||||
if (Platform.isAndroid) {
|
||||
Bubble().startBubbleHead(sendAppToBackground: true);
|
||||
}
|
||||
await openGoogleMapFromDriverToPassenger();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
|
||||
// Get the passenger location from the arguments.
|
||||
// await argumentLoading();
|
||||
runGoogleMapDirectly();
|
||||
addCustomCarIcon();
|
||||
addCustomPassengerIcon();
|
||||
addCustomStartIcon();
|
||||
|
||||
@@ -3,13 +3,11 @@ import 'dart:convert';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'dart:math' as math;
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../constant/table_names.dart';
|
||||
import '../../functions/audio_controller.dart';
|
||||
import '../../functions/crud.dart';
|
||||
import '../../functions/location_controller.dart';
|
||||
import 'home_captain_controller.dart';
|
||||
@@ -33,10 +31,14 @@ class OrderRequestController extends GetxController {
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
// AudioController audioController = Get.put(AudioController());
|
||||
|
||||
// audioController.playAudio();
|
||||
// getRefusedOrderByCaptain();
|
||||
initilizeOrderPage();
|
||||
addCustomStartIcon();
|
||||
addCustomEndIcon();
|
||||
|
||||
// calculateConsumptionFuel();
|
||||
update();
|
||||
super.onInit();
|
||||
|
||||
Reference in New Issue
Block a user