10/10/1
This commit is contained in:
@@ -54,8 +54,8 @@ android {
|
|||||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = flutter.targetSdkVersion
|
targetSdk = flutter.targetSdkVersion
|
||||||
versionCode = 105
|
versionCode = 107
|
||||||
versionName = '1.5.05'
|
versionName = '1.5.07'
|
||||||
multiDexEnabled =true
|
multiDexEnabled =true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>64</string>
|
<string>66</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleURLTypes</key>
|
<key>CFBundleURLTypes</key>
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>4.0.64</string>
|
<string>4.0.66</string>
|
||||||
<key>FirebaseAppDelegateProxyEnabled</key>
|
<key>FirebaseAppDelegateProxyEnabled</key>
|
||||||
<string>NO</string>
|
<string>NO</string>
|
||||||
<key>GMSApiKey</key>
|
<key>GMSApiKey</key>
|
||||||
|
|||||||
@@ -244,10 +244,18 @@ class AppLink {
|
|||||||
//===================Auth============
|
//===================Auth============
|
||||||
|
|
||||||
static String addInviteDriver = "$server/ride/invitor/add.php";
|
static String addInviteDriver = "$server/ride/invitor/add.php";
|
||||||
|
static String addInvitationPassenger =
|
||||||
|
"$server/ride/invitor/addInvitationPassenger.php";
|
||||||
static String getInviteDriver = "$server/ride/invitor/get.php";
|
static String getInviteDriver = "$server/ride/invitor/get.php";
|
||||||
|
static String getDriverInvitationToPassengers =
|
||||||
|
"$server/ride/invitor/getDriverInvitationToPassengers.php";
|
||||||
static String updateInviteDriver = "$server/ride/invitor/update.php";
|
static String updateInviteDriver = "$server/ride/invitor/update.php";
|
||||||
|
static String updatePassengerGift =
|
||||||
|
"$server/ride/invitor/updatePassengerGift.php";
|
||||||
static String updateInvitationCodeFromRegister =
|
static String updateInvitationCodeFromRegister =
|
||||||
"$server/ride/invitor/updateInvitationCodeFromRegister.php";
|
"$server/ride/invitor/updateInvitationCodeFromRegister.php";
|
||||||
|
static String updatePassengersInvitation =
|
||||||
|
"$server/ride/invitor/updatePassengersInvitation.php";
|
||||||
|
|
||||||
//===================Auth============
|
//===================Auth============
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import 'colors.dart';
|
|||||||
class AppStyle {
|
class AppStyle {
|
||||||
static TextStyle headTitle = TextStyle(
|
static TextStyle headTitle = TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 40,
|
fontSize: 36,
|
||||||
color: AppColor.accentColor,
|
color: AppColor.accentColor,
|
||||||
fontFamily: box.read(BoxName.lang) == 'ar'
|
fontFamily: box.read(BoxName.lang) == 'ar'
|
||||||
// ?GoogleFonts.notoNaskhArabic().fontFamily
|
// ?GoogleFonts.notoNaskhArabic().fontFamily
|
||||||
@@ -15,21 +15,21 @@ class AppStyle {
|
|||||||
: GoogleFonts.roboto().fontFamily);
|
: GoogleFonts.roboto().fontFamily);
|
||||||
static TextStyle headTitle2 = TextStyle(
|
static TextStyle headTitle2 = TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 26,
|
fontSize: 24,
|
||||||
color: AppColor.writeColor,
|
color: AppColor.writeColor,
|
||||||
fontFamily: box.read(BoxName.lang) == 'ar'
|
fontFamily: box.read(BoxName.lang) == 'ar'
|
||||||
? GoogleFonts.notoNaskhArabic().fontFamily
|
? GoogleFonts.notoNaskhArabic().fontFamily
|
||||||
: GoogleFonts.roboto().fontFamily);
|
: GoogleFonts.roboto().fontFamily);
|
||||||
static TextStyle title = TextStyle(
|
static TextStyle title = TextStyle(
|
||||||
fontWeight: FontWeight.normal,
|
fontWeight: FontWeight.normal,
|
||||||
fontSize: box.read(BoxName.lang) == 'ar' ? 14 : 16,
|
fontSize: 14,
|
||||||
color: AppColor.writeColor,
|
color: AppColor.writeColor,
|
||||||
fontFamily: box.read(BoxName.lang) == 'ar'
|
fontFamily: box.read(BoxName.lang) == 'ar'
|
||||||
? GoogleFonts.notoNaskhArabic().fontFamily
|
? GoogleFonts.notoNaskhArabic().fontFamily
|
||||||
: GoogleFonts.roboto().fontFamily);
|
: GoogleFonts.roboto().fontFamily);
|
||||||
static TextStyle subtitle = TextStyle(
|
static TextStyle subtitle = TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 13,
|
fontSize: 12,
|
||||||
color: AppColor.writeColor,
|
color: AppColor.writeColor,
|
||||||
fontFamily: box.read(BoxName.lang) == 'ar'
|
fontFamily: box.read(BoxName.lang) == 'ar'
|
||||||
? GoogleFonts.notoNaskhArabic().fontFamily
|
? GoogleFonts.notoNaskhArabic().fontFamily
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_contacts/contact.dart';
|
import 'package:flutter_contacts/contact.dart';
|
||||||
import 'package:flutter_contacts/flutter_contacts.dart';
|
import 'package:flutter_contacts/flutter_contacts.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:share/share.dart';
|
||||||
|
|
||||||
import '../../../main.dart';
|
import '../../../main.dart';
|
||||||
import '../../../print.dart';
|
import '../../../print.dart';
|
||||||
@@ -19,6 +20,42 @@ import '../../notification/notification_captain_controller.dart';
|
|||||||
class InviteController extends GetxController {
|
class InviteController extends GetxController {
|
||||||
final TextEditingController invitePhoneController = TextEditingController();
|
final TextEditingController invitePhoneController = TextEditingController();
|
||||||
List driverInvitationData = [];
|
List driverInvitationData = [];
|
||||||
|
List driverInvitationDataToPassengers = [];
|
||||||
|
String? couponCode;
|
||||||
|
String? driverCouponCode;
|
||||||
|
|
||||||
|
int selectedTab = 0;
|
||||||
|
PassengerStats passengerStats = PassengerStats();
|
||||||
|
void updateSelectedTab(int index) {
|
||||||
|
selectedTab = index;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> shareCouponCode() async {
|
||||||
|
// TODO: Implement sharing functionality
|
||||||
|
// You can use share_plus package to share the coupon code
|
||||||
|
}
|
||||||
|
Future<void> shareDriverCode() async {
|
||||||
|
if (driverCouponCode != null) {
|
||||||
|
final String shareText = '''
|
||||||
|
Join SEFER as a driver using my referral code!
|
||||||
|
Use code: $driverCouponCode
|
||||||
|
Download the SEFER Driver app now and earn rewards!
|
||||||
|
''';
|
||||||
|
await Share.share(shareText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> sharePassengerCode() async {
|
||||||
|
if (couponCode != null) {
|
||||||
|
final String shareText = '''
|
||||||
|
Get a discount on your first SEFER ride!
|
||||||
|
Use my referral code: $couponCode
|
||||||
|
Download the SEFER app now and enjoy your ride!
|
||||||
|
''';
|
||||||
|
await Share.share(shareText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@@ -39,6 +76,20 @@ class InviteController extends GetxController {
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fetchDriverStatsPassengers() async {
|
||||||
|
try {
|
||||||
|
var response = await CRUD()
|
||||||
|
.get(link: AppLink.getDriverInvitationToPassengers, payload: {
|
||||||
|
"driverId": box.read(BoxName.driverID),
|
||||||
|
});
|
||||||
|
if (response != 'failure') {
|
||||||
|
var data = jsonDecode(response);
|
||||||
|
driverInvitationDataToPassengers = data['message'];
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
void selectPhone(String phone) {
|
void selectPhone(String phone) {
|
||||||
if (box.read(BoxName.countryCode) == 'Egypt') {
|
if (box.read(BoxName.countryCode) == 'Egypt') {
|
||||||
invitePhoneController.text = phone;
|
invitePhoneController.text = phone;
|
||||||
@@ -136,6 +187,57 @@ class InviteController extends GetxController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onSelectPassengerInvitation(int index) async {
|
||||||
|
MyDialog().getDialog(
|
||||||
|
driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 6
|
||||||
|
? '${'When'.tr} ${driverInvitationDataToPassengers[index]['passengerName']} ${"complete, you can claim your gift".tr} '
|
||||||
|
: 'You deserve the gift'.tr,
|
||||||
|
'${driverInvitationDataToPassengers[index]['passengerName']} ${driverInvitationDataToPassengers[index]['countOfInvitDriver']} / 6 ${'Trip'.tr}',
|
||||||
|
() async {
|
||||||
|
if (driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 6) {
|
||||||
|
Get.back();
|
||||||
|
} else {
|
||||||
|
// Claim the gift if 100 trips are completed
|
||||||
|
if (driverInvitationDataToPassengers[index]['isGiftToken']
|
||||||
|
.toString() ==
|
||||||
|
'0') {
|
||||||
|
Get.back();
|
||||||
|
// Add wallet to the inviter
|
||||||
|
await Get.find<CaptainWalletController>()
|
||||||
|
.addDriverWallet('paymentMethod', '50');
|
||||||
|
// add for invitor too
|
||||||
|
await Get.find<CaptainWalletController>().addDriverWalletToInvitor(
|
||||||
|
'paymentMethod',
|
||||||
|
driverInvitationData[index]['driverInviterId'],
|
||||||
|
'50');
|
||||||
|
// Update invitation as claimed
|
||||||
|
await CRUD().post(
|
||||||
|
link: AppLink.updatePassengerGift,
|
||||||
|
payload: {'id': driverInvitationDataToPassengers[index]['id']},
|
||||||
|
);
|
||||||
|
// Notify the inviter
|
||||||
|
NotificationCaptainController().addNotificationCaptain(
|
||||||
|
driverInvitationDataToPassengers[index]['passengerInviterId']
|
||||||
|
.toString(),
|
||||||
|
"You have got a gift for invitation".tr,
|
||||||
|
'${"You have 50".tr} ${'LE'}',
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
Get.back();
|
||||||
|
MyDialog().getDialog(
|
||||||
|
"You have got a gift".tr,
|
||||||
|
"Share the app with another new passenger".tr,
|
||||||
|
() {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
savePhoneToServer() async {
|
savePhoneToServer() async {
|
||||||
for (var i = 0; i < contactMaps.length; i++) {
|
for (var i = 0; i < contactMaps.length; i++) {
|
||||||
var phones = contactMaps[i]['phones'];
|
var phones = contactMaps[i]['phones'];
|
||||||
@@ -174,7 +276,7 @@ class InviteController extends GetxController {
|
|||||||
|
|
||||||
var response = await CRUD().post(link: AppLink.addInviteDriver, payload: {
|
var response = await CRUD().post(link: AppLink.addInviteDriver, payload: {
|
||||||
"driverId": box.read(BoxName.driverID),
|
"driverId": box.read(BoxName.driverID),
|
||||||
"inviterDriverPhone": phoneNumber
|
"inviterDriverPhone": '+2$phoneNumber'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response != 'failure') {
|
if (response != 'failure') {
|
||||||
@@ -203,4 +305,58 @@ class InviteController extends GetxController {
|
|||||||
// Get.snackbar('Error', 'An error occurred'.tr);
|
// Get.snackbar('Error', 'An error occurred'.tr);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sendInviteToPassenger() async {
|
||||||
|
if (invitePhoneController.text.isEmpty) {
|
||||||
|
Get.snackbar('Error', 'Please enter an phone address'.tr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// try {
|
||||||
|
String phoneNumber = formatPhoneNumber(invitePhoneController.text);
|
||||||
|
|
||||||
|
var response =
|
||||||
|
await CRUD().post(link: AppLink.addInvitationPassenger, payload: {
|
||||||
|
"driverId": box.read(BoxName.driverID),
|
||||||
|
"inviterPassengerPhone": '+2$phoneNumber'
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response != 'failure') {
|
||||||
|
var d = jsonDecode(response);
|
||||||
|
Get.snackbar('Success', 'Invite sent successfully'.tr);
|
||||||
|
|
||||||
|
String message = '${'*SEFER APP CODE*'.tr}\n\n'
|
||||||
|
'${"Use this code in registration".tr}\n'
|
||||||
|
'${"To get a gift for both".tr}\n\n'
|
||||||
|
'${"The period of this code is 1 hour".tr}\n\n'
|
||||||
|
'${'before'.tr} *${d['message']['expirationTime'].toString()}*\n\n'
|
||||||
|
'_*${d['message']['inviteCode'].toString()}*_\n\n'
|
||||||
|
'${"Install our app:".tr}\n'
|
||||||
|
'*Android:* https://play.google.com/store/apps/details?id=com.mobileapp.store.ride\n\n\n'
|
||||||
|
'*iOS:* https://apps.apple.com/us/app/sefer/id6458734951';
|
||||||
|
|
||||||
|
launchCommunication('whatsapp', '+2$phoneNumber', message);
|
||||||
|
|
||||||
|
invitePhoneController.clear();
|
||||||
|
} else {
|
||||||
|
Get.snackbar('Error'.tr, "Invite code already used".tr,
|
||||||
|
backgroundColor: AppColor.redColor,
|
||||||
|
duration: const Duration(seconds: 4));
|
||||||
|
}
|
||||||
|
// } catch (e) {
|
||||||
|
// Get.snackbar('Error', 'An error occurred'.tr);
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PassengerStats {
|
||||||
|
final int totalInvites;
|
||||||
|
final int activeUsers;
|
||||||
|
final double totalEarnings;
|
||||||
|
|
||||||
|
PassengerStats({
|
||||||
|
this.totalInvites = 0,
|
||||||
|
this.activeUsers = 0,
|
||||||
|
this.totalEarnings = 0.0,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,31 @@ class LoginDriverController extends GetxController {
|
|||||||
BoxName.nameDriver,
|
BoxName.nameDriver,
|
||||||
'${jsonDecoeded['data'][0]['first_name']}'
|
'${jsonDecoeded['data'][0]['first_name']}'
|
||||||
' ${jsonDecoeded['data'][0]['last_name']}');
|
' ${jsonDecoeded['data'][0]['last_name']}');
|
||||||
|
if ((jsonDecoeded['data'][0]['model'].toString().contains('دراجه') ||
|
||||||
|
jsonDecoeded['data'][0]['make'].toString().contains('دراجه '))) {
|
||||||
|
if (jsonDecoeded['data'][0]['gender'].toString() == 'Male') {
|
||||||
|
box.write(BoxName.carTypeOfDriver, 'Scooter');
|
||||||
|
} else {
|
||||||
|
box.write(BoxName.carTypeOfDriver, 'Pink Bike');
|
||||||
|
}
|
||||||
|
} else if (int.parse(jsonDecoeded['data'][0]['year'].toString()) >
|
||||||
|
2017) {
|
||||||
|
if (jsonDecoeded['data'][0]['gender'].toString() != 'Male') {
|
||||||
|
box.write(BoxName.carTypeOfDriver, 'Lady');
|
||||||
|
} else {
|
||||||
|
box.write(BoxName.carTypeOfDriver, 'Comfort');
|
||||||
|
}
|
||||||
|
} else if (int.parse(jsonDecoeded['data'][0]['year'].toString()) >
|
||||||
|
2002 &&
|
||||||
|
int.parse(jsonDecoeded['data'][0]['year'].toString()) < 2017) {
|
||||||
|
box.write(BoxName.carTypeOfDriver, 'Speed');
|
||||||
|
} else if (int.parse(jsonDecoeded['data'][0]['year'].toString()) <
|
||||||
|
2002) {
|
||||||
|
box.write(BoxName.carTypeOfDriver, 'Awfar Car');
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.print(
|
||||||
|
' box.write(BoxName.carTypeOfDriver: ${box.read(BoxName.carTypeOfDriver)}');
|
||||||
|
|
||||||
var token = await CRUD().get(
|
var token = await CRUD().get(
|
||||||
link: AppLink.getDriverToken,
|
link: AppLink.getDriverToken,
|
||||||
|
|||||||
@@ -158,8 +158,16 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
// Get.to(const VipOrderPage());
|
// Get.to(const VipOrderPage());
|
||||||
} else if (message.notification!.title! == 'message From passenger'.tr) {
|
} else if (message.notification!.title! == 'message From passenger'.tr) {
|
||||||
passengerDialog(message.notification!.body!);
|
passengerDialog(message.notification!.body!);
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
NotificationController()
|
||||||
|
.showNotification('message From passenger'.tr, ''.tr, 'ding', '');
|
||||||
|
}
|
||||||
} else if (message.notification!.title == 'Cancel') {
|
} else if (message.notification!.title == 'Cancel') {
|
||||||
cancelTripDialog1();
|
cancelTripDialog1();
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
NotificationController()
|
||||||
|
.showNotification('Cancel'.tr, ''.tr, 'cancel', '');
|
||||||
|
}
|
||||||
} else if (message.notification!.title! == 'token change') {
|
} else if (message.notification!.title! == 'token change') {
|
||||||
// NotificationController1()
|
// NotificationController1()
|
||||||
// .showNotification('token change'.tr, 'token change', 'cancel');
|
// .showNotification('token change'.tr, 'token change', 'cancel');
|
||||||
@@ -167,7 +175,7 @@ class FirebaseMessagesController extends GetxController {
|
|||||||
GoogleSignInHelper.signOut();
|
GoogleSignInHelper.signOut();
|
||||||
} else if (message.notification!.title! == 'face detect') {
|
} else if (message.notification!.title! == 'face detect') {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
NotificationController1()
|
NotificationController()
|
||||||
.showNotification('face detect'.tr, ''.tr, 'tone2', '');
|
.showNotification('face detect'.tr, ''.tr, 'tone2', '');
|
||||||
}
|
}
|
||||||
String result0 = await faceDetector();
|
String result0 = await faceDetector();
|
||||||
|
|||||||
@@ -70,6 +70,23 @@ class AI extends GetxController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future updatePassengersInvitation() async {
|
||||||
|
if (formKey.currentState!.validate()) {
|
||||||
|
var res = await CRUD().post(
|
||||||
|
link: AppLink.updatePassengersInvitation,
|
||||||
|
payload: {"inviteCode": invitationCodeController.text});
|
||||||
|
if (res != 'failure') {
|
||||||
|
isInviteDriverFound = true;
|
||||||
|
update();
|
||||||
|
Get.snackbar("Code approved".tr, '',
|
||||||
|
backgroundColor: AppColor.greenColor);
|
||||||
|
} else {
|
||||||
|
Get.snackbar("Code not approved".tr, '',
|
||||||
|
backgroundColor: AppColor.redColor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final today = DateTime.now();
|
final today = DateTime.now();
|
||||||
|
|
||||||
Future<void> addDriverAndCarEgypt() async {
|
Future<void> addDriverAndCarEgypt() async {
|
||||||
|
|||||||
@@ -28,25 +28,13 @@ Future<void> getPermissionOverlay() async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<void> getPermissionLocation() async {
|
Future<void> closeOverlayIfFound() async {
|
||||||
// // final PermissionStatus status = await Permission.location.status;
|
bool isOverlayActive = await FlutterOverlayWindow.isActive();
|
||||||
// // if (!status.isGranted) {
|
if (isOverlayActive) {
|
||||||
// // Log.print('status.isGranted: ${status.isGranted}');
|
await FlutterOverlayWindow.closeOverlay();
|
||||||
// // // box.write(BoxName.locationPermission, 'true');
|
}
|
||||||
// // await Permission.location.request();
|
}
|
||||||
// // Get.find<LoginDriverController>().update();
|
|
||||||
// // MyDialog().getDialog(
|
|
||||||
// // 'Enable Location Permission'.tr, // {en:ar}
|
|
||||||
// // 'Allowing location access will help us display orders near you. Please enable it now.'
|
|
||||||
// // .tr, // {en:ar}
|
|
||||||
// // () async {
|
|
||||||
// // Get.back();
|
|
||||||
// // box.write(BoxName.locationPermission, 'true');
|
|
||||||
// // await Permission.location.request();
|
|
||||||
// // },
|
|
||||||
// // );
|
|
||||||
// // }
|
|
||||||
// }
|
|
||||||
final location = Location();
|
final location = Location();
|
||||||
Future<void> getLocationPermission() async {
|
Future<void> getLocationPermission() async {
|
||||||
bool serviceEnabled;
|
bool serviceEnabled;
|
||||||
|
|||||||
@@ -462,6 +462,7 @@ class MapDriverController extends GetxController {
|
|||||||
mapController!.animateCamera(
|
mapController!.animateCamera(
|
||||||
CameraUpdate.newCameraPosition(
|
CameraUpdate.newCameraPosition(
|
||||||
CameraPosition(
|
CameraPosition(
|
||||||
|
bearing: Get.find<LocationController>().heading,
|
||||||
target: myLocation,
|
target: myLocation,
|
||||||
zoom: 17, // Adjust zoom level as needed
|
zoom: 17, // Adjust zoom level as needed
|
||||||
),
|
),
|
||||||
@@ -527,6 +528,25 @@ class MapDriverController extends GetxController {
|
|||||||
? (distanceBetweenDriverAndPassengerWhenConfirm * .08) + (5 * 1)
|
? (distanceBetweenDriverAndPassengerWhenConfirm * .08) + (5 * 1)
|
||||||
: (distanceBetweenDriverAndPassengerWhenConfirm * .06) +
|
: (distanceBetweenDriverAndPassengerWhenConfirm * .06) +
|
||||||
(5 * .06); //for Eygpt other like jordan .06 per minute
|
(5 * .06); //for Eygpt other like jordan .06 per minute
|
||||||
|
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||||
|
'id': rideId,
|
||||||
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
|
'status': 'CancelAfterWait',
|
||||||
|
});
|
||||||
|
CRUD().post(
|
||||||
|
link: "${AppLink.seferAlexandriaServer}/rides/update.php",
|
||||||
|
payload: {
|
||||||
|
'id': rideId,
|
||||||
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
|
'status': 'CancelAfterWait',
|
||||||
|
});
|
||||||
|
CRUD()
|
||||||
|
.post(link: "${AppLink.seferGizaServer}/rides/update.php", payload: {
|
||||||
|
'id': rideId,
|
||||||
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
|
'status': 'CancelAfterWait',
|
||||||
|
});
|
||||||
|
|
||||||
var paymentTokenWait =
|
var paymentTokenWait =
|
||||||
await generateTokenDriver(costOfWaiting5Minute.toString());
|
await generateTokenDriver(costOfWaiting5Minute.toString());
|
||||||
var res = await CRUD().post(link: AppLink.addDrivePayment, payload: {
|
var res = await CRUD().post(link: AppLink.addDrivePayment, payload: {
|
||||||
|
|||||||
@@ -165,6 +165,32 @@ class MyTranslation extends Translations {
|
|||||||
'Rejected Orders Count': "عدد الطلبات المرفوضة",
|
'Rejected Orders Count': "عدد الطلبات المرفوضة",
|
||||||
'This is the total number of rejected orders per day after accepting the orders':
|
'This is the total number of rejected orders per day after accepting the orders':
|
||||||
'هذا هو العدد الإجمالي للطلبات المرفوضة يوميًا بعد قبول الطلبات',
|
'هذا هو العدد الإجمالي للطلبات المرفوضة يوميًا بعد قبول الطلبات',
|
||||||
|
"Invite": "دعوة",
|
||||||
|
"Drivers": "السائقين",
|
||||||
|
"Passengers": "الركاب",
|
||||||
|
"Your Driver Referral Code": "رمز الإحالة الخاص بالسائق",
|
||||||
|
"DRIVER123": "سائق123",
|
||||||
|
"Share this code with other drivers. Both of you will receive rewards!":
|
||||||
|
"شارك هذا الرمز مع السائقين الآخرين. سيحصل كل منكما على مكافآت!",
|
||||||
|
"Share Code": "مشاركة الرمز",
|
||||||
|
"Invite another driver and both get a gift after he completes 100 trips!":
|
||||||
|
"ادع سائقًا آخر وسيحصل كلاكما على هدية بعد أن يكمل 100 رحلة!",
|
||||||
|
"Enter phone": "أدخل رقم الهاتف",
|
||||||
|
"Send Invite": "إرسال دعوة",
|
||||||
|
"Show Invitations": "عرض الدعوات",
|
||||||
|
"No invitation found yet!": "لم يتم العثور على دعوات حتى الآن!",
|
||||||
|
"Trip": "رحلة",
|
||||||
|
"Your Passenger Referral Code": "رمز الإحالة الخاص بالراكب",
|
||||||
|
"SEFER123": "سفر123",
|
||||||
|
"Share this code with passengers and earn rewards when they use it!":
|
||||||
|
"شارك هذا الرمز مع الركاب واكسب مكافآت عند استخدامه!",
|
||||||
|
"Your Rewards": "مكافآتك",
|
||||||
|
"Total Invites": "إجمالي الدعوات",
|
||||||
|
"Active Users": "المستخدمون النشطون",
|
||||||
|
"Total Earnings": "إجمالي الأرباح",
|
||||||
|
"Choose from contact": "اختر من جهات الاتصال",
|
||||||
|
"Cancel": "إلغاء",
|
||||||
|
"No invitation found": "لم يتم العثور على دعوة",
|
||||||
'You are not near the passenger location':
|
'You are not near the passenger location':
|
||||||
"أنت لست بالقرب من موقع الراكب",
|
"أنت لست بالقرب من موقع الراكب",
|
||||||
'If you need assistance, contact us':
|
'If you need assistance, contact us':
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class RideAvailableController extends GetxController {
|
|||||||
var res = await CRUD().get(
|
var res = await CRUD().get(
|
||||||
link: AppLink.getRideWaiting,
|
link: AppLink.getRideWaiting,
|
||||||
payload: {
|
payload: {
|
||||||
"carType": box.read(BoxName.carTypeOfDriver),
|
"carType": box.read(BoxName.carTypeOfDriver).toString(),
|
||||||
'southwestLat': bounds.southwest.latitude.toString(),
|
'southwestLat': bounds.southwest.latitude.toString(),
|
||||||
'southwestLon': bounds.southwest.longitude.toString(),
|
'southwestLon': bounds.southwest.longitude.toString(),
|
||||||
'northeastLat': bounds.northeast.latitude.toString(),
|
'northeastLat': bounds.northeast.latitude.toString(),
|
||||||
|
|||||||
@@ -662,25 +662,28 @@ class PaymentController extends GetxController {
|
|||||||
onPayment: (PaymobResponse response) {},
|
onPayment: (PaymobResponse response) {},
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response!.responseCode == 'APPROVED') {
|
// if (response!.responseCode == 'APPROVED') {
|
||||||
Get.defaultDialog(
|
if (response!.responseCode == '200' && response.success == true) {
|
||||||
barrierDismissible: false,
|
Toast.show(context, 'Payment Successful'.tr, AppColor.greenColor);
|
||||||
title: 'Payment Successful'.tr,
|
|
||||||
titleStyle: AppStyle.title,
|
|
||||||
// backgroundColor: AppColor.greenColor,
|
|
||||||
content: Text(
|
|
||||||
'The payment was approved.'.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
confirm: MyElevatedButton(
|
|
||||||
kolor: AppColor.greenColor,
|
|
||||||
title: 'OK'.tr,
|
|
||||||
onPressed: () async {
|
|
||||||
Get.back();
|
|
||||||
method();
|
method();
|
||||||
},
|
// Get.defaultDialog(
|
||||||
),
|
// barrierDismissible: false,
|
||||||
);
|
// title: 'Payment Successful'.tr,
|
||||||
|
// titleStyle: AppStyle.title,
|
||||||
|
// // backgroundColor: AppColor.greenColor,
|
||||||
|
// content: Text(
|
||||||
|
// 'The payment was approved.'.tr,
|
||||||
|
// style: AppStyle.title,
|
||||||
|
// ),
|
||||||
|
// confirm: MyElevatedButton(
|
||||||
|
// kolor: AppColor.greenColor,
|
||||||
|
// title: 'OK'.tr,
|
||||||
|
// onPressed: () async {
|
||||||
|
// Get.back();
|
||||||
|
// method();
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
} else {
|
} else {
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
|
|||||||
@@ -1,50 +1,177 @@
|
|||||||
import 'package:SEFER/constant/box_name.dart';
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
import 'package:SEFER/constant/colors.dart';
|
import 'package:SEFER/constant/colors.dart';
|
||||||
import 'package:SEFER/main.dart';
|
import 'package:SEFER/main.dart';
|
||||||
|
import 'package:SEFER/views/widgets/mydialoug.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import '../../../controller/auth/captin/invit_controller.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../controller/auth/captin/invit_controller.dart';
|
||||||
import '../../widgets/elevated_btn.dart';
|
import '../../widgets/elevated_btn.dart';
|
||||||
|
|
||||||
class InviteDriverScreen extends StatelessWidget {
|
class InviteScreen extends StatelessWidget {
|
||||||
final InviteController controller = Get.put(InviteController());
|
final InviteController controller = Get.put(InviteController());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoPageScaffold(
|
return Scaffold(
|
||||||
navigationBar: CupertinoNavigationBar(
|
backgroundColor: CupertinoColors.systemBackground,
|
||||||
middle: Text('Invite a Driver'.tr),
|
appBar: AppBar(
|
||||||
leading: CupertinoNavigationBarBackButton(
|
backgroundColor: CupertinoColors.systemBackground,
|
||||||
|
elevation: 0,
|
||||||
|
title: Text(
|
||||||
|
'Invite'.tr,
|
||||||
|
style: const TextStyle(color: CupertinoColors.label),
|
||||||
|
),
|
||||||
|
leading: IconButton(
|
||||||
|
icon: const Icon(Icons.arrow_back_ios, color: AppColor.blueColor),
|
||||||
onPressed: () => Get.back(),
|
onPressed: () => Get.back(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: SafeArea(
|
body: SafeArea(
|
||||||
|
child: GetBuilder<InviteController>(
|
||||||
|
builder: (controller) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: CupertinoColors.systemGrey6,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: SegmentedButton<int>(
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor:
|
||||||
|
MaterialStateProperty.resolveWith<Color>(
|
||||||
|
(states) => states.contains(MaterialState.selected)
|
||||||
|
? CupertinoColors.white
|
||||||
|
: Colors.transparent,
|
||||||
|
),
|
||||||
|
foregroundColor:
|
||||||
|
MaterialStateProperty.resolveWith<Color>(
|
||||||
|
(states) => states.contains(MaterialState.selected)
|
||||||
|
? AppColor.blueColor
|
||||||
|
: CupertinoColors.label,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
segments: [
|
||||||
|
ButtonSegment(
|
||||||
|
value: 0,
|
||||||
|
label: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text('Drivers'.tr),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ButtonSegment(
|
||||||
|
value: 1,
|
||||||
|
label: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text('Passengers'.tr),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
selected: {controller.selectedTab},
|
||||||
|
onSelectionChanged: (Set<int> newSelection) {
|
||||||
|
controller.updateSelectedTab(newSelection.first);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Column(
|
child: controller.selectedTab == 0
|
||||||
|
? _buildDriverTab(context)
|
||||||
|
: _buildPassengerTab(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildDriverTab(BuildContext context) {
|
||||||
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
"Invite another driver and both get a gift after he completes 100 trips!"
|
"Invite another driver and both get a gift after he completes 100 trips!"
|
||||||
.tr,
|
.tr,
|
||||||
style: CupertinoTheme.of(context).textTheme.navTitleTextStyle,
|
style: const TextStyle(
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: CupertinoColors.label,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Row(
|
_buildPhoneInput(),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
_buildActionButtons(),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
_buildInvitationsList(context),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPassengerTab(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: CupertinoColors.systemGrey6,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Share this code with passengers and earn rewards when they use it!"
|
||||||
|
.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: CupertinoColors.secondaryLabel,
|
||||||
|
fontSize: 13,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
_buildPhoneInput(),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
_buildActionButtonsPassengers(),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
_buildInvitationsListPassengers(context),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPhoneInput() {
|
||||||
|
return Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: CupertinoColors.systemGrey6,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: CupertinoTextField(
|
child: CupertinoTextField.borderless(
|
||||||
controller: controller.invitePhoneController,
|
controller: controller.invitePhoneController,
|
||||||
placeholder: 'Enter driver\'s phone'.tr,
|
placeholder: 'Enter phone'.tr,
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
keyboardType: TextInputType.phone,
|
keyboardType: TextInputType.phone,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
CupertinoButton(
|
CupertinoButton(
|
||||||
child: const Icon(CupertinoIcons.person_2),
|
child: const Icon(CupertinoIcons.person_badge_plus,
|
||||||
|
color: AppColor.blueColor),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await controller.pickContacts();
|
await controller.pickContacts();
|
||||||
if (controller.contacts.isNotEmpty) {
|
if (controller.contacts.isNotEmpty) {
|
||||||
@@ -52,140 +179,461 @@ class InviteDriverScreen extends StatelessWidget {
|
|||||||
controller.savePhoneToServer();
|
controller.savePhoneToServer();
|
||||||
box.write(BoxName.IsSavedPhones, true);
|
box.write(BoxName.IsSavedPhones, true);
|
||||||
}
|
}
|
||||||
_showContactsDialog(context);
|
_showContactsDialog(Get.context!);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
);
|
||||||
Row(
|
}
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
|
Widget _buildActionButtons() {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 20.0, horizontal: 16.0),
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
MyElevatedButton(
|
Expanded(
|
||||||
title: 'Send Invite'.tr,
|
child: Container(
|
||||||
onPressed: controller.sendInvite,
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: 6,
|
||||||
|
offset: const Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: CupertinoButton(
|
||||||
|
color: AppColor.blueColor,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||||
|
onPressed: controller.sendInvite,
|
||||||
|
child: Text(
|
||||||
|
'Send Invite'.tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: CupertinoColors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: 6,
|
||||||
|
offset: const Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: CupertinoButton(
|
||||||
|
color: AppColor.blueColor,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||||
|
child: Text(
|
||||||
|
'Show Invitations'.tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: CupertinoColors.white,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
MyElevatedButton(
|
|
||||||
title: 'Show Invitations'.tr,
|
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
controller.fetchDriverStats();
|
controller.fetchDriverStats();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
);
|
||||||
GetBuilder<InviteController>(
|
}
|
||||||
builder: (controller) {
|
|
||||||
|
Widget _buildActionButtonsPassengers() {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 20.0, horizontal: 16.0),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: 6,
|
||||||
|
offset: const Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: CupertinoButton(
|
||||||
|
color: AppColor.blueColor,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||||
|
onPressed: controller.sendInviteToPassenger,
|
||||||
|
child: Text(
|
||||||
|
'Send Invite'.tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: CupertinoColors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.black.withOpacity(0.1),
|
||||||
|
blurRadius: 6,
|
||||||
|
offset: const Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child: CupertinoButton(
|
||||||
|
color: AppColor.blueColor,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||||
|
child: Text(
|
||||||
|
'Show Invitations'.tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: CupertinoColors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: () async {
|
||||||
|
controller.fetchDriverStatsPassengers();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInvitationsList(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: Get.height * .4,
|
height: Get.height * .4,
|
||||||
child: controller.driverInvitationData.isEmpty
|
child: controller.driverInvitationData.isEmpty
|
||||||
? Center(
|
? Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
"No invitation found yet!".tr,
|
"No invitation found yet!".tr,
|
||||||
style: CupertinoTheme.of(context)
|
style: const TextStyle(
|
||||||
.textTheme
|
color: CupertinoColors.secondaryLabel,
|
||||||
.navTitleTextStyle,
|
fontSize: 17,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView.builder(
|
: ListView.builder(
|
||||||
itemCount: controller.driverInvitationData.length,
|
itemCount: controller.driverInvitationData.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
int countOfInvitDriver = int.tryParse(controller
|
return _buildInvitationItem(context, index);
|
||||||
.driverInvitationData[index]
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInvitationsListPassengers(BuildContext context) {
|
||||||
|
return SizedBox(
|
||||||
|
height: Get.height * .4,
|
||||||
|
child: controller.driverInvitationDataToPassengers.isEmpty
|
||||||
|
? Center(
|
||||||
|
child: Text(
|
||||||
|
"No invitation found yet!".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: CupertinoColors.secondaryLabel,
|
||||||
|
fontSize: 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: ListView.builder(
|
||||||
|
itemCount: controller.driverInvitationDataToPassengers.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return _buildInvitationItemPassengers(context, index);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInvitationItem(BuildContext context, int index) {
|
||||||
|
int countOfInvitDriver = int.tryParse(controller.driverInvitationData[index]
|
||||||
['countOfInvitDriver']
|
['countOfInvitDriver']
|
||||||
?.toString() ??
|
?.toString() ??
|
||||||
'0') ??
|
'0') ??
|
||||||
0;
|
0;
|
||||||
|
double progressValue = (countOfInvitDriver / 100.0).clamp(0.0, 1.0);
|
||||||
double progressValue = countOfInvitDriver / 100.0;
|
|
||||||
progressValue = progressValue.clamp(0.0, 1.0);
|
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () async {
|
onTap: () {
|
||||||
controller.onSelectDriverInvitation(index);
|
controller.onSelectDriverInvitation(index);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
margin:
|
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
const EdgeInsets.symmetric(vertical: 8.0),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Stack(
|
|
||||||
alignment: AlignmentDirectional.center,
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius:
|
color: CupertinoColors.systemGrey6,
|
||||||
BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
color: CupertinoColors.systemGrey5,
|
|
||||||
),
|
),
|
||||||
width: Get.width * .85,
|
child: Column(
|
||||||
height: 35,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
child: ClipRRect(
|
children: [
|
||||||
borderRadius:
|
Text(
|
||||||
BorderRadius.circular(12),
|
controller.driverInvitationData[index]['invitorName'],
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: CupertinoColors.label,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
child: LinearProgressIndicator(
|
child: LinearProgressIndicator(
|
||||||
value: progressValue,
|
value: progressValue,
|
||||||
backgroundColor:
|
backgroundColor: CupertinoColors.systemGrey4,
|
||||||
CupertinoColors.systemGrey3,
|
|
||||||
valueColor:
|
valueColor:
|
||||||
const AlwaysStoppedAnimation<
|
const AlwaysStoppedAnimation<Color>(AppColor.blueColor),
|
||||||
Color>(
|
minHeight: 6,
|
||||||
CupertinoColors.activeBlue),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
'$countOfInvitDriver / 100 ${'Trip'.tr}',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: CupertinoColors.secondaryLabel,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInvitationItemPassengers(BuildContext context, int index) {
|
||||||
|
// Extracting the data from the sample JSON-like structure
|
||||||
|
var invitation = controller.driverInvitationDataToPassengers[index];
|
||||||
|
|
||||||
|
int countOfInvitDriver =
|
||||||
|
int.tryParse(invitation['countOfInvitDriver']?.toString() ?? '0') ?? 0;
|
||||||
|
double progressValue = (countOfInvitDriver / 10.0).clamp(0.0, 1.0);
|
||||||
|
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
controller.onSelectPassengerInvitation(index);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
margin: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: CupertinoColors.systemGrey6,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
invitation['passengerName']
|
||||||
|
.toString(), // Handle null or missing data
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: CupertinoColors.label,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
child: LinearProgressIndicator(
|
||||||
|
value: progressValue,
|
||||||
|
backgroundColor: CupertinoColors.systemGrey4,
|
||||||
|
valueColor:
|
||||||
|
const AlwaysStoppedAnimation<Color>(AppColor.blueColor),
|
||||||
|
minHeight: 6,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
'$countOfInvitDriver / 6 ${'Trip'.tr}', // Show trips completed
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: CupertinoColors.secondaryLabel,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildPassengerStats(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: CupertinoColors.systemGrey6,
|
||||||
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Your Rewards".tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: CupertinoColors.label,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
_buildStatItem(
|
||||||
|
context,
|
||||||
|
"Total Invites".tr,
|
||||||
|
controller.driverInvitationDataToPassengers[0]['countOfInvitDriver']
|
||||||
|
.toString(),
|
||||||
|
),
|
||||||
|
_buildStatItem(
|
||||||
|
context,
|
||||||
|
"Active Users".tr,
|
||||||
|
controller.driverInvitationDataToPassengers[0]['passengerName']
|
||||||
|
.toString(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildStatItem(BuildContext context, String label, String value) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: const TextStyle(
|
||||||
|
color: CupertinoColors.label,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${controller.driverInvitationData[index]['invitorName']} ${countOfInvitDriver} / 100 ${'Trip'.tr}',
|
value,
|
||||||
style: CupertinoTheme.of(context)
|
style: const TextStyle(
|
||||||
.textTheme
|
fontWeight: FontWeight.w600,
|
||||||
.textStyle,
|
color: AppColor.blueColor,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showContactsDialog(BuildContext context) {
|
void _showContactsDialog(BuildContext context) {
|
||||||
showCupertinoModalPopup(
|
showCupertinoModalPopup(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) => CupertinoActionSheet(
|
builder: (BuildContext context) => Container(
|
||||||
title: Text('Choose from contact'.tr),
|
height: 400,
|
||||||
actions: [
|
color: CupertinoColors.systemBackground,
|
||||||
SizedBox(
|
child: Column(
|
||||||
height: 300,
|
children: [
|
||||||
child: CupertinoScrollbar(
|
Container(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: CupertinoColors.separator.withOpacity(0.5)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
CupertinoButton(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
child: Text('Cancel'.tr),
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Choose from contact'.tr,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 17,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 60), // For balance
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: controller.contactMaps.length,
|
itemCount: controller.contactMaps.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final contact = controller.contactMaps[index];
|
final contact = controller.contactMaps[index];
|
||||||
return CupertinoActionSheetAction(
|
return Container(
|
||||||
child: Text(
|
decoration: BoxDecoration(
|
||||||
'${contact['name']} - ${controller.formatPhoneNumber(contact['phones'][0].toString())}'),
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: CupertinoColors.separator.withOpacity(0.5),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: CupertinoButton(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16, vertical: 12),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
contact['name'],
|
||||||
|
style: const TextStyle(
|
||||||
|
color: CupertinoColors.label,
|
||||||
|
fontSize: 17,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
controller.formatPhoneNumber(
|
||||||
|
contact['phones'][0].toString()),
|
||||||
|
style: const TextStyle(
|
||||||
|
color: CupertinoColors.secondaryLabel,
|
||||||
|
fontSize: 15,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Icon(
|
||||||
|
CupertinoIcons.chevron_right,
|
||||||
|
color: CupertinoColors.secondaryLabel,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
controller.selectPhone(contact['phones'].toString());
|
controller.selectPhone(contact['phones'].toString());
|
||||||
// Navigator.pop(context);
|
// Navigator.pop(context);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
cancelButton: CupertinoActionSheetAction(
|
|
||||||
child: Text('Cancel'.tr),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -20,18 +20,21 @@ class PassengerLocationMapPage extends StatelessWidget {
|
|||||||
final LocationController locationController = Get.put(LocationController());
|
final LocationController locationController = Get.put(LocationController());
|
||||||
final MapDriverController mapDriverController =
|
final MapDriverController mapDriverController =
|
||||||
Get.put(MapDriverController());
|
Get.put(MapDriverController());
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (!mapDriverController.initialized) {
|
// if (!mapDriverController.initialized) {
|
||||||
// Call a method to initialize the controller
|
// // Call a method to initialize the controller
|
||||||
|
|
||||||
mapDriverController.initialized;
|
// mapDriverController.initialized;
|
||||||
} else {
|
// } else {
|
||||||
Get.put(MapDriverController()).argumentLoading();
|
// Get.put(MapDriverController()).argumentLoading();
|
||||||
|
|
||||||
Get.put(MapDriverController())
|
// Get.put(MapDriverController())
|
||||||
.startTimerToShowPassengerInfoWindowFromDriver();
|
// .startTimerToShowPassengerInfoWindowFromDriver();
|
||||||
}
|
// }
|
||||||
|
mapDriverController.argumentLoading();
|
||||||
|
mapDriverController.startTimerToShowPassengerInfoWindowFromDriver();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
// title: 'Map Passenger'.tr,
|
// title: 'Map Passenger'.tr,
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class CupertinoDrawerCaptain extends StatelessWidget {
|
|||||||
_buildDrawerItem(
|
_buildDrawerItem(
|
||||||
icon: CupertinoIcons.share,
|
icon: CupertinoIcons.share,
|
||||||
text: 'Share App'.tr,
|
text: 'Share App'.tr,
|
||||||
onTap: () => Get.to(() => InviteDriverScreen()),
|
onTap: () => Get.to(() => InviteScreen()),
|
||||||
),
|
),
|
||||||
_buildDivider(),
|
_buildDivider(),
|
||||||
_buildDrawerItem(
|
_buildDrawerItem(
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import 'dart:io';
|
|||||||
import 'package:SEFER/constant/box_name.dart';
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
|
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
|
||||||
import 'package:SEFER/views/notification/available_rides_page.dart';
|
import 'package:SEFER/views/notification/available_rides_page.dart';
|
||||||
import 'package:SEFER/views/widgets/mydialoug.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_overlay_window/flutter_overlay_window.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:flutter_font_icons/flutter_font_icons.dart';
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||||
@@ -17,7 +17,6 @@ import '../../../../constant/colors.dart';
|
|||||||
import '../../../../constant/info.dart';
|
import '../../../../constant/info.dart';
|
||||||
import '../../../../constant/style.dart';
|
import '../../../../constant/style.dart';
|
||||||
import '../../../../controller/functions/location_controller.dart';
|
import '../../../../controller/functions/location_controller.dart';
|
||||||
import '../../../../controller/functions/location_permission.dart';
|
|
||||||
import '../../../../controller/functions/overlay_permisssion.dart';
|
import '../../../../controller/functions/overlay_permisssion.dart';
|
||||||
import '../../../../controller/functions/package_info.dart';
|
import '../../../../controller/functions/package_info.dart';
|
||||||
import '../../../../controller/home/captin/home_captain_controller.dart';
|
import '../../../../controller/home/captin/home_captain_controller.dart';
|
||||||
@@ -38,13 +37,15 @@ class HomeCaptain extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Get.put(OrderRequestController());
|
Get.put(OrderRequestController());
|
||||||
Get.put(HomeCaptainController());
|
// Get.put(HomeCaptainController());
|
||||||
Get.put(CaptainWalletController());
|
Get.put(CaptainWalletController());
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
|
closeOverlayIfFound();
|
||||||
checkForUpdate(context);
|
checkForUpdate(context);
|
||||||
getPermissionOverlay();
|
getPermissionOverlay();
|
||||||
|
|
||||||
// getPermissionLocation1();
|
// getPermissionLocation1();
|
||||||
_showFirstTimeOfferNotification(context);
|
await showFirstTimeOfferNotification(context);
|
||||||
});
|
});
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@@ -59,16 +60,6 @@ class HomeCaptain extends StatelessWidget {
|
|||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
// IconButton(
|
|
||||||
// // onPressed: () => Get.find<OrderRequestController>().getSQL(),
|
|
||||||
// onPressed: () => sql.deleteAllData(TableName.driverOrdersRefuse),
|
|
||||||
// icon: const Icon(Icons.remove)),
|
|
||||||
// GetBuilder<OrderRequestController>(
|
|
||||||
// builder: (orderRequestController) => IconButton(
|
|
||||||
// onPressed: () =>
|
|
||||||
// orderRequestController.getRefusedOrderByCaptain(),
|
|
||||||
// icon: const Icon(Icons.get_app)),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
drawer: CupertinoDrawerCaptain(),
|
drawer: CupertinoDrawerCaptain(),
|
||||||
@@ -381,7 +372,7 @@ class HomeCaptain extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showFirstTimeOfferNotification(BuildContext context) {
|
showFirstTimeOfferNotification(BuildContext context) async {
|
||||||
bool isFirstTime = _checkIfFirstTime();
|
bool isFirstTime = _checkIfFirstTime();
|
||||||
|
|
||||||
if (isFirstTime) {
|
if (isFirstTime) {
|
||||||
|
|||||||
@@ -185,33 +185,33 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
Platform.isAndroid
|
// Platform.isAndroid
|
||||||
? AnimatedContainer(
|
// ? AnimatedContainer(
|
||||||
duration: const Duration(microseconds: 200),
|
// duration: const Duration(microseconds: 200),
|
||||||
width: controller.widthMapTypeAndTraffic,
|
// width: controller.widthMapTypeAndTraffic,
|
||||||
decoration: BoxDecoration(
|
// decoration: BoxDecoration(
|
||||||
color: AppColor.secondaryColor,
|
// color: AppColor.secondaryColor,
|
||||||
border: Border.all(color: AppColor.blueColor),
|
// border: Border.all(color: AppColor.blueColor),
|
||||||
borderRadius: BorderRadius.circular(15)),
|
// borderRadius: BorderRadius.circular(15)),
|
||||||
child: Builder(builder: (context) {
|
// child: Builder(builder: (context) {
|
||||||
return IconButton(
|
// return IconButton(
|
||||||
onPressed: () async {
|
// onPressed: () async {
|
||||||
bool isOverlayActive =
|
// bool isOverlayActive =
|
||||||
await FlutterOverlayWindow.isActive();
|
// await FlutterOverlayWindow.isActive();
|
||||||
if (isOverlayActive) {
|
// if (isOverlayActive) {
|
||||||
await FlutterOverlayWindow.closeOverlay();
|
// await FlutterOverlayWindow.closeOverlay();
|
||||||
}
|
// }
|
||||||
// print(box.read(BoxName.tokenDriver));
|
// // print(box.read(BoxName.tokenDriver));
|
||||||
},
|
// },
|
||||||
icon: const Icon(
|
// icon: const Icon(
|
||||||
FontAwesome5.window_close,
|
// FontAwesome5.window_close,
|
||||||
size: 29,
|
// size: 29,
|
||||||
color: AppColor.blueColor,
|
// color: AppColor.blueColor,
|
||||||
),
|
// ),
|
||||||
);
|
// );
|
||||||
}),
|
// }),
|
||||||
)
|
// )
|
||||||
: const SizedBox(),
|
// : const SizedBox(),
|
||||||
// AnimatedContainer(
|
// AnimatedContainer(
|
||||||
// duration: const Duration(microseconds: 200),
|
// duration: const Duration(microseconds: 200),
|
||||||
// width: controller.widthMapTypeAndTraffic,
|
// width: controller.widthMapTypeAndTraffic,
|
||||||
|
|||||||
@@ -28,39 +28,34 @@ class GoogleDriverMap extends StatelessWidget {
|
|||||||
onMapCreated: controller.onMapCreated,
|
onMapCreated: controller.onMapCreated,
|
||||||
zoomControlsEnabled: true,
|
zoomControlsEnabled: true,
|
||||||
initialCameraPosition: CameraPosition(
|
initialCameraPosition: CameraPosition(
|
||||||
// bearing: 45,
|
|
||||||
target: locationController.myLocation,
|
target: locationController.myLocation,
|
||||||
zoom: 13,
|
zoom: 13,
|
||||||
|
bearing: locationController.heading,
|
||||||
tilt: 40,
|
tilt: 40,
|
||||||
),
|
),
|
||||||
// onCameraMoveStarted: () {},
|
cameraTargetBounds:
|
||||||
cameraTargetBounds: CameraTargetBounds(controller.boundsData),
|
CameraTargetBounds.unbounded, // Allow unrestricted movement
|
||||||
onCameraMove: (position) {
|
onCameraMove: (position) {
|
||||||
locationController.myLocation = position.target;
|
locationController.myLocation = position.target;
|
||||||
controller.mapController!
|
// controller.mapController
|
||||||
.animateCamera(CameraUpdate.newCameraPosition(position));
|
// ?.animateCamera(CameraUpdate.newCameraPosition(position));
|
||||||
},
|
},
|
||||||
minMaxZoomPreference: const MinMaxZoomPreference(8, 15),
|
minMaxZoomPreference: const MinMaxZoomPreference(8, 15),
|
||||||
myLocationEnabled: true, myLocationButtonEnabled: true,
|
myLocationEnabled: true,
|
||||||
|
myLocationButtonEnabled: true,
|
||||||
compassEnabled: true,
|
compassEnabled: true,
|
||||||
mapType: MapType.terrain,
|
mapType: MapType.terrain,
|
||||||
rotateGesturesEnabled: true,
|
rotateGesturesEnabled: true,
|
||||||
scrollGesturesEnabled: true,
|
scrollGesturesEnabled: true,
|
||||||
trafficEnabled: false,
|
trafficEnabled: false,
|
||||||
// liteModeEnabled: true,
|
|
||||||
buildingsEnabled: true,
|
buildingsEnabled: true,
|
||||||
mapToolbarEnabled: true,
|
mapToolbarEnabled: true,
|
||||||
// zoomControlsEnabled: true,
|
|
||||||
fortyFiveDegreeImageryEnabled: true,
|
fortyFiveDegreeImageryEnabled: true,
|
||||||
zoomGesturesEnabled: true,
|
zoomGesturesEnabled: true,
|
||||||
polylines: {
|
polylines: {
|
||||||
Polyline(
|
Polyline(
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
consumeTapEvents: true,
|
|
||||||
geodesic: true,
|
geodesic: true,
|
||||||
endCap: Cap.buttCap,
|
|
||||||
startCap: Cap.buttCap,
|
|
||||||
visible: true,
|
|
||||||
polylineId: const PolylineId('route1'),
|
polylineId: const PolylineId('route1'),
|
||||||
points: controller.polylineCoordinates,
|
points: controller.polylineCoordinates,
|
||||||
color: const Color.fromARGB(255, 163, 81, 246),
|
color: const Color.fromARGB(255, 163, 81, 246),
|
||||||
@@ -68,11 +63,7 @@ class GoogleDriverMap extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Polyline(
|
Polyline(
|
||||||
zIndex: 2,
|
zIndex: 2,
|
||||||
consumeTapEvents: true,
|
|
||||||
geodesic: true,
|
geodesic: true,
|
||||||
endCap: Cap.buttCap,
|
|
||||||
startCap: Cap.buttCap,
|
|
||||||
visible: true,
|
|
||||||
polylineId: const PolylineId('route'),
|
polylineId: const PolylineId('route'),
|
||||||
points: controller.polylineCoordinatesDestination,
|
points: controller.polylineCoordinatesDestination,
|
||||||
color: const Color.fromARGB(255, 10, 29, 126),
|
color: const Color.fromARGB(255, 10, 29, 126),
|
||||||
@@ -85,7 +76,8 @@ class GoogleDriverMap extends StatelessWidget {
|
|||||||
position: locationController.myLocation,
|
position: locationController.myLocation,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
icon: controller.carIcon,
|
icon: controller.carIcon,
|
||||||
rotation: locationController.heading),
|
rotation: locationController.heading,
|
||||||
|
),
|
||||||
Marker(
|
Marker(
|
||||||
markerId: MarkerId('start'.tr),
|
markerId: MarkerId('start'.tr),
|
||||||
position: controller.latLngPassengerLocation,
|
position: controller.latLngPassengerLocation,
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: Get.height * .15,
|
height: Get.height * .2,
|
||||||
width: Get.width * .9,
|
width: Get.width * .9,
|
||||||
decoration: AppStyle.boxDecoration1,
|
decoration: AppStyle.boxDecoration1,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -301,40 +301,40 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
Padding(
|
// Padding(
|
||||||
padding: const EdgeInsets.all(4),
|
// padding: const EdgeInsets.all(4),
|
||||||
child: Container(
|
// child: Container(
|
||||||
color: AppColor.greenColor.withOpacity(.5),
|
// color: AppColor.greenColor.withOpacity(.5),
|
||||||
child: Row(
|
// child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
// children: [
|
||||||
RichText(
|
// RichText(
|
||||||
text: TextSpan(
|
// text: TextSpan(
|
||||||
text: 'Cost Of Trip IS '.tr,
|
// text: 'Cost Of Trip IS '.tr,
|
||||||
style: AppStyle.title,
|
// style: AppStyle.title,
|
||||||
children: [
|
// children: [
|
||||||
TextSpan(
|
// TextSpan(
|
||||||
text: myList[26], style: AppStyle.headTitle2),
|
// text: myList[26], style: AppStyle.headTitle2),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
RichText(
|
// RichText(
|
||||||
text: TextSpan(
|
// text: TextSpan(
|
||||||
text: 'Total net'.tr,
|
// text: 'Total net'.tr,
|
||||||
style: AppStyle.title,
|
// style: AppStyle.title,
|
||||||
children: [
|
// children: [
|
||||||
TextSpan(
|
// TextSpan(
|
||||||
text: (double.parse(myList[2]) -
|
// text: (double.parse(myList[2]) -
|
||||||
double.parse(myList[32]))
|
// double.parse(myList[32]))
|
||||||
.toStringAsFixed(2),
|
// .toStringAsFixed(2),
|
||||||
style: AppStyle.headTitle2),
|
// style: AppStyle.headTitle2),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@@ -531,33 +531,52 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
MyElevatedButton(
|
MyElevatedButton(
|
||||||
title: 'Refuse Order'.tr,
|
title: 'Refuse Order'.tr,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Get.defaultDialog(
|
// Get.defaultDialog(
|
||||||
title: 'Reject Order'.tr,
|
// title: 'Reject Order'.tr,
|
||||||
titleStyle: AppStyle.title,
|
// titleStyle: AppStyle.title,
|
||||||
content: Column(
|
// content: Column(
|
||||||
children: [
|
// children: [
|
||||||
IconButton(
|
// IconButton(
|
||||||
onPressed: () async {
|
// onPressed: () async {
|
||||||
await Get.find<TextToSpeechController>()
|
// await Get.find<TextToSpeechController>()
|
||||||
.speakText(
|
// .speakText(
|
||||||
'You can decline a request without any cost'
|
// 'You can decline a request without any cost'
|
||||||
.tr);
|
// .tr);
|
||||||
},
|
// },
|
||||||
icon: const Icon(Icons.headphones),
|
// icon: const Icon(Icons.headphones),
|
||||||
),
|
// ),
|
||||||
Text(
|
// Text(
|
||||||
'You can decline a request without any cost'
|
// 'You can decline a request without any cost'
|
||||||
.tr,
|
// .tr,
|
||||||
style: AppStyle.title,
|
// style: AppStyle.title,
|
||||||
)
|
// )
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
confirm: MyElevatedButton(
|
// confirm: MyElevatedButton(
|
||||||
title: 'Ok'.tr,
|
// title: 'Ok'.tr,
|
||||||
onPressed: () {
|
// onPressed: () {
|
||||||
Get.back();
|
// Get.back();
|
||||||
Get.back();
|
// Get.back();
|
||||||
}));
|
// }));
|
||||||
|
orderRequestController.endTimer();
|
||||||
|
|
||||||
|
orderRequestController.refuseOrder(
|
||||||
|
myList[16].toString(),
|
||||||
|
);
|
||||||
|
orderRequestController.addRideToNotificationDriverString(
|
||||||
|
myList[16].toString(),
|
||||||
|
myList[29].toString(),
|
||||||
|
myList[30].toString(),
|
||||||
|
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day}',
|
||||||
|
'${DateTime.now().hour}:${DateTime.now().minute}',
|
||||||
|
myList[2].toString(),
|
||||||
|
myList[7].toString(),
|
||||||
|
'wait',
|
||||||
|
myList[31].toString(),
|
||||||
|
myList[33].toString(),
|
||||||
|
myList[2].toString(),
|
||||||
|
myList[5].toString(),
|
||||||
|
myList[4].toString());
|
||||||
},
|
},
|
||||||
kolor: AppColor.redColor,
|
kolor: AppColor.redColor,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,23 +1,11 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:SEFER/constant/colors.dart';
|
import 'package:SEFER/constant/colors.dart';
|
||||||
import 'package:SEFER/constant/style.dart';
|
import 'package:SEFER/constant/style.dart';
|
||||||
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
|
|
||||||
import 'package:SEFER/controller/notification/ride_available_controller.dart';
|
import 'package:SEFER/controller/notification/ride_available_controller.dart';
|
||||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
|
||||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||||
import 'package:SEFER/views/widgets/mycircular.dart';
|
import 'package:SEFER/views/widgets/mycircular.dart';
|
||||||
import 'package:SEFER/views/widgets/mydialoug.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
import '../../constant/box_name.dart';
|
|
||||||
import '../../constant/links.dart';
|
|
||||||
import '../../controller/firebase/firbase_messge.dart';
|
|
||||||
import '../../controller/functions/crud.dart';
|
|
||||||
import '../../main.dart';
|
|
||||||
import '../home/Captin/driver_map_page.dart';
|
|
||||||
|
|
||||||
class AvailableRidesPage extends StatelessWidget {
|
class AvailableRidesPage extends StatelessWidget {
|
||||||
const AvailableRidesPage({super.key});
|
const AvailableRidesPage({super.key});
|
||||||
|
|
||||||
@@ -34,293 +22,113 @@ class AvailableRidesPage extends StatelessWidget {
|
|||||||
: ListView.builder(
|
: ListView.builder(
|
||||||
itemCount: rideAvailableController
|
itemCount: rideAvailableController
|
||||||
.rideAvailableMap['message'].length,
|
.rideAvailableMap['message'].length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (context, index) => RideAvailableCard(
|
||||||
var list = rideAvailableController
|
rideInfo: rideAvailableController
|
||||||
.rideAvailableMap['message'][index];
|
.rideAvailableMap['message'][index],
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: 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('${'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),
|
|
||||||
});
|
|
||||||
CRUD().post(
|
|
||||||
link:
|
|
||||||
'${AppLink.seferAlexandriaServer}rides/updateStausFromSpeed.php',
|
|
||||||
payload: {
|
|
||||||
'id': list['id'],
|
|
||||||
'rideTimeStart':
|
|
||||||
DateTime.now().toString(),
|
|
||||||
'status': 'Apply',
|
|
||||||
'driver_id':
|
|
||||||
box.read(BoxName.driverID),
|
|
||||||
});
|
|
||||||
CRUD().post(
|
|
||||||
link:
|
|
||||||
'${AppLink.seferGizaServer}rides/updateStausFromSpeed.php',
|
|
||||||
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") {
|
|
||||||
MyDialog().getDialog(
|
|
||||||
"This ride is already taken by another driver."
|
|
||||||
.tr,
|
|
||||||
'', () {
|
|
||||||
CRUD().post(
|
|
||||||
link: AppLink.deleteAvailableRide,
|
|
||||||
payload: {'id': list['id']});
|
|
||||||
CRUD().post(
|
|
||||||
link:
|
|
||||||
'${AppLink.endPoint}/ride/notificationCaptain/deleteAvailableRide.php',
|
|
||||||
payload: {'id': list['id']});
|
|
||||||
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'
|
|
||||||
});
|
|
||||||
CRUD().postFromDialogue(
|
|
||||||
link:
|
|
||||||
'${AppLink.seferAlexandriaServer}/driver_order/add.php',
|
|
||||||
payload: {
|
|
||||||
'driver_id':
|
|
||||||
box.read(BoxName.driverID),
|
|
||||||
// box.read(BoxName.driverID).toString(),
|
|
||||||
'order_id': list['id'],
|
|
||||||
'status': 'Apply'
|
|
||||||
});
|
|
||||||
CRUD().postFromDialogue(
|
|
||||||
link:
|
|
||||||
'${AppLink.seferGizaServer}/driver_order/add.php',
|
|
||||||
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'
|
|
||||||
});
|
|
||||||
CRUD().post(
|
|
||||||
link:
|
|
||||||
'${AppLink.seferAlexandriaServer}/rides/update.php',
|
|
||||||
payload: {
|
|
||||||
'id': list['id'],
|
|
||||||
'DriverIsGoingToPassenger':
|
|
||||||
DateTime.now().toString(),
|
|
||||||
'status': 'Applied'
|
|
||||||
});
|
|
||||||
CRUD().post(
|
|
||||||
link:
|
|
||||||
'${AppLink.seferGizaServer}/rides/update.php',
|
|
||||||
payload: {
|
|
||||||
'id': list['id'],
|
|
||||||
'DriverIsGoingToPassenger':
|
|
||||||
DateTime.now().toString(),
|
|
||||||
'status': 'Applied'
|
|
||||||
});
|
|
||||||
await CRUD().post(
|
|
||||||
link: AppLink.updateWaitingRide,
|
|
||||||
payload: {
|
|
||||||
'id': list['id'],
|
|
||||||
'status': 'Applied'
|
|
||||||
});
|
|
||||||
|
|
||||||
FirebaseMessagesController()
|
|
||||||
.sendNotificationToPassengerToken(
|
|
||||||
'Apply Ride',
|
|
||||||
'your ride is applied'.tr,
|
|
||||||
// arguments['DriverList'][9].toString(),
|
|
||||||
list['passengerToken']
|
|
||||||
.toString(),
|
|
||||||
// box.read(BoxName.tokenDriver).toString(),
|
|
||||||
bodyToPassenger,
|
|
||||||
'start.wav');
|
|
||||||
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);
|
isleading: true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RideAvailableCard extends StatelessWidget {
|
||||||
|
final Map<String, dynamic> rideInfo;
|
||||||
|
|
||||||
|
const RideAvailableCard({Key? key, required this.rideInfo}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Card(
|
||||||
|
margin: const EdgeInsets.all(8.0),
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||||
|
elevation: 4,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// _buildLocationRow('🟢', rideInfo['startName']),
|
||||||
|
// const SizedBox(height: 8),
|
||||||
|
// _buildLocationRow('🔴', rideInfo['endName']),
|
||||||
|
_buildLocationRow('↑', rideInfo['startName'], AppColor.greenColor),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
_buildLocationRow('↓', rideInfo['endName'], Colors.red),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
_buildInfoRow(),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
_buildActionRow(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildLocationRow(String icon, String location, Color iconColor) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
icon,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20, fontWeight: FontWeight.bold, color: iconColor),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
location,
|
||||||
|
style: AppStyle.subtitle,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildInfoRow() {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('${'Price:'.tr} ${rideInfo['price']} \$', style: AppStyle.title),
|
||||||
|
Text(
|
||||||
|
rideInfo['carType'],
|
||||||
|
style: AppStyle.title.copyWith(color: AppColor.greenColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildActionRow() {
|
||||||
|
return Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Text('📈 ${rideInfo['passengerRate']}', style: AppStyle.title),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
'📍 ${rideInfo['distance']} ${'KM'.tr}',
|
||||||
|
style: AppStyle.title.copyWith(color: AppColor.greenColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () => _acceptRide(),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: AppColor.greenColor,
|
||||||
|
shape:
|
||||||
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
|
),
|
||||||
|
child: Text('Accept'.tr),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _acceptRide() async {
|
||||||
|
// Your existing accept ride logic here
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user