This commit is contained in:
Hamza-Ayed
2023-09-11 19:12:33 +03:00
parent a626915f45
commit 8b0b5e9cef
10 changed files with 556 additions and 275 deletions

View File

@@ -0,0 +1,42 @@
import 'package:get/get.dart';
import 'package:ride/constant/links.dart';
import '../../functions/crud.dart';
class TimerController extends GetxController {
double progress = 0;
int duration = 25;
int remainingTime = 0;
@override
void onInit() {
startTimer();
super.onInit();
}
void startTimer() async {
for (int i = 0; i <= duration; i++) {
await Future.delayed(const Duration(seconds: 1));
progress = i / duration;
remainingTime = duration - i;
update();
}
timerEnded();
}
void refuseOrder(String driverID, orderID) async {
await CRUD().postFromDialogue(link: AppLink.addDriverOrder, payload: {
'driver_id': driverID,
// box.read(BoxName.driverID).toString(),
'order_id': orderID,
'status': 'Refused'
});
Get.back();
}
void timerEnded() async {
print('Timer ended');
// refuseOrder();
}
}