9/11/1
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/controller/firebase/firbase_messge.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/my_scafold.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
@@ -7,17 +10,19 @@ import '../../constant/links.dart';
|
||||
import '../../constant/style.dart';
|
||||
import '../../controller/functions/crud.dart';
|
||||
import '../../controller/functions/launch.dart';
|
||||
import '../../controller/home/captin/order_request_controller.dart';
|
||||
import '../widgets/elevated_btn.dart';
|
||||
|
||||
class OrderRequestPage extends StatelessWidget {
|
||||
const OrderRequestPage({super.key});
|
||||
|
||||
OrderRequestPage({super.key});
|
||||
TimerController timerController = Get.put(TimerController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final arguments = Get.arguments;
|
||||
final myListString = arguments['myListString'];
|
||||
final myList = arguments['myList'];
|
||||
final myList = arguments['DriverList'];
|
||||
final body = arguments['body'];
|
||||
|
||||
return MyScafolld(
|
||||
title: 'Order Request Page',
|
||||
body: [
|
||||
@@ -40,34 +45,98 @@ class OrderRequestPage extends StatelessWidget {
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Tatal From Passenger is '.tr +
|
||||
double.parse(myList[2]).toStringAsFixed(2),
|
||||
style: AppStyle.title,
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Passenger Name is '.tr,
|
||||
style: AppStyle.title,
|
||||
children: [
|
||||
TextSpan(text: myList[8], style: AppStyle.headtitle2),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Tatal For You is '.tr +
|
||||
double.parse(myList[3]).toStringAsFixed(2),
|
||||
style: AppStyle.title,
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Tatal From Passenger is '.tr,
|
||||
style: AppStyle.title,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: double.parse(myList[2]).toStringAsFixed(2),
|
||||
style: AppStyle.headtitle2),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Distance is '.tr + myList[5].toString() + ' KM'.tr,
|
||||
style: AppStyle.title,
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Duration To Passenger is '.tr,
|
||||
style: AppStyle.title,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: myList[11].toString(),
|
||||
style: AppStyle.headtitle2),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'Duration of Trip is '.tr +
|
||||
myList[4].toString() +
|
||||
' Minutes'.tr,
|
||||
style: AppStyle.title,
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Distance To Passenger is '.tr,
|
||||
style: AppStyle.title,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: myList[12].toString(),
|
||||
style: AppStyle.headtitle2),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Tatal For You is '.tr,
|
||||
style: AppStyle.title,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: double.parse(myList[3]).toStringAsFixed(2),
|
||||
style: AppStyle.headtitle2),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Distance is '.tr,
|
||||
style: AppStyle.title,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: myList[5].toString(),
|
||||
style: AppStyle.headtitle2),
|
||||
TextSpan(text: ' KM'.tr, style: AppStyle.title),
|
||||
]),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: 'Duration of Trip is '.tr,
|
||||
style: AppStyle.title,
|
||||
children: [
|
||||
TextSpan(
|
||||
text: myList[4].toString(),
|
||||
style: AppStyle.headtitle2),
|
||||
TextSpan(text: ' Minutes'.tr, style: AppStyle.title),
|
||||
]),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
@@ -86,19 +155,49 @@ class OrderRequestPage extends StatelessWidget {
|
||||
'order_id': body.toString(),
|
||||
'status': 'Apply'
|
||||
});
|
||||
// Get.back();
|
||||
List<String> bodyToPassenger = [
|
||||
box.read(BoxName.driverID).toString(),
|
||||
box.read(BoxName.nameDriver).toString(),
|
||||
box.read(BoxName.tokenDriver).toString(),
|
||||
];
|
||||
print(bodyToPassenger);
|
||||
FirebasMessagesController()
|
||||
.sendNotificanToPassengerToken(
|
||||
'Apply Ride',
|
||||
arguments['DriverList'][9].toString(),
|
||||
arguments['DriverList'][9].toString(),
|
||||
// box.read(BoxName.tokenDriver).toString(),
|
||||
bodyToPassenger,
|
||||
);
|
||||
},
|
||||
),
|
||||
GetBuilder<TimerController>(
|
||||
builder: (timerController) {
|
||||
final isNearEnd = timerController.remainingTime <=
|
||||
5; // Define a threshold for "near end"
|
||||
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(
|
||||
value: timerController.progress,
|
||||
// Set the color based on the "isNearEnd" condition
|
||||
color: isNearEnd ? Colors.red : Colors.blue,
|
||||
),
|
||||
Text(
|
||||
'${timerController.remainingTime}',
|
||||
style: AppStyle.number,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Refuse Order'.tr,
|
||||
onPressed: () async {
|
||||
await CRUD().postFromDialogue(
|
||||
link: AppLink.addDriverOrder,
|
||||
payload: {
|
||||
'driver_id': myList[6].toString(),
|
||||
// box.read(BoxName.driverID).toString(),
|
||||
'order_id': body.toString(),
|
||||
'status': 'Refused'
|
||||
});
|
||||
timerController.refuseOrder(
|
||||
myList[6].toString(), body.toString());
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user