9/11/1
This commit is contained in:
@@ -7,7 +7,10 @@
|
|||||||
<string>YOUR_API_KEY</string>
|
<string>YOUR_API_KEY</string>
|
||||||
<key>NSLocationWhenInUseUsageDescription</key>
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
<string>Your location is required to provide relevant information.</string>
|
<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>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:ride/constant/style.dart';
|
|||||||
import 'package:ride/controller/functions/crud.dart';
|
import 'package:ride/controller/functions/crud.dart';
|
||||||
import 'package:ride/controller/functions/launch.dart';
|
import 'package:ride/controller/functions/launch.dart';
|
||||||
import 'package:ride/controller/functions/toast.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/home/profile/promos_passenger_page.dart';
|
||||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||||
|
|
||||||
@@ -101,11 +102,13 @@ class FirebasMessagesController extends GetxController {
|
|||||||
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
|
||||||
if (message.data.isNotEmpty) {
|
if (message.data.isNotEmpty) {
|
||||||
if (message.notification!.title!.contains('Order')) {
|
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>;
|
var myList = jsonDecode(myListString) as List<dynamic>;
|
||||||
Get.to(() => const OrderRequestPage(), arguments: {
|
Get.to(() => OrderRequestPage(), arguments: {
|
||||||
'myListString': myListString,
|
'myListString': myListString,
|
||||||
'myList': myList,
|
'DriverList': myList,
|
||||||
'body': message.notification!.body
|
'body': message.notification!.body
|
||||||
});
|
});
|
||||||
// Get.defaultDialog(
|
// 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')) {
|
} else if (message.notification!.title!.contains('Promo')) {
|
||||||
Get.to(const PromosPassengerPage());
|
Get.to(const PromosPassengerPage());
|
||||||
}
|
}
|
||||||
@@ -381,35 +403,58 @@ class FirebasMessagesController extends GetxController {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// void sendNotificationDriverId(String title, body, token) async {
|
void sendNotificanToPassengerToken(
|
||||||
// http
|
String title, body, token, List<String> map) async {
|
||||||
// .post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
try {
|
||||||
// headers: <String, String>{
|
final response = await http.post(
|
||||||
// 'Content-Type': 'application/json',
|
Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||||
// 'Authorization': 'key=${AppCredintials.serverAPI}'
|
headers: <String, String>{
|
||||||
// },
|
'Content-Type': 'application/json',
|
||||||
// body: jsonEncode({
|
'Authorization': 'key=${AppCredintials.serverAPI}'
|
||||||
// 'notification': <String, dynamic>{
|
},
|
||||||
// 'title': title,
|
body: jsonEncode({
|
||||||
// 'body': body,
|
'notification': <String, dynamic>{
|
||||||
// 'sound': 'true'
|
'title': title,
|
||||||
// },
|
'body': body,
|
||||||
// 'priority': 'high',
|
'sound': 'true'
|
||||||
// 'data': <String, dynamic>{
|
},
|
||||||
// 'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
'data': {
|
||||||
// 'id': '1',
|
'passengerList': map,
|
||||||
// 'status': 'done'
|
},
|
||||||
// },
|
'priority': 'high',
|
||||||
// 'to': token,
|
'to': token,
|
||||||
// }))
|
}),
|
||||||
// .whenComplete(() {})
|
);
|
||||||
// .catchError((e) {
|
|
||||||
// print('sendNotification() error: $e');
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
void sendNotificationDriverId(String title, body, strin1, strin2, strin3,
|
if (response.statusCode == 200) {
|
||||||
strin4, strin5, strin6, string7, string8, token) async {
|
// 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
|
http
|
||||||
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
.post(Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||||
headers: <String, String>{
|
headers: <String, String>{
|
||||||
@@ -431,7 +476,10 @@ class FirebasMessagesController extends GetxController {
|
|||||||
strin5,
|
strin5,
|
||||||
strin6,
|
strin6,
|
||||||
string7,
|
string7,
|
||||||
string8
|
string8,
|
||||||
|
passengerName,
|
||||||
|
passengertoken,
|
||||||
|
passengerPhone
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
'priority': 'high',
|
'priority': 'high',
|
||||||
@@ -442,4 +490,41 @@ class FirebasMessagesController extends GetxController {
|
|||||||
print('sendNotification() error: $e');
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class CRUD {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
print(response.request);
|
print(response.request);
|
||||||
|
print(payload);
|
||||||
|
|
||||||
var jsonData = jsonDecode(response.body);
|
var jsonData = jsonDecode(response.body);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ class LocationController extends GetxController {
|
|||||||
|
|
||||||
await CRUD().post(link: AppLink.addCarsLocationByPassenger, payload: {
|
await CRUD().post(link: AppLink.addCarsLocationByPassenger, payload: {
|
||||||
'driver_id': box.read(BoxName.driverID).toString(),
|
'driver_id': box.read(BoxName.driverID).toString(),
|
||||||
'latitude': mylocation!.latitude.toString(),
|
'latitude': mylocation.latitude.toString(),
|
||||||
'longitude': mylocation!.longitude.toString(),
|
'longitude': mylocation.longitude.toString(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
42
lib/controller/home/captin/order_request_controller.dart
Normal file
42
lib/controller/home/captin/order_request_controller.dart
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -126,12 +126,12 @@ class MapController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeConfirmRide() async {
|
changeConfirmRide() async {
|
||||||
rideConfirm = true;
|
// rideConfirm = true;
|
||||||
print('rideConfirm= $rideConfirm');
|
// update();
|
||||||
|
// print('rideConfirm= $rideConfirm');
|
||||||
|
await getCarsLocationByPassenger();
|
||||||
await CRUD().post(link: AppLink.addRides, payload: {
|
await CRUD().post(link: AppLink.addRides, payload: {
|
||||||
"start_location": '${data[0]['start_address']}',
|
"start_location": '${data[0]['start_address']}',
|
||||||
|
|
||||||
// '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
// '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||||
"end_location": '${data[0]['end_address']}',
|
"end_location": '${data[0]['end_address']}',
|
||||||
// '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
// '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||||
@@ -147,6 +147,7 @@ class MapController extends GetxController {
|
|||||||
"distance": distance.toString()
|
"distance": distance.toString()
|
||||||
}).then((value) {
|
}).then((value) {
|
||||||
// print(jsonDecode(value)['message']);
|
// print(jsonDecode(value)['message']);
|
||||||
|
// List<String> body = [
|
||||||
List<String> body = [
|
List<String> body = [
|
||||||
// '${data[0]['start_address']}',
|
// '${data[0]['start_address']}',
|
||||||
// '${data[0]['end_address']}',
|
// '${data[0]['end_address']}',
|
||||||
@@ -157,21 +158,37 @@ class MapController extends GetxController {
|
|||||||
duration.toString(),
|
duration.toString(),
|
||||||
distance.toString(),
|
distance.toString(),
|
||||||
dataCarsLocationByPassenger['message'][0]['id'].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',
|
'Order',
|
||||||
jsonDecode(value)['message'].toString(),
|
jsonDecode(value)['message'].toString(),
|
||||||
body[0],
|
dataCarsLocationByPassenger['message'][0]['token'].toString(),
|
||||||
body[1],
|
body,
|
||||||
body[2],
|
|
||||||
body[3],
|
|
||||||
body[4],
|
|
||||||
body[5],
|
|
||||||
body[6],
|
|
||||||
body[7],
|
|
||||||
box.read(BoxName.tokenFCM).toString(), //TODO change to Driver
|
|
||||||
);
|
);
|
||||||
|
// 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();
|
update();
|
||||||
@@ -372,7 +389,7 @@ class MapController extends GetxController {
|
|||||||
|
|
||||||
LatLngBounds calculateBounds(
|
LatLngBounds calculateBounds(
|
||||||
double centerLat, double centerLng, double radius) {
|
double centerLat, double centerLng, double radius) {
|
||||||
double radius = 2000; // 10 km in meters
|
double radius = 4000; // 10 km in meters
|
||||||
|
|
||||||
southwest = LatLng(
|
southwest = LatLng(
|
||||||
centerLat - (radius / 111000),
|
centerLat - (radius / 111000),
|
||||||
@@ -449,6 +466,7 @@ class MapController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String duratioByPassenger = '';
|
String duratioByPassenger = '';
|
||||||
|
String distanceByPassenger = '';
|
||||||
void getNearestDriverByPassengerLocation() async {
|
void getNearestDriverByPassengerLocation() async {
|
||||||
if (polylines.isEmpty || data.isEmpty) {
|
if (polylines.isEmpty || data.isEmpty) {
|
||||||
double nearestDistance = double.infinity;
|
double nearestDistance = double.infinity;
|
||||||
@@ -471,7 +489,7 @@ class MapController extends GetxController {
|
|||||||
// longitude: double.parse(carLocation['longitude']),
|
// longitude: double.parse(carLocation['longitude']),
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
isloading = true;
|
// isloading = true;
|
||||||
update();
|
update();
|
||||||
// Make API request to get exact distance and duration
|
// Make API request to get exact distance and duration
|
||||||
String apiUrl =
|
String apiUrl =
|
||||||
@@ -481,6 +499,8 @@ class MapController extends GetxController {
|
|||||||
var data = response;
|
var data = response;
|
||||||
// Extract distance and duration from the response and handle accordingly
|
// Extract distance and duration from the response and handle accordingly
|
||||||
int distance1 = data['rows'][0]['elements'][0]['distance']['value'];
|
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'];
|
duration1 = data['rows'][0]['elements'][0]['duration']['value'];
|
||||||
duratioByPassenger =
|
duratioByPassenger =
|
||||||
data['rows'][0]['elements'][0]['duration']['text'];
|
data['rows'][0]['elements'][0]['duration']['text'];
|
||||||
@@ -495,7 +515,7 @@ class MapController extends GetxController {
|
|||||||
latitude: double.parse(carLocation['latitude']),
|
latitude: double.parse(carLocation['latitude']),
|
||||||
longitude: double.parse(carLocation['longitude']),
|
longitude: double.parse(carLocation['longitude']),
|
||||||
);
|
);
|
||||||
isloading = false;
|
// isloading = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class MyApp extends StatelessWidget {
|
|||||||
: box.read(BoxName.email) != null
|
: box.read(BoxName.email) != null
|
||||||
? const MapPage()
|
? const MapPage()
|
||||||
: box.read(BoxName.emailDriver) == null
|
: box.read(BoxName.emailDriver) == null
|
||||||
? LoginCaptin()
|
? LoginPage()
|
||||||
: const HomeCaptin());
|
: const HomeCaptin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
import 'package:ride/constant/colors.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/controller/home/map_page_controller.dart';
|
||||||
import 'package:ride/views/home/map_widget.dart/cancel_raide_page.dart';
|
import 'package:ride/views/home/map_widget.dart/cancel_raide_page.dart';
|
||||||
import 'package:ride/views/widgets/mycircular.dart';
|
import 'package:ride/views/widgets/mycircular.dart';
|
||||||
@@ -53,204 +54,234 @@ class MapPage extends StatelessWidget {
|
|||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
|
|
||||||
body: Stack(
|
body: SafeArea(
|
||||||
children: [
|
child: Stack(
|
||||||
GetBuilder<MapController>(
|
children: [
|
||||||
builder: (controller) => controller.isloading
|
GetBuilder<MapController>(
|
||||||
? const MyCircularProgressIndicator()
|
builder: (controller) => controller.isloading
|
||||||
: GoogleMap(
|
? const MyCircularProgressIndicator()
|
||||||
onMapCreated: controller.onMapCreated,
|
: GoogleMap(
|
||||||
cameraTargetBounds:
|
onMapCreated: controller.onMapCreated,
|
||||||
CameraTargetBounds(controller.boundsdata),
|
cameraTargetBounds:
|
||||||
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
|
CameraTargetBounds(controller.boundsdata),
|
||||||
onLongPress: (argument) {
|
minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
|
||||||
Get.defaultDialog(
|
onLongPress: (argument) {
|
||||||
title: 'Are you want to go to this site'.tr,
|
Get.defaultDialog(
|
||||||
content: Column(
|
title: 'Are you want to go to this site'.tr,
|
||||||
children: [
|
content: Column(
|
||||||
Text('${argument.latitude},${argument.longitude}'),
|
children: [
|
||||||
],
|
Text(
|
||||||
),
|
'${argument.latitude},${argument.longitude}'),
|
||||||
onConfirm: () async {
|
],
|
||||||
controller.clearpolyline();
|
),
|
||||||
await controller.getMap(
|
onConfirm: () async {
|
||||||
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
controller.clearpolyline();
|
||||||
'${argument.latitude.toString()},${argument.longitude.toString()}');
|
await controller.getMap(
|
||||||
|
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
||||||
|
'${argument.latitude.toString()},${argument.longitude.toString()}');
|
||||||
|
|
||||||
Get.back();
|
Get.back();
|
||||||
controller.bottomSheet();
|
controller.bottomSheet();
|
||||||
controller.showBottomSheet1();
|
controller.showBottomSheet1();
|
||||||
//
|
//
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
onTap: (argument) {
|
onTap: (argument) {
|
||||||
controller.hidePlaces();
|
controller.hidePlaces();
|
||||||
|
|
||||||
controller.changeButtomSheetShown();
|
controller.changeButtomSheetShown();
|
||||||
// controller.bottomSheet();
|
// controller.bottomSheet();
|
||||||
},
|
},
|
||||||
initialCameraPosition: CameraPosition(
|
initialCameraPosition: CameraPosition(
|
||||||
target: controller.mylocation,
|
target: controller.mylocation,
|
||||||
zoom: 15,
|
zoom: 15,
|
||||||
),
|
),
|
||||||
markers: {
|
markers: {
|
||||||
for (var carLocation
|
for (var carLocation
|
||||||
in controller.carsLocationByPassenger)
|
in controller.carsLocationByPassenger)
|
||||||
|
Marker(
|
||||||
|
// anchor: const Offset(4, 4),
|
||||||
|
position: carLocation,
|
||||||
|
icon: controller.carIcon,
|
||||||
|
markerId: MarkerId(carLocation.toString())),
|
||||||
Marker(
|
Marker(
|
||||||
// anchor: const Offset(4, 4),
|
markerId: MarkerId('MyLocation'.tr),
|
||||||
position: carLocation,
|
position: controller.mylocation,
|
||||||
icon: controller.carIcon,
|
draggable: true,
|
||||||
markerId: MarkerId(carLocation.toString())),
|
icon: controller.markerIcon,
|
||||||
Marker(
|
onDragEnd: (value) {
|
||||||
markerId: MarkerId('MyLocation'.tr),
|
print(value);
|
||||||
position: controller.mylocation,
|
},
|
||||||
draggable: true,
|
infoWindow: InfoWindow(title: 'my location'.tr),
|
||||||
icon: controller.markerIcon,
|
),
|
||||||
onDragEnd: (value) {
|
Marker(
|
||||||
print(value);
|
markerId: MarkerId('Target'.tr),
|
||||||
},
|
position: controller.mydestination,
|
||||||
infoWindow: InfoWindow(title: 'my location'.tr),
|
draggable: true,
|
||||||
),
|
onDragEnd: (v) {
|
||||||
Marker(
|
print(v);
|
||||||
markerId: MarkerId('Target'.tr),
|
},
|
||||||
position: controller.mydestination,
|
),
|
||||||
draggable: true,
|
},
|
||||||
onDragEnd: (v) {
|
polylines: {
|
||||||
print(v);
|
Polyline(
|
||||||
},
|
zIndex: 2,
|
||||||
),
|
consumeTapEvents: true,
|
||||||
},
|
geodesic: true,
|
||||||
polylines: {
|
endCap: Cap.buttCap,
|
||||||
Polyline(
|
startCap: Cap.buttCap,
|
||||||
zIndex: 2,
|
visible: true,
|
||||||
consumeTapEvents: true,
|
polylineId: const PolylineId('route'),
|
||||||
geodesic: true,
|
points: controller.polylineCoordinates,
|
||||||
endCap: Cap.buttCap,
|
color: AppColor.primaryColor,
|
||||||
startCap: Cap.buttCap,
|
width: 5,
|
||||||
visible: true,
|
),
|
||||||
polylineId: const PolylineId('route'),
|
// Polyline(
|
||||||
points: controller.polylineCoordinates,
|
// zIndex: 2,
|
||||||
color: AppColor.primaryColor,
|
// consumeTapEvents: true,
|
||||||
width: 5,
|
// geodesic: true,
|
||||||
),
|
// endCap: Cap.buttCap,
|
||||||
// Polyline(
|
// startCap: Cap.buttCap,
|
||||||
// zIndex: 2,
|
// visible: true,
|
||||||
// consumeTapEvents: true,
|
// polylineId: PolylineId('g'),
|
||||||
// geodesic: true,
|
// points: [
|
||||||
// endCap: Cap.buttCap,
|
// LatLng(controller.southwest.latitude,
|
||||||
// startCap: Cap.buttCap,
|
// controller.southwest.longitude),
|
||||||
// visible: true,
|
// LatLng(controller.northeast.latitude,
|
||||||
// polylineId: PolylineId('g'),
|
// controller.northeast.longitude)
|
||||||
// points: [
|
// ],
|
||||||
// LatLng(controller.southwest.latitude,
|
// color: AppColor.primaryColor,
|
||||||
// controller.southwest.longitude),
|
// width: 5,
|
||||||
// LatLng(controller.northeast.latitude,
|
// ),
|
||||||
// controller.northeast.longitude)
|
},
|
||||||
// ],
|
// circles: {
|
||||||
// color: AppColor.primaryColor,
|
// Circle(
|
||||||
// width: 5,
|
// circleId: const CircleId('kk'),
|
||||||
// ),
|
// center: controller.mylocation,
|
||||||
},
|
// radius: 60,
|
||||||
// circles: {
|
// fillColor: AppColor.primaryColor,)
|
||||||
// Circle(
|
// },
|
||||||
// circleId: const CircleId('kk'),
|
mapType: controller.mapType
|
||||||
// center: controller.mylocation,
|
? MapType.satellite
|
||||||
// radius: 60,
|
: MapType.normal,
|
||||||
// fillColor: AppColor.primaryColor,)
|
myLocationButtonEnabled: true,
|
||||||
// },
|
// liteModeEnabled: true, tiltGesturesEnabled: false,
|
||||||
mapType:
|
|
||||||
controller.mapType ? MapType.satellite : MapType.normal,
|
|
||||||
myLocationButtonEnabled: true,
|
|
||||||
// liteModeEnabled: true, tiltGesturesEnabled: false,
|
|
||||||
|
|
||||||
// indoorViewEnabled: true,
|
// indoorViewEnabled: true,
|
||||||
trafficEnabled: controller.mapTraficON,
|
trafficEnabled: controller.mapTraficON,
|
||||||
buildingsEnabled: true,
|
buildingsEnabled: true,
|
||||||
mapToolbarEnabled: true,
|
mapToolbarEnabled: true,
|
||||||
onCameraMove: (position) {
|
onCameraMove: (position) {
|
||||||
controller.newMylocation = position.target;
|
controller.newMylocation = position.target;
|
||||||
// print('my' + controller.mylocation.toString());
|
// print('my' + controller.mylocation.toString());
|
||||||
// print('new' + controller.newMylocation.toString());
|
// print('new' + controller.newMylocation.toString());
|
||||||
},
|
},
|
||||||
myLocationEnabled: true,
|
myLocationEnabled: true,
|
||||||
// liteModeEnabled: true,
|
// liteModeEnabled: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
GetBuilder<MapController>(
|
GetBuilder<MapController>(
|
||||||
builder: (controller) => Positioned(
|
builder: (controller) => Positioned(
|
||||||
top: 85,
|
top: 85,
|
||||||
left: 6,
|
left: 6,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
AnimatedContainer(
|
AnimatedContainer(
|
||||||
duration: const Duration(microseconds: 200),
|
duration: const Duration(microseconds: 200),
|
||||||
width: controller.widthMapTypeAndTrafic,
|
width: controller.widthMapTypeAndTrafic,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(),
|
border: Border.all(),
|
||||||
color: AppColor.secondaryColor,
|
color: AppColor.secondaryColor,
|
||||||
borderRadius: BorderRadius.circular(15)),
|
borderRadius: BorderRadius.circular(15)),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
controller.changeMapType();
|
controller.changeMapType();
|
||||||
// Toast.show(context, 'This is a toast message!');
|
// Toast.show(context, 'This is a toast message!');
|
||||||
},
|
},
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
Icons.satellite_alt,
|
Icons.satellite_alt,
|
||||||
size: 29,
|
size: 29,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(
|
||||||
const SizedBox(
|
height: 5,
|
||||||
height: 5,
|
),
|
||||||
),
|
AnimatedContainer(
|
||||||
AnimatedContainer(
|
duration: const Duration(microseconds: 200),
|
||||||
duration: const Duration(microseconds: 200),
|
width: controller.widthMapTypeAndTrafic,
|
||||||
width: controller.widthMapTypeAndTrafic,
|
decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
color: AppColor.secondaryColor,
|
||||||
color: AppColor.secondaryColor,
|
border: Border.all(),
|
||||||
border: Border.all(),
|
borderRadius: BorderRadius.circular(15)),
|
||||||
borderRadius: BorderRadius.circular(15)),
|
child: IconButton(
|
||||||
child: IconButton(
|
onPressed: () {
|
||||||
onPressed: () {
|
controller.changeMapTraffic();
|
||||||
controller.changeMapTraffic();
|
// Toast.show(context, 'This is a toast message!');
|
||||||
// Toast.show(context, 'This is a toast message!');
|
},
|
||||||
},
|
icon: const Icon(
|
||||||
icon: const Icon(
|
Icons.streetview_sharp,
|
||||||
Icons.streetview_sharp,
|
size: 29,
|
||||||
size: 29,
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
)),
|
||||||
)),
|
),
|
||||||
),
|
const PickerIconOnMap(),
|
||||||
const PickerIconOnMap(),
|
// PickerAnimtionContainerFormPlaces(),
|
||||||
// PickerAnimtionContainerFormPlaces(),
|
const MainBottomMenuMap(),
|
||||||
const MainBottomMenuMap(),
|
const MapMenuWidget(),
|
||||||
const MapMenuWidget(),
|
const MenuIconMapPageWidget(),
|
||||||
const MenuIconMapPageWidget(),
|
buttomSheetMapPage(),
|
||||||
buttomSheetMapPage(),
|
GetBuilder<MapController>(
|
||||||
cancelRidePage(),
|
builder: ((controller) => controller.rideConfirm
|
||||||
GetBuilder<MapController>(
|
? Positioned(
|
||||||
builder: (controller) => controller.data.isNotEmpty
|
top: Get.height * .2,
|
||||||
? Positioned(
|
left: Get.width * .2,
|
||||||
right: 5,
|
right: Get.width * .2,
|
||||||
top: 55,
|
child: AnimatedContainer(
|
||||||
child: GestureDetector(
|
duration: const Duration(microseconds: 300),
|
||||||
onTap: () {
|
height: 350,
|
||||||
controller.changeCancelRidePageShow();
|
width: 200,
|
||||||
},
|
decoration: BoxDecoration(
|
||||||
child: const Icon(
|
border: Border.all(),
|
||||||
Icons.clear,
|
color: AppColor.secondaryColor,
|
||||||
size: 30,
|
borderRadius: BorderRadius.circular(15)),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Waiting for Captin ...'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
))
|
)
|
||||||
: const SizedBox()),
|
: const SizedBox())),
|
||||||
const CashConfirmPageShown(),
|
cancelRidePage(),
|
||||||
const PaymentMethodPage()
|
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()
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,12 +76,12 @@ class MainBottomMenuMap extends StatelessWidget {
|
|||||||
animatedTexts: [
|
animatedTexts: [
|
||||||
ScaleAnimatedText(
|
ScaleAnimatedText(
|
||||||
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||||
WavyAnimatedText(
|
// WavyAnimatedText(
|
||||||
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||||
FlickerAnimatedText(
|
// FlickerAnimatedText(
|
||||||
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||||
WavyAnimatedText(
|
// WavyAnimatedText(
|
||||||
'${'Where to'.tr} ${box.read(BoxName.name)}'),
|
// '${'Where to'.tr} ${box.read(BoxName.name)}'),
|
||||||
],
|
],
|
||||||
isRepeatingAnimation: true,
|
isRepeatingAnimation: true,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.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 'package:ride/views/widgets/my_scafold.dart';
|
||||||
|
|
||||||
import '../../constant/colors.dart';
|
import '../../constant/colors.dart';
|
||||||
@@ -7,17 +10,19 @@ import '../../constant/links.dart';
|
|||||||
import '../../constant/style.dart';
|
import '../../constant/style.dart';
|
||||||
import '../../controller/functions/crud.dart';
|
import '../../controller/functions/crud.dart';
|
||||||
import '../../controller/functions/launch.dart';
|
import '../../controller/functions/launch.dart';
|
||||||
|
import '../../controller/home/captin/order_request_controller.dart';
|
||||||
import '../widgets/elevated_btn.dart';
|
import '../widgets/elevated_btn.dart';
|
||||||
|
|
||||||
class OrderRequestPage extends StatelessWidget {
|
class OrderRequestPage extends StatelessWidget {
|
||||||
const OrderRequestPage({super.key});
|
OrderRequestPage({super.key});
|
||||||
|
TimerController timerController = Get.put(TimerController());
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final arguments = Get.arguments;
|
final arguments = Get.arguments;
|
||||||
final myListString = arguments['myListString'];
|
final myListString = arguments['myListString'];
|
||||||
final myList = arguments['myList'];
|
final myList = arguments['DriverList'];
|
||||||
final body = arguments['body'];
|
final body = arguments['body'];
|
||||||
|
|
||||||
return MyScafolld(
|
return MyScafolld(
|
||||||
title: 'Order Request Page',
|
title: 'Order Request Page',
|
||||||
body: [
|
body: [
|
||||||
@@ -40,34 +45,98 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: RichText(
|
||||||
'Tatal From Passenger is '.tr +
|
text: TextSpan(
|
||||||
double.parse(myList[2]).toStringAsFixed(2),
|
text: 'Passenger Name is '.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
|
children: [
|
||||||
|
TextSpan(text: myList[8], style: AppStyle.headtitle2),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: RichText(
|
||||||
'Tatal For You is '.tr +
|
text: TextSpan(
|
||||||
double.parse(myList[3]).toStringAsFixed(2),
|
text: 'Tatal From Passenger is '.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: double.parse(myList[2]).toStringAsFixed(2),
|
||||||
|
style: AppStyle.headtitle2),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: RichText(
|
||||||
'Distance is '.tr + myList[5].toString() + ' KM'.tr,
|
text: TextSpan(
|
||||||
style: AppStyle.title,
|
text: 'Duration To Passenger is '.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: myList[11].toString(),
|
||||||
|
style: AppStyle.headtitle2),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Text(
|
child: RichText(
|
||||||
'Duration of Trip is '.tr +
|
text: TextSpan(
|
||||||
myList[4].toString() +
|
text: 'Distance To Passenger is '.tr,
|
||||||
' Minutes'.tr,
|
style: AppStyle.title,
|
||||||
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(
|
Padding(
|
||||||
@@ -86,19 +155,49 @@ class OrderRequestPage extends StatelessWidget {
|
|||||||
'order_id': body.toString(),
|
'order_id': body.toString(),
|
||||||
'status': 'Apply'
|
'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(
|
MyElevatedButton(
|
||||||
title: 'Refuse Order'.tr,
|
title: 'Refuse Order'.tr,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await CRUD().postFromDialogue(
|
timerController.refuseOrder(
|
||||||
link: AppLink.addDriverOrder,
|
myList[6].toString(), body.toString());
|
||||||
payload: {
|
|
||||||
'driver_id': myList[6].toString(),
|
|
||||||
// box.read(BoxName.driverID).toString(),
|
|
||||||
'order_id': body.toString(),
|
|
||||||
'status': 'Refused'
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
kolor: AppColor.redColor,
|
kolor: AppColor.redColor,
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user