12/31/2
This commit is contained in:
@@ -13,11 +13,6 @@ import '../../constant/style.dart';
|
||||
import '../../main.dart';
|
||||
import '../../views/home/profile/promos_passenger_page.dart';
|
||||
import '../../views/home/Captin/orderCaptin/order_request_page.dart';
|
||||
import '../../views/widgets/elevated_btn.dart';
|
||||
import '../functions/crud.dart';
|
||||
import '../functions/launch.dart';
|
||||
import '../home/captin/map_driver_controller.dart';
|
||||
import '../home/map_passenger_controller.dart';
|
||||
|
||||
class FirebaseMessagesController extends GetxController {
|
||||
final fcmToken = FirebaseMessaging.instance;
|
||||
@@ -203,19 +198,19 @@ class FirebaseMessagesController extends GetxController {
|
||||
}
|
||||
// If the app is in the background or terminated, show a system tray message
|
||||
RemoteNotification? notification = message.notification;
|
||||
AndroidNotification? android = message.notification?.android;
|
||||
AndroidNotification? android = notification?.android;
|
||||
// if (notification != null && android != null) {
|
||||
if (notification != null && android != null) {
|
||||
print('onMessageOpenedApp: ${notification.title} ${notification.body}');
|
||||
// print('onMessageOpenedApp: ${notification.title} ${notification.body}');
|
||||
if (message.data.isNotEmpty) {
|
||||
if (message.notification!.title!.contains('Order')) {
|
||||
var myListString = message.data['DriverList'];
|
||||
print(myListString);
|
||||
print('9999999999999myListString999999999999999');
|
||||
// print(myListString);
|
||||
// print('9999999999999myListString999999999999999');
|
||||
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||
driverToken = myList[14].toString();
|
||||
update();
|
||||
print('driverToken==============$driverToken');
|
||||
// print('driverToken==============$driverToken');
|
||||
Get.to(() => OrderRequestPage(), arguments: {
|
||||
'myListString': myListString,
|
||||
'DriverList': myList,
|
||||
@@ -223,8 +218,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
});
|
||||
} else if (message.notification!.title!.contains('Apply Ride')) {
|
||||
var passengerList = message.data['passengerList'];
|
||||
print(passengerList);
|
||||
print('9999999999999my Apply Ride 999999999999999');
|
||||
// print(passengerList);
|
||||
// print('9999999999999my Apply Ride 999999999999999');
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[2].toString();
|
||||
|
||||
@@ -313,18 +308,18 @@ class FirebaseMessagesController extends GetxController {
|
||||
});
|
||||
|
||||
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
|
||||
print(
|
||||
'onMessageOpenedApp: ${message.notification!.title} ${message.notification!.body}');
|
||||
// print(
|
||||
// 'onMessageOpenedApp: ${message.notification!.title} ${message.notification!.body}');
|
||||
RemoteNotification? notification = message.notification;
|
||||
if (message.data.isNotEmpty) {
|
||||
if (message.notification!.title!.contains('Order')) {
|
||||
if (notification!.title!.contains('Order')) {
|
||||
var myListString = message.data['DriverList'];
|
||||
print(myListString);
|
||||
print('9999999999999myListString999999999999999');
|
||||
// print(myListString);
|
||||
// print('9999999999999myListString999999999999999');
|
||||
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||
driverToken = myList[14].toString();
|
||||
update();
|
||||
print('driverToken==============$driverToken');
|
||||
// print('driverToken==============$driverToken');
|
||||
Get.to(() => OrderRequestPage(), arguments: {
|
||||
'myListString': myListString,
|
||||
'DriverList': myList,
|
||||
@@ -332,8 +327,8 @@ class FirebaseMessagesController extends GetxController {
|
||||
});
|
||||
} else if (message.notification!.title!.contains('Apply Ride')) {
|
||||
var passengerList = message.data['passengerList'];
|
||||
print(passengerList);
|
||||
print('9999999999999my Apply Ride 999999999999999');
|
||||
// print(passengerList);
|
||||
// print('9999999999999my Apply Ride 999999999999999');
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[2].toString();
|
||||
|
||||
|
||||
@@ -103,6 +103,18 @@ class MapPassengerController extends GetxController {
|
||||
late String driverToken;
|
||||
int carsOrder = 0;
|
||||
String? mapAPIKEY;
|
||||
late double totalME = 0;
|
||||
late double tax = 0;
|
||||
late double totalPassenger = 0;
|
||||
late double totalDriver = 0;
|
||||
late double averageDuration = 0;
|
||||
late double costDuration = 0;
|
||||
late double cost = 0;
|
||||
late double distance = 0;
|
||||
late double duration = 0;
|
||||
|
||||
late Duration durationToAdd;
|
||||
late DateTime newTime = DateTime.now();
|
||||
|
||||
void onChangedPassengerCount(int newValue) {
|
||||
selectedPassengerCount = newValue;
|
||||
@@ -116,6 +128,7 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
void getCurrentLocationFormString() async {
|
||||
currentLocationToFormPlaces = true;
|
||||
currentLocationString = 'Waiting for your location'.tr;
|
||||
await getLocation();
|
||||
currentLocationString = myLocation.toString();
|
||||
newStartPointLocation = myLocation;
|
||||
@@ -401,7 +414,7 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
title: 'No Car or Captain Found in your area.'.tr,
|
||||
title: 'No Car or Driver Found in your area.'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
middleText: 'Please Try anther time '.tr,
|
||||
middleTextStyle: AppStyle.title.copyWith(color: AppColor.yellowColor),
|
||||
@@ -436,7 +449,7 @@ class MapPassengerController extends GetxController {
|
||||
changeConfirmRide();
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
title: 'There no Captain Aplly your order sorry for that '.tr,
|
||||
title: 'There no Driver Aplly your order sorry for that '.tr,
|
||||
middleText: 'try next time .',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Back',
|
||||
@@ -503,30 +516,19 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
var res =
|
||||
await CRUD().get(link: AppLink.getCarsLocationByPassenger, payload: {
|
||||
'southwestLat': southwest.latitude.toString(),
|
||||
'southwestLon': southwest.longitude.toString(),
|
||||
'northeastLat': northeast.latitude.toString(),
|
||||
'northeastLon': northeast.longitude.toString(),
|
||||
'southwestLat': bounds.southwest.latitude.toString(),
|
||||
'southwestLon': bounds.southwest.longitude.toString(),
|
||||
'northeastLat': bounds.northeast.latitude.toString(),
|
||||
'northeastLon': bounds.northeast.longitude.toString(),
|
||||
});
|
||||
if (res == 'failure') {
|
||||
noCarString = true;
|
||||
dataCarsLocationByPassenger = res;
|
||||
update();
|
||||
// Get.snackbar('No Car in your site.Sorry!'.tr, '',
|
||||
// backgroundColor: AppColor.redColor);
|
||||
// Get.defaultDialog(
|
||||
// title: 'No Car in your site.Sorry!'.tr,
|
||||
// middleText: '',
|
||||
// confirm: MyElevatedButton(
|
||||
// title: 'Back',
|
||||
// onPressed: () {
|
||||
// Get.back();
|
||||
// markerReloadingTimer.cancel();
|
||||
// }));
|
||||
} else {
|
||||
noCarString = false;
|
||||
dataCarsLocationByPassenger = jsonDecode(res);
|
||||
// print(dataCarsLocationByPassenger);
|
||||
print(dataCarsLocationByPassenger);
|
||||
// if (dataCarsLocationByPassenger.length > carsOrder) {
|
||||
driverId = dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
|
||||
.toString();
|
||||
@@ -569,7 +571,7 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
Future runEvery30SecondsUntilConditionMet() async {
|
||||
// Calculate the duration of the trip in minutes.
|
||||
double tripDurationInMinutes = duration1 / 30;
|
||||
double tripDurationInMinutes = duration1 / 20;
|
||||
int loopCount = tripDurationInMinutes.ceil();
|
||||
// If the trip duration is less than or equal to 50 minutes, then break the loop.
|
||||
for (var i = 0; i < loopCount; i++) {
|
||||
@@ -769,7 +771,7 @@ class MapPassengerController extends GetxController {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: Size(Get.width * .6, Get.height * .6),
|
||||
);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/picker.png')
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/brand.png')
|
||||
.then((value) {
|
||||
tripIcon = value;
|
||||
update();
|
||||
@@ -1133,18 +1135,6 @@ class MapPassengerController extends GetxController {
|
||||
return distance;
|
||||
}
|
||||
|
||||
late double totalME = 0;
|
||||
late double tax = 0;
|
||||
late double totalPassenger = 0;
|
||||
late double totalDriver = 0;
|
||||
late double averageDuration = 0;
|
||||
late double costDuration = 0;
|
||||
late double cost = 0;
|
||||
late double distance = 0;
|
||||
late double duration = 0;
|
||||
|
||||
late Duration durationToAdd;
|
||||
late DateTime newTime = DateTime.now();
|
||||
Future bottomSheet() async {
|
||||
if (data.isNotEmpty) {
|
||||
String distanceText = await data[0]['distance']['text'];
|
||||
|
||||
@@ -47,19 +47,31 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
|
||||
],
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(15))),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
child: ListView.builder(
|
||||
itemCount:
|
||||
controller.dataCarsLocationByPassenger.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .15,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(controller
|
||||
.dataCarsLocationByPassenger
|
||||
.toString()),
|
||||
Image.asset(
|
||||
'assets/images/jeep.png',
|
||||
width: 50,
|
||||
fit: BoxFit.fill,
|
||||
repeat: ImageRepeat.repeatX,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
@@ -100,7 +112,8 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
|
||||
),
|
||||
controller.promoTaken
|
||||
? const Icon(
|
||||
Icons.filter_vintage_rounded,
|
||||
Icons
|
||||
.filter_vintage_rounded,
|
||||
color: AppColor.redColor,
|
||||
)
|
||||
: const SizedBox(
|
||||
@@ -111,6 +124,8 @@ GetBuilder<MapPassengerController> buttomSheetMapPage() {
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
|
||||
@@ -151,7 +151,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
markerId: MarkerId('MyLocation'.tr),
|
||||
position: controller.newStartPointLocation,
|
||||
draggable: true,
|
||||
icon: controller.tripIcon,
|
||||
icon: controller.markerIcon,
|
||||
infoWindow: const InfoWindow(
|
||||
title: 'Time',
|
||||
// snippet: controller.durationFromDriverToPassenger
|
||||
@@ -166,7 +166,7 @@ class GoogleMapPassengerWidget extends StatelessWidget {
|
||||
markerId: MarkerId('Destination'.tr),
|
||||
position: controller.newMyLocation,
|
||||
draggable: true,
|
||||
icon: controller.tripIcon,
|
||||
icon: controller.markerIcon,
|
||||
infoWindow: const InfoWindow(
|
||||
title: 'Time',
|
||||
// snippet: controller.durationFromDriverToPassenger
|
||||
|
||||
@@ -82,15 +82,15 @@ class MainBottomMenuMap extends StatelessWidget {
|
||||
controller.startLocationFromMap =
|
||||
false;
|
||||
controller.isPickerShown = false;
|
||||
print(controller.myLocation);
|
||||
print(controller
|
||||
.newStartPointLocation);
|
||||
// print(controller.myLocation);
|
||||
// print(controller
|
||||
// .newStartPointLocation);
|
||||
} else {
|
||||
controller.newMyLocation =
|
||||
controller.newMyLocation;
|
||||
controller.isPickerShown = false;
|
||||
print(controller.myLocation);
|
||||
print(controller.newMyLocation);
|
||||
// print(controller.myLocation);
|
||||
// print(controller.newMyLocation);
|
||||
}
|
||||
|
||||
// await controller.getMap(
|
||||
|
||||
@@ -203,6 +203,9 @@ class IconMainPageMap extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder(
|
||||
future: Future.delayed(const Duration(milliseconds: 400)),
|
||||
builder: (context, snapshot) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
@@ -237,5 +240,6 @@ class IconMainPageMap extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,17 +45,6 @@ class MyScafolld extends StatelessWidget {
|
||||
style: AppStyle.title.copyWith(fontSize: 30),
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height,
|
||||
width: Get.width,
|
||||
child: Stack(children: body))
|
||||
],
|
||||
),
|
||||
)));
|
||||
body: SafeArea(child: Stack(children: body)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user