4/4/2
This commit is contained in:
@@ -23,10 +23,14 @@ class HistoryCaptainController extends GetxController {
|
||||
var res = await CRUD().get(
|
||||
link: AppLink.getDriverOrder,
|
||||
payload: {'driver_id': box.read(BoxName.driverID)});
|
||||
historyData = jsonDecode(res);
|
||||
print(historyData);
|
||||
isloading = false;
|
||||
update();
|
||||
if (res != 'failure') {
|
||||
historyData = jsonDecode(res);
|
||||
print(historyData);
|
||||
isloading = false;
|
||||
update();
|
||||
} else {
|
||||
Get.defaultDialog(title: 'Not found');
|
||||
}
|
||||
}
|
||||
|
||||
getHistoryDetails(String orderId) async {
|
||||
|
||||
@@ -2345,7 +2345,7 @@ class MapPassengerController extends GetxController {
|
||||
link: AppLink.getPassengerRate,
|
||||
payload: {'passenger_id': box.read(BoxName.passengerID)});
|
||||
if (res != 'failure') {
|
||||
passengerRate = double.parse(jsonDecode(res)['message']['rating']);
|
||||
passengerRate = jsonDecode(res)['message']['rating'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2354,6 +2354,11 @@ class MapPassengerController extends GetxController {
|
||||
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
|
||||
getFavioratePlaces();
|
||||
readyWayPoints();
|
||||
addCustomPicker();
|
||||
addCustomCarIcon();
|
||||
addCustomStepIcon();
|
||||
addCustomStartIcon();
|
||||
addCustomEndIcon();
|
||||
await getLocation();
|
||||
await addToken();
|
||||
await getKazanPercent();
|
||||
@@ -2361,11 +2366,6 @@ class MapPassengerController extends GetxController {
|
||||
startMarkerReloading();
|
||||
// await getCarsLocationByPassenger();
|
||||
// await getNearestDriverByPassengerLocation();
|
||||
addCustomPicker();
|
||||
addCustomCarIcon();
|
||||
addCustomStepIcon();
|
||||
addCustomStartIcon();
|
||||
addCustomEndIcon();
|
||||
|
||||
initilizeGetStorage();
|
||||
cardNumber = await SecureStorage().readData(BoxName.cardNumber);
|
||||
|
||||
@@ -478,10 +478,12 @@ class MyTranslation extends Translations {
|
||||
'Distance from Passenger to destination is ':
|
||||
"المسافة من الراكب إلى الوجهة هي ",
|
||||
'Cost Of Trip IS ': "تكلفة الرحلة هي ",
|
||||
'No ride found yet': 'لا يوجد طلبات متوفرة حاليا',
|
||||
'Accept Order': "اقبل الطلب",
|
||||
'reject your order.': "رفض طلبك.",
|
||||
'Bottom Bar Example': "مثال لشريط الأسفل",
|
||||
'Statistics': "الإحصائيات",'Available for rides':'مشاوير متاحة',
|
||||
'Statistics': "الإحصائيات",
|
||||
'Available for rides': 'مشاوير متاحة',
|
||||
'Scan Id': "مسح الهوية",
|
||||
'Camera not initilaized yet': "الكاميرا لم تُثبت بعد",
|
||||
'Scan ID MklGoogle': "مسح هوية MklGoogle",
|
||||
|
||||
@@ -39,8 +39,8 @@ class DrawerCaptain extends StatelessWidget {
|
||||
color: AppColor.greenColor,
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppColor.greenColor,
|
||||
AppColor.yellowColor,
|
||||
AppColor.primaryColor,
|
||||
AppColor.secondaryColor,
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
@@ -100,9 +100,11 @@ class DrawerCaptain extends StatelessWidget {
|
||||
GetBuilder<ImageController>(builder: (imageController) {
|
||||
return imageController.isloading
|
||||
? const MyCircularProgressIndicator()
|
||||
: ClipOval(
|
||||
child: Image.network(
|
||||
'${AK.serverPHP}/portrate_captain_image/${box.read(BoxName.driverID)}.jpg'));
|
||||
: CircleAvatar(
|
||||
radius: 45,
|
||||
backgroundImage: NetworkImage(
|
||||
'${AK.serverPHP}/portrate_captain_image/${box.read(BoxName.driverID)}.jpg'),
|
||||
);
|
||||
}),
|
||||
Positioned(
|
||||
right: 0,
|
||||
|
||||
@@ -420,7 +420,7 @@ class OrderRequestPage extends StatelessWidget {
|
||||
myList[33].toString(),
|
||||
myList[2].toString(),
|
||||
myList[5].toString(),
|
||||
myList[4].toString());
|
||||
myList[4].toString()); //duration
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
),
|
||||
|
||||
@@ -32,195 +32,221 @@ class AvailableRidesPage extends StatelessWidget {
|
||||
? const MyCircularProgressIndicator()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: ListView.builder(
|
||||
itemCount: rideAvailableController
|
||||
.rideAvalibleMap['message'].length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var list = rideAvailableController
|
||||
.rideAvalibleMap['message'][index];
|
||||
return Container(
|
||||
width: Get.width * .9,
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
' ${list['start_location']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${list['end_location']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
child: rideAvailableController
|
||||
.rideAvalibleMap['message'].length ==
|
||||
1 &&
|
||||
rideAvailableController.rideAvalibleMap['message']
|
||||
[0]['start_location'] ==
|
||||
null
|
||||
? Center(
|
||||
child: Text(
|
||||
'No ride found yet'.tr,
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: rideAvailableController
|
||||
.rideAvalibleMap['message'].length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var list = rideAvailableController
|
||||
.rideAvalibleMap['message'][index];
|
||||
return Container(
|
||||
width: Get.width * .9,
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text('${'Price: '.tr}${list['price']} \$'),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${list['carType']}',
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.greenColor),
|
||||
' ${list['start_location']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text('📈 ${list['passengerRate']}',
|
||||
style: AppStyle.title),
|
||||
MyElevatedButton(
|
||||
title: 'Accept'.tr,
|
||||
onPressed: () async {
|
||||
box.write(
|
||||
BoxName.statusDriverLocation, 'on');
|
||||
Text(
|
||||
'${list['end_location']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
'${'Price: '.tr}${list['price']} \$'),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'${list['carType']}',
|
||||
style: AppStyle.title.copyWith(
|
||||
color: AppColor.greenColor),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text('📈 ${list['passengerRate']}',
|
||||
style: AppStyle.title),
|
||||
MyElevatedButton(
|
||||
title: 'Accept'.tr,
|
||||
onPressed: () async {
|
||||
box.write(
|
||||
BoxName.statusDriverLocation,
|
||||
'on');
|
||||
|
||||
var res = await CRUD().post(
|
||||
link: AppLink.updateStausFromSpeed,
|
||||
payload: {
|
||||
'id': list['id'],
|
||||
'rideTimeStart':
|
||||
DateTime.now().toString(),
|
||||
'status': 'Apply',
|
||||
'driver_id':
|
||||
box.read(BoxName.driverID),
|
||||
});
|
||||
// .then((value) {
|
||||
// var json = jsonDecode(res);
|
||||
print('res $res');
|
||||
if (res == "failure") {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
"This ride is already taken by another driver."
|
||||
.tr,
|
||||
middleText: '',
|
||||
titleStyle: AppStyle.title,
|
||||
middleTextStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Get.back();
|
||||
Get.back();
|
||||
}));
|
||||
} else if (jsonDecode(res)['status'] ==
|
||||
"success") {
|
||||
List<String> bodyToPassenger = [
|
||||
box
|
||||
.read(BoxName.driverID)
|
||||
.toString(),
|
||||
box
|
||||
.read(BoxName.nameDriver)
|
||||
.toString(),
|
||||
box
|
||||
.read(BoxName.tokenDriver)
|
||||
.toString(),
|
||||
];
|
||||
await CRUD().postFromDialogue(
|
||||
link: AppLink.addDriverOrder,
|
||||
payload: {
|
||||
'driver_id':
|
||||
box.read(BoxName.driverID),
|
||||
// box.read(BoxName.driverID).toString(),
|
||||
'order_id': list['id'],
|
||||
'status': 'Apply'
|
||||
});
|
||||
// print(bodyToPassenger);
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Apply Ride',
|
||||
'your ride is applied'.tr,
|
||||
// arguments['DriverList'][9].toString(),
|
||||
list['passengerToken'].toString(),
|
||||
// box.read(BoxName.tokenDriver).toString(),
|
||||
bodyToPassenger,
|
||||
);
|
||||
Get.back();
|
||||
Get.to(
|
||||
() => PassengerLocationMapPage(),
|
||||
arguments: {
|
||||
'passengerLocation':
|
||||
list['start_location']
|
||||
.toString(),
|
||||
'passengerDestination':
|
||||
list['end_location']
|
||||
.toString(),
|
||||
'Duration':
|
||||
list['duration'].toString(),
|
||||
'totalCost':
|
||||
list['price'].toString(),
|
||||
'Distance':
|
||||
list['distance'].toString(),
|
||||
'name': list['first_name']
|
||||
.toString(),
|
||||
'phone':
|
||||
list['phone'].toString(),
|
||||
'email':
|
||||
list['email'].toString(),
|
||||
'WalletChecked':
|
||||
list['payment_method']
|
||||
.toString(),
|
||||
'tokenPassenger':
|
||||
list['passengerToken']
|
||||
.toString(),
|
||||
'direction':
|
||||
'https://www.google.com/maps/dir/${list['start_location']}/${list['end_location']}/',
|
||||
'DurationToPassenger':
|
||||
list['duration'].toString(),
|
||||
'rideId': list['id'].toString(),
|
||||
'passengerId':
|
||||
list['passenger_id']
|
||||
.toString(),
|
||||
'driverId': box
|
||||
var res = await CRUD().post(
|
||||
link: AppLink
|
||||
.updateStausFromSpeed,
|
||||
payload: {
|
||||
'id': list['id'],
|
||||
'rideTimeStart':
|
||||
DateTime.now().toString(),
|
||||
'status': 'Apply',
|
||||
'driver_id': box
|
||||
.read(BoxName.driverID),
|
||||
});
|
||||
// .then((value) {
|
||||
// var json = jsonDecode(res);
|
||||
print('res $res');
|
||||
if (res == "failure") {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
"This ride is already taken by another driver."
|
||||
.tr,
|
||||
middleText: '',
|
||||
titleStyle: AppStyle.title,
|
||||
middleTextStyle:
|
||||
AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
Get.back();
|
||||
Get.back();
|
||||
}));
|
||||
} else if (jsonDecode(
|
||||
res)['status'] ==
|
||||
"success") {
|
||||
List<String> bodyToPassenger = [
|
||||
box
|
||||
.read(BoxName.driverID)
|
||||
.toString(),
|
||||
'durationOfRideValue':
|
||||
list['duration'].toString(),
|
||||
'paymentAmount':
|
||||
list['price'].toString(),
|
||||
'paymentMethod':
|
||||
'cash'.toString() == //todo fix payment method
|
||||
'true'
|
||||
? 'visa'
|
||||
: 'cash',
|
||||
'isHaveSteps':
|
||||
'startEnd'.toString(),
|
||||
'step0': ''.toString(),
|
||||
'step1': ''.toString(),
|
||||
'step2': ''.toString(),
|
||||
'step3': ''.toString(),
|
||||
'step4': ''.toString(),
|
||||
'passengerWalletBurc':
|
||||
list['bruc'].toString(),
|
||||
'timeOfOrder':
|
||||
DateTime.now().toString(),
|
||||
'totalPassenger':
|
||||
list['price'].toString(),
|
||||
'carType':
|
||||
list['carType'].toString(),
|
||||
'kazan': Get.find<
|
||||
HomeCaptainController>()
|
||||
.kazan
|
||||
box
|
||||
.read(BoxName.nameDriver)
|
||||
.toString(),
|
||||
});
|
||||
}
|
||||
},
|
||||
kolor: AppColor.greenColor,
|
||||
),
|
||||
Text(
|
||||
'📍 ${list['distance']} ${'KM'.tr}',
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.greenColor),
|
||||
),
|
||||
box
|
||||
.read(BoxName.tokenDriver)
|
||||
.toString(),
|
||||
];
|
||||
await CRUD().postFromDialogue(
|
||||
link: AppLink.addDriverOrder,
|
||||
payload: {
|
||||
'driver_id': box
|
||||
.read(BoxName.driverID),
|
||||
// box.read(BoxName.driverID).toString(),
|
||||
'order_id': list['id'],
|
||||
'status': 'Apply'
|
||||
});
|
||||
// print(bodyToPassenger);
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Apply Ride',
|
||||
'your ride is applied'.tr,
|
||||
// arguments['DriverList'][9].toString(),
|
||||
list['passengerToken']
|
||||
.toString(),
|
||||
// box.read(BoxName.tokenDriver).toString(),
|
||||
bodyToPassenger,
|
||||
);
|
||||
Get.back();
|
||||
Get.to(
|
||||
() =>
|
||||
PassengerLocationMapPage(),
|
||||
arguments: {
|
||||
'passengerLocation':
|
||||
list['start_location']
|
||||
.toString(),
|
||||
'passengerDestination':
|
||||
list['end_location']
|
||||
.toString(),
|
||||
'Duration': list['duration']
|
||||
.toString(),
|
||||
'totalCost': list['price']
|
||||
.toString(),
|
||||
'Distance': list['distance']
|
||||
.toString(),
|
||||
'name': list['first_name']
|
||||
.toString(),
|
||||
'phone': list['phone']
|
||||
.toString(),
|
||||
'email': list['email']
|
||||
.toString(),
|
||||
'WalletChecked':
|
||||
list['payment_method']
|
||||
.toString(),
|
||||
'tokenPassenger':
|
||||
list['passengerToken']
|
||||
.toString(),
|
||||
'direction':
|
||||
'https://www.google.com/maps/dir/${list['start_location']}/${list['end_location']}/',
|
||||
'DurationToPassenger':
|
||||
list['duration']
|
||||
.toString(),
|
||||
'rideId':
|
||||
list['id'].toString(),
|
||||
'passengerId':
|
||||
list['passenger_id']
|
||||
.toString(),
|
||||
'driverId': box
|
||||
.read(BoxName.driverID)
|
||||
.toString(),
|
||||
'durationOfRideValue':
|
||||
list['duration']
|
||||
.toString(),
|
||||
'paymentAmount':
|
||||
list['price']
|
||||
.toString(),
|
||||
'paymentMethod':
|
||||
'cash'.toString() == //todo fix payment method
|
||||
'true'
|
||||
? 'visa'
|
||||
: 'cash',
|
||||
'isHaveSteps':
|
||||
'startEnd'.toString(),
|
||||
'step0': ''.toString(),
|
||||
'step1': ''.toString(),
|
||||
'step2': ''.toString(),
|
||||
'step3': ''.toString(),
|
||||
'step4': ''.toString(),
|
||||
'passengerWalletBurc':
|
||||
list['bruc'].toString(),
|
||||
'timeOfOrder':
|
||||
DateTime.now()
|
||||
.toString(),
|
||||
'totalPassenger':
|
||||
list['price']
|
||||
.toString(),
|
||||
'carType': list['carType']
|
||||
.toString(),
|
||||
'kazan': Get.find<
|
||||
HomeCaptainController>()
|
||||
.kazan
|
||||
.toString(),
|
||||
});
|
||||
}
|
||||
},
|
||||
kolor: AppColor.greenColor,
|
||||
),
|
||||
Text(
|
||||
'📍 ${list['distance']} ${'KM'.tr}',
|
||||
style: AppStyle.title.copyWith(
|
||||
color: AppColor.greenColor),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
}),
|
||||
)
|
||||
],
|
||||
isleading: true);
|
||||
|
||||
Reference in New Issue
Block a user