This commit is contained in:
Hamza-Ayed
2023-09-23 16:39:05 +03:00
parent 9bc121f07a
commit 92b0713811
4 changed files with 43 additions and 16 deletions

View File

@@ -112,7 +112,12 @@ class FirebasMessagesController extends GetxController {
'body': message.notification!.body 'body': message.notification!.body
}); });
} else if (message.notification!.title!.contains('Apply Ride')) { } else if (message.notification!.title!.contains('Apply Ride')) {
// MapController().rideConfirm = true; // MapController mapController = Get.put(MapController());
// mapController.rideConfirm = false;
// print('-----------------------------rideConfirm===' +
// mapController.rideConfirm.toString());
// update();
var passengerList = message.data['passengerList']; var passengerList = message.data['passengerList'];
print(passengerList); print(passengerList);
print('9999999999999my Apply Ride 999999999999999'); print('9999999999999my Apply Ride 999999999999999');

View File

@@ -151,7 +151,7 @@ class MapController extends GetxController {
"price": totalPassenger.toString(), "price": totalPassenger.toString(),
"passenger_id": box.read(BoxName.pasengerID).toString(), "passenger_id": box.read(BoxName.pasengerID).toString(),
"driver_id": dataCarsLocationByPassenger['message'][0]['id'].toString(), "driver_id": dataCarsLocationByPassenger['message'][0]['id'].toString(),
"status": "active", "status": "waiting",
"price_for_driver": totalDriver.toString(), "price_for_driver": totalDriver.toString(),
"price_for_passenger": totaME.toString(), "price_for_passenger": totaME.toString(),
"distance": distance.toString() "distance": distance.toString()
@@ -194,25 +194,24 @@ class MapController extends GetxController {
} }
void delayAndFetchRideStatus(String rideId) { void delayAndFetchRideStatus(String rideId) {
Timer(const Duration(seconds: 3), () async { Timer(const Duration(seconds: 1), () async {
if (shouldFetch) { if (shouldFetch) {
// print('shouldFetch is =$shouldFetch'); // print('shouldFetch is =$shouldFetch');
var res = await CRUD() var res = await CRUD()
.get(link: AppLink.getRideStatus, payload: {'order_id': rideId}); .get(link: AppLink.getRideStatus, payload: {'order_id': rideId});
var decod = jsonDecode(res); var decod = jsonDecode(res);
// print(' 0000000000000000000000000000000000000000000000000'); print(' 0000000000000000000000000000000000000000000000000');
// print(decod['data']); print(decod['data']);
if (decod['data'].toString() == 'Apply' || if (decod['data'].toString() == 'Apply' ||
decod['data'].toString() == 'Refused') { decod['data'].toString() == 'Refused') {
shouldFetch = false; // Stop further fetches shouldFetch = false; // Stop further fetches
rideConfirm = false; rideConfirm = false;
update();
startTimer(); startTimer();
update();
} else { } else {
shouldFetch = true; delayAndFetchRideStatus(
rideId); // Repeat the delay and fetch operation
update(); update();
// delayAndFetchRideStatus(
// rideId); // Repeat the delay and fetch operation
} }
} }
}); });

View File

@@ -197,6 +197,13 @@ class MapPage extends StatelessWidget {
position: carLocation, position: carLocation,
icon: controller.carIcon, icon: controller.carIcon,
markerId: MarkerId(carLocation.toString())), markerId: MarkerId(carLocation.toString())),
for (var carLocation in controller
.driverCarsLocationToPassengerAfterApplied)
Marker(
// anchor: const Offset(4, 4),
position: carLocation,
icon: controller.carIcon,
markerId: MarkerId(carLocation.toString())),
Marker( Marker(
markerId: MarkerId('MyLocation'.tr), markerId: MarkerId('MyLocation'.tr),
position: controller.mylocation, position: controller.mylocation,
@@ -287,6 +294,24 @@ class MapPage extends StatelessWidget {
const PaymentMethodPage(), const PaymentMethodPage(),
timerForCancellTripFromPassenger(), timerForCancellTripFromPassenger(),
const DriverTimeArrivePassengerPage(), const DriverTimeArrivePassengerPage(),
GetBuilder<MapController>(builder: (controller) {
if (controller.remainingTime == 0
//&&
// controller.newTime1.isBefore(
// controller.currentTime.add(const Duration(minutes: 2)),
// )
) {
return Center(
child: Container(
decoration: AppStyle.boxDecoration,
height: 100,
width: 100,
),
);
} else {
return const SizedBox();
}
}),
], ],
), ),
), ),

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:ride/views/home/map_widget.dart/hexegone_clipper.dart'; import 'package:intl/intl.dart';
// import 'package:intl/intl.dart';
import '../../../constant/style.dart'; import '../../../constant/style.dart';
import '../../../controller/home/map_page_controller.dart'; import '../../../controller/home/map_page_controller.dart';
@@ -13,12 +14,9 @@ class DriverTimeArrivePassengerPage extends StatelessWidget {
return GetBuilder<MapController>( return GetBuilder<MapController>(
builder: (controller) { builder: (controller) {
return controller.remainingTime == 0 return controller.remainingTime == 0
? Positioned.directional( ? Positioned(
bottom: Get.height * .35, bottom: Get.height * .35,
end: Get.width * .05, right: Get.width * .05,
textDirection: Get.locale!.languageCode == 'ar'
? TextDirection.rtl
: TextDirection.ltr,
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
@@ -37,7 +35,7 @@ class DriverTimeArrivePassengerPage extends StatelessWidget {
style: AppStyle.title, style: AppStyle.title,
), ),
Text( Text(
controller.newTime1.toString(), " ${DateFormat('h:mm a').format(controller.newTime)}",
style: AppStyle.title, style: AppStyle.title,
), ),
], ],