2/14/1
This commit is contained in:
@@ -32,4 +32,8 @@ class AK {
|
||||
static final String payPalClientId = Env.payPalClientId;
|
||||
static final String payPalSecret = Env.payPalSecret;
|
||||
static final String geminiApi = Env.geminiApi;
|
||||
static const String agoraAppId = '12994c6e707543e68d5638894d04f989';
|
||||
static const String agoraChannelName = 'seferCall';
|
||||
static const String agoraToken =
|
||||
'007eJxTYCjrVT009+knq6WOp9gqgx77z/CIjHtQ7PBrUdB1CZWUhUcUGAyNLC1Nks1SzQ3MTU2MU80sUkzNjC0sLE1SDEzSLC0sK4XPpjYEMjIEfg5lYWSAQBCfk6E4NS21yDkxJ4eBAQD1PiDo';
|
||||
}
|
||||
|
||||
@@ -56,6 +56,10 @@ class AppLink {
|
||||
static String deleteRides = "$ride/rides/delete.php";
|
||||
|
||||
//-----------------DriverPayment------------------
|
||||
static String adddriverScam = "$ride/driver_scam/add.php";
|
||||
static String getdriverScam = "$ride/driver_scam/get.php";
|
||||
|
||||
////-----------------DriverPayment------------------
|
||||
static String addDriverpayment = "$ride/payment/add.php";
|
||||
static String addDriverPaymentPoints = "$ride/driverPayment/add.php";
|
||||
static String getDriverPaymentPoints = "$ride/driverWallet/get.php";
|
||||
|
||||
@@ -23,6 +23,7 @@ import '../../views/home/Captin/orderCaptin/order_request_page.dart';
|
||||
import '../home/map_passenger_controller.dart';
|
||||
import '../home/payment/captain_wallet_controller.dart';
|
||||
import '../payment/payment_controller.dart';
|
||||
import 'local_notification.dart';
|
||||
|
||||
class FirebaseMessagesController extends GetxController {
|
||||
final fcmToken = FirebaseMessaging.instance;
|
||||
@@ -128,6 +129,9 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
void fireBaseTitles(RemoteMessage message) {
|
||||
if (message.notification!.title! == 'Order') {
|
||||
if (Platform.isAndroid) {
|
||||
NotificationController().showNotification('Order', '', 'order');
|
||||
}
|
||||
var myListString = message.data['DriverList'];
|
||||
// print(myListString);
|
||||
// print('9999999999999myListString999999999999999');
|
||||
@@ -146,33 +150,57 @@ class FirebaseMessagesController extends GetxController {
|
||||
// print('9999999999999my Apply Ride 999999999999999');
|
||||
var myList = jsonDecode(passengerList) as List<dynamic>;
|
||||
driverID = myList[2].toString();
|
||||
|
||||
driverAppliedTripSnakBar();
|
||||
NotificationController().showNotification(
|
||||
'Apply Order', 'Driver Applied the Ride for You'.tr, 'order');
|
||||
// driverAppliedTripSnakBar();
|
||||
} else if (message.notification!.title! == 'Promo') {
|
||||
NotificationController()
|
||||
.showNotification('Promo', 'Show latest promo'.tr, 'order');
|
||||
Get.to(const PromosPassengerPage());
|
||||
} else if (message.notification!.title == 'Cancel Trip') {
|
||||
NotificationController().showNotification(
|
||||
'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'order');
|
||||
cancelTripDialog();
|
||||
} else if (message.notification!.title! == 'DriverIsGoingToPassenger') {
|
||||
Get.snackbar('Driver is Going To Passenger', '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
NotificationController().showNotification('Driver is Going To You'.tr,
|
||||
'Please stay on the picked point.'.tr, 'order');
|
||||
// Get.snackbar('Driver is Going To Passenger', '',
|
||||
// backgroundColor: AppColor.greenColor);
|
||||
} else if (message.notification!.title! == 'RideIsBegin') {
|
||||
Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
|
||||
// Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
|
||||
NotificationController()
|
||||
.showNotification('Trip is Begin'.tr, ''.tr, 'order');
|
||||
update();
|
||||
} else if (message.notification!.title! == 'Hi ,I will go now') {
|
||||
Get.snackbar('Hi ,I will go now', '',
|
||||
backgroundColor: AppColor.greenColor);
|
||||
// Get.snackbar('Hi ,I will go now', '',
|
||||
// backgroundColor: AppColor.greenColor);
|
||||
NotificationController().showNotification(
|
||||
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'order');
|
||||
update();
|
||||
} else if (message.notification!.title! == 'Hi ,I Arrive your site') {
|
||||
NotificationController()
|
||||
.showNotification('Hi ,I Arrive your site'.tr, ''.tr, 'order');
|
||||
driverArrivePassengerDialoge();
|
||||
|
||||
update();
|
||||
} else if (message.notification!.title! == 'Driver Finish Trip') {
|
||||
var myListString = message.data['passengerList'];
|
||||
var driverList = jsonDecode(myListString) as List<dynamic>;
|
||||
NotificationController().showNotification(
|
||||
'Driver Finish Trip'.tr,
|
||||
'you will pay to Driver'.tr +
|
||||
' ${Get.find<MapPassengerController>().totalPassenger} \$'.tr,
|
||||
'order');
|
||||
if (Get.find<PaymentController>().isCashChecked == false &&
|
||||
Get.find<PaymentController>().isWalletChecked == true) {
|
||||
driverFinishTripDialoge(driverList);
|
||||
} else {
|
||||
} else if (double.parse(box.read(BoxName.passengerWalletTotal)) < 0) {
|
||||
CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': box.read(BoxName.passengerID).toString(),
|
||||
'balance':
|
||||
((-1) * double.parse(box.read(BoxName.passengerWalletTotal)))
|
||||
.toString()
|
||||
});
|
||||
Get.to(() => RateDriverFromPassenger(), arguments: {
|
||||
'driverId': driverList[0].toString(),
|
||||
'rideId': driverList[1].toString(),
|
||||
@@ -184,6 +212,11 @@ class FirebaseMessagesController extends GetxController {
|
||||
// .tr,
|
||||
// 'message',
|
||||
// backgroundColor: AppColor.redColor);
|
||||
NotificationController().showNotification(
|
||||
'Driver Cancel Your Trip'.tr,
|
||||
'you will pay to Driver you will be pay the cost of driver time look to your SEFER Wallet'
|
||||
.tr,
|
||||
'order');
|
||||
Get.find<MapPassengerController>().restCounter();
|
||||
Get.offAll(const MapPagePassenger());
|
||||
}
|
||||
@@ -213,6 +246,7 @@ class FirebaseMessagesController extends GetxController {
|
||||
|
||||
Future<dynamic> cancelTripDialog() {
|
||||
return Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'Passenger Cancel Trip'.tr,
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
|
||||
29
lib/controller/firebase/local_notification.dart
Normal file
29
lib/controller/firebase/local_notification.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class NotificationController extends GetxController {
|
||||
final FlutterLocalNotificationsPlugin _flutterLocalNotificationsPlugin =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
|
||||
// Initializes the local notifications plugin
|
||||
Future<void> initNotifications() async {
|
||||
const AndroidInitializationSettings android =
|
||||
AndroidInitializationSettings('@mipmap/launcher_icon');
|
||||
const InitializationSettings initializationSettings =
|
||||
InitializationSettings(android: android);
|
||||
await _flutterLocalNotificationsPlugin.initialize(initializationSettings);
|
||||
}
|
||||
|
||||
// Displays a notification with the given title and message
|
||||
void showNotification(String title, String message, String tone) async {
|
||||
AndroidNotificationDetails android = AndroidNotificationDetails(
|
||||
'your channel id', 'your channel name',
|
||||
importance: Importance.max,
|
||||
priority: Priority.high,
|
||||
showWhen: false,
|
||||
sound: RawResourceAndroidNotificationSound(tone));
|
||||
|
||||
NotificationDetails details = NotificationDetails(android: android);
|
||||
await _flutterLocalNotificationsPlugin.show(0, title, message, details);
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class LocationController extends GetxController {
|
||||
}
|
||||
|
||||
void startLocationUpdates() async {
|
||||
_locationTimer = Timer.periodic(const Duration(seconds: 20), (timer) async {
|
||||
_locationTimer = Timer.periodic(const Duration(seconds: 10), (timer) async {
|
||||
try {
|
||||
totalPoints = Get.find<CaptainWalletController>().totalPoints;
|
||||
|
||||
@@ -97,11 +97,11 @@ class LocationController extends GetxController {
|
||||
: null)!;
|
||||
|
||||
// Print location details
|
||||
print('myLocation: ${myLocation}');
|
||||
print('Accuracy: ${_locationData.accuracy}');
|
||||
print('Latitude: ${_locationData.latitude}');
|
||||
print('Longitude: ${_locationData.longitude}');
|
||||
print('Time: ${_locationData.time}');
|
||||
// print('myLocation: ${myLocation}');
|
||||
// print('Accuracy: ${_locationData.accuracy}');
|
||||
// print('Latitude: ${_locationData.latitude}');
|
||||
// print('Longitude: ${_locationData.longitude}');
|
||||
// print('Time: ${_locationData.time}');
|
||||
isLoading = false;
|
||||
update();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/controller/home/captin/map_driver_controller.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import '../../../constant/links.dart';
|
||||
@@ -204,11 +205,12 @@ class HomeCaptainController extends GetxController {
|
||||
}
|
||||
|
||||
addToken() async {
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
await CRUD().post(link: AppLink.addTokensDriver, payload: {
|
||||
'token': box.read(BoxName.tokenDriver),
|
||||
'captain_id': box.read(BoxName.driverID).toString()
|
||||
}).then((value) => print('Token Added'));
|
||||
MapDriverController().driverCallPassenger();
|
||||
// box.write(BoxName.statusDriverLocation, 'off');
|
||||
}
|
||||
|
||||
getPaymentToday() async {
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:google_polyline_algorithm/google_polyline_algorithm.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/home/captin/home_captain_controller.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/api_key.dart';
|
||||
@@ -45,6 +46,7 @@ class MapDriverController extends GetxController {
|
||||
late String step3;
|
||||
late String step4;
|
||||
late String duration;
|
||||
late String totalCost;
|
||||
late String distance;
|
||||
late String name;
|
||||
late String phone;
|
||||
@@ -242,6 +244,46 @@ class MapDriverController extends GetxController {
|
||||
tokenPassenger);
|
||||
}
|
||||
|
||||
bool isSocialPressed = false;
|
||||
driverCallPassenger() async {
|
||||
String scam = await getDriverScam();
|
||||
if (scam != 'failure') {
|
||||
if (int.parse(scam) > 3) {
|
||||
box.write(BoxName.statusDriverLocation, 'on');
|
||||
Get.find<LocationController>().stopLocationUpdates();
|
||||
await CRUD().post(link: AppLink.addNotificationCaptain, payload: {
|
||||
'driverID': box.read(BoxName.driverID),
|
||||
'title': 'scams operations'.tr,
|
||||
'body':
|
||||
'you have connect to passengers and let them cancel the order'.tr,
|
||||
});
|
||||
} else if (isSocialPressed == true) {
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
await CRUD().post(link: AppLink.adddriverScam, payload: {
|
||||
'driverID': box.read(BoxName.driverID),
|
||||
'passengerID': passengerId,
|
||||
'rideID': rideId,
|
||||
'isDriverCalledPassenger': '$isSocialPressed'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> getDriverScam() async {
|
||||
var res = await CRUD().post(link: AppLink.getdriverScam, payload: {
|
||||
'driverID': box.read(BoxName.driverID),
|
||||
});
|
||||
if (res == 'failure') {
|
||||
print('Scam is failure');
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
return '0';
|
||||
}
|
||||
var d = jsonDecode(res);
|
||||
print('Scam is ');
|
||||
print(d['message'][0]['count']);
|
||||
return d['message'][0]['count'];
|
||||
}
|
||||
|
||||
void startRideFromDriver() async {
|
||||
changeRideToBeginToPassenger();
|
||||
isPassengerInfoWindow = false;
|
||||
@@ -283,14 +325,20 @@ class MapDriverController extends GetxController {
|
||||
// 'RideIsBegin', box.read(BoxName.name).toString(), tokenPassenger);
|
||||
}
|
||||
|
||||
addWaittingTimeCostFromPassengerToDriverWallet() async {
|
||||
calculateDistanseBetweenDriverAndPassengerLocation() {
|
||||
double distance2 = Geolocator.distanceBetween(
|
||||
latLngpassengerLocation.latitude,
|
||||
latLngpassengerLocation.longitude,
|
||||
Get.find<LocationController>().myLocation.latitude,
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
);
|
||||
if (distance2 > 80) {
|
||||
return distance2;
|
||||
}
|
||||
|
||||
addWaittingTimeCostFromPassengerToDriverWallet() async {
|
||||
double distance2 = calculateDistanseBetweenDriverAndPassengerLocation();
|
||||
|
||||
if (distance2 > 40) {
|
||||
Get.defaultDialog(
|
||||
title: 'Your are far from passenger location'.tr,
|
||||
middleText:
|
||||
@@ -321,6 +369,7 @@ class MapDriverController extends GetxController {
|
||||
'passenger_id': passengerId,
|
||||
'balance': (cost * -1).toString()
|
||||
});
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
Get.offAll(HomeCaptain());
|
||||
}
|
||||
}
|
||||
@@ -335,21 +384,30 @@ class MapDriverController extends GetxController {
|
||||
'rideTimeFinish': DateTime.now().toString(),
|
||||
'status': 'Finished'
|
||||
});
|
||||
Get.back();
|
||||
if (walletChecked == 'true') {
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'ba lance': ((-1) * double.parse(totalCost)).toString()
|
||||
});
|
||||
}
|
||||
|
||||
// Get.back();
|
||||
Future.delayed(const Duration(milliseconds: 300));
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Driver Finish Trip',
|
||||
'you will pay to Driver'.tr + ' $totalCost \$'.tr,
|
||||
tokenPassenger,
|
||||
[
|
||||
box.read(BoxName.driverID),
|
||||
rideId,
|
||||
box.read(BoxName.tokenDriver),
|
||||
],
|
||||
);
|
||||
Get.to(() => RatePassenger(), arguments: {
|
||||
'rideId': rideId,
|
||||
'passengerId': passengerId,
|
||||
'driverId': driverId
|
||||
});
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Driver Finish Trip',
|
||||
box.read(BoxName.name).toString(),
|
||||
tokenPassenger, [
|
||||
box.read(BoxName.driverID),
|
||||
rideId,
|
||||
box.read(BoxName.tokenDriver),
|
||||
]);
|
||||
}
|
||||
|
||||
void cancelCheckRidefromPassenger() async {
|
||||
@@ -623,6 +681,7 @@ class MapDriverController extends GetxController {
|
||||
passengerLocation = Get.arguments['passengerLocation'];
|
||||
passengerDestination = Get.arguments['passengerDestination'];
|
||||
duration = Get.arguments['Duration'];
|
||||
totalCost = Get.arguments['totalCost'];
|
||||
passengerId = Get.arguments['passengerId'];
|
||||
driverId = Get.arguments['driverId'];
|
||||
distance = Get.arguments['Distance'];
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:get/get.dart';
|
||||
import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/home/Captin/home_captain/home_captin.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/box_name.dart';
|
||||
@@ -38,7 +39,7 @@ class OrderRequestController extends GetxController {
|
||||
String driverId = box.read(BoxName.driverID).toString();
|
||||
|
||||
String customQuery = '''
|
||||
SELECT COUNT(*) AS count
|
||||
SELECT COUNT(*) AS count
|
||||
FROM ${TableName.driverOrdersRefuse}
|
||||
WHERE driver_id = '$driverId'
|
||||
AND created_at LIKE '%$todayDay%'
|
||||
@@ -95,12 +96,16 @@ class OrderRequestController extends GetxController {
|
||||
'status': 'Refused'
|
||||
});
|
||||
Get.back();
|
||||
// applied = true;
|
||||
sql.insertData({
|
||||
'order_id': orderID,
|
||||
'created_at': DateTime.now().toString(),
|
||||
'driver_id': box.read(BoxName.driverID).toString(),
|
||||
'rideId': orderID
|
||||
}, TableName.driverOrdersRefuse);
|
||||
getRefusedOrderByCaptain();
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
update();
|
||||
// Get.offAll(HomeCaptain());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/controller/home/payment/captain_wallet_controller.dart';
|
||||
import 'package:ride/views/home/my_wallet/walet_captain.dart';
|
||||
|
||||
import '../../../../constant/style.dart';
|
||||
import '../../../../views/widgets/elevated_btn.dart';
|
||||
@@ -34,7 +33,7 @@ class ConnectWidget extends StatelessWidget {
|
||||
barrierDismissible: false,
|
||||
title: double.parse(captainWalletController.totalPoints) <
|
||||
-100
|
||||
? 'You dont have Points'
|
||||
? 'You dont have Points'.tr
|
||||
: 'You Are Stopped For this Day !'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
content: Text(
|
||||
|
||||
@@ -184,10 +184,11 @@ class MapPassengerController extends GetxController {
|
||||
late double totalME = 0;
|
||||
late double tax = 0;
|
||||
late double totalPassenger = 0;
|
||||
late double totalCostPassenger = 0;
|
||||
late double totalDriver = 0;
|
||||
late double averageDuration = 0;
|
||||
late double costDuration = 0;
|
||||
late double cost = 0;
|
||||
late double costDistance = 0;
|
||||
late double distance = 0;
|
||||
late double duration = 0;
|
||||
|
||||
@@ -514,19 +515,24 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
rideTimerBegin = false;
|
||||
isRideFinished = true;
|
||||
update();
|
||||
//print('rideTimerBegin: $rideTimerBegin');
|
||||
//print('isRideFinished: $isRideFinished');
|
||||
if (Get.find<PaymentController>().isWalletChecked == true &&
|
||||
Get.find<PaymentController>().isCashChecked == false) {
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': box.read(BoxName.passengerID).toString(),
|
||||
'balance': ((-1) * totalPassenger).toString()
|
||||
});
|
||||
}
|
||||
// if (Get.find<PaymentController>().isWalletChecked == true &&
|
||||
// Get.find<PaymentController>().isCashChecked == false) {
|
||||
// if (double.parse(box.read(BoxName.passengerWalletTotal)) < 0) {
|
||||
// totalPassenger = totalCostPassenger +
|
||||
// double.parse(box.read(BoxName.passengerWalletTotal));
|
||||
// } else {
|
||||
// totalPassenger = totalCostPassenger + 0;
|
||||
// }
|
||||
// await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
// 'passenger_id': box.read(BoxName.passengerID).toString(),
|
||||
// 'balance': ((-1) * totalPassenger).toString()
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
void getBeginRideFromDriver() async {
|
||||
@@ -699,10 +705,10 @@ class MapPassengerController extends GetxController {
|
||||
List<String> body = [
|
||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
totalPassenger.toString(),
|
||||
totalDriver.toString(),
|
||||
totalPassenger.toStringAsFixed(2),
|
||||
totalDriver.toStringAsFixed(2),
|
||||
durationToRide.toString(),
|
||||
distance.toString(),
|
||||
distance.toStringAsFixed(2),
|
||||
dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
|
||||
.toString(),
|
||||
box.read(BoxName.passengerID).toString(),
|
||||
@@ -727,7 +733,7 @@ class MapPassengerController extends GetxController {
|
||||
placesCoordinate[2],
|
||||
placesCoordinate[3],
|
||||
placesCoordinate[4],
|
||||
cost.toStringAsFixed(2)
|
||||
costDistance.toStringAsFixed(2)
|
||||
];
|
||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||
'Order',
|
||||
@@ -781,6 +787,7 @@ class MapPassengerController extends GetxController {
|
||||
changeConfirmRide();
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
barrierDismissible: false,
|
||||
title: 'There no Driver Aplly your order sorry for that '.tr,
|
||||
middleText: 'try next time .',
|
||||
confirm: MyElevatedButton(
|
||||
@@ -956,9 +963,9 @@ class MapPassengerController extends GetxController {
|
||||
clearPlacesDestination();
|
||||
clearPolyline();
|
||||
data = [];
|
||||
await CRUD().post(link: AppLink.updateDriverOrder, payload: {
|
||||
"order_id": rideId.toString(), // Convert to String
|
||||
"status": 'Cancel'
|
||||
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||
"id": rideId.toString(), // Convert to String
|
||||
"status": 'notApplyFromAnyDriver'
|
||||
});
|
||||
rideConfirm = false;
|
||||
shouldFetch = false;
|
||||
@@ -1780,8 +1787,14 @@ class MapPassengerController extends GetxController {
|
||||
if (decode["status"] == "success") {
|
||||
//print(totalPassenger);
|
||||
var firstElement = decode["message"][0];
|
||||
totalPassenger = totalPassenger -
|
||||
(totalPassenger * int.parse(firstElement['amount']) / 100);
|
||||
if (double.parse(box.read(BoxName.passengerWalletTotal)) < 0) {
|
||||
totalPassenger = totalCostPassenger -
|
||||
(totalCostPassenger * int.parse(firstElement['amount']) / 100);
|
||||
} else {
|
||||
totalPassenger = totalCostPassenger -
|
||||
(totalCostPassenger * int.parse(firstElement['amount']) / 100);
|
||||
}
|
||||
|
||||
totalDriver = totalDriver -
|
||||
(totalDriver * int.parse(firstElement['amount']) / 100);
|
||||
promoTaken = true;
|
||||
@@ -1814,34 +1827,51 @@ class MapPassengerController extends GetxController {
|
||||
averageDuration = (durationToRide / 60) / distance;
|
||||
costDuration = (durationToRide / 60) * averageDuration * 0.016;
|
||||
print('costDuration----- $costDuration');
|
||||
var totalDriver1 = cost + costDuration;
|
||||
totalPassenger = totalDriver1 + (totalDriver1 * .16);
|
||||
print('costDistance----- $costDistance');
|
||||
print(
|
||||
'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}');
|
||||
var totalDriver1 = costDistance + costDuration;
|
||||
totalCostPassenger = totalDriver1 + (totalDriver1 * .16);
|
||||
totalDriver = totalDriver1 + (totalDriver1 * .16);
|
||||
tax = totalPassenger * .16;
|
||||
totalME = totalPassenger - tax;
|
||||
tax = totalCostPassenger * .16;
|
||||
totalME = totalCostPassenger - tax;
|
||||
|
||||
if (double.parse(box.read(BoxName.passengerWalletTotal)) < 0) {
|
||||
totalPassenger = totalCostPassenger +
|
||||
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
|
||||
} else {
|
||||
totalPassenger = totalCostPassenger;
|
||||
}
|
||||
|
||||
update();
|
||||
if (currentTime.hour >= 22) {
|
||||
cost = distance * 0.23;
|
||||
costDistance = distance * 0.23;
|
||||
update();
|
||||
} else if (currentTime.hour < 5) {
|
||||
cost = distance * 0.25;
|
||||
costDistance = distance * 0.25;
|
||||
update();
|
||||
} else if (currentTime.hour >= 13 && currentTime.hour <= 16) {
|
||||
if (averageDuration > 2.5) {
|
||||
cost = distance * 0.25;
|
||||
costDistance = distance * 0.25;
|
||||
update();
|
||||
} else {
|
||||
cost = distance * 0.21;
|
||||
costDistance = distance * 0.21;
|
||||
update();
|
||||
}
|
||||
} else {
|
||||
cost = distance * 0.21;
|
||||
costDistance = distance * 0.21;
|
||||
update();
|
||||
}
|
||||
//print('cost $cost');
|
||||
if (totalPassenger < 1) {
|
||||
totalPassenger = 1;
|
||||
totalDriver = 1;
|
||||
if (totalCostPassenger < 1) {
|
||||
totalCostPassenger = 1;
|
||||
if (double.parse(box.read(BoxName.passengerWalletTotal)) < 0) {
|
||||
totalPassenger = totalCostPassenger +
|
||||
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
|
||||
} else {
|
||||
totalPassenger = totalCostPassenger;
|
||||
}
|
||||
|
||||
update();
|
||||
// if (totalDriver < .5) {
|
||||
// totalDriver = .75;
|
||||
@@ -1851,8 +1881,8 @@ class MapPassengerController extends GetxController {
|
||||
// totalDriver = .90;
|
||||
// totalME = .06;
|
||||
// update();
|
||||
// }
|
||||
}
|
||||
// }
|
||||
|
||||
// buttomSheetMapPage();
|
||||
changeBottomSheetShown();
|
||||
|
||||
@@ -459,6 +459,9 @@ class PaymentController extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
timestamp = now.millisecondsSinceEpoch;
|
||||
if (box.read(BoxName.passengerWalletTotal) == null) {
|
||||
box.write(BoxName.passengerWalletTotal, '0');
|
||||
}
|
||||
getPassengerWallet();
|
||||
final localAuth = LocalAuthentication();
|
||||
super.onInit();
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/links.dart';
|
||||
import 'package:ride/controller/functions/crud.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/my_textField.dart';
|
||||
|
||||
import '../../views/widgets/elevated_btn.dart';
|
||||
|
||||
@@ -37,24 +38,30 @@ class ProfileController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
updatField(String columnName) async {
|
||||
updatField(String columnName, TextInputType type) async {
|
||||
Get.defaultDialog(
|
||||
title: '${'Update'.tr} $columnName',
|
||||
content: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .7,
|
||||
child: TextField(
|
||||
controller: txtController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(), hintText: 'type here'),
|
||||
),
|
||||
),
|
||||
width: Get.width * .7,
|
||||
child: MyTextForm(
|
||||
controller: txtController,
|
||||
label: 'type here'.tr,
|
||||
hint: 'type here',
|
||||
type: type)
|
||||
// TextField(
|
||||
// controller: txtController,
|
||||
// decoration: const InputDecoration(
|
||||
// border: OutlineInputBorder(), hintText: 'type here'),
|
||||
// ),
|
||||
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Update'.tr,
|
||||
onPressed: () {
|
||||
updateColumn({
|
||||
'id': prfoileData['id'].toString(),
|
||||
'id': box.read(BoxName.passengerID),
|
||||
columnName: txtController.text,
|
||||
});
|
||||
if (columnName == 'first_name') {
|
||||
|
||||
@@ -8,12 +8,12 @@ import 'package:flutter_stripe/flutter_stripe.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:ride/controller/home/map_passenger_controller.dart';
|
||||
|
||||
import 'constant/api_key.dart';
|
||||
import 'constant/credential.dart';
|
||||
import 'constant/info.dart';
|
||||
import 'controller/firebase/firbase_messge.dart';
|
||||
import 'controller/firebase/local_notification.dart';
|
||||
import 'controller/local/local_controller.dart';
|
||||
import 'controller/local/translations.dart';
|
||||
import 'firebase_options.dart';
|
||||
@@ -33,13 +33,25 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await NotificationController().initNotifications();
|
||||
await GetStorage.init();
|
||||
await AC().gAK();
|
||||
print(
|
||||
'local is t ${WidgetsBinding.instance.platformDispatcher.locale.countryCode}');
|
||||
print(Get.deviceLocale!.countryCode);
|
||||
Stripe.publishableKey = AK.publishableKey;
|
||||
final navigatorKey = GlobalKey<NavigatorState>();
|
||||
|
||||
/// 2/5: set navigator key to ZegoUIKitPrebuiltCallInvitationService
|
||||
// ZegoUIKitPrebuiltCallInvitationService().setNavigatorKey(navigatorKey);
|
||||
|
||||
// ZegoUIKit().initLog().then((value) {
|
||||
// ZegoUIKitPrebuiltCallInvitationService().useSystemCallingUI(
|
||||
// [ZegoUIKitSignalingPlugin()],
|
||||
// );
|
||||
|
||||
// runApp(MyApp(navigatorKey: navigatorKey));
|
||||
// });
|
||||
//StripeKey.publishableKey;
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
await Firebase.initializeApp(
|
||||
|
||||
@@ -57,6 +57,7 @@ class DbSql {
|
||||
CREATE TABLE IF NOT EXISTS ${TableName.driverOrdersRefuse}(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
order_id TEXT,
|
||||
rideId TEXT UNIQUE,
|
||||
created_at TEXT,
|
||||
driver_id TEXT
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@ class HomeCaptain extends StatelessWidget {
|
||||
appBar: AppBar(
|
||||
backgroundColor: AppColor.greenColor,
|
||||
elevation: 0,
|
||||
title: Text('Captain Home'.tr),
|
||||
title: Text('Home'.tr),
|
||||
actions: [
|
||||
GetBuilder<LocationController>(
|
||||
builder: (locationController) => locationController.isLoading
|
||||
@@ -58,7 +58,19 @@ class HomeCaptain extends StatelessWidget {
|
||||
child: Text(
|
||||
orderRequestController.countRefuse.toString(),
|
||||
style: AppStyle.title,
|
||||
)))
|
||||
))),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
// NotificationController()
|
||||
// .showNotification('Order', 'hi this is', 'tone2');
|
||||
// Get.to(() => CallPage(callID: '111'));
|
||||
// MapDriverController().getDriverScam();
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.call,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
drawer: DrawerCaptain(),
|
||||
|
||||
@@ -98,7 +98,11 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
controller.isSocialPressed = true;
|
||||
await controller
|
||||
.driverCallPassenger();
|
||||
|
||||
launchCommunication('phone',
|
||||
controller.phone.toString(), '');
|
||||
},
|
||||
@@ -107,22 +111,30 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
color: AppColor.blueColor,
|
||||
)),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
controller.isSocialPressed = true;
|
||||
await controller
|
||||
.driverCallPassenger();
|
||||
|
||||
launchCommunication(
|
||||
'whatsapp',
|
||||
controller.phone.toString(),
|
||||
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
'${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
},
|
||||
icon: const Icon(
|
||||
FontAwesome.whatsapp,
|
||||
color: AppColor.greenColor,
|
||||
)),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
controller.isSocialPressed = true;
|
||||
await controller
|
||||
.driverCallPassenger();
|
||||
|
||||
launchCommunication(
|
||||
'sms',
|
||||
controller.phone.toString(),
|
||||
'${'Hello this is Captain'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
'${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.sms_rounded,
|
||||
@@ -130,6 +142,7 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
)),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
controller.isSocialPressed = true;
|
||||
launchCommunication(
|
||||
'email',
|
||||
controller.phone.toString(),
|
||||
@@ -203,20 +216,25 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
? MyElevatedButton(
|
||||
title: 'I arrive you'.tr,
|
||||
kolor: AppColor.yellowColor,
|
||||
onPressed: () {
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Hi ,I Arrive your site'
|
||||
.tr,
|
||||
'I Arrive your site'
|
||||
.tr,
|
||||
controller
|
||||
.tokenPassenger,
|
||||
[]);
|
||||
controller
|
||||
.startTimerToShowDriverWaitPassengerDuration();
|
||||
controller.isArrivedSend =
|
||||
false;
|
||||
onPressed: () async {
|
||||
if (controller
|
||||
.calculateDistanseBetweenDriverAndPassengerLocation() <
|
||||
40) {
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Hi ,I Arrive your site'
|
||||
.tr,
|
||||
'I Arrive your site'
|
||||
.tr,
|
||||
controller
|
||||
.tokenPassenger,
|
||||
[]);
|
||||
controller
|
||||
.startTimerToShowDriverWaitPassengerDuration();
|
||||
controller
|
||||
.isArrivedSend =
|
||||
false;
|
||||
}
|
||||
})
|
||||
: const SizedBox()
|
||||
],
|
||||
@@ -259,21 +277,31 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
.tr,
|
||||
kolor: AppColor
|
||||
.deepPurpleAccent,
|
||||
onPressed: () async {
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Driver Cancel Your Trip'
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
'Are you sure to cancel?'
|
||||
.tr,
|
||||
'You will be pay the cost to driver or we will get it from you on next trip'
|
||||
.tr,
|
||||
controller
|
||||
.tokenPassenger,
|
||||
[]);
|
||||
await controller
|
||||
.addWaittingTimeCostFromPassengerToDriverWallet();
|
||||
controller
|
||||
.isdriverWaitTimeEnd =
|
||||
false;
|
||||
confirm:
|
||||
MyElevatedButton(
|
||||
title:
|
||||
'Yes'.tr,
|
||||
onPressed:
|
||||
() async {
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Driver Cancel Your Trip'
|
||||
.tr,
|
||||
'You will be pay the cost to driver or we will get it from you on next trip'
|
||||
.tr,
|
||||
controller
|
||||
.tokenPassenger,
|
||||
[]);
|
||||
await controller
|
||||
.addWaittingTimeCostFromPassengerToDriverWallet();
|
||||
controller
|
||||
.isdriverWaitTimeEnd =
|
||||
false;
|
||||
}));
|
||||
})
|
||||
: const SizedBox(),
|
||||
],
|
||||
|
||||
25
lib/views/home/Captin/orderCaptin/call.dart
Normal file
25
lib/views/home/Captin/orderCaptin/call.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:ride/constant/api_key.dart';
|
||||
// import 'package:ride/constant/box_name.dart';
|
||||
// import 'package:ride/main.dart';
|
||||
// import 'package:zego_uikit_prebuilt_call/zego_uikit_prebuilt_call.dart';
|
||||
|
||||
// class CallPage extends StatelessWidget {
|
||||
// const CallPage({Key? key, required this.callID}) : super(key: key);
|
||||
// final String callID;
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return ZegoUIKitPrebuiltCall(
|
||||
// appID: AK
|
||||
// .zegoCloudAppID, // Fill in the appID that you get from ZEGOCLOUD Admin Console.
|
||||
// appSign: AK
|
||||
// .zegoCloudAppSIGN, // Fill in the appSign that you get from ZEGOCLOUD Admin Console.
|
||||
// userID: box.read(BoxName.passengerID) ?? box.read(BoxName.driverID),
|
||||
// userName: box.read(BoxName.name) ?? box.read(BoxName.nameDriver),
|
||||
// callID: callID,
|
||||
// // You can also use groupVideo/groupVoice/oneOnOneVoice to make more types of calls.
|
||||
// config: ZegoUIKitPrebuiltCallConfig.oneOnOneVoiceCall(),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
@@ -223,6 +223,7 @@ class OrderRequestPage extends StatelessWidget {
|
||||
'passengerLocation': myList[0].toString(),
|
||||
'passengerDestination': myList[1].toString(),
|
||||
'Duration': myList[4].toString(),
|
||||
'totalCost': myList[2].toString(),
|
||||
'Distance': myList[5].toString(),
|
||||
'name': myList[8].toString(),
|
||||
'phone': myList[10].toString(),
|
||||
@@ -276,8 +277,6 @@ class OrderRequestPage extends StatelessWidget {
|
||||
box.read(BoxName.nameDriver).toString(),
|
||||
box.read(BoxName.tokenDriver).toString(),
|
||||
];
|
||||
orderRequestController.refuseOrder(
|
||||
myList[16].toString(), body.toString());
|
||||
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
@@ -287,6 +286,8 @@ class OrderRequestPage extends StatelessWidget {
|
||||
// box.read(BoxName.tokenDriver).toString(),
|
||||
bodyToPassenger,
|
||||
);
|
||||
orderRequestController.refuseOrder(
|
||||
myList[16].toString(), body.toString());
|
||||
},
|
||||
kolor: AppColor.redColor,
|
||||
),
|
||||
|
||||
@@ -2,8 +2,10 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/info.dart';
|
||||
import 'package:ride/controller/payment/payment_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
@@ -13,431 +15,476 @@ import '../../../controller/home/map_passenger_controller.dart';
|
||||
GetBuilder<MapPassengerController> buttomSheetMapPage() {
|
||||
Get.put(PaymentController());
|
||||
return GetBuilder<MapPassengerController>(
|
||||
builder: (controller) => controller.isBottomSheetShown &&
|
||||
controller.rideConfirm == false
|
||||
? Positioned(
|
||||
left: 5,
|
||||
bottom: 0,
|
||||
right: 5,
|
||||
child: AnimatedContainer(
|
||||
// clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
curve: Curves.easeInCirc,
|
||||
onEnd: () {
|
||||
controller.height = 250;
|
||||
},
|
||||
height: controller.heightBottomSheetShown,
|
||||
duration: const Duration(seconds: 2),
|
||||
child: Column(
|
||||
children: [
|
||||
controller.data.isEmpty
|
||||
? const SizedBox()
|
||||
: Container(
|
||||
// width: Get.width * .9,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
boxShadow: [
|
||||
const BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
offset: Offset(2, 2)),
|
||||
BoxShadow(
|
||||
color:
|
||||
AppColor.accentColor.withOpacity(.4),
|
||||
offset: const Offset(-2, -2))
|
||||
],
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(15))),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .15,
|
||||
builder: (controller) =>
|
||||
controller.isBottomSheetShown && controller.rideConfirm == false
|
||||
? Positioned(
|
||||
left: 5,
|
||||
bottom: 0,
|
||||
right: 5,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
double.parse(box.read(BoxName.passengerWalletTotal)) <
|
||||
0 &&
|
||||
controller.data.isNotEmpty
|
||||
? Container(
|
||||
decoration: AppStyle.boxDecoration.copyWith(
|
||||
color: AppColor.redColor.withOpacity(.5)),
|
||||
height: 50,
|
||||
width: Get.width * .94,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/jeep.png',
|
||||
width: 50,
|
||||
fit: BoxFit.fill,
|
||||
repeat: ImageRepeat.repeatX,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8),
|
||||
child: Text(
|
||||
'Your trip cost is'.tr +
|
||||
' ${controller.totalCostPassenger.toStringAsFixed(2)} '
|
||||
'But you have a negative salary of'
|
||||
.tr +
|
||||
'${double.parse(box.read(BoxName.passengerWalletTotal)).toStringAsFixed(2)}'
|
||||
' in your'
|
||||
.tr +
|
||||
' ${AppInformation.appName}'
|
||||
' wallet due to a previous trip.'
|
||||
.tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .55,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
controller.hours > 1
|
||||
? '${'Your Ride Duration is '.tr}${controller.hours} H and ${controller.minutes} m'
|
||||
: '${'Your Ride Duration is '.tr} ${controller.minutes} m',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
// Text(
|
||||
// '${'You will be thier in'.tr} ${DateFormat('h:mm a').format(controller.newTime)}',
|
||||
// style: AppStyle.subtitle,
|
||||
// ),
|
||||
Text(
|
||||
'${'Your trip distance is'.tr} ${controller.distance.toStringAsFixed(2)} KM',
|
||||
style: AppStyle.subtitle,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .2,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 5, left: 5),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
))
|
||||
: const SizedBox(),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
AnimatedContainer(
|
||||
// clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
curve: Curves.easeInCirc,
|
||||
onEnd: () {
|
||||
controller.height = 250;
|
||||
},
|
||||
height: controller.heightBottomSheetShown,
|
||||
duration: const Duration(seconds: 2),
|
||||
child: Column(
|
||||
children: [
|
||||
controller.data.isEmpty
|
||||
? const SizedBox()
|
||||
: Container(
|
||||
// width: Get.width * .9,
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
boxShadow: [
|
||||
const BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
offset: Offset(2, 2)),
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor
|
||||
.withOpacity(.4),
|
||||
offset: const Offset(-2, -2))
|
||||
],
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(15))),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width: Get.width * .14,
|
||||
height: Get.height * .06,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(
|
||||
width: 2,
|
||||
color: AppColor.greenColor)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${'Fee is'.tr} \n${controller.totalPassenger.toStringAsFixed(2)}',
|
||||
style: AppStyle.subtitle,
|
||||
SizedBox(
|
||||
width: Get.width * .15,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Image.asset(
|
||||
'assets/images/jeep.png',
|
||||
width: 50,
|
||||
fit: BoxFit.fill,
|
||||
repeat: ImageRepeat.repeatX,
|
||||
),
|
||||
),
|
||||
),
|
||||
controller.promoTaken
|
||||
? const Icon(
|
||||
Icons.filter_vintage_rounded,
|
||||
color: AppColor.redColor,
|
||||
SizedBox(
|
||||
width: Get.width * .55,
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text(
|
||||
controller.hours > 1
|
||||
? '${'Your Ride Duration is '.tr}${controller.hours} H and ${controller.minutes} m'
|
||||
: '${'Your Ride Duration is '.tr} ${controller.minutes} m',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
// Text(
|
||||
// '${'You will be thier in'.tr} ${DateFormat('h:mm a').format(controller.newTime)}',
|
||||
// style: AppStyle.subtitle,
|
||||
// ),
|
||||
Text(
|
||||
'${'Your trip distance is'.tr} ${controller.distance.toStringAsFixed(2)} KM',
|
||||
style: AppStyle.subtitle,
|
||||
)
|
||||
: const SizedBox(
|
||||
height: 0,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Container(
|
||||
// height: 130,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
boxShadow: [
|
||||
const BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
offset: Offset(2, 2)),
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor.withOpacity(.4),
|
||||
offset: const Offset(-2, -2))
|
||||
],
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(15))),
|
||||
child: controller.data.isEmpty
|
||||
? const SizedBox()
|
||||
: Center(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 5),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.location_on,
|
||||
color: AppColor.redColor,
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'From : '.tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
controller.data[0]['start_address']
|
||||
.toString(),
|
||||
style: AppStyle.subtitle,
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.location_searching_rounded),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'To : '.tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
controller.data[0]['end_address'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: AppColor.accentColor,
|
||||
thickness: 1,
|
||||
height: 2,
|
||||
indent: 1,
|
||||
),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(12),
|
||||
// border: Border.all(),
|
||||
),
|
||||
child: Row(
|
||||
SizedBox(
|
||||
width: Get.width * .2,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
right: 5, left: 5),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.monetization_on,
|
||||
color: Colors.green[400],
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
controller
|
||||
.changeCashConfirmPageShown();
|
||||
Get.find<
|
||||
PaymentController>()
|
||||
.getPassengerWallet();
|
||||
},
|
||||
child: GetBuilder<
|
||||
PaymentController>(
|
||||
builder:
|
||||
(paymentController) =>
|
||||
paymentController
|
||||
.isCashChecked
|
||||
? Text(
|
||||
'CASH',
|
||||
style: AppStyle
|
||||
.title,
|
||||
)
|
||||
: Text(
|
||||
'${AppInformation.appName} Wallet',
|
||||
style: AppStyle
|
||||
.title,
|
||||
),
|
||||
Container(
|
||||
width: Get.width * .14,
|
||||
height: Get.height * .06,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor
|
||||
.secondaryColor,
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(
|
||||
width: 2,
|
||||
color: AppColor
|
||||
.greenColor)),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'${'Fee is'.tr} \n${controller.totalPassenger.toStringAsFixed(2)}',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
),
|
||||
controller.promoTaken
|
||||
? const Icon(
|
||||
Icons
|
||||
.filter_vintage_rounded,
|
||||
color:
|
||||
AppColor.redColor,
|
||||
)
|
||||
: const SizedBox(
|
||||
height: 0,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 40,
|
||||
),
|
||||
GetBuilder<PaymentController>(
|
||||
builder:
|
||||
(paymentController) =>
|
||||
Container(
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: AppColor
|
||||
.secondaryColor,
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons
|
||||
.qr_code_2_rounded,
|
||||
color: Colors
|
||||
.green[400],
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (controller
|
||||
.promoTaken ==
|
||||
false) {
|
||||
Get.defaultDialog(
|
||||
title: 'Add Promo'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width:
|
||||
Get.width * .7,
|
||||
child:
|
||||
TextFormField(
|
||||
controller: controller.promo,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Promo Code'.tr,
|
||||
hintText: 'Enter promo code'.tr,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.grey[200],
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: AppColor.primaryColor,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.red,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
MyElevatedButton(
|
||||
title:
|
||||
'Add Promo'.tr,
|
||||
onPressed:
|
||||
() async {
|
||||
controller.applyPromoCodeToPassenger();
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
} else {
|
||||
Get.snackbar(
|
||||
'You have promo!'
|
||||
.tr,
|
||||
'',
|
||||
backgroundColor:
|
||||
AppColor
|
||||
.redColor);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
'Add Promo'.tr,
|
||||
style: AppStyle
|
||||
.title,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .95,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
controller.isCashSelectedBeforeConfirmRide ==
|
||||
false
|
||||
? MyElevatedButton(
|
||||
title: 'Next'.tr,
|
||||
onPressed: () {
|
||||
controller
|
||||
.changeCashConfirmPageShown();
|
||||
},
|
||||
),
|
||||
],
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Container(
|
||||
// height: 130,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
boxShadow: [
|
||||
const BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
offset: Offset(2, 2)),
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor
|
||||
.withOpacity(.4),
|
||||
offset: const Offset(-2, -2))
|
||||
],
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(15))),
|
||||
child: controller.data.isEmpty
|
||||
? const SizedBox()
|
||||
: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 5),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.location_on,
|
||||
color: AppColor.redColor,
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'From : '.tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
controller.data[0]
|
||||
['start_address']
|
||||
.toString(),
|
||||
style: AppStyle.subtitle,
|
||||
)
|
||||
: controller.isPassengerChosen ==
|
||||
false
|
||||
? MyElevatedButton(
|
||||
title: 'Next'.tr,
|
||||
onPressed: () {
|
||||
controller
|
||||
.onChangedPassengersChoose();
|
||||
Get.defaultDialog(
|
||||
barrierDismissible:
|
||||
false,
|
||||
title:
|
||||
'How Many Passengers?'
|
||||
.tr,
|
||||
titleStyle:
|
||||
AppStyle.title,
|
||||
content: Column(
|
||||
children: [
|
||||
Text(
|
||||
'Allowed up to 4 Passengers.'
|
||||
.tr,
|
||||
style: AppStyle
|
||||
.title,
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
200, // Set the desired height here
|
||||
child:
|
||||
CupertinoPicker(
|
||||
itemExtent:
|
||||
32,
|
||||
onSelectedItemChanged:
|
||||
(index) {
|
||||
controller.onChangedPassengerCount(
|
||||
index +
|
||||
1);
|
||||
},
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons
|
||||
.location_searching_rounded),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'To : '.tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
controller.data[0]
|
||||
['end_address'],
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
color: AppColor.accentColor,
|
||||
thickness: 1,
|
||||
height: 2,
|
||||
indent: 1,
|
||||
),
|
||||
SizedBox(
|
||||
height: 40,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor
|
||||
.secondaryColor,
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
12),
|
||||
// border: Border.all(),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.monetization_on,
|
||||
color:
|
||||
Colors.green[400],
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
controller
|
||||
.changeCashConfirmPageShown();
|
||||
Get.find<
|
||||
PaymentController>()
|
||||
.getPassengerWallet();
|
||||
},
|
||||
child: GetBuilder<
|
||||
PaymentController>(
|
||||
builder: (paymentController) =>
|
||||
paymentController
|
||||
.isCashChecked
|
||||
? Text(
|
||||
'CASH',
|
||||
style: AppStyle
|
||||
.title,
|
||||
)
|
||||
: Text(
|
||||
'${AppInformation.appName} Wallet',
|
||||
style: AppStyle
|
||||
.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 40,
|
||||
),
|
||||
GetBuilder<PaymentController>(
|
||||
builder:
|
||||
(paymentController) =>
|
||||
Container(
|
||||
decoration:
|
||||
BoxDecoration(
|
||||
color: AppColor
|
||||
.secondaryColor,
|
||||
borderRadius:
|
||||
BorderRadius
|
||||
.circular(
|
||||
12),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Text('1 Passenger'
|
||||
.tr),
|
||||
Text('2 Passengers'
|
||||
.tr),
|
||||
Text('3 Passengers'
|
||||
.tr),
|
||||
Text('4 Passengers'
|
||||
.tr),
|
||||
Icon(
|
||||
Icons
|
||||
.qr_code_2_rounded,
|
||||
color: Colors
|
||||
.green[
|
||||
400],
|
||||
),
|
||||
InkWell(
|
||||
onTap:
|
||||
() {
|
||||
if (controller.promoTaken ==
|
||||
false) {
|
||||
Get.defaultDialog(
|
||||
title: 'Add Promo'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: Get.width * .7,
|
||||
child: TextFormField(
|
||||
controller: controller.promo,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Promo Code'.tr,
|
||||
hintText: 'Enter promo code'.tr,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
filled: true,
|
||||
fillColor: Colors.grey[200],
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: AppColor.primaryColor,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
errorBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.red,
|
||||
width: 2.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: const BorderSide(
|
||||
color: Colors.grey,
|
||||
width: 1.0,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Add Promo'.tr,
|
||||
onPressed: () async {
|
||||
controller.applyPromoCodeToPassenger();
|
||||
},
|
||||
)
|
||||
],
|
||||
));
|
||||
} else {
|
||||
Get.snackbar(
|
||||
'You have promo!'.tr,
|
||||
'',
|
||||
backgroundColor: AppColor.redColor);
|
||||
}
|
||||
},
|
||||
child:
|
||||
Text(
|
||||
'Add Promo'
|
||||
.tr,
|
||||
style: AppStyle
|
||||
.title,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Back',
|
||||
onPressed: () =>
|
||||
Get.back(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: MyElevatedButton(
|
||||
title: 'Confirm Selection'
|
||||
.tr,
|
||||
onPressed: () {
|
||||
controller
|
||||
.changeConfirmRide();
|
||||
},
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.width * .95,
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.center,
|
||||
children: [
|
||||
controller.isCashSelectedBeforeConfirmRide ==
|
||||
false
|
||||
? MyElevatedButton(
|
||||
title: 'Next'.tr,
|
||||
onPressed: () {
|
||||
controller
|
||||
.changeCashConfirmPageShown();
|
||||
},
|
||||
)
|
||||
: controller.isPassengerChosen ==
|
||||
false
|
||||
? MyElevatedButton(
|
||||
title: 'Next'.tr,
|
||||
onPressed: () {
|
||||
controller
|
||||
.onChangedPassengersChoose();
|
||||
Get.defaultDialog(
|
||||
barrierDismissible:
|
||||
false,
|
||||
title:
|
||||
'How Many Passengers?'
|
||||
.tr,
|
||||
titleStyle:
|
||||
AppStyle
|
||||
.title,
|
||||
content:
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'Allowed up to 4 Passengers.'
|
||||
.tr,
|
||||
style: AppStyle
|
||||
.title,
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
200, // Set the desired height here
|
||||
child:
|
||||
CupertinoPicker(
|
||||
itemExtent:
|
||||
32,
|
||||
onSelectedItemChanged:
|
||||
(index) {
|
||||
controller.onChangedPassengerCount(index +
|
||||
1);
|
||||
},
|
||||
children: [
|
||||
Text('1 Passenger'.tr),
|
||||
Text('2 Passengers'.tr),
|
||||
Text('3 Passengers'.tr),
|
||||
Text('4 Passengers'.tr),
|
||||
],
|
||||
),
|
||||
),
|
||||
MyElevatedButton(
|
||||
title:
|
||||
'Back',
|
||||
onPressed:
|
||||
() =>
|
||||
Get.back(),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: MyElevatedButton(
|
||||
title:
|
||||
'Confirm Selection'
|
||||
.tr,
|
||||
onPressed: () {
|
||||
controller
|
||||
.changeConfirmRide();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox());
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: const SizedBox());
|
||||
}
|
||||
|
||||
class Details extends StatelessWidget {
|
||||
@@ -467,7 +514,7 @@ class Details extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Text(
|
||||
'Cost for .21/km ${controller.cost.toStringAsFixed(2)} ',
|
||||
'Cost for .21/km ${controller.costDistance.toStringAsFixed(2)} ',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
|
||||
@@ -157,6 +157,8 @@ class CashConfirmPageShown extends StatelessWidget {
|
||||
title: 'Next as Cash \$\$!'.tr,
|
||||
onPressed: () {
|
||||
paymentController.isCashChecked = true;
|
||||
paymentController.isWalletChecked = false;
|
||||
paymentController.update();
|
||||
controller.changeCashConfirmPageShown();
|
||||
},
|
||||
),
|
||||
|
||||
@@ -7,8 +7,10 @@ import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/main.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/firebase/local_notification.dart';
|
||||
import '../../../controller/functions/tts.dart';
|
||||
import '../../../controller/home/map_passenger_controller.dart';
|
||||
import '../Captin/orderCaptin/call.dart';
|
||||
|
||||
GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
final textToSpeechController = Get.put(TextToSpeechController());
|
||||
@@ -99,6 +101,26 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
|
||||
),
|
||||
),
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: IconButton(
|
||||
onPressed: () {
|
||||
NotificationController()
|
||||
.showNotification('Order', 'hi this is', 'tone1');
|
||||
// Get.to(() => CallPage(callID: '111'));
|
||||
// Get.to(() => CallPage(callID: controller.rideId));
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.call,
|
||||
size: 29,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'You will arrive to your destination after '.tr,
|
||||
'You will arrive to your destination after timer end.'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Stack(
|
||||
@@ -45,7 +45,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
color: controller.remainingTimeTimerRideBegin < 60
|
||||
? AppColor.redColor
|
||||
: AppColor.greenColor,
|
||||
minHeight: 50,
|
||||
minHeight: 45,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
value: controller.progressTimerRideBegin.toDouble(),
|
||||
),
|
||||
@@ -61,45 +61,52 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
if (box.read(BoxName.sosPhonePassenger).toString() ==
|
||||
'') {
|
||||
Get.defaultDialog(
|
||||
title: 'You dont Add Emergency Phone Yet!'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
Form(
|
||||
key: controller.sosFormKey,
|
||||
child: TextFormField(
|
||||
keyboardType: TextInputType
|
||||
.phone, // Set the keyboard type to phone
|
||||
validator: (value) {
|
||||
if (value!.isEmpty ||
|
||||
value.length != 10) {
|
||||
return 'Please enter a valid phone number'
|
||||
.tr;
|
||||
}
|
||||
// Add additional validation if needed
|
||||
return null;
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
hintText: 'Type here',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Add Phone'.tr,
|
||||
onPressed: () async {
|
||||
await profileController
|
||||
.updatField('sosPhone');
|
||||
box.write(
|
||||
BoxName.sosPhonePassenger,
|
||||
profileController
|
||||
.prfoileData['sosPhone']);
|
||||
}));
|
||||
onPressed: () async {
|
||||
if (box.read(BoxName.sosPhonePassenger) == null) {
|
||||
{
|
||||
await profileController.updatField(
|
||||
'sosPhone', TextInputType.phone);
|
||||
box.write(BoxName.sosPhonePassenger,
|
||||
profileController.prfoileData['sosPhone']);
|
||||
}
|
||||
// Get.defaultDialog(
|
||||
// title: 'You dont Add Emergency Phone Yet!'.tr,
|
||||
// content: Column(
|
||||
// children: [
|
||||
// Form(
|
||||
// key: controller.sosFormKey,
|
||||
// child: TextFormField(
|
||||
// keyboardType: TextInputType
|
||||
// .phone, // Set the keyboard type to phone
|
||||
// controller:
|
||||
// controller.sosPhonePassengerProfile,
|
||||
// validator: (value) {
|
||||
// if (value!.isEmpty ||
|
||||
// value.length != 10) {
|
||||
// return 'Please enter a valid phone number'
|
||||
// .tr;
|
||||
// }
|
||||
// // Add additional validation if needed
|
||||
// return null;
|
||||
// },
|
||||
// decoration: const InputDecoration(
|
||||
// border: OutlineInputBorder(),
|
||||
// hintText: 'Type here',
|
||||
// ),
|
||||
// ),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// confirm: MyElevatedButton(
|
||||
// title: 'Add Phone'.tr,
|
||||
// onPressed: () async {
|
||||
// await profileController
|
||||
// .updatField('sosPhone');
|
||||
// box.write(
|
||||
// BoxName.sosPhonePassenger,
|
||||
// profileController
|
||||
// .prfoileData['sosPhone']);
|
||||
// }));
|
||||
} else {
|
||||
controller
|
||||
.sendSMS(box.read(BoxName.sosPhonePassenger));
|
||||
@@ -111,48 +118,24 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
if (box.read(BoxName.sosPhonePassenger).toString() ==
|
||||
'') {
|
||||
Get.defaultDialog(
|
||||
title: 'You dont Add Emergency Phone Yet!'.tr,
|
||||
content: Column(
|
||||
children: [
|
||||
Form(
|
||||
key: controller.sosFormKey,
|
||||
child: TextFormField(
|
||||
keyboardType: TextInputType
|
||||
.phone, // Set the keyboard type to phone
|
||||
validator: (value) {
|
||||
if (value!.isEmpty ||
|
||||
value.length < 10) {
|
||||
return 'Please enter a phone number'
|
||||
.tr;
|
||||
}
|
||||
// Add additional validation if needed
|
||||
return null;
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
hintText: 'Type here',
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Add Phone'.tr,
|
||||
onPressed: () async {
|
||||
await profileController
|
||||
.updatField('sosPhone');
|
||||
box.write(
|
||||
BoxName.sosPhonePassenger,
|
||||
profileController
|
||||
.prfoileData['sosPhone']);
|
||||
}));
|
||||
onPressed: () async {
|
||||
print(box.read(BoxName.sosPhonePassenger));
|
||||
if (box.read(BoxName.sosPhonePassenger) == null ||
|
||||
box.read(BoxName.sosPhonePassenger) == 'sos') {
|
||||
{
|
||||
await profileController.updatField(
|
||||
'sosPhone', TextInputType.phone);
|
||||
box.write(BoxName.sosPhonePassenger,
|
||||
profileController.prfoileData['sosPhone']);
|
||||
}
|
||||
} else {
|
||||
controller.sendWhatsapp(
|
||||
box.read(BoxName.sosPhonePassenger).toString());
|
||||
String phoneNumber =
|
||||
box.read(BoxName.sosPhonePassenger).toString();
|
||||
phoneNumber = phoneNumber.replaceAll('0', '');
|
||||
print(phoneNumber); // Output: 798583061
|
||||
var phone =
|
||||
'+962${box.read(BoxName.sosPhonePassenger)}';
|
||||
controller.sendWhatsapp(phone);
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
|
||||
@@ -55,7 +55,8 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
subtitle: Text(
|
||||
'${controller.prfoileData['first_name']} ${controller.prfoileData['last_name']}'),
|
||||
onTap: () {
|
||||
controller.updatField('first_name');
|
||||
controller.updatField(
|
||||
'first_name', TextInputType.name);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@@ -144,7 +145,8 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
.prfoileData['employmentType']
|
||||
.toString()),
|
||||
onTap: () {
|
||||
controller.updatField('employmentType');
|
||||
controller.updatField(
|
||||
'employmentType', TextInputType.name);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@@ -161,7 +163,8 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
.prfoileData['maritalStatus']
|
||||
.toString()),
|
||||
onTap: () {
|
||||
controller.updatField('maritalStatus');
|
||||
controller.updatField(
|
||||
'maritalStatus', TextInputType.name);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
@@ -178,7 +181,8 @@ class PassengerProfilePage extends StatelessWidget {
|
||||
subtitle: Text(controller.prfoileData['sosPhone']
|
||||
.toString()),
|
||||
onTap: () async {
|
||||
await controller.updatField('sosPhone');
|
||||
await controller.updatField(
|
||||
'sosPhone', TextInputType.phone);
|
||||
box.write(BoxName.sosPhonePassenger,
|
||||
controller.prfoileData['sosPhone']);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user