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

@@ -7,7 +7,10 @@
<string>YOUR_API_KEY</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location is required to provide relevant information.</string>
<key>NSCameraUsageDescription</key>
<string>Sefer app requires access to your camera in order to scan QR codes and capture images for uploading.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Sefer app needs access to your location to provide you with accurate directions and location-based services.</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>

View File

@@ -9,6 +9,7 @@ import 'package:ride/constant/style.dart';
import 'package:ride/controller/functions/crud.dart';
import 'package:ride/controller/functions/launch.dart';
import 'package:ride/controller/functions/toast.dart';
import 'package:ride/controller/home/map_page_controller.dart';
import 'package:ride/views/home/profile/promos_passenger_page.dart';
import 'package:ride/views/widgets/elevated_btn.dart';
@@ -101,11 +102,13 @@ class FirebasMessagesController extends GetxController {
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
if (message.data.isNotEmpty) {
if (message.notification!.title!.contains('Order')) {
var myListString = message.data['myList'];
var myListString = message.data['DriverList'];
print(myListString);
print('9999999999999myListString999999999999999');
var myList = jsonDecode(myListString) as List<dynamic>;
Get.to(() => const OrderRequestPage(), arguments: {
Get.to(() => OrderRequestPage(), arguments: {
'myListString': myListString,
'myList': myList,
'DriverList': myList,
'body': message.notification!.body
});
// Get.defaultDialog(
@@ -199,6 +202,25 @@ class FirebasMessagesController extends GetxController {
// )
// ],
// ));
} else if (message.notification!.title!.contains('Apply Ride')) {
// MapController().rideConfirm = true;
var passengerList = message.data['passengerList'];
print(passengerList);
print('9999999999999my Apply Ride 999999999999999');
var myList = jsonDecode(passengerList) as List<dynamic>;
Get.defaultDialog(
barrierDismissible: false,
title: message.notification!.title.toString(),
content: Row(
children: [Text(myList[1].toString())],
),
confirm: MyElevatedButton(
title: 'Ok',
onPressed: () {
// MapController().rideConfirm = true;
},
));
} else if (message.notification!.title!.contains('Promo')) {
Get.to(const PromosPassengerPage());
}
@@ -381,35 +403,58 @@ class FirebasMessagesController extends GetxController {
// }
// }
// void sendNotificationDriverId(String title, body, token) async {
// http
// .post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
// headers: <String, String>{
// 'Content-Type': 'application/json',
// 'Authorization': 'key=${AppCredintials.serverAPI}'
// },
// body: jsonEncode({
// 'notification': <String, dynamic>{
// 'title': title,
// 'body': body,
// 'sound': 'true'
// },
// 'priority': 'high',
// 'data': <String, dynamic>{
// 'click_action': 'FLUTTER_NOTIFICATION_CLICK',
// 'id': '1',
// 'status': 'done'
// },
// 'to': token,
// }))
// .whenComplete(() {})
// .catchError((e) {
// print('sendNotification() error: $e');
// });
// }
void sendNotificanToPassengerToken(
String title, body, token, List<String> map) async {
try {
final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'),
headers: <String, String>{
'Content-Type': 'application/json',
'Authorization': 'key=${AppCredintials.serverAPI}'
},
body: jsonEncode({
'notification': <String, dynamic>{
'title': title,
'body': body,
'sound': 'true'
},
'data': {
'passengerList': map,
},
'priority': 'high',
'to': token,
}),
);
void sendNotificationDriverId(String title, body, strin1, strin2, strin3,
strin4, strin5, strin6, string7, string8, token) async {
if (response.statusCode == 200) {
// Notification sent successfully
print('Notification sent successfully');
} else {
// Handle error response
print(
'Failed to send notification. Status code: ${response.statusCode}');
}
} catch (e) {
// Handle other exceptions
print('sendNotification() error: $e');
}
}
void sendNotificationToDriverId(
String title,
body,
strin1,
strin2,
strin3,
strin4,
strin5,
strin6,
string7,
string8,
passengerName,
passengertoken,
passengerPhone,
token) async {
http
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
headers: <String, String>{
@@ -431,7 +476,10 @@ class FirebasMessagesController extends GetxController {
strin5,
strin6,
string7,
string8
string8,
passengerName,
passengertoken,
passengerPhone
]),
},
'priority': 'high',
@@ -442,4 +490,41 @@ class FirebasMessagesController extends GetxController {
print('sendNotification() error: $e');
});
}
void sendNotificationToDriverMAP(
String title, String body, String token, List<String> data) async {
try {
final response = await http.post(
Uri.parse('https://fcm.googleapis.com/fcm/send'),
headers: <String, String>{
'Content-Type': 'application/json',
'Authorization': 'key=${AppCredintials.serverAPI}'
},
body: jsonEncode({
'notification': <String, dynamic>{
'title': title,
'body': body,
'sound': 'true'
},
'data': {
'DriverList': data,
},
'priority': 'high',
'to': token,
}),
);
if (response.statusCode == 200) {
// Notification sent successfully
print('Notification sent successfully');
} else {
// Handle error response
print(
'Failed to send notification. Status code: ${response.statusCode}');
}
} catch (e) {
// Handle other exceptions
print('sendNotification() error: $e');
}
}
}

View File

@@ -50,6 +50,7 @@ class CRUD {
},
);
print(response.request);
print(payload);
var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) {

View File

@@ -31,8 +31,8 @@ class LocationController extends GetxController {
await CRUD().post(link: AppLink.addCarsLocationByPassenger, payload: {
'driver_id': box.read(BoxName.driverID).toString(),
'latitude': mylocation!.latitude.toString(),
'longitude': mylocation!.longitude.toString(),
'latitude': mylocation.latitude.toString(),
'longitude': mylocation.longitude.toString(),
});
});
}

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();
}
}

