This commit is contained in:
Hamza Aleghwairyeen
2024-03-31 15:15:41 +03:00
parent ebb2dd357a
commit 912b2d4526

View File

@@ -32,7 +32,8 @@ class OrderSpeedRequest extends StatelessWidget {
Duration durationToAdd = Duration(seconds: int.parse(myList[4])); Duration durationToAdd = Duration(seconds: int.parse(myList[4]));
int hours = durationToAdd.inHours; int hours = durationToAdd.inHours;
int minutes = (durationToAdd.inMinutes % 60).round(); int minutes = (durationToAdd.inMinutes % 60).round();
orderRequestController.startTimer(myList[6].toString(), body.toString()); orderRequestController.startTimerSpeed(
myList[6].toString(), body.toString());
var coords = myList[0].split(','); var coords = myList[0].split(',');
var coordDestination = myList[1].split(','); var coordDestination = myList[1].split(',');
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker; BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
@@ -373,7 +374,8 @@ class OrderSpeedRequest extends StatelessWidget {
}); });
// .then((value) { // .then((value) {
var json = jsonDecode(res); var json = jsonDecode(res);
if (res == "failure") { print('res $json');
if (json['status'] == "failure") {
Get.defaultDialog( Get.defaultDialog(
title: title:
"This ride is already taken by another driver." "This ride is already taken by another driver."
@@ -440,19 +442,19 @@ class OrderSpeedRequest extends StatelessWidget {
), ),
GetBuilder<OrderRequestController>( GetBuilder<OrderRequestController>(
builder: (timerController) { builder: (timerController) {
final isNearEnd = timerController.remainingTime <= final isNearEnd = timerController.remainingTimeSpeed <=
5; // Define a threshold for "near end" 5; // Define a threshold for "near end"
return Stack( return Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
CircularProgressIndicator( CircularProgressIndicator(
value: timerController.progress, value: timerController.progressSpeed,
// Set the color based on the "isNearEnd" condition // Set the color based on the "isNearEnd" condition
color: isNearEnd ? Colors.red : Colors.blue, color: isNearEnd ? Colors.red : Colors.blue,
), ),
Text( Text(
'${timerController.remainingTime}', '${timerController.remainingTimeSpeed}',
style: AppStyle.number, style: AppStyle.number,
), ),
], ],