6/28/1
This commit is contained in:
@@ -110,19 +110,20 @@ class RatePassenger extends StatelessWidget {
|
||||
Form(
|
||||
key: controller.formKey,
|
||||
child: MyTextForm(
|
||||
controller:
|
||||
controller.passengerPayAmount,
|
||||
label: "passenger amount to me".tr,
|
||||
hint: "passenger amount to me".tr,
|
||||
type: const TextInputType
|
||||
.numberWithOptions(
|
||||
decimal: true)),
|
||||
controller:
|
||||
controller.passengerPayAmount,
|
||||
label: "passenger amount to me".tr,
|
||||
hint: "passenger amount to me".tr,
|
||||
type: const TextInputType
|
||||
.numberWithOptions(decimal: true),
|
||||
),
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: "Press here".tr,
|
||||
onPressed: () {
|
||||
controller.addPassengerWallet();
|
||||
})
|
||||
title: "Press here".tr,
|
||||
onPressed: () {
|
||||
controller.addPassengerWallet();
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -139,10 +140,11 @@ class RatePassenger extends StatelessWidget {
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: "Press here".tr,
|
||||
onPressed: () {
|
||||
controller.passengerWantPay();
|
||||
})
|
||||
title: "Press here".tr,
|
||||
onPressed: () {
|
||||
controller.passengerWantPay();
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
@@ -25,9 +25,9 @@ class LoginCaptin extends StatelessWidget {
|
||||
final AuthController authController = Get.put(AuthController());
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(LoginCaptinController());
|
||||
Get.put(LoginDriverController());
|
||||
// Get.put(LocationBackgroundController());
|
||||
return GetBuilder<LoginCaptinController>(
|
||||
return GetBuilder<LoginDriverController>(
|
||||
builder: (controller) => MyScafolld(
|
||||
title: 'Login Driver'.tr,
|
||||
isleading: false,
|
||||
@@ -221,8 +221,8 @@ class LoginCaptin extends StatelessWidget {
|
||||
box.write(BoxName.driverID, user.uid);
|
||||
box.write(
|
||||
BoxName.emailDriver, user.email);
|
||||
Get.find<LoginCaptinController>()
|
||||
.loginFromSignInGoogle(
|
||||
Get.find<LoginDriverController>()
|
||||
.loginUsingCredentials(
|
||||
box.read(BoxName.driverID).toString(),
|
||||
box
|
||||
.read(BoxName.emailDriver)
|
||||
@@ -347,7 +347,7 @@ class LoginCaptin extends StatelessWidget {
|
||||
const SizedBox(
|
||||
height: 100,
|
||||
),
|
||||
GetBuilder<LoginCaptinController>(
|
||||
GetBuilder<LoginDriverController>(
|
||||
builder: (controller) => Column(
|
||||
children: [
|
||||
Row(
|
||||
@@ -381,7 +381,7 @@ class LoginCaptin extends StatelessWidget {
|
||||
}
|
||||
|
||||
locationPermissionDialog() {
|
||||
return GetBuilder<LoginCaptinController>(builder: (controller) {
|
||||
return GetBuilder<LoginDriverController>(builder: (controller) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Container(
|
||||
|
||||
@@ -79,7 +79,7 @@ class CountryPicker extends StatelessWidget {
|
||||
MyElevatedButton(
|
||||
title: 'Select Country'.tr, // Use translated text for button
|
||||
onPressed: () {
|
||||
Get.find<LoginCaptinController>().saveCountryCode(controller
|
||||
Get.find<LoginDriverController>().saveCountryCode(controller
|
||||
.selectedCountry
|
||||
.toString()); // No conversion needed
|
||||
box.write(
|
||||
@@ -98,8 +98,8 @@ class CountryPicker extends StatelessWidget {
|
||||
|
||||
class CountryPickerFromSetting extends StatelessWidget {
|
||||
final ProfileController controller = Get.put(ProfileController());
|
||||
final LoginCaptinController loginController =
|
||||
Get.put(LoginCaptinController());
|
||||
final LoginDriverController loginController =
|
||||
Get.put(LoginDriverController());
|
||||
|
||||
final List<String> countryOptions = [
|
||||
'Jordan',
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
@@ -105,12 +104,7 @@ class HelpCaptain extends StatelessWidget {
|
||||
return helpController
|
||||
.helpQuestionDate['message'].length ==
|
||||
0
|
||||
? Center(
|
||||
child: Text(
|
||||
'text',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
)
|
||||
? SizedBox()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(3),
|
||||
child: Container(
|
||||
@@ -125,7 +119,7 @@ class HelpCaptain extends StatelessWidget {
|
||||
// color: AppColor.greenColor,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
helpController.getindex(
|
||||
helpController.getIndex(
|
||||
list['id'], list['helpQuestion']);
|
||||
helpController.getHelpRepley(
|
||||
list['id'].toString());
|
||||
|
||||
@@ -20,35 +20,35 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
||||
left: 6,
|
||||
child: Column(
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: AppColor.blueColor),
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
AC credentials = AC();
|
||||
String apiKey = '4601103';
|
||||
String convertedStringN = credentials.c(
|
||||
credentials.c(credentials.c(apiKey, cs), cC), cn);
|
||||
print(convertedStringN);
|
||||
String retrievedStringS = credentials.r(
|
||||
credentials.r(credentials.r(convertedStringN, cn), cC),
|
||||
cs);
|
||||
print(retrievedStringS);
|
||||
//
|
||||
if (retrievedStringS == apiKey) {
|
||||
print('same');
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
FontAwesome.map_signs,
|
||||
size: 24,
|
||||
color: Colors.black,
|
||||
)),
|
||||
),
|
||||
// AnimatedContainer(
|
||||
// duration: const Duration(microseconds: 200),
|
||||
// width: controller.widthMapTypeAndTraffic,
|
||||
// decoration: BoxDecoration(
|
||||
// border: Border.all(color: AppColor.blueColor),
|
||||
// color: AppColor.secondaryColor,
|
||||
// borderRadius: BorderRadius.circular(15)),
|
||||
// child: IconButton(
|
||||
// onPressed: () {
|
||||
// AC credentials = AC();
|
||||
// String apiKey = '4601103';
|
||||
// String convertedStringN = credentials.c(
|
||||
// credentials.c(credentials.c(apiKey, cs), cC), cn);
|
||||
// print(convertedStringN);
|
||||
// String retrievedStringS = credentials.r(
|
||||
// credentials.r(credentials.r(convertedStringN, cn), cC),
|
||||
// cs);
|
||||
// print(retrievedStringS);
|
||||
// //
|
||||
// if (retrievedStringS == apiKey) {
|
||||
// print('same');
|
||||
// }
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// FontAwesome.map_signs,
|
||||
// size: 24,
|
||||
// color: Colors.black,
|
||||
// )),
|
||||
// ),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
|
||||
@@ -32,229 +32,230 @@ class AvailableRidesPage extends StatelessWidget {
|
||||
? const MyCircularProgressIndicator()
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: rideAvailableController
|
||||
.rideAvailableMap['message'].length ==
|
||||
1 &&
|
||||
rideAvailableController.rideAvailableMap['message']
|
||||
[0]['start_location'] ==
|
||||
null
|
||||
? Center(
|
||||
child: Text(
|
||||
'No ride found yet'.tr,
|
||||
style: AppStyle.headTitle2,
|
||||
),
|
||||
)
|
||||
: ListView.builder(
|
||||
itemCount: rideAvailableController
|
||||
.rideAvailableMap['message'].length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var list = rideAvailableController
|
||||
.rideAvailableMap['message'][index];
|
||||
return Container(
|
||||
width: Get.width * .9,
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Column(
|
||||
child: ListView.builder(
|
||||
itemCount: rideAvailableController
|
||||
.rideAvailableMap['message'].length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var list = rideAvailableController
|
||||
.rideAvailableMap['message'][index];
|
||||
return Container(
|
||||
width: Get.width * .9,
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'🟢 ',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
SizedBox(
|
||||
height: Get.height * .06,
|
||||
width: Get.width * .8,
|
||||
child: Text(
|
||||
'${list['startName']}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'🔴 ',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
SizedBox(
|
||||
height: Get.height * .06,
|
||||
width: Get.width * .8,
|
||||
child: Text(
|
||||
'${list['endName']}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
' ${list['start_location']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
'${list['end_location']}',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text('${'Price: '.tr}${list['price']} \$'),
|
||||
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),
|
||||
),
|
||||
],
|
||||
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);
|
||||
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'
|
||||
});
|
||||
await CRUD().post(
|
||||
link: AppLink.updateRides,
|
||||
payload: {
|
||||
'id': list['id'],
|
||||
'driverGoToPassengerTime':
|
||||
DateTime.now()
|
||||
.toString(),
|
||||
'status': 'Applied'
|
||||
});
|
||||
|
||||
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),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
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);
|
||||
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'
|
||||
});
|
||||
await CRUD().post(
|
||||
link: AppLink.updateRides,
|
||||
payload: {
|
||||
'id': list['id'],
|
||||
'DriverIsGoingToPassenger':
|
||||
DateTime.now().toString(),
|
||||
'status': 'Applied'
|
||||
});
|
||||
|
||||
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