View File

@@ -126,12 +126,12 @@ class MapController extends GetxController {
}
changeConfirmRide() async {
rideConfirm = true;
print('rideConfirm= $rideConfirm');
// rideConfirm = true;
// update();
// print('rideConfirm= $rideConfirm');
await getCarsLocationByPassenger();
await CRUD().post(link: AppLink.addRides, payload: {
"start_location": '${data[0]['start_address']}',
// '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
"end_location": '${data[0]['end_address']}',
// '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
@@ -147,6 +147,7 @@ class MapController extends GetxController {
"distance": distance.toString()
}).then((value) {
// print(jsonDecode(value)['message']);
// List<String> body = [
List<String> body = [
// '${data[0]['start_address']}',
// '${data[0]['end_address']}',
@@ -157,21 +158,37 @@ class MapController extends GetxController {
duration.toString(),
distance.toString(),
dataCarsLocationByPassenger['message'][0]['id'].toString(),
box.read(BoxName.pasengerID).toString()
box.read(BoxName.pasengerID).toString(),
box.read(BoxName.name).toString(),
box.read(BoxName.tokenFCM).toString(),
box.read(BoxName.phone).toString(),
duratioByPassenger.toString(),
distanceByPassenger.toString(),
];
FirebasMessagesController().sendNotificationDriverId(
FirebasMessagesController().sendNotificationToDriverMAP(
'Order',
jsonDecode(value)['message'].toString(),
body[0],
body[1],
body[2],
body[3],
body[4],
body[5],
body[6],
body[7],
box.read(BoxName.tokenFCM).toString(), //TODO change to Driver
dataCarsLocationByPassenger['message'][0]['token'].toString(),
body,
);
// FirebasMessagesController().sendNotificationToDriverId(
// 'Order',
// jsonDecode(value)['message'].toString(),
// body[0],
// body[1],
// body[2],
// body[3],
// body[4],
// body[5],
// body[6],
// body[7],
// body[8],
// body[9],
// body[10],
// dataCarsLocationByPassenger['message'][0]['token'].toString(),
// );
print(dataCarsLocationByPassenger);
print(dataCarsLocationByPassenger['message'][0]['token'].toString());
});
update();
@@ -372,7 +389,7 @@ class MapController extends GetxController {
LatLngBounds calculateBounds(
double centerLat, double centerLng, double radius) {
double radius = 2000; // 10 km in meters
double radius = 4000; // 10 km in meters
southwest = LatLng(
centerLat - (radius / 111000),
@@ -449,6 +466,7 @@ class MapController extends GetxController {
}
String duratioByPassenger = '';
String distanceByPassenger = '';
void getNearestDriverByPassengerLocation() async {
if (polylines.isEmpty || data.isEmpty) {
double nearestDistance = double.infinity;
@@ -471,7 +489,7 @@ class MapController extends GetxController {
// longitude: double.parse(carLocation['longitude']),
// );
// }
isloading = true;
// isloading = true;
update();
// Make API request to get exact distance and duration
String apiUrl =
@@ -481,6 +499,8 @@ class MapController extends GetxController {
var data = response;
// Extract distance and duration from the response and handle accordingly
int distance1 = data['rows'][0]['elements'][0]['distance']['value'];
distanceByPassenger =
data['rows'][0]['elements'][0]['distance']['text'];
duration1 = data['rows'][0]['elements'][0]['duration']['value'];
duratioByPassenger =
data['rows'][0]['elements'][0]['duration']['text'];
@@ -495,7 +515,7 @@ class MapController extends GetxController {
latitude: double.parse(carLocation['latitude']),
longitude: double.parse(carLocation['longitude']),
);
isloading = false;
// isloading = false;
update();
}
}

View File

@@ -76,7 +76,7 @@ class MyApp extends StatelessWidget {
: box.read(BoxName.email) != null
? const MapPage()
: box.read(BoxName.emailDriver) == null
? LoginCaptin()
? LoginPage()
: const HomeCaptin());
}
}

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:ride/constant/colors.dart';
import 'package:ride/constant/style.dart';
import 'package:ride/controller/home/map_page_controller.dart';
import 'package:ride/views/home/map_widget.dart/cancel_raide_page.dart';
import 'package:ride/views/widgets/mycircular.dart';
@@ -53,204 +54,234 @@ class MapPage extends StatelessWidget {
// ),
// ),
body: Stack(
children: [
GetBuilder<MapController>(
builder: (controller) => controller.isloading
? const MyCircularProgressIndicator()
: GoogleMap(
onMapCreated: controller.onMapCreated,
cameraTargetBounds:
CameraTargetBounds(controller.boundsdata),
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
onLongPress: (argument) {
Get.defaultDialog(
title: 'Are you want to go to this site'.tr,
content: Column(
children: [
Text('${argument.latitude},${argument.longitude}'),
],
),
onConfirm: () async {
controller.clearpolyline();
await controller.getMap(
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
'${argument.latitude.toString()},${argument.longitude.toString()}');
body: SafeArea(
child: Stack(
children: [
GetBuilder<MapController>(
builder: (controller) => controller.isloading
? const MyCircularProgressIndicator()
: GoogleMap(
onMapCreated: controller.onMapCreated,
cameraTargetBounds:
CameraTargetBounds(controller.boundsdata),
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
onLongPress: (argument) {
Get.defaultDialog(
title: 'Are you want to go to this site'.tr,
content: Column(
children: [
Text(
'${argument.latitude},${argument.longitude}'),
],
),
onConfirm: () async {
controller.clearpolyline();
await controller.getMap(
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
'${argument.latitude.toString()},${argument.longitude.toString()}');
Get.back();
controller.bottomSheet();
controller.showBottomSheet1();
//
},
);
},
Get.back();
controller.bottomSheet();
controller.showBottomSheet1();
//
},
);
},
onTap: (argument) {
controller.hidePlaces();
onTap: (argument) {
controller.hidePlaces();
controller.changeButtomSheetShown();
// controller.bottomSheet();
},
initialCameraPosition: CameraPosition(
target: controller.mylocation,
zoom: 15,
),
markers: {
for (var carLocation
in controller.carsLocationByPassenger)
controller.changeButtomSheetShown();
// controller.bottomSheet();
},
initialCameraPosition: CameraPosition(
target: controller.mylocation,
zoom: 15,
),
markers: {
for (var carLocation
in controller.carsLocationByPassenger)
Marker(
// anchor: const Offset(4, 4),
position: carLocation,
icon: controller.carIcon,
markerId: MarkerId(carLocation.toString())),
Marker(
// anchor: const Offset(4, 4),
position: carLocation,
icon: controller.carIcon,
markerId: MarkerId(carLocation.toString())),
Marker(
markerId: MarkerId('MyLocation'.tr),
position: controller.mylocation,
draggable: true,
icon: controller.markerIcon,
onDragEnd: (value) {
print(value);
},
infoWindow: InfoWindow(title: 'my location'.tr),
),
Marker(
markerId: MarkerId('Target'.tr),
position: controller.mydestination,
draggable: true,
onDragEnd: (v) {
print(v);
},
),
},
polylines: {
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route'),
points: controller.polylineCoordinates,
color: AppColor.primaryColor,
width: 5,
),
// Polyline(
// zIndex: 2,
// consumeTapEvents: true,
// geodesic: true,
// endCap: Cap.buttCap,
// startCap: Cap.buttCap,
// visible: true,
// polylineId: PolylineId('g'),
// points: [
// LatLng(controller.southwest.latitude,
// controller.southwest.longitude),
// LatLng(controller.northeast.latitude,
// controller.northeast.longitude)
// ],
// color: AppColor.primaryColor,
// width: 5,
// ),
},
// circles: {
// Circle(
// circleId: const CircleId('kk'),
// center: controller.mylocation,
// radius: 60,
// fillColor: AppColor.primaryColor,)
// },
mapType:
controller.mapType ? MapType.satellite : MapType.normal,
myLocationButtonEnabled: true,
// liteModeEnabled: true, tiltGesturesEnabled: false,
markerId: MarkerId('MyLocation'.tr),
position: controller.mylocation,
draggable: true,
icon: controller.markerIcon,
onDragEnd: (value) {
print(value);
},
infoWindow: InfoWindow(title: 'my location'.tr),
),
Marker(
markerId: MarkerId('Target'.tr),
position: controller.mydestination,
draggable: true,
onDragEnd: (v) {
print(v);
},
),
},
polylines: {
Polyline(
zIndex: 2,
consumeTapEvents: true,
geodesic: true,
endCap: Cap.buttCap,
startCap: Cap.buttCap,
visible: true,
polylineId: const PolylineId('route'),
points: controller.polylineCoordinates,
color: AppColor.primaryColor,
width: 5,
),
// Polyline(
// zIndex: 2,
// consumeTapEvents: true,
// geodesic: true,
// endCap: Cap.buttCap,
// startCap: Cap.buttCap,
// visible: true,
// polylineId: PolylineId('g'),
// points: [
// LatLng(controller.southwest.latitude,
// controller.southwest.longitude),
// LatLng(controller.northeast.latitude,
// controller.northeast.longitude)
// ],
// color: AppColor.primaryColor,
// width: 5,
// ),
},
// circles: {
// Circle(
// circleId: const CircleId('kk'),
// center: controller.mylocation,
// radius: 60,
// fillColor: AppColor.primaryColor,)
// },
mapType: controller.mapType
? MapType.satellite
: MapType.normal,
myLocationButtonEnabled: true,
// liteModeEnabled: true, tiltGesturesEnabled: false,
// indoorViewEnabled: true,
trafficEnabled: controller.mapTraficON,
buildingsEnabled: true,
mapToolbarEnabled: true,
onCameraMove: (position) {
controller.newMylocation = position.target;
// print('my' + controller.mylocation.toString());
// print('new' + controller.newMylocation.toString());
},
myLocationEnabled: true,
// liteModeEnabled: true,
),
),
GetBuilder<MapController>(
builder: (controller) => Positioned(
top: 85,
left: 6,
child: Column(
children: [
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTrafic,
decoration: BoxDecoration(
border: Border.all(),
color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
controller.changeMapType();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.satellite_alt,
size: 29,
// indoorViewEnabled: true,
trafficEnabled: controller.mapTraficON,
buildingsEnabled: true,
mapToolbarEnabled: true,
onCameraMove: (position) {
controller.newMylocation = position.target;
// print('my' + controller.mylocation.toString());
// print('new' + controller.newMylocation.toString());
},
myLocationEnabled: true,
// liteModeEnabled: true,
),
),
GetBuilder<MapController>(
builder: (controller) => Positioned(
top: 85,
left: 6,
child: Column(
children: [
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTrafic,
decoration: BoxDecoration(
border: Border.all(),
color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
controller.changeMapType();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.satellite_alt,
size: 29,
),
),
),
),
const SizedBox(
height: 5,
),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTrafic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(),
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
controller.changeMapTraffic();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.streetview_sharp,
size: 29,
const SizedBox(
height: 5,
),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTrafic,
decoration: BoxDecoration(
color: AppColor.secondaryColor,
border: Border.all(),
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
controller.changeMapTraffic();
// Toast.show(context, 'This is a toast message!');
},
icon: const Icon(
Icons.streetview_sharp,
size: 29,
),
),
),
),
],
)),
),
const PickerIconOnMap(),
// PickerAnimtionContainerFormPlaces(),
const MainBottomMenuMap(),
const MapMenuWidget(),
const MenuIconMapPageWidget(),
buttomSheetMapPage(),
cancelRidePage(),
GetBuilder<MapController>(
builder: (controller) => controller.data.isNotEmpty
? Positioned(
right: 5,
top: 55,
child: GestureDetector(
onTap: () {
controller.changeCancelRidePageShow();
},
child: const Icon(
Icons.clear,
size: 30,
],
)),
),
const PickerIconOnMap(),
// PickerAnimtionContainerFormPlaces(),
const MainBottomMenuMap(),
const MapMenuWidget(),
const MenuIconMapPageWidget(),
buttomSheetMapPage(),
GetBuilder<MapController>(
builder: ((controller) => controller.rideConfirm
? Positioned(
top: Get.height * .2,
left: Get.width * .2,
right: Get.width * .2,
child: AnimatedContainer(
duration: const Duration(microseconds: 300),
height: 350,
width: 200,
decoration: BoxDecoration(
border: Border.all(),
color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'Waiting for Captin ...'.tr,
style: AppStyle.title,
),
],
),
),
))
: const SizedBox()),
const CashConfirmPageShown(),
const PaymentMethodPage()
],
)
: const SizedBox())),
cancelRidePage(),
GetBuilder<MapController>(
builder: (controller) => controller.data.isNotEmpty
? Positioned(
right: 5,
top: 55,
child: GestureDetector(
onTap: () {
controller.changeCancelRidePageShow();
},
child: const Icon(
Icons.clear,
size: 30,
),
))
: const SizedBox()),
const CashConfirmPageShown(),
const PaymentMethodPage()
],
),
),
);
}

View File

@@ -76,12 +76,12 @@ class MainBottomMenuMap extends StatelessWidget {
animatedTexts: [
ScaleAnimatedText(
'${'Where to'.tr} ${box.read(BoxName.name)}'),
WavyAnimatedText(
'${'Where to'.tr} ${box.read(BoxName.name)}'),
FlickerAnimatedText(
'${'Where to'.tr} ${box.read(BoxName.name)}'),
WavyAnimatedText(
'${'Where to'.tr} ${box.read(BoxName.name)}'),
// WavyAnimatedText(
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
// FlickerAnimatedText(
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
// WavyAnimatedText(
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
],
isRepeatingAnimation: true,
onTap: () {

View File

@@ -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,
),