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
});
} 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'];
print(passengerList);
print('9999999999999my Apply Ride 999999999999999');

View File

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

View File

@@ -197,6 +197,13 @@ class MapPage extends StatelessWidget {
position: carLocation,
icon: controller.carIcon,
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(
markerId: MarkerId('MyLocation'.tr),
position: controller.mylocation,
@@ -287,6 +294,24 @@ class MapPage extends StatelessWidget {
const PaymentMethodPage(),
timerForCancellTripFromPassenger(),
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: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 '../../../controller/home/map_page_controller.dart';
@@ -13,12 +14,9 @@ class DriverTimeArrivePassengerPage extends StatelessWidget {
return GetBuilder<MapController>(
builder: (controller) {
return controller.remainingTime == 0
? Positioned.directional(
? Positioned(
bottom: Get.height * .35,
end: Get.width * .05,
textDirection: Get.locale!.languageCode == 'ar'
? TextDirection.rtl
: TextDirection.ltr,
right: Get.width * .05,
child: Stack(
alignment: Alignment.center,
children: [
@@ -37,7 +35,7 @@ class DriverTimeArrivePassengerPage extends StatelessWidget {
style: AppStyle.title,
),
Text(
controller.newTime1.toString(),
" ${DateFormat('h:mm a').format(controller.newTime)}",
style: AppStyle.title,
),
],