2/25/1
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
class BoxName {
|
||||
static const String driverID = "driverID";
|
||||
static const String countryCode = "countryCode";
|
||||
|
||||
static const String lang = "lang";
|
||||
static const String statusDriverLocation = "statusDriverLocation";
|
||||
|
||||
@@ -129,7 +129,7 @@ class AppLink {
|
||||
|
||||
////////////////emails ============//
|
||||
static String sendEmailToPassengerForTripDetails =
|
||||
"$ride/rate/emailToPassengerTripDetail.php";
|
||||
"$ride/rides/emailToPassengerTripDetail.php";
|
||||
|
||||
// ===========================================
|
||||
static String pathImage = "$server/upload/types/";
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import 'dart:convert';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:SEFER/env/env.dart';
|
||||
|
||||
import '../../constant/api_key.dart';
|
||||
import '../home/captin/map_driver_controller.dart';
|
||||
|
||||
class CRUD {
|
||||
Future<dynamic> get({
|
||||
@@ -189,6 +191,28 @@ class CRUD {
|
||||
return (jsonData['status']);
|
||||
}
|
||||
|
||||
sendEmail(
|
||||
String link,
|
||||
Map<String, String>? payload,
|
||||
) async {
|
||||
var headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
|
||||
};
|
||||
var request = http.Request('POST', Uri.parse(link));
|
||||
request.bodyFields = payload!;
|
||||
request.headers.addAll(headers);
|
||||
|
||||
http.StreamedResponse response = await request.send();
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
print(await response.stream.bytesToString());
|
||||
} else {
|
||||
print(response.reasonPhrase);
|
||||
}
|
||||
}
|
||||
|
||||
Future<dynamic> postFromDialogue({
|
||||
required String link,
|
||||
Map<String, dynamic>? payload,
|
||||
|
||||
@@ -101,6 +101,12 @@ class LogOutController extends GetxController {
|
||||
box.remove(BoxName.phone);
|
||||
box.remove(BoxName.tokenFCM);
|
||||
box.remove(BoxName.tokens);
|
||||
box.remove(BoxName.addHome);
|
||||
box.remove(BoxName.addWork);
|
||||
box.remove(BoxName.agreeTerms);
|
||||
box.remove(BoxName.apiKeyRun);
|
||||
box.remove(BoxName.countryCode);
|
||||
box.remove(BoxName.accountIdStripeConnect);
|
||||
Get.offAll(OnBoardingPage());
|
||||
},
|
||||
child: Text(
|
||||
|
||||
@@ -144,7 +144,7 @@ class HomeCaptainController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
GoogleMapController? mapHomeCaptaiController;
|
||||
late GoogleMapController mapHomeCaptaiController;
|
||||
void onMapCreated(GoogleMapController controller) {
|
||||
mapHomeCaptaiController = controller;
|
||||
controller.getVisibleRegion();
|
||||
|
||||
@@ -49,6 +49,8 @@ class MapDriverController extends GetxController {
|
||||
late String totalCost;
|
||||
late String distance;
|
||||
late String name;
|
||||
late String email;
|
||||
late String totalPassenger;
|
||||
late String phone;
|
||||
late String rideId;
|
||||
late String isHaveSteps;
|
||||
@@ -69,7 +71,7 @@ class MapDriverController extends GetxController {
|
||||
bool isdriverWaitTimeEnd = false;
|
||||
bool isRideFinished = false;
|
||||
bool isRideStarted = false;
|
||||
double passengerInfoWindow = Get.height * .35;
|
||||
double passengerInfoWindow = Get.height * .39;
|
||||
double driverEndPage = 100;
|
||||
double progress = 0;
|
||||
double progressToPassenger = 0;
|
||||
@@ -406,11 +408,11 @@ class MapDriverController extends GetxController {
|
||||
}
|
||||
print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}');
|
||||
if (double.parse(passengerWalletBurc) < 0) {
|
||||
print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
|
||||
});
|
||||
print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
|
||||
}
|
||||
Future.delayed(const Duration(milliseconds: 300));
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
@@ -718,6 +720,8 @@ class MapDriverController extends GetxController {
|
||||
driverId = Get.arguments['driverId'];
|
||||
distance = Get.arguments['Distance'];
|
||||
name = Get.arguments['name'];
|
||||
email = Get.arguments['email'];
|
||||
totalPassenger = Get.arguments['totalPassenger'];
|
||||
phone = Get.arguments['phone'];
|
||||
walletChecked = Get.arguments['WalletChecked'];
|
||||
tokenPassenger = Get.arguments['tokenPassenger'];
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:geolocator/geolocator.dart';
|
||||
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:intl/intl.dart';
|
||||
import 'package:location/location.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
@@ -120,6 +121,9 @@ class MapPassengerController extends GetxController {
|
||||
bool rideConfirm = false;
|
||||
bool isMarkersShown = false;
|
||||
bool isMainBottomMenuMap = true;
|
||||
late Timer markerReloadingTimer2;
|
||||
late Timer markerReloadingTimer1;
|
||||
late int duration1;
|
||||
bool isWayPointSheet = false;
|
||||
bool isWayPointStopsSheet = false;
|
||||
bool isWayPointStopsSheetUtilGetMap = false;
|
||||
@@ -516,7 +520,13 @@ class MapPassengerController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
late String arrivalTime;
|
||||
void rideIsBeginPassengerTimer() async {
|
||||
// Calculate arrival time considering current time and duration
|
||||
DateTime now = DateTime.now();
|
||||
DateTime arrivalTime1 = now.add(Duration(seconds: durationToRide));
|
||||
arrivalTime = DateFormat('hh:mm').format(arrivalTime1);
|
||||
|
||||
for (int i = 0; i <= durationToRide; i++) {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
progressTimerRideBegin = i / durationToRide;
|
||||
@@ -762,6 +772,7 @@ class MapPassengerController extends GetxController {
|
||||
? double.parse(box.read(BoxName.passengerWalletTotal))
|
||||
.toStringAsFixed(2)
|
||||
: '0',
|
||||
box.read(BoxName.email).toString(),
|
||||
];
|
||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||
'Order',
|
||||
@@ -1022,6 +1033,8 @@ class MapPassengerController extends GetxController {
|
||||
"order_id": rideId.toString(), // Convert to String
|
||||
"status": 'Cancel'
|
||||
});
|
||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||
'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []);
|
||||
}
|
||||
rideConfirm = false;
|
||||
shouldFetch = false;
|
||||
@@ -1407,9 +1420,6 @@ class MapPassengerController extends GetxController {
|
||||
// });
|
||||
// }
|
||||
|
||||
late Timer markerReloadingTimer2;
|
||||
late Timer markerReloadingTimer1;
|
||||
late int duration1;
|
||||
void startMarkerReloading() {
|
||||
int reloadCount = 0;
|
||||
|
||||
@@ -1461,61 +1471,61 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
getNearestDriverByPassengerLocation() async {
|
||||
if (polyLines.isEmpty || data.isEmpty) {
|
||||
if (rideConfirm == false) {
|
||||
double nearestDistance = double.infinity;
|
||||
if (dataCarsLocationByPassenger != 'failure') {
|
||||
if (dataCarsLocationByPassenger['message'].length > 0) {
|
||||
for (var i = 0;
|
||||
i < dataCarsLocationByPassenger['message'].length;
|
||||
i++) {
|
||||
var carLocation = dataCarsLocationByPassenger['message'][i];
|
||||
return null; // Early return if data is empty
|
||||
}
|
||||
if (!rideConfirm) {
|
||||
double nearestDistance = double.infinity;
|
||||
if (dataCarsLocationByPassenger != 'failure') {
|
||||
if (dataCarsLocationByPassenger['message'].length > 0) {
|
||||
for (var i = 0;
|
||||
i < dataCarsLocationByPassenger['message'].length;
|
||||
i++) {
|
||||
var carLocation = dataCarsLocationByPassenger['message'][i];
|
||||
|
||||
// }
|
||||
// isloading = true;
|
||||
// }
|
||||
// isloading = true;
|
||||
update();
|
||||
// Make API request to get exact distance and duration
|
||||
String apiUrl =
|
||||
'${AppLink.googleMapsLink}distancematrix/json?destinations=${carLocation['latitude']},${carLocation['longitude']}&origins=${passengerLocation.latitude},${passengerLocation.longitude}&units=metric&key=${AK.mapAPIKEY}';
|
||||
var response = await CRUD().getGoogleApi(link: apiUrl, payload: {});
|
||||
if (response['status'] == "OK") {
|
||||
var data = response;
|
||||
// Extract distance and duration from the response and handle accordingly
|
||||
int distance1 =
|
||||
data['rows'][0]['elements'][0]['distance']['value'];
|
||||
distanceByPassenger =
|
||||
data['rows'][0]['elements'][0]['distance']['text'];
|
||||
duration1 = data['rows'][0]['elements'][0]['duration']['value'];
|
||||
|
||||
durationFromDriverToPassenger =
|
||||
Duration(seconds: duration1.toInt());
|
||||
newTime1 = currentTime.add(durationFromDriverToPassenger);
|
||||
timeFromDriverToPassenger =
|
||||
newTime1.add(Duration(minutes: 2.toInt()));
|
||||
durationByPassenger =
|
||||
data['rows'][0]['elements'][0]['duration']['text'];
|
||||
update();
|
||||
// Make API request to get exact distance and duration
|
||||
String apiUrl =
|
||||
'${AppLink.googleMapsLink}distancematrix/json?destinations=${carLocation['latitude']},${carLocation['longitude']}&origins=${passengerLocation.latitude},${passengerLocation.longitude}&units=metric&key=${AK.mapAPIKEY}';
|
||||
var response =
|
||||
await CRUD().getGoogleApi(link: apiUrl, payload: {});
|
||||
if (response['status'] == "OK") {
|
||||
var data = response;
|
||||
// Extract distance and duration from the response and handle accordingly
|
||||
int distance1 =
|
||||
data['rows'][0]['elements'][0]['distance']['value'];
|
||||
distanceByPassenger =
|
||||
data['rows'][0]['elements'][0]['distance']['text'];
|
||||
duration1 = data['rows'][0]['elements'][0]['duration']['value'];
|
||||
if (distance1 < nearestDistance) {
|
||||
nearestDistance = distance1.toDouble();
|
||||
|
||||
durationFromDriverToPassenger =
|
||||
Duration(seconds: duration1.toInt());
|
||||
newTime1 = currentTime.add(durationFromDriverToPassenger);
|
||||
timeFromDriverToPassenger =
|
||||
newTime1.add(Duration(minutes: 2.toInt()));
|
||||
durationByPassenger =
|
||||
data['rows'][0]['elements'][0]['duration']['text'];
|
||||
nearestCar = CarLocation(
|
||||
distance: distance1.toDouble(),
|
||||
duration: duration1.toDouble(),
|
||||
id: carLocation['driver_id'],
|
||||
latitude: double.parse(carLocation['latitude']),
|
||||
longitude: double.parse(carLocation['longitude']),
|
||||
);
|
||||
// isloading = false;
|
||||
update();
|
||||
if (distance1 < nearestDistance) {
|
||||
nearestDistance = distance1.toDouble();
|
||||
|
||||
nearestCar = CarLocation(
|
||||
distance: distance1.toDouble(),
|
||||
duration: duration1.toDouble(),
|
||||
id: carLocation['driver_id'],
|
||||
latitude: double.parse(carLocation['latitude']),
|
||||
longitude: double.parse(carLocation['longitude']),
|
||||
);
|
||||
// isloading = false;
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle the distance and duration as needed
|
||||
else {
|
||||
//print(
|
||||
// 'Failed to retrieve distance and duration: ${response['status']}');
|
||||
// Handle the failure case
|
||||
}
|
||||
// Handle the distance and duration as needed
|
||||
else {
|
||||
//print(
|
||||
// 'Failed to retrieve distance and duration: ${response['status']}');
|
||||
// Handle the failure case
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1537,7 +1547,8 @@ class MapPassengerController extends GetxController {
|
||||
driverCarsLocationToPassengerAfterApplied.last.longitude,
|
||||
);
|
||||
if (distance > 500) {
|
||||
cancelRide();
|
||||
isCancelRidePageShown = true;
|
||||
update();
|
||||
} else {
|
||||
Get.defaultDialog(
|
||||
title: 'The Driver Will be in your location soon .'.tr,
|
||||
|
||||
@@ -23,7 +23,7 @@ class SplashScreenController extends GetxController
|
||||
|
||||
animationController = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(seconds: 7),
|
||||
duration: const Duration(seconds: 4),
|
||||
);
|
||||
|
||||
zoomInAnimation = Tween<double>(begin: 1.0, end: 1.5).animate(
|
||||
@@ -45,7 +45,7 @@ class SplashScreenController extends GetxController
|
||||
}
|
||||
|
||||
void startTimer() {
|
||||
Timer(const Duration(seconds: 7), () {
|
||||
Timer(const Duration(seconds: 4), () {
|
||||
box.read(BoxName.onBoarding) == null
|
||||
? Get.off(() => OnBoardingPage())
|
||||
: box.read(BoxName.email) != null
|
||||
|
||||
@@ -115,7 +115,7 @@ class MyTranslation extends Translations {
|
||||
"My Wallet": "محفظتي",
|
||||
"Tariff": "تعرفة",
|
||||
"Settings": "الإعدادات",
|
||||
"Feed Back": "التغذية الراجعة",
|
||||
"Feed Back": "اقتراحات",
|
||||
"Promos": "العروض الترويجية",
|
||||
"Please enter a valid 16-digit card number":
|
||||
"الرجاء إدخال رقم بطاقة صالح مكون من 16 رقمًا",
|
||||
@@ -438,6 +438,14 @@ class MyTranslation extends Translations {
|
||||
'Camera not initilaized yet': "الكاميرا لم تُثبت بعد",
|
||||
'Scan ID MklGoogle': "مسح هوية MklGoogle",
|
||||
'Language': "اللغة",
|
||||
"Jordan": "الأردن",
|
||||
"USA": "الولايات المتحدة الأمريكية",
|
||||
"Egypt": "مصر",
|
||||
"Turkey": "تركيا",
|
||||
"Saudi Arabia": "المملكة العربية السعودية",
|
||||
"Qatar": "قطر",
|
||||
"Bahrain": "البحرين",
|
||||
"Kuwait": "الكويت",
|
||||
'Your trip cost is': "تكلفة رحلتك هي",
|
||||
'But you have a negative salary of': "لكن لديك راتب سلبي بقيمة",
|
||||
' in your': "في",
|
||||
@@ -558,7 +566,11 @@ class MyTranslation extends Translations {
|
||||
'Night': "الليل",
|
||||
'from 23:59 till 05:30': "من 23:59 إلى 05:30",
|
||||
'Rate Driver': "تقييم السائق",
|
||||
'Total Cost is ': ' صافي الربح ',
|
||||
'Write note': 'اكتب ملاحظه',
|
||||
'Time to arrive': 'وقت الوصول',
|
||||
'Ride Summaries': "ملخصات الرحلات",
|
||||
'Total Cost': "المبلغ الاجمالي",
|
||||
'Average of Hours of': "متوسط ساعات",
|
||||
' is ON for this month': "في هذا الشهر",
|
||||
'Days': "أيام",
|
||||
|
||||
@@ -29,6 +29,14 @@ class ProfileController extends GetxController {
|
||||
update();
|
||||
}
|
||||
|
||||
String? selectedCountry;
|
||||
|
||||
void setCountry(String? country) {
|
||||
selectedCountry = country;
|
||||
// box.write(BoxName.countryCode, country);
|
||||
update();
|
||||
}
|
||||
|
||||
updateColumn(Map<String, dynamic> payload) async {
|
||||
isloading = true;
|
||||
update();
|
||||
|
||||
@@ -36,6 +36,7 @@ class RateController extends GetxController {
|
||||
void addRateToPassenger() async {
|
||||
// HomeCaptainController homeCaptainController =
|
||||
// Get.find<HomeCaptainController>();
|
||||
// Get.put(MapDriverController());
|
||||
if (selectedRateItemId < 1) {
|
||||
Get.defaultDialog(
|
||||
title: 'You Should choose rate figure'.tr,
|
||||
@@ -50,18 +51,17 @@ class RateController extends GetxController {
|
||||
'rating': selectedRateItemId.toString(),
|
||||
'comment': comment.text,
|
||||
});
|
||||
await CRUD()
|
||||
.post(link: AppLink.sendEmailToPassengerForTripDetails, payload: {
|
||||
await CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, {
|
||||
'startLocation':
|
||||
Get.find<MapDriverController>().latLngpassengerLocation.toString(),
|
||||
'endLocation': Get.find<MapDriverController>()
|
||||
.latLngPassengerDestination
|
||||
.toString(),
|
||||
Get.find<MapDriverController>().passengerLocation.toString(),
|
||||
'endLocation':
|
||||
Get.find<MapDriverController>().passengerDestination.toString(),
|
||||
'name': Get.find<MapDriverController>().name.toString(),
|
||||
'timeOfTrip': Get.find<MapDriverController>().duration.toString(),
|
||||
'fee': Get.find<MapDriverController>().timeOfOrder.toString(),
|
||||
'timeOfTrip': Get.find<MapDriverController>().timeOfOrder.toString(),
|
||||
'fee': Get.find<MapDriverController>().totalPassenger.toString(),
|
||||
'duration': Get.find<MapDriverController>().duration.toString(),
|
||||
'phone': Get.find<MapDriverController>().phone.toString(),
|
||||
'email': Get.find<MapDriverController>().email.toString(),
|
||||
});
|
||||
// homeCaptainController.isActive = true;
|
||||
// update();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -41,7 +42,8 @@ void main() async {
|
||||
// Get.put(DriverCallController());
|
||||
await AC().gAK();
|
||||
print(
|
||||
'local is t ${WidgetsBinding.instance.platformDispatcher.locale.countryCode}');
|
||||
'local is ${WidgetsBinding.instance.platformDispatcher.locale.countryCode}');
|
||||
|
||||
print(Get.deviceLocale!.countryCode);
|
||||
Stripe.publishableKey = AK.publishableKey;
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ class OnBoardingPage extends StatelessWidget {
|
||||
body: SafeArea(
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
SizedBox(
|
||||
child: const CustomSliderOnBoarding(),
|
||||
height: Get.height * .7,
|
||||
child: const CustomSliderOnBoarding(),
|
||||
),
|
||||
const CustomDotControllerOnBoarding(),
|
||||
// const Spacer(flex: 2),
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:SEFER/views/widgets/my_textField.dart';
|
||||
|
||||
import '../../constant/info.dart';
|
||||
import '../../controller/auth/login_controller.dart';
|
||||
import '../home/profile/passenger_profile_page.dart';
|
||||
import '../widgets/mycircular.dart';
|
||||
import 'register_page.dart';
|
||||
|
||||
@@ -72,6 +73,8 @@ class LoginPage extends StatelessWidget {
|
||||
body: [
|
||||
if (box.read(BoxName.agreeTerms) != 'agreed')
|
||||
agreedPage()
|
||||
else if (box.read(BoxName.countryCode) == null)
|
||||
CountryPicker()
|
||||
else
|
||||
SingleChildScrollView(
|
||||
child: Column(
|
||||
@@ -231,7 +234,10 @@ class LoginPage extends StatelessWidget {
|
||||
displayFullTextOnTap: true,
|
||||
stopPauseOnTap: true,
|
||||
),
|
||||
const Spacer(),
|
||||
// const Spacer(),
|
||||
const SizedBox(
|
||||
height: 40,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () => Get.to(LoginCaptin()),
|
||||
child: Row(
|
||||
|
||||
@@ -8,10 +8,13 @@ import 'package:SEFER/views/widgets/mycircular.dart';
|
||||
|
||||
import '../../../../constant/colors.dart';
|
||||
import '../../../../constant/info.dart';
|
||||
import '../../../../constant/links.dart';
|
||||
import '../../../../constant/style.dart';
|
||||
import '../../../../constant/table_names.dart';
|
||||
import '../../../../controller/functions/crud.dart';
|
||||
import '../../../../controller/functions/location_controller.dart';
|
||||
import '../../../../controller/home/captin/home_captain_controller.dart';
|
||||
import '../../../../controller/home/captin/map_driver_controller.dart';
|
||||
import '../../../../controller/home/captin/order_request_controller.dart';
|
||||
import '../../../../controller/home/captin/widget/call_page.dart';
|
||||
import '../../../../controller/home/captin/widget/connect.dart';
|
||||
@@ -119,7 +122,7 @@ class HomeCaptain extends StatelessWidget {
|
||||
builder: (homeCaptainController) => Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
width: Get.width * .8,
|
||||
height: 80,
|
||||
height: 104,
|
||||
child: Center(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
@@ -195,12 +198,31 @@ class HomeCaptain extends StatelessWidget {
|
||||
// border: Border.all(),
|
||||
// borderRadius: BorderRadius.circular(15)),
|
||||
// child: IconButton(
|
||||
// onPressed: () {
|
||||
// Get.to(
|
||||
// () => const DriverCallPage(),
|
||||
// );
|
||||
// onPressed: () async {
|
||||
// CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, {
|
||||
// 'startLocation': Get.find<MapDriverController>()
|
||||
// .passengerLocation
|
||||
// .toString(),
|
||||
// 'endLocation': Get.find<MapDriverController>()
|
||||
// .passengerDestination
|
||||
// .toString(),
|
||||
// 'name': Get.find<MapDriverController>().name.toString(),
|
||||
// 'timeOfTrip':
|
||||
// Get.find<MapDriverController>().timeOfOrder.toString(),
|
||||
// 'fee': Get.find<MapDriverController>()
|
||||
// .totalPassenger
|
||||
// .toString(),
|
||||
// 'duration':
|
||||
// Get.find<MapDriverController>().duration.toString(),
|
||||
// 'phone': Get.find<MapDriverController>().phone.toString(),
|
||||
// 'email': Get.find<MapDriverController>().email.toString(),
|
||||
// });
|
||||
// },
|
||||
// icon: const Icon(Fontisto.phone),
|
||||
// icon: const Icon(
|
||||
// MaterialCommunityIcons.map_marker_radius,
|
||||
// size: 45,
|
||||
// color: AppColor.blueColor,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
@@ -41,8 +43,9 @@ class GoogleMapApp extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.map,
|
||||
MaterialCommunityIcons.map_marker_radius,
|
||||
size: 45,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
)),
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
@@ -25,12 +26,12 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
? Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 50,
|
||||
bottom: 5,
|
||||
// left: 8,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
height: controller.passengerInfoWindow,
|
||||
width: Get.width * .96,
|
||||
width: Get.width * .99,
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
@@ -39,10 +40,56 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
children: [
|
||||
DefaultTextStyle(
|
||||
style: AppStyle.title,
|
||||
child: Text(
|
||||
'Go to passenger Location now'.tr,
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.greenColor),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Go to passenger Location now'.tr,
|
||||
style: AppStyle.title
|
||||
.copyWith(color: AppColor.greenColor),
|
||||
),
|
||||
controller.isRideBegin
|
||||
? const SizedBox()
|
||||
: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
controller.isSocialPressed =
|
||||
true;
|
||||
await controller
|
||||
.driverCallPassenger();
|
||||
Get.to(
|
||||
() => const CallPage());
|
||||
// launchCommunication('phone',
|
||||
// controller.phone.toString(), '');
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.phone,
|
||||
color: AppColor.blueColor,
|
||||
)),
|
||||
const SizedBox(
|
||||
width: 25,
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
controller.isSocialPressed =
|
||||
true;
|
||||
launchCommunication(
|
||||
'email',
|
||||
controller.phone
|
||||
.toString(),
|
||||
'${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
},
|
||||
child: const Icon(
|
||||
Icons.email,
|
||||
color: AppColor.redColor,
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
// AnimatedTextKit(
|
||||
// animatedTexts: [
|
||||
@@ -64,9 +111,10 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text('Duration of the Ride is '.tr,
|
||||
style: AppStyle.title),
|
||||
Text('${controller.duration} ${'Minute'.tr}',
|
||||
Text(
|
||||
controller.hours > 1
|
||||
? '${'${'Your Ride Duration is '.tr}${controller.hours}${' H and'.tr}'} ${controller.minutes} m'
|
||||
: '${'Your Ride Duration is '.tr} ${controller.minutes} ${'m'.tr}',
|
||||
style: AppStyle.title),
|
||||
],
|
||||
),
|
||||
@@ -90,69 +138,23 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
controller.isRideBegin
|
||||
? const SizedBox()
|
||||
: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
controller.isSocialPressed = true;
|
||||
await controller
|
||||
.driverCallPassenger();
|
||||
Get.to(() => const CallPage());
|
||||
// launchCommunication('phone',
|
||||
// controller.phone.toString(), '');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.phone,
|
||||
color: AppColor.blueColor,
|
||||
)),
|
||||
// IconButton(
|
||||
// onPressed: () async {
|
||||
// controller.isSocialPressed = true;
|
||||
// await controller
|
||||
// .driverCallPassenger();
|
||||
|
||||
// launchCommunication(
|
||||
// 'whatsapp',
|
||||
// controller.phone.toString(),
|
||||
// '${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// FontAwesome.whatsapp,
|
||||
// color: AppColor.greenColor,
|
||||
// )),
|
||||
// IconButton(
|
||||
// onPressed: () async {
|
||||
// controller.isSocialPressed = true;
|
||||
// await controller
|
||||
// .driverCallPassenger();
|
||||
|
||||
// launchCommunication(
|
||||
// 'sms',
|
||||
// controller.phone.toString(),
|
||||
// '${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// Icons.sms_rounded,
|
||||
// color: AppColor.blueColor,
|
||||
// )),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
controller.isSocialPressed = true;
|
||||
launchCommunication(
|
||||
'email',
|
||||
controller.phone.toString(),
|
||||
'${'Hello this is Driver'.tr} ${box.read(BoxName.nameDriver)}');
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.email,
|
||||
color: AppColor.redColor,
|
||||
)),
|
||||
],
|
||||
),
|
||||
Card(
|
||||
elevation: 5,
|
||||
color: AppColor.greenColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4),
|
||||
child: Row(
|
||||
children: [
|
||||
Text('Total Cost is '.tr,
|
||||
style: AppStyle.title),
|
||||
Text(
|
||||
controller.totalPassenger.toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
controller.remainingTimeToPassenger != 0
|
||||
? Stack(
|
||||
children: [
|
||||
@@ -331,7 +333,7 @@ class PassengerInfoWindow extends StatelessWidget {
|
||||
)
|
||||
: controller.remainingTimeToShowPassengerInfoWindowFromDriver > 0 //
|
||||
? Positioned(
|
||||
bottom: Get.height * .3,
|
||||
bottom: Get.height * .2,
|
||||
left: 15,
|
||||
child: Container(
|
||||
decoration: AppStyle.boxDecoration,
|
||||
|
||||
@@ -227,6 +227,7 @@ class OrderRequestPage extends StatelessWidget {
|
||||
'Distance': myList[5].toString(),
|
||||
'name': myList[8].toString(),
|
||||
'phone': myList[10].toString(),
|
||||
'email': myList[28].toString(),
|
||||
'WalletChecked': myList[13].toString(),
|
||||
'tokenPassenger': myList[9].toString(),
|
||||
'direction':
|
||||
@@ -247,6 +248,7 @@ class OrderRequestPage extends StatelessWidget {
|
||||
'step4': myList[25].toString(),
|
||||
'passengerWalletBurc': myList[26].toString(),
|
||||
'timeOfOrder': DateTime.now().toString(),
|
||||
'totalPassenger': myList[2].toString(),
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:SEFER/views/home/profile/feed_back_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -32,9 +33,56 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'You will arrive to your destination after timer end.'.tr,
|
||||
style: AppStyle.title,
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
// 'You will arrive to your destination after timer end.'.tr,
|
||||
'Time to arrive'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.arrivalTime,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'Total Cost'.tr,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
controller.totalPassenger.toStringAsFixed(2),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Text('Write note'.tr),
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Get.to(
|
||||
() => FeedBackPage(),
|
||||
transition: Transition.downToUp,
|
||||
);
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.note_add,
|
||||
color: AppColor.redColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Stack(
|
||||
children: [
|
||||
@@ -44,7 +92,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
color: controller.remainingTimeTimerRideBegin < 60
|
||||
? AppColor.redColor
|
||||
: AppColor.greenColor,
|
||||
minHeight: 45,
|
||||
minHeight: 25,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
value: controller.progressTimerRideBegin.toDouble(),
|
||||
),
|
||||
@@ -133,7 +181,7 @@ class RideBeginPassenger extends StatelessWidget {
|
||||
phoneNumber = phoneNumber.replaceAll('0', '');
|
||||
print(phoneNumber); // Output: 798583061
|
||||
var phone =
|
||||
'+962${box.read(BoxName.sosPhonePassenger)}';
|
||||
'+${box.read(BoxName.countryCode)}${box.read(BoxName.sosPhonePassenger)}';
|
||||
controller.sendWhatsapp(phone);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -12,9 +12,11 @@ GetBuilder<MapPassengerController> timerForCancelTripFromPassenger() {
|
||||
|
||||
return controller.remainingTime > 0 && controller.remainingTime != 25
|
||||
? Positioned(
|
||||
bottom: Get.height * .35,
|
||||
left: Get.width * .05,
|
||||
bottom: 5,
|
||||
left: 10,
|
||||
right: 10,
|
||||
child: Container(
|
||||
height: 180,
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
|
||||
@@ -50,7 +50,7 @@ class TimerToPassengerFromDriver extends StatelessWidget {
|
||||
60
|
||||
? AppColor.redColor
|
||||
: AppColor.greenColor,
|
||||
minHeight: 50,
|
||||
minHeight: 25,
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
value: controller
|
||||
.progressTimerToPassengerFromDriverAfterApplied
|
||||
@@ -64,6 +64,13 @@ class TimerToPassengerFromDriver extends StatelessWidget {
|
||||
)
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: const Icon(
|
||||
Icons.phone,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
),
|
||||
controller.remainingTimeToPassengerFromDriverAfterApplied < 60
|
||||
? MyElevatedButton(
|
||||
title: 'You can cancel trip'.tr,
|
||||
|
||||
@@ -298,3 +298,52 @@ class EducationDegreePicker extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CountryPicker extends StatelessWidget {
|
||||
final ProfileController controller = Get.put(ProfileController());
|
||||
|
||||
final List<String> countryOptions = [
|
||||
'Jordan'.tr,
|
||||
'USA'.tr,
|
||||
'Egypt'.tr,
|
||||
'Turkey'.tr,
|
||||
'Saudi Arabia'.tr,
|
||||
'Qatar'.tr,
|
||||
'Bahrain'.tr,
|
||||
'Kuwait'.tr,
|
||||
];
|
||||
|
||||
CountryPicker({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 300,
|
||||
child: CupertinoPicker(
|
||||
itemExtent: 32,
|
||||
onSelectedItemChanged: (int index) {
|
||||
controller.setCountry(countryOptions[index]);
|
||||
},
|
||||
children: List.generate(
|
||||
countryOptions.length,
|
||||
(index) => Center(
|
||||
child: Text(
|
||||
countryOptions[index],
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: controller.selectedCountry.toString(),
|
||||
onPressed: () {
|
||||
box.write(
|
||||
BoxName.countryCode, controller.selectedCountry.toString());
|
||||
})
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user