diff --git a/android/app/build.gradle b/android/app/build.gradle
index d16ca8c..5b43576 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -31,7 +31,7 @@ def keystorePropertiesFile = rootProject.file('key.properties')
android {
- namespace "com.mobileapp.store.ride"
+ namespace "com.sefer_driver"
compileSdkVersion 34
ndkVersion flutter.ndkVersion
@@ -50,7 +50,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
- applicationId "com.mobileapp.store.ride"
+ applicationId "com.sefer_driver"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 26
diff --git a/android/app/google-services.json b/android/app/google-services.json
index f19436f..3ded064 100644
--- a/android/app/google-services.json
+++ b/android/app/google-services.json
@@ -14,7 +14,7 @@
},
"oauth_client": [
{
- "client_id": "594687661098-2hfb9gumub3j60vb7mqtq794k8spihuh.apps.googleusercontent.com",
+ "client_id": "594687661098-2u640akrb3k7sak5t0nqki6f4v6hq1bq.apps.googleusercontent.com",
"client_type": 3
}
],
@@ -29,6 +29,49 @@
{
"client_id": "594687661098-2hfb9gumub3j60vb7mqtq794k8spihuh.apps.googleusercontent.com",
"client_type": 3
+ },
+ {
+ "client_id": "594687661098-8e26699cris2k3nj5msj1osi59it9kpf.apps.googleusercontent.com",
+ "client_type": 2,
+ "ios_info": {
+ "bundle_id": "com.mobileapp.store.ride"
+ }
+ }
+ ]
+ }
+ }
+ },
+ {
+ "client_info": {
+ "mobilesdk_app_id": "1:594687661098:android:46557bd4f534b5bb595f53",
+ "android_client_info": {
+ "package_name": "com.sefer_driver"
+ }
+ },
+ "oauth_client": [
+ {
+ "client_id": "594687661098-2u640akrb3k7sak5t0nqki6f4v6hq1bq.apps.googleusercontent.com",
+ "client_type": 3
+ }
+ ],
+ "api_key": [
+ {
+ "current_key": "AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0"
+ }
+ ],
+ "services": {
+ "appinvite_service": {
+ "other_platform_oauth_client": [
+ {
+ "client_id": "594687661098-2hfb9gumub3j60vb7mqtq794k8spihuh.apps.googleusercontent.com",
+ "client_type": 3
+ },
+ {
+ "client_id": "594687661098-8e26699cris2k3nj5msj1osi59it9kpf.apps.googleusercontent.com",
+ "client_type": 2,
+ "ios_info": {
+ "bundle_id": "com.mobileapp.store.ride"
+ }
}
]
}
diff --git a/android/app/src/main/kotlin/com/mobileapp/store/ride/MainActivity.kt b/android/app/src/main/kotlin/com/sefer_driver/MainActivity.kt
similarity index 83%
rename from android/app/src/main/kotlin/com/mobileapp/store/ride/MainActivity.kt
rename to android/app/src/main/kotlin/com/sefer_driver/MainActivity.kt
index cd7a19e..67061a9 100644
--- a/android/app/src/main/kotlin/com/mobileapp/store/ride/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/sefer_driver/MainActivity.kt
@@ -1,4 +1,4 @@
-package com.mobileapp.store.ride
+package com.sefer_driver
import io.flutter.embedding.android.FlutterActivity
diff --git a/android/build.gradle b/android/build.gradle
index e909018..216e3bd 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -6,6 +6,9 @@ buildscript {
}
dependencies {
+ // START: FlutterFire Configuration
+ classpath 'com.google.gms:google-services:4.3.15'
+ // END: FlutterFire Configuration
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
diff --git a/firebase.json b/firebase.json
index 2d031e0..c712f94 100644
--- a/firebase.json
+++ b/firebase.json
@@ -1,17 +1 @@
-{
- "functions": [
- {
- "source": "functions",
- "codebase": "default",
- "ignore": [
- "node_modules",
- ".git",
- "firebase-debug.log",
- "firebase-debug.*.log"
- ],
- "predeploy": [
- "npm --prefix \"$RESOURCE_DIR\" run lint"
- ]
- }
- ]
-}
+{"functions":[{"source":"functions","codebase":"default","ignore":["node_modules",".git","firebase-debug.log","firebase-debug.*.log"],"predeploy":["npm --prefix \"$RESOURCE_DIR\" run lint"]}],"flutter":{"platforms":{"android":{"default":{"projectId":"ride-b1bd8","appId":"1:594687661098:android:46557bd4f534b5bb595f53","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"ride-b1bd8","appId":"1:594687661098:ios:4f236057ba0383b0595f53","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"ride-b1bd8","configurations":{"android":"1:594687661098:android:46557bd4f534b5bb595f53","ios":"1:594687661098:ios:4f236057ba0383b0595f53"}}}}}}
\ No newline at end of file
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index f18ff93..4735433 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -530,13 +530,13 @@
DEVELOPMENT_TEAM = 63CVT8G5P8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
- INFOPLIST_KEY_CFBundleDisplayName = Sefer;
+ INFOPLIST_KEY_CFBundleDisplayName = "Sefer Driver";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.travel";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.mobileapp.store.ride;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sefer.driver;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
@@ -716,13 +716,13 @@
DEVELOPMENT_TEAM = 63CVT8G5P8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
- INFOPLIST_KEY_CFBundleDisplayName = Sefer;
+ INFOPLIST_KEY_CFBundleDisplayName = "Sefer Driver";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.travel";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.mobileapp.store.ride;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sefer.driver;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -742,13 +742,13 @@
DEVELOPMENT_TEAM = 63CVT8G5P8;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
- INFOPLIST_KEY_CFBundleDisplayName = Sefer;
+ INFOPLIST_KEY_CFBundleDisplayName = "Sefer Driver";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.travel";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
- PRODUCT_BUNDLE_IDENTIFIER = com.mobileapp.store.ride;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sefer.driver;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist
index 1e79c35..2d31548 100644
--- a/ios/Runner/GoogleService-Info.plist
+++ b/ios/Runner/GoogleService-Info.plist
@@ -3,9 +3,9 @@
CLIENT_ID
- 594687661098-8e26699cris2k3nj5msj1osi59it9kpf.apps.googleusercontent.com
+ 594687661098-9fnj82nef9oagl98prigdf8qne3ddbto.apps.googleusercontent.com
REVERSED_CLIENT_ID
- com.googleusercontent.apps.594687661098-8e26699cris2k3nj5msj1osi59it9kpf
+ com.googleusercontent.apps.594687661098-9fnj82nef9oagl98prigdf8qne3ddbto
API_KEY
AIzaSyCf2mW2h0HD8ZYjwh4VOa2ladw6MJkCDTM
GCM_SENDER_ID
@@ -13,7 +13,7 @@
PLIST_VERSION
1
BUNDLE_ID
- com.mobileapp.store.ride
+ com.sefer.driver
PROJECT_ID
ride-b1bd8
STORAGE_BUCKET
@@ -29,6 +29,6 @@
IS_SIGNIN_ENABLED
GOOGLE_APP_ID
- 1:594687661098:ios:6f69eee1449be943595f53
+ 1:594687661098:ios:4f236057ba0383b0595f53
\ No newline at end of file
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index deaf1b6..de396aa 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -2,25 +2,6 @@
- CFBundleURLTypes
-
-
- CFBundleTypeRole
- Editor
- CFBundleURLSchemes
-
-
- com.googleusercontent.apps.594687661098-8e26699cris2k3nj5msj1osi59it9kpf
-
-
-
-
- LSApplicationQueriesSchemes
-
- googlechromes
- comgooglemaps
-
CADisableMinimumFrameDurationOnPhone
CFBundleDevelopmentRegion
@@ -36,13 +17,26 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleName
- Sefer
+ Sefer Driver
CFBundlePackageType
APPL
CFBundleShortVersionString
21
CFBundleSignature
????
+ CFBundleURLTypes
+
+
+ CFBundleTypeRole
+ Editor
+ CFBundleURLSchemes
+
+ com.googleusercontent.apps.594687661098-9fnj82nef9oagl98prigdf8qne3ddbto
+
+
+
+
CFBundleVersion
1.41
FirebaseAppDelegateProxyEnabled
@@ -51,6 +45,11 @@
YOUR_API_KEY
LSApplicationCategoryType
+ LSApplicationQueriesSchemes
+
+ googlechromes
+ comgooglemaps
+
LSRequiresIPhoneOS
NSCameraUsageDescription
diff --git a/lib/controller/auth/login_controller.dart b/lib/controller/auth/login_controller.dart
index 8fdaea2..650926d 100644
--- a/lib/controller/auth/login_controller.dart
+++ b/lib/controller/auth/login_controller.dart
@@ -11,7 +11,6 @@ import 'package:SEFER/controller/functions/crud.dart';
import 'package:SEFER/controller/functions/secure_storage.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/auth/verify_email_page.dart';
-import 'package:SEFER/views/home/map_page_passenger.dart';
import '../../views/admin/admin_home_page.dart';
import '../functions/device_info.dart';
@@ -105,7 +104,7 @@ class LoginController extends GetxController {
jsonDecoeded['data'][0]['last_name']);
box.write(BoxName.phone, jsonDecoeded['data'][0]['phone']);
SecureStorage().saveData(BoxName.password, passwordController.text);
- Get.offAll(() => const MapPagePassenger());
+ // Get.offAll(() => const MapPagePassenger());
isloading = false;
update();
print(box.read(BoxName.passengerID).toString());
@@ -147,7 +146,7 @@ class LoginController extends GetxController {
goToMapPage() {
if (box.read(BoxName.email) != null) {
- Get.offAll(() => const MapPagePassenger());
+ // Get.offAll(() => const MapPagePassenger());
}
}
diff --git a/lib/controller/auth/onboarding_controller.dart b/lib/controller/auth/onboarding_controller.dart
index 1edc952..518f8e5 100644
--- a/lib/controller/auth/onboarding_controller.dart
+++ b/lib/controller/auth/onboarding_controller.dart
@@ -5,6 +5,7 @@ import 'package:SEFER/main.dart';
import 'package:SEFER/views/auth/login_page.dart';
import '../../models/model/onboarding_model.dart';
+import '../../views/auth/captin/login_captin.dart';
abstract class OnBoardingController extends GetxController {
next();
@@ -22,7 +23,7 @@ class OnBoardingControllerImp extends OnBoardingController {
if (currentPage > onBoardingList.length - 1) {
box.write(BoxName.onBoarding, 'yes');
- Get.offAll(LoginPage());
+ Get.offAll(LoginCaptin());
} else {
pageController.animateToPage(currentPage,
duration: const Duration(milliseconds: 900), curve: Curves.easeInOut);
diff --git a/lib/controller/auth/register_controller.dart b/lib/controller/auth/register_controller.dart
index 08ecccb..304e79f 100644
--- a/lib/controller/auth/register_controller.dart
+++ b/lib/controller/auth/register_controller.dart
@@ -9,6 +9,7 @@ import 'package:SEFER/controller/functions/crud.dart';
import 'package:SEFER/views/auth/login_page.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
+import '../../views/auth/captin/login_captin.dart';
import '../../views/auth/verify_email_page.dart';
class RegisterController extends GetxController {
@@ -66,7 +67,7 @@ class RegisterController extends GetxController {
});
var dec = jsonDecode(res);
if (dec['status'] == 'success') {
- Get.offAll(() => LoginPage());
+ Get.offAll(() => LoginCaptin());
}
}
diff --git a/lib/controller/firebase/firbase_messge.dart b/lib/controller/firebase/firbase_messge.dart
index 5abd8fd..5e38427 100644
--- a/lib/controller/firebase/firbase_messge.dart
+++ b/lib/controller/firebase/firbase_messge.dart
@@ -1,14 +1,11 @@
import 'dart:convert';
import 'dart:io';
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
-import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
import 'package:SEFER/views/home/Captin/home_captain/widget/call_page.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:http/http.dart' as http;
-import 'package:SEFER/controller/functions/crud.dart';
-import 'package:SEFER/controller/functions/toast.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import '../../constant/api_key.dart';
@@ -17,15 +14,9 @@ import '../../constant/colors.dart';
import '../../constant/links.dart';
import '../../constant/style.dart';
import '../../main.dart';
-import '../../views/Rate/rate_captain.dart';
import '../../views/home/Captin/home_captain/home_captin.dart';
import '../../views/home/Captin/orderCaptin/order_speed_request.dart';
-import '../../views/home/map_page_passenger.dart';
-import '../../views/home/map_widget.dart/call_passenger_page.dart';
-import '../../views/home/profile/promos_passenger_page.dart';
import '../../views/home/Captin/orderCaptin/order_request_page.dart';
-import '../home/map_passenger_controller.dart';
-import '../payment/payment_controller.dart';
import 'local_notification.dart';
class FirebaseMessagesController extends GetxController {
@@ -140,73 +131,22 @@ class FirebaseMessagesController extends GetxController {
// 'PolylineJson': myPoints,
'body': message.notification!.body
});
- } else if (message.notification!.title! == 'Apply Ride') {
- var passengerList = message.data['passengerList'];
-
- var myList = jsonDecode(passengerList) as List;
- driverID = myList[2].toString();
-
- NotificationController().showNotification(
- 'Apply Order'.tr, 'Driver Applied the Ride for You'.tr, 'order1');
- // driverAppliedTripSnakBar();
- } else if (message.notification!.title! == 'Promo') {
- NotificationController()
- .showNotification('Promo', 'Show latest promo'.tr, 'promo');
- Get.to(const PromosPassengerPage());
} else if (message.notification!.title == 'Cancel Trip') {
NotificationController().showNotification(
'Cancel Trip'.tr, 'Passenger Cancel Trip'.tr, 'cancel');
cancelTripDialog();
- } else if (message.notification!.title! == 'DriverIsGoingToPassenger') {
- Get.find().isDriverInPassengerWay = true;
- Get.find().update();
- NotificationController().showNotification('Driver is Going To You'.tr,
- 'Please stay on the picked point.'.tr, 'tone1');
- // Get.snackbar('Driver is Going To Passenger', '',
- // backgroundColor: AppColor.greenColor);
} else if (message.notification!.title! == 'message From passenger') {
NotificationController()
.showNotification('message From passenger'.tr, ''.tr, 'tone2');
passengerDialog(message.notification!.body!);
update();
- } else if (message.notification!.title! == 'RideIsBegin') {
- Get.find().getBeginRideFromDriver();
- // Get.snackbar('RideIsBegin', '', backgroundColor: AppColor.greenColor);
- box.write(BoxName.passengerWalletTotal, '0');
- NotificationController()
- .showNotification('Trip is Begin'.tr, ''.tr, 'start');
- update();
} else if (message.notification!.title! == 'Hi ,I will go now') {
// Get.snackbar('Hi ,I will go now', '',
// backgroundColor: AppColor.greenColor);
NotificationController().showNotification(
'Passenger come to you'.tr, 'Hi ,I will go now'.tr, 'tone2');
update();
- } else if (message.notification!.title! == 'Hi ,I Arrive your site') {
- NotificationController()
- .showNotification('Hi ,I Arrive your site'.tr, ''.tr, 'tone2');
- driverArrivePassengerDialoge();
-
- update();
- } else if (message.notification!.title! == 'Driver Finish Trip') {
- var myListString = message.data['passengerList'];
- var driverList = jsonDecode(myListString) as List;
- NotificationController().showNotification(
- 'Driver Finish Trip'.tr,
- 'you will pay to Driver'.tr + ' ${driverList[3].toString()} \$'.tr,
- 'tone1');
- Get.find().tripFinishedFromDriver();
- // if (Get.find().isCashChecked == false &&
- // Get.find().isWalletChecked == true) {
- // // driverFinishTripDialoge(driverList);
- // } else {
- Get.to(() => RateDriverFromPassenger(), arguments: {
- 'driverId': driverList[0].toString(),
- 'rideId': driverList[1].toString(),
- 'price': driverList[3].toString()
- });
- // }
} else if (message.notification!.title! == 'Call Income') {
try {
var myListString = message.data['passengerList'];
@@ -219,11 +159,11 @@ class FirebaseMessagesController extends GetxController {
);
// }
// Assuming GetMaterialApp is initialized and context is valid for navigation
- Get.to(() => PassengerCallPage(
- channelName: driverList[1].toString(),
- token: driverList[0].toString(),
- remoteID: driverList[2].toString(),
- ));
+ // Get.to(() => PassengerCallPage(
+ // channelName: driverList[1].toString(),
+ // token: driverList[0].toString(),
+ // remoteID: driverList[2].toString(),
+ // ));
} catch (e) {
print('Error navigating to PassengerCallPage: $e');
}
@@ -263,22 +203,6 @@ class FirebaseMessagesController extends GetxController {
} catch (e) {
print('Error navigating to PassengerCallPage: $e');
}
- } else if (message.notification!.title! == 'Driver Cancel Your Trip') {
- // Get.snackbar(
- // 'You will be pay the cost to driver or we will get it from you on next trip'
- // .tr,
- // 'message',
- // backgroundColor: AppColor.redColor);
- if (Platform.isAndroid) {
- 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,
- 'cancel');
- }
-
- Get.find().restCounter();
- Get.offAll(const MapPagePassenger());
} else if (message.notification!.title! == 'Order Applied') {
Get.snackbar(
"The order has been accepted by another driver."
@@ -346,24 +270,24 @@ class FirebaseMessagesController extends GetxController {
}));
}
- Future driverArrivePassengerDialoge() {
- return Get.defaultDialog(
- barrierDismissible: false,
- title: 'Hi ,I Arrive your site'.tr,
- middleText: 'Please go to Car Driver'.tr,
- confirm: MyElevatedButton(
- title: 'Ok I will go now.'.tr,
- onPressed: () {
- FirebaseMessagesController().sendNotificationToPassengerToken(
- 'Hi ,I will go now'.tr,
- 'I will go now'.tr,
- Get.find().driverToken, []);
- Get.find()
- .startTimerDriverWaitPassenger5Minute();
+ // Future driverArrivePassengerDialoge() {
+ // return Get.defaultDialog(
+ // barrierDismissible: false,
+ // title: 'Hi ,I Arrive your site'.tr,
+ // middleText: 'Please go to Car Driver'.tr,
+ // confirm: MyElevatedButton(
+ // title: 'Ok I will go now.'.tr,
+ // onPressed: () {
+ // FirebaseMessagesController().sendNotificationToPassengerToken(
+ // 'Hi ,I will go now'.tr,
+ // 'I will go now'.tr,
+ // Get.find().driverToken, []);
+ // Get.find()
+ // .startTimerDriverWaitPassenger5Minute();
- Get.back();
- }));
- }
+ // Get.back();
+ // }));
+ // }
Future passengerDialog(String message) {
return Get.defaultDialog(
@@ -386,60 +310,60 @@ class FirebaseMessagesController extends GetxController {
}));
}
- Future driverFinishTripDialoge(List driverList) {
- return Get.defaultDialog(
- title: 'Driver Finish Trip'.tr,
- content: const DriverTipWidget(),
- confirm: MyElevatedButton(
- title: 'Yes'.tr,
- onPressed: () async {
- var tip = (Get.find().totalPassenger) *
- (double.parse(box.read(BoxName.tipPercentage.toString())));
- var res = await CRUD().post(link: AppLink.addTips, payload: {
- 'passengerID': box.read(BoxName.passengerID),
- 'driverID': driverList[0].toString(),
- 'rideID': driverList[1].toString(),
- 'tipAmount': tip.toString(),
- });
- await CRUD().post(link: AppLink.addPassengersWallet, payload: {
- 'passenger_id': box.read(BoxName.passengerID).toString(),
- 'balance': ((-1) * tip).toString()
- });
+ // Future driverFinishTripDialoge(List driverList) {
+ // return Get.defaultDialog(
+ // title: 'Driver Finish Trip'.tr,
+ // content: const DriverTipWidget(),
+ // confirm: MyElevatedButton(
+ // title: 'Yes'.tr,
+ // onPressed: () async {
+ // var tip = (Get.find().totalPassenger) *
+ // (double.parse(box.read(BoxName.tipPercentage.toString())));
+ // var res = await CRUD().post(link: AppLink.addTips, payload: {
+ // 'passengerID': box.read(BoxName.passengerID),
+ // 'driverID': driverList[0].toString(),
+ // 'rideID': driverList[1].toString(),
+ // 'tipAmount': tip.toString(),
+ // });
+ // await CRUD().post(link: AppLink.addPassengersWallet, payload: {
+ // 'passenger_id': box.read(BoxName.passengerID).toString(),
+ // 'balance': ((-1) * tip).toString()
+ // });
- await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
- 'driverID': driverList[0].toString(),
- 'paymentID': '${Get.find().rideId}tip',
- 'amount': (tip * 100).toString(),
- 'paymentMethod': 'visa-tip',
- });
+ // await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
+ // 'driverID': driverList[0].toString(),
+ // 'paymentID': '${Get.find().rideId}tip',
+ // 'amount': (tip * 100).toString(),
+ // 'paymentMethod': 'visa-tip',
+ // });
- if (res != 'failure') {
- FirebaseMessagesController().sendNotificationToAnyWithoutData(
- 'You Have Tips',
- '${'${tip.toString()}\$${' tips\nTotal is'.tr}'} ${tip + (Get.find().totalPassenger)}',
- driverList[2].toString(),
- );
- }
- Get.to(() => RateDriverFromPassenger(), arguments: {
- 'driverId': driverList[0].toString(),
- 'rideId': driverList[1].toString(),
- 'price': driverList[3].toString()
- });
- },
- kolor: AppColor.greenColor,
- ),
- cancel: MyElevatedButton(
- title: 'No,I want'.tr,
- onPressed: () {
- Get.to(() => RateDriverFromPassenger(), arguments: {
- 'driverId': driverList[0].toString(),
- 'rideId': driverList[1].toString(),
- 'price': driverList[3].toString()
- });
- },
- kolor: AppColor.redColor,
- ));
- }
+ // if (res != 'failure') {
+ // FirebaseMessagesController().sendNotificationToAnyWithoutData(
+ // 'You Have Tips',
+ // '${'${tip.toString()}\$${' tips\nTotal is'.tr}'} ${tip + (Get.find().totalPassenger)}',
+ // driverList[2].toString(),
+ // );
+ // }
+ // Get.to(() => RateDriverFromPassenger(), arguments: {
+ // 'driverId': driverList[0].toString(),
+ // 'rideId': driverList[1].toString(),
+ // 'price': driverList[3].toString()
+ // });
+ // },
+ // kolor: AppColor.greenColor,
+ // ),
+ // cancel: MyElevatedButton(
+ // title: 'No,I want'.tr,
+ // onPressed: () {
+ // Get.to(() => RateDriverFromPassenger(), arguments: {
+ // 'driverId': driverList[0].toString(),
+ // 'rideId': driverList[1].toString(),
+ // 'price': driverList[3].toString()
+ // });
+ // },
+ // kolor: AppColor.redColor,
+ // ));
+ // }
void sendNotificationAll(String title, body) async {
// Get the token you want to subtract.
@@ -661,130 +585,3 @@ class FirebaseMessagesController extends GetxController {
}
}
}
-
-class DriverTipWidget extends StatelessWidget {
- const DriverTipWidget({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(builder: (controller) {
- return Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- // Text(
- // '${'Your fee is '.tr}${Get.find().totalPassenger.toStringAsFixed(2)}'),
- Text(
- 'Do you want to pay Tips for this Driver'.tr,
- textAlign: TextAlign.center,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- InkWell(
- onTap: () {
- box.write(BoxName.tipPercentage, '0.05');
-
- Toast.show(
- context,
- '${'Tip is '.tr}${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
- AppColor.blueColor);
- controller.update();
- },
- child: Container(
- decoration: BoxDecoration(border: Border.all()),
- child: const Padding(
- padding: EdgeInsets.all(4),
- child: Center(
- child: Text('5%'),
- ),
- ),
- ),
- ),
- InkWell(
- onTap: () {
- box.write(BoxName.tipPercentage, '0.10');
- Toast.show(
- context,
- '${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
- AppColor.blueColor);
- controller.update();
- },
- child: Container(
- decoration: BoxDecoration(border: Border.all()),
- child: const Center(
- child: Padding(
- padding: EdgeInsets.all(5),
- child: Text('10%'),
- ),
- ),
- ),
- ),
- InkWell(
- onTap: () {
- box.write(BoxName.tipPercentage, '0.15');
- Toast.show(
- context,
- '${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
- AppColor.blueColor);
- controller.update();
- },
- child: Container(
- decoration: BoxDecoration(border: Border.all()),
- child: const Center(
- child: Padding(
- padding: EdgeInsets.all(5),
- child: Text('15%'),
- ),
- ),
- ),
- ),
- InkWell(
- onTap: () {
- box.write(BoxName.tipPercentage, '0.20');
- Toast.show(
- context,
- '${'Tip is'.tr} ${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))}',
- AppColor.blueColor);
- controller.update();
- },
- child: Container(
- decoration: BoxDecoration(border: Border.all()),
- child: const Center(
- child: Padding(
- padding: EdgeInsets.all(5),
- child: Text('20%'),
- ),
- ),
- ),
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- MyElevatedButton(
- kolor: AppColor.redColor,
- title: 'No i want'.tr,
- onPressed: () {
- box.write(BoxName.tipPercentage, '0');
- controller.update();
- }),
- Container(
- decoration: AppStyle.boxDecoration1,
- child: Padding(
- padding: const EdgeInsets.all(6),
- child: Text(
- '${(controller.totalPassenger) * (double.parse(box.read(BoxName.tipPercentage.toString())))} ${box.read(BoxName.countryCode) == 'Egypt' ? 'LE'.tr : 'JOD'.tr}',
- style: AppStyle.title,
- ),
- ),
- ),
- ],
- )
- ],
- );
- });
- }
-}
diff --git a/lib/controller/functions/audio_record1.dart b/lib/controller/functions/audio_record1.dart
deleted file mode 100644
index d955078..0000000
--- a/lib/controller/functions/audio_record1.dart
+++ /dev/null
@@ -1,119 +0,0 @@
-import 'dart:io';
-
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
-// import 'package:flutter_sound/flutter_sound.dart';
-import 'package:path_provider/path_provider.dart';
-
-import 'package:get/get.dart';
-import 'package:just_audio/just_audio.dart';
-import 'package:record/record.dart';
-
-class AudioRecorderController extends GetxController {
- AudioPlayer audioPlayer = AudioPlayer();
- AudioRecorder recorder = AudioRecorder();
-
- bool isRecording = false;
- String filePath = '';
- String? selectedFilePath;
- double currentPosition = 0;
- double totalDuration = 0;
- String? selectedFile;
-
- Future startRecording() async {
- final bool isPermissionGranted = await recorder.hasPermission();
- if (!isPermissionGranted) {
- // RecordingPermissionException('l');
- print('sss');
- return;
- }
-
- final directory = await getApplicationDocumentsDirectory();
- // Generate a unique file name using the current timestamp
- String fileName =
- '${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day}_${Get.find().rideId}.m4a';
- filePath = '${directory.path}/$fileName';
-
- // Define the configuration for the recording
- const config = RecordConfig(
- // Specify the format, encoder, sample rate, etc., as needed
- encoder: AudioEncoder.aacLc, // For example, using AAC codec
- sampleRate: 44100, // Sample rate
- bitRate: 128000, // Bit rate
- );
-
- // Start recording to file with the specified configuration
- await recorder.start(config, path: filePath);
-
- isRecording = true;
- update();
- }
-
- Future stopRecording() async {
- final path = await recorder.stop();
- print(path);
- isRecording = false;
- update();
- }
-
- Future playRecording() async {
- if (filePath != null) {
- await audioPlayer.setFilePath(filePath!);
- totalDuration = audioPlayer.duration?.inSeconds.toDouble() ?? 0;
- audioPlayer.play();
-
- audioPlayer.positionStream.listen((position) {
- currentPosition = position.inSeconds.toDouble();
- });
- selectedFilePath = filePath;
- update();
- }
- }
-
- Future> getRecordedFiles() async {
- final directory = await getApplicationDocumentsDirectory();
- final files = await directory.list().toList();
- return files
- .map((file) => file.path)
- .where((path) => path.endsWith('.m4a'))
- .toList();
- }
-
- Future playRecordedFile(String filePath) async {
- await audioPlayer.setFilePath(filePath);
- totalDuration = audioPlayer.duration?.inSeconds.toDouble() ?? 0;
- audioPlayer.play();
-
- audioPlayer.positionStream.listen((position) {
- currentPosition = position.inSeconds.toDouble();
- });
- update();
- }
-
- Future deleteRecordedFile(String filePath) async {
- final file = File(filePath);
- if (await file.exists()) {
- await file.delete();
- print('File deleted: $filePath');
- await getRecordedFiles();
- } else {
- print('File not found: $filePath');
- }
- }
-
- Future deleteAllRecordedFiles() async {
- final directory = await getApplicationDocumentsDirectory();
- final files = await directory.list().toList();
- for (final file in files) {
- if (file.path.endsWith('.m4a')) {
- await deleteRecordedFile(file.path);
- }
- }
- }
-
- @override
- void onClose() {
- audioPlayer.dispose();
- recorder.dispose();
- super.onClose();
- }
-}
diff --git a/lib/controller/functions/call_controller.dart b/lib/controller/functions/call_controller.dart
index 9976488..c67f0ea 100644
--- a/lib/controller/functions/call_controller.dart
+++ b/lib/controller/functions/call_controller.dart
@@ -1,6 +1,5 @@
import 'package:SEFER/constant/api_key.dart';
import 'package:SEFER/controller/functions/crud.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
@@ -23,15 +22,10 @@ class CallController extends GetxController {
@override
void onInit() {
super.onInit();
- if (box.read(BoxName.passengerID) != null) {
- channelName = Get.find().rideId; // 'sefer300'; //
- remoteUid = int.parse(Get.find().driverPhone);
- uid = int.parse(box.read(BoxName.phone));
- } else {
- channelName = Get.find().rideId; // 'sefer300'; //
- remoteUid = int.parse(Get.find().passengerPhone);
- uid = int.parse(box.read(BoxName.phoneDriver));
- }
+
+ channelName = Get.find().rideId; // 'sefer300'; //
+ remoteUid = int.parse(Get.find().passengerPhone);
+ uid = int.parse(box.read(BoxName.phoneDriver));
initAgoraFull();
}
@@ -46,12 +40,8 @@ class CallController extends GetxController {
// join();
FirebaseMessagesController().sendNotificationToPassengerToken(
'Call Income from Passenger',
- box.read(BoxName.passengerID) != null
- ? '${'You have call from Passenger'.tr} ${box.read(BoxName.name)}'
- : '${'You have call from driver'.tr} ${box.read(BoxName.nameDriver)}',
- box.read(BoxName.passengerID) != null
- ? Get.find().driverToken
- : Get.find().tokenPassenger,
+ '${'You have call from driver'.tr} ${box.read(BoxName.nameDriver)}',
+ Get.find().tokenPassenger,
[
token,
channelName,
@@ -89,10 +79,9 @@ class CallController extends GetxController {
},
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
// Get.snackbar("Remote user uid:$remoteUid joined the channel", '');
- status =
- '${box.read(BoxName.passengerID) != null ? Get.find().driverName : Get.find().passengerName}'
- ' joined'
- .tr;
+ status = '${Get.find().passengerName}'
+ ' joined'
+ .tr;
remoteUid = remoteUid;
update();
},
diff --git a/lib/controller/functions/crud.dart b/lib/controller/functions/crud.dart
index 19cd94e..6e28b58 100644
--- a/lib/controller/functions/crud.dart
+++ b/lib/controller/functions/crud.dart
@@ -106,7 +106,36 @@ class CRUD {
Future.delayed(const Duration(seconds: 2));
String extracted =
await arabicTextExtractByVisionAndAI(imagePath: imagePath);
- await AI().geminiAiExtraction(prompt, extracted);
+
+ Map extractedData = extractText(extracted);
+ print(extractedData);
+ // await AI().geminiAiExtraction(prompt, extractedData);
+ }
+
+ Map extractText(String jsonData) {
+ Map data = jsonDecode(jsonData);
+ List> textLines = [];
+
+ for (var region in data['regions']) {
+ List lineTexts = [];
+ for (var line in region['lines']) {
+ String lineText = "";
+ for (var word in line['words']) {
+ lineText += word['text'] + " ";
+ }
+ lineText = lineText.trim();
+ lineTexts.add(lineText);
+ }
+ textLines.add(lineTexts);
+ }
+
+ // You can choose between returning a new JSON or a List based on your needs
+
+ // Option 1: Return a new JSON with "textLines" key
+ return {"textLines": textLines};
+
+ // Option 2: Return a List of List (lines with words)
+ // return textLines;
}
Future arabicTextExtractByVisionAndAI({
@@ -122,7 +151,7 @@ class CRUD {
String imagePathFull =
'${AppLink.server}card_image/$imagePath-${box.read(BoxName.driverID) ?? box.read(BoxName.passengerID)}.jpg';
- print('imagePath=$imagePathFull');
+ // print('imagePath=$imagePathFull');
var requestBody = {"url": imagePathFull};
var response = await http.post(
url,
@@ -132,7 +161,7 @@ class CRUD {
if (response.statusCode == 200) {
var responseBody = jsonDecode(response.body);
- // print(decode);
+ print(responseBody);
print('imagePath=$imagePathFull');
return responseBody.toString();
}
diff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart
deleted file mode 100644
index 290b30e..0000000
--- a/lib/controller/home/map_passenger_controller.dart
+++ /dev/null
@@ -1,2572 +0,0 @@
-import 'dart:async';
-import 'dart:convert';
-import 'dart:math' show cos;
-import 'dart:math' as math;
-
-import 'package:SEFER/controller/functions/tts.dart';
-import 'package:flutter/material.dart';
-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';
-import 'package:SEFER/controller/home/points_for_rider_controller.dart';
-import 'package:SEFER/views/home/map_widget.dart/form_serch_multiy_point.dart';
-import '../../constant/api_key.dart';
-import '../../constant/box_name.dart';
-import '../../constant/info.dart';
-import '../../constant/links.dart';
-import '../../constant/table_names.dart';
-import '../../main.dart';
-import '../../models/model/locations.dart';
-import '../../views/home/map_widget.dart/car_details_widget_to_go.dart';
-import '../../views/widgets/elevated_btn.dart';
-import '../firebase/firbase_messge.dart';
-import '../functions/crud.dart';
-import '../functions/launch.dart';
-import '../functions/secure_storage.dart';
-import '../payment/payment_controller.dart';
-
-class MapPassengerController extends GetxController {
- bool isLoading = true;
- TextEditingController placeDestinationController = TextEditingController();
- TextEditingController increasFeeFromPassenger = TextEditingController();
- TextEditingController placeStartController = TextEditingController();
- TextEditingController wayPoint0Controller = TextEditingController();
- TextEditingController wayPoint1Controller = TextEditingController();
- TextEditingController wayPoint2Controller = TextEditingController();
- TextEditingController wayPoint3Controller = TextEditingController();
- TextEditingController wayPoint4Controller = TextEditingController();
- TextEditingController sosPhonePassengerProfile = TextEditingController();
- final sosFormKey = GlobalKey();
- final increasFeeFormKey = GlobalKey();
- List data = [];
- List bounds = [];
- List placesStart = [];
- List driversToken = [];
- LatLng previousLocationOfDrivers = const LatLng(0, 0);
- double angleDegrees = 0;
- LatLng currentLocationOfDrivers = const LatLng(0, 0);
- List allTextEditingPlaces = [];
- List placesDestination = [];
- List wayPoint0 = [];
- List wayPoint1 = [];
- List wayPoint2 = [];
- List wayPoint3 = [];
- List wayPoint4 = [];
- final textToSpeechController = Get.put(TextToSpeechController());
- List> placeListResponseAll = [];
-
- List placeListResponse = [
- formSearchPlaces(0),
- formSearchPlaces(1),
- formSearchPlaces(2),
- formSearchPlaces(3),
- ];
- LatLngBounds? boundsdata;
- List markers = [];
- List polyLines = [];
- late LatLng passengerLocation = const LatLng(32, 34);
- late LatLng newMyLocation = const LatLng(32.115295, 36.064773);
- late LatLng newStartPointLocation = const LatLng(32.115295, 36.064773);
- late LatLng newPointLocation0 = const LatLng(32.115295, 36.064773);
- late LatLng newPointLocation1 = const LatLng(32.115295, 36.064773);
- late LatLng newPointLocation2 = const LatLng(32.115295, 36.064773);
- late LatLng newPointLocation3 = const LatLng(32.115295, 36.064773);
- late LatLng newPointLocation4 = const LatLng(32.115295, 36.064773);
- late LatLng myDestination;
- List polylineCoordinates = [];
- List polylineCoordinates0 = [];
- List polylineCoordinates1 = [];
- List polylineCoordinates2 = [];
- List polylineCoordinates3 = [];
- List polylineCoordinates4 = [];
- List> polylineCoordinatesPointsAll = [];
- List carsLocationByPassenger = [];
- List driverCarsLocationToPassengerAfterApplied = [];
- BitmapDescriptor markerIcon = BitmapDescriptor.defaultMarker;
- BitmapDescriptor tripIcon = BitmapDescriptor.defaultMarker;
- BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
- BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
- BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker;
- double height = 150;
- DateTime currentTime = DateTime.now();
- final location = Location();
- late LocationData currentLocation;
- double heightMenu = 0;
- double widthMenu = 0;
- double heightPickerContainer = 90;
- double heightPointsPageForRider = 0;
- double mainBottomMenuMapHeight = Get.height * .2;
- double wayPointSheetHeight = 0;
- String stringRemainingTimeToPassenger = '';
- String stringRemainingTimeDriverWaitPassenger5Minute = '';
- bool isDriverInPassengerWay = false;
- bool isDriverArrivePassenger = false;
- bool startLocationFromMap = false;
- bool passengerStartLocationFromMap = false;
- bool workLocationFromMap = false;
- bool homeLocationFromMap = false;
- bool isPassengerRideLocationWidget = false;
- bool startLocationFromMap0 = false;
- bool startLocationFromMap1 = false;
- bool startLocationFromMap2 = false;
- bool startLocationFromMap3 = false;
- bool startLocationFromMap4 = false;
- List startLocationFromMapAll = [];
- double latePrice = 0;
- double fuelPrice = 0;
- double heavyPrice = 0;
- double naturePrice = 0;
- bool heightMenuBool = false;
- String statusRide = 'wait';
- bool statusRideFromStart = false;
- bool isPickerShown = false;
- bool isPointsPageForRider = false;
- bool isBottomSheetShown = false;
- bool mapType = false;
- bool mapTrafficON = false;
- bool isCancelRidePageShown = false;
- bool isCashConfirmPageShown = false;
- bool isPaymentMethodPageShown = false;
- bool isRideFinished = false;
- bool rideConfirm = false;
- bool isMarkersShown = false;
- bool isMainBottomMenuMap = true;
- late Timer markerReloadingTimer2;
- late Timer markerReloadingTimer1;
- late int durationToPassenger = 0;
- bool isWayPointSheet = false;
- bool isWayPointStopsSheet = false;
- bool isWayPointStopsSheetUtilGetMap = false;
- double heightBottomSheetShown = 0;
- double cashConfirmPageShown = 250;
- late String driverId = '';
- late String gender = '';
- double widthMapTypeAndTraffic = 50;
- double paymentPageShown = Get.height * .6;
- late LatLng southwest;
- late LatLng northeast;
- List carLocationsModels = [];
- var dataCarsLocationByPassenger;
- var datadriverCarsLocationToPassengerAfterApplied;
- CarLocation? nearestCar;
- late Timer markerReloadingTimer;
- bool shouldFetch = true; // Flag to determine if fetch should be executed
- int selectedPassengerCount = 1;
- double progress = 0;
- double progressTimerToPassengerFromDriverAfterApplied = 0;
- double progressTimerDriverWaitPassenger5Minute = 0;
- int durationTimer = 9;
- int durationToRide = 0;
- int remainingTime = 25;
- int remainingTimeToPassengerFromDriverAfterApplied = 60;
- int remainingTimeDriverWaitPassenger5Minute = 60;
- int timeToPassengerFromDriverAfterApplied = 0;
- Timer? timerToPassengerFromDriverAfterApplied;
- bool rideTimerBegin = false;
- double progressTimerRideBegin = 0;
- int remainingTimeTimerRideBegin = 60;
- String stringRemainingTimeRideBegin = '';
- String hintTextStartPoint = 'Search for your Start point'.tr;
- String hintTextwayPoint0 = 'Search for waypoint'.tr;
- String hintTextwayPoint1 = 'Search for waypoint'.tr;
- String hintTextwayPoint2 = 'Search for waypoint'.tr;
- String hintTextwayPoint3 = 'Search for waypoint'.tr;
- String hintTextwayPoint4 = 'Search for waypoint'.tr;
- String currentLocationString = 'Current Location'.tr;
- String currentLocationString0 = 'Current Location'.tr;
- String currentLocationString1 = 'Add Location 1'.tr;
- String currentLocationString2 = 'Add Location 2'.tr;
- String currentLocationString3 = 'Add Location 3'.tr;
- String currentLocationString4 = 'Add Location 4'.tr;
- String placesCoordinate0 = ''.tr;
- String placesCoordinate1 = ''.tr;
- String placesCoordinate2 = ''.tr;
- String placesCoordinate3 = ''.tr;
- String placesCoordinate4 = ''.tr;
- List currentLocationStringAll = [];
- List hintTextwayPointStringAll = [];
- var placesCoordinate = [];
- String hintTextDestinationPoint = 'Select your destination'.tr;
- late String rideId = 'yet';
- bool noCarString = false;
- bool isCashSelectedBeforeConfirmRide = false;
- bool isPassengerChosen = false;
- bool isSearchingWindow = false;
- bool currentLocationToFormPlaces = false;
- bool currentLocationToFormPlaces0 = false;
- bool currentLocationToFormPlaces1 = false;
- bool currentLocationToFormPlaces2 = false;
- bool currentLocationToFormPlaces3 = false;
- bool currentLocationToFormPlaces4 = false;
- List currentLocationToFormPlacesAll = [];
- late String driverToken;
- int carsOrder = 0;
- int wayPointIndex = 0;
- late double kazan;
- String? mapAPIKEY;
- late double totalME = 0;
- late double tax = 0;
- late double totalPassenger = 0;
- late double totalCostPassenger = 0;
- late double totalPassengerComfort = 0;
- late double totalPassengerComfortDiscount = 0;
- late double totalPassengerSpeedDiscount = 0;
- late double totalPassengerMotoDelivery = 0;
- late double totalDriver = 0;
- late double averageDuration = 0;
- late double costDuration = 0;
- late double costDistance = 0;
- late double distance = 0;
- late double duration = 0;
-
- late Duration durationToAdd;
- late DateTime newTime = DateTime.now();
- int hours = 0;
- int minutes = 0;
- void onChangedPassengerCount(int newValue) {
- selectedPassengerCount = newValue;
- update();
- }
-
- void onChangedPassengersChoose() {
- isPassengerChosen = true;
- update();
- }
-
- void getCurrentLocationFormString() async {
- currentLocationToFormPlaces = true;
- currentLocationString = 'Waiting for your location'.tr;
- await getLocation();
- currentLocationString = passengerLocation.toString();
- newStartPointLocation = passengerLocation;
- update();
- }
-
- List coordinatesWithoutEmpty = [];
- void getMapPointsForAllMethods() async {
- print(placesCoordinate.toString());
- clearPolyline();
- isMarkersShown = false;
- isWayPointStopsSheetUtilGetMap = false;
- isWayPointSheet = false;
- durationToRide = 0;
- distanceOfDestination = 0;
- wayPointSheetHeight = 0;
- remainingTime = 25;
- haveSteps = true;
-
- // Filter out empty value
- coordinatesWithoutEmpty =
- placesCoordinate.where((coord) => coord.isNotEmpty).toList();
- latestPosition = LatLng(
- double.parse(coordinatesWithoutEmpty.last.split(',')[0]),
- double.parse(coordinatesWithoutEmpty.last.split(',')[1]));
- // print(coordinatesWithoutEmpty);
- for (var i = 0; i < coordinatesWithoutEmpty.length; i++) {
- if ((i + 1) < coordinatesWithoutEmpty.length) {
- await getMapPoints(
- coordinatesWithoutEmpty[i].toString(),
- coordinatesWithoutEmpty[i + 1].toString(),
- i,
- );
- if (i == 0) {
- startNameAddress = data[0]['start_address'];
- }
- if (i == coordinatesWithoutEmpty.length) {
- endNameAddress = data[0]['end_address'];
- }
- }
- }
-
- // isWayPointStopsSheet = false;
- if (haveSteps) {
- String latestWaypoint =
- placesCoordinate.lastWhere((coord) => coord.isNotEmpty);
- latestPosition = LatLng(
- double.parse(latestWaypoint.split(',')[0]),
- double.parse(latestWaypoint.split(',')[1]),
- );
- }
- updateCameraForDistanceAfterGetMap();
- changeWayPointStopsSheet();
- bottomSheet();
- showBottomSheet1();
-
- update();
- }
-
- void convertHintTextStartNewPlaces(int index) {
- if (placesStart.isEmpty) {
- hintTextStartPoint = 'Search for your Start point'.tr;
- update();
- } else {
- hintTextStartPoint = placesStart[index]['name'];
- double lat = placesStart[index]['geometry']['location']['lat'];
- double lng = placesStart[index]['geometry']['location']['lng'];
- newStartPointLocation = LatLng(lat, lng);
- update();
- }
- }
-
- void convertHintTextPlaces(int index, var res) {
- if (placeListResponseAll[index].isEmpty) {
- placeListResponseAll[index] = res;
- hintTextwayPointStringAll[index] = 'Search for your Start point'.tr;
- update();
- } else {
- hintTextwayPointStringAll[index] = res['name'];
- currentLocationStringAll[index] = res['name'];
- placesCoordinate[index] =
- '${res['geometry']['location']['lat']},${res['geometry']['location']['lng']}';
- placeListResponseAll[index] = [];
- allTextEditingPlaces[index].clear();
- // double lat = wayPoint0[index]['geometry']['location']['lat'];
- // double lng = wayPoint0[index]['geometry']['location']['lng'];
- // newPointLocation0 = LatLng(lat, lng);
- update();
- Get.back();
- }
- }
-
- increaseFeeByPassengerAndReOrder() async {
- if (increasFeeFormKey.currentState!.validate()) {
- if (double.parse(increasFeeFromPassenger.text) > totalPassenger) {
- totalPassenger = double.parse(increasFeeFromPassenger.text);
- Get.back();
- if (rideId != 'yet') {
- await CRUD().post(link: AppLink.updateDriverOrder, payload: {
- "order_id": rideId.toString(), // Convert to String
- "status": 'Cancel'
- });
- }
- confirmRideForFirstDriver();
- }
- }
- }
-
- void convertHintTextPlaces1(int index) {
- if (wayPoint1.isEmpty) {
- hintTextwayPoint1 = 'Search for your Start point'.tr;
- update();
- } else {
- hintTextwayPoint1 = wayPoint1[index]['name'];
- currentLocationString1 = wayPoint1[index]['name'];
- double lat = wayPoint1[index]['geometry']['location']['lat'];
- double lng = wayPoint1[index]['geometry']['location']['lng'];
- newPointLocation1 = LatLng(lat, lng);
- update();
- }
- }
-
- void convertHintTextPlaces2(int index) {
- if (wayPoint1.isEmpty) {
- hintTextwayPoint2 = 'Search for your Start point'.tr;
- update();
- } else {
- hintTextwayPoint2 = wayPoint2[index]['name'];
- currentLocationString2 = wayPoint1[index]['name'];
- double lat = wayPoint2[index]['geometry']['location']['lat'];
- double lng = wayPoint2[index]['geometry']['location']['lng'];
- newPointLocation2 = LatLng(lat, lng);
- update();
- }
- }
-
- void convertHintTextPlaces3(int index) {
- if (wayPoint1.isEmpty) {
- hintTextwayPoint3 = 'Search for your Start point'.tr;
- update();
- } else {
- hintTextwayPoint3 = wayPoint3[index]['name'];
- currentLocationString3 = wayPoint1[index]['name'];
- double lat = wayPoint3[index]['geometry']['location']['lat'];
- double lng = wayPoint3[index]['geometry']['location']['lng'];
- newPointLocation3 = LatLng(lat, lng);
- update();
- }
- }
-
- void convertHintTextPlaces4(int index) {
- if (wayPoint1.isEmpty) {
- hintTextwayPoint4 = 'Search for your Start point'.tr;
- update();
- } else {
- hintTextwayPoint4 = wayPoint4[index]['name'];
- currentLocationString4 = wayPoint1[index]['name'];
- double lat = wayPoint4[index]['geometry']['location']['lat'];
- double lng = wayPoint4[index]['geometry']['location']['lng'];
- newPointLocation4 = LatLng(lat, lng);
- update();
- }
- }
-
- void convertHintTextDestinationNewPlaces(int index) {
- if (placesDestination.isEmpty) {
- hintTextDestinationPoint = 'Search for your destination'.tr;
- update();
- } else {
- hintTextDestinationPoint = placesDestination[index]['name'];
- double lat = placesDestination[index]['geometry']['location']['lat'];
- double lng = placesDestination[index]['geometry']['location']['lng'];
- newMyLocation = LatLng(lat, lng);
-
- update();
- }
- }
-
- void convertHintTextDestinationNewPlacesFromRecent(
- List recentLocations, int index) {
- hintTextDestinationPoint = recentLocations[index]['name'];
- double lat = recentLocations[index]['latitude'];
- double lng = recentLocations[index]['longitude'];
- newMyLocation = LatLng(lat, lng);
-
- update();
- }
-
-// final mainBottomMenuMap = GlobalKey();
- void changeBottomSheetShown() {
- isBottomSheetShown = !isBottomSheetShown;
- heightBottomSheetShown = isBottomSheetShown == true ? 250 : 0;
- update();
- }
-
- void changeCashConfirmPageShown() {
- isCashConfirmPageShown = !isCashConfirmPageShown;
- isCashSelectedBeforeConfirmRide = true;
- cashConfirmPageShown = isCashConfirmPageShown == true ? 250 : 0;
- // to get or sure picker point for origin //todo
- // isPickerShown = true;
- // clickPointPosition();
- update();
- }
-
- void changePaymentMethodPageShown() {
- isPaymentMethodPageShown = !isPaymentMethodPageShown;
- paymentPageShown = isPaymentMethodPageShown == true ? Get.height * .6 : 0;
- update();
- }
-
- void changeMapType() {
- mapType = !mapType;
- // heightButtomSheetShown = isButtomSheetShown == true ? 240 : 0;
- update();
- }
-
- void changeMapTraffic() {
- mapTrafficON = !mapTrafficON;
- update();
- }
-
- void sendSMS(String to) async {
- // Get the driver's phone number.
- String driverPhone =
- dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
-
- // Format the message.
- String message =
- 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with $firstName as the driver. $firstName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.';
-
- // Launch the URL to send the SMS.
- launchCommunication('sms', to, message);
- }
-
- void sendWhatsapp(String to) async {
- // Get the driver's phone number.
- // String driverPhone =
- // dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
-
- // Format the message.
- String message =
- '${'${'Hi! This is'.tr} ${box.read(BoxName.name)}.\n${' I am using'.tr}'} ${AppInformation.appName}${' to ride with'.tr} $firstName${' as the driver.'.tr} $firstName \n${'is driving a '.tr}$model\n${' with license plate '.tr}$licensePlate.\n${' I am currently located at '.tr} https://www.google.com/maps/place/${passengerLocation.latitude},${passengerLocation.longitude}.\n${' If you need to reach me, please contact the driver directly at'.tr}\n\n $driverPhone.';
-
- // Launch the URL to send the SMS.
- launchCommunication('whatsapp', to, message);
- }
-
- void changeCancelRidePageShow() {
- // rideConfirm == true
- // ?
- isCancelRidePageShown = !isCancelRidePageShown;
- // : cancelRide();
- update();
- }
-
- void getDrawerMenu() {
- heightMenuBool = !heightMenuBool;
- widthMapTypeAndTraffic = heightMenuBool == true ? 0 : 50;
- heightMenu = heightMenuBool == true ? 100 : 0;
- widthMenu = heightMenuBool == true ? 110 : 0;
- update();
- }
-
- calcualateDistsanceInMetet(LatLng prev, current) async {
- double distance2 = Geolocator.distanceBetween(
- prev.latitude,
- prev.longitude,
- current.latitude,
- current.longitude,
- );
- return distance2;
- }
-
- bool isTimerFromDriverToPassengerAfterAppliedRunning = true;
- void startTimerFromDriverToPassengerAfterApplied() async {
- for (int i = 0;
- i <= timeToPassengerFromDriverAfterApplied &&
- isTimerFromDriverToPassengerAfterAppliedRunning;
- i++) {
- await Future.delayed(const Duration(seconds: 1));
- progressTimerToPassengerFromDriverAfterApplied =
- i / timeToPassengerFromDriverAfterApplied;
- remainingTimeToPassengerFromDriverAfterApplied =
- timeToPassengerFromDriverAfterApplied - i;
-
- if (remainingTimeToPassengerFromDriverAfterApplied < 69) {
- if (rideTimerBegin == false) {
- getBeginRideFromDriver();
- }
- }
-
- int minutes =
- (remainingTimeToPassengerFromDriverAfterApplied / 60).floor();
- int seconds = remainingTimeToPassengerFromDriverAfterApplied % 60;
- stringRemainingTimeToPassenger =
- '$minutes:${seconds.toString().padLeft(2, '0')}';
-
- update();
- }
- }
-
- // Function to stop the timer
- void stopTimerFromDriverToPassengerAfterApplied() {
- isTimerFromDriverToPassengerAfterAppliedRunning = false;
- update();
- }
-
- void startTimerDriverWaitPassenger5Minute() async {
- stopTimerFromDriverToPassengerAfterApplied();
- isDriverArrivePassenger = true;
- isDriverInPassengerWay = false;
- timeToPassengerFromDriverAfterApplied = 0;
- update();
- for (int i = 0; i <= 300; i++) {
- await Future.delayed(const Duration(seconds: 1));
- progressTimerDriverWaitPassenger5Minute = i / 300;
- remainingTimeDriverWaitPassenger5Minute = 300 - i;
-
- int minutes = (remainingTimeDriverWaitPassenger5Minute / 60).floor();
- int seconds = remainingTimeDriverWaitPassenger5Minute % 60;
- stringRemainingTimeDriverWaitPassenger5Minute =
- '$minutes:${seconds.toString().padLeft(2, '0')}';
-
- update();
- }
- }
-
- // Create a StreamController to manage the timer values
- final timerController = StreamController();
-
-// Start the timer when the ride begins
- void beginRideTimer() {
- // Set up the timer to run every second
- Timer.periodic(const Duration(seconds: 1), (timer) {
- // Update the timer value and notify listeners
- timerController.add(timer.tick);
- update();
- });
- }
-
-// Stop the timer when the ride ends
- void stopRideTimer() {
- timerController.close();
- 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);
- box.write(BoxName.arrivalTime, arrivalTime);
- for (int i = 0; i <= durationToRide; i++) {
- await Future.delayed(const Duration(seconds: 1));
- progressTimerRideBegin = i / durationToRide;
- remainingTimeTimerRideBegin = durationToRide - i;
- bool sendSOS = false;
- if (speed > 100 && sendSOS == false) {
- Get.defaultDialog(
- barrierDismissible: false,
- title: "Warning: Speeding detected!".tr,
- titleStyle: AppStyle.title,
- content: Text(
- "We noticed the speed is exceeding 100 km/h. Please slow down for your safety. If you feel unsafe, you can share your trip details with a contact or call the police using the red SOS button."
- .tr,
- style: AppStyle.title,
- ),
- confirm: MyElevatedButton(
- title: "Share Trip Details".tr,
- onPressed: () {
- Get.back();
- // Implement sharing trip details logic here
- String message = "**Emergency SOS from Passenger:**\n";
-
-// Get trip details from GetX or relevant provider
- String origin = passengerLocation.toString();
- String destination = myDestination.toString();
- String driverName = firstName;
- String driverCarPlate = licensePlate;
-
-// Add trip details to the message
- message += "* ${'Origin'.tr}: $origin\n";
- message += "* ${'Destination'.tr}: $destination\n";
- message += "* ${'Driver Name'.tr}: $driverName\n";
- message += "* ${'Driver Car Plate'.tr}: $driverCarPlate\n\n";
- message += "* ${'Driver phone'.tr}:$driverPhone\n\n";
-
-// Add any additional information you want to include (optional)
-// - Example: current location (using GetX LocationController)
- message +=
- "${'Current Location'.tr}:https://www.google.com/maps/place/${passengerLocation.latitude},${passengerLocation.longitude} \n";
-
-// Append a call to action
- message += "Please help! Contact me as soon as possible.".tr;
-
-// Launch WhatsApp communication with the constructed message
- launchCommunication(
- 'whatsapp', box.read(BoxName.sosPhonePassenger), message);
- sendSOS = true;
- },
- kolor: AppColor.redColor,
- ),
- cancel: MyElevatedButton(
- title: "Cancel".tr,
- onPressed: () {
- Get.back();
- },
- kolor: AppColor.greenColor,
- ),
- );
- }
- int minutes = (remainingTimeTimerRideBegin / 60).floor();
- int seconds = remainingTimeTimerRideBegin % 60;
- stringRemainingTimeRideBegin =
- '$minutes:${seconds.toString().padLeft(2, '0')}';
-
- update();
- }
- // rideTimerBegin = false;
- // isRideFinished = true;
- // update();
- }
-
- void tripFinishedFromDriver() async {
- isRideFinished = true;
- rideTimerBegin = false;
- box.write(BoxName.arrivalTime, '');
- remainingTimeTimerRideBegin = 0;
- box.write(BoxName.passengerWalletTotal, '0');
- update();
- }
-
- void getBeginRideFromDriver() async {
- try {
- var res = await CRUD()
- .get(link: AppLink.getRideStatusBegin, payload: {'ride_id': rideId});
- if (res == 'failure') {
- // print(res);
- }
- var decode = jsonDecode(res);
-
- if (decode['data']['status'] == 'Begin') {
- timeToPassengerFromDriverAfterApplied = 0;
- remainingTime = 0;
- remainingTimeToPassengerFromDriverAfterApplied = 0;
- remainingTimeDriverWaitPassenger5Minute = 0;
- rideTimerBegin = true;
- statusRide = 'Begin';
- isDriverInPassengerWay = false;
- isDriverArrivePassenger = false;
- update();
- // isCancelRidePageShown = true;
- rideIsBeginPassengerTimer();
- runWhenRideIsBegin();
- // //print('rideTimerBegin: $rideTimerBegin');
- }
- } catch (e) {
- //print('Error: $e');
- // Handle the error or perform any necessary actions
- }
- }
-
- Map rideStatusFromStartApp = {};
- getRideStatusFromStartApp() async {
- try {
- var res = await CRUD().get(
- link: AppLink.getRideStatusFromStartApp,
- payload: {'passenger_id': box.read(BoxName.passengerID)});
- if (res == 'failure') {
- //print(res);
- }
- rideStatusFromStartApp = jsonDecode(res);
- print(rideStatusFromStartApp['data']['status']);
- if (rideStatusFromStartApp['data']['status'] == 'Begin') {
- statusRide = 'Begin';
- driverId = rideStatusFromStartApp['data']['driver_id'];
- firstName = rideStatusFromStartApp['data']['driverName'];
- driverRate = rideStatusFromStartApp['data']['rateDriver'].toString();
- statusRideFromStart = true;
- // DateTime endTime =
- // DateTime.parse(rideStatusFromStartApp['data']['endtime']);
- // DateTime rideTimeStart =
- // DateTime.parse(rideStatusFromStartApp['data']['rideTimeStart']);
- //
- // // Calculate the new end time by adding the duration to the rideTimeStart
- // DateTime newEndTime = rideTimeStart.add(
- // Duration(seconds: endTime.difference(rideTimeStart).inSeconds));
- //
- // // Save the new end time in a variable
- // var newEndTimeVariable = newEndTime.toString();
- update();
-
- Map tripData =
- box.read(BoxName.tripData) as Map;
- print(tripData);
- final points = decodePolyline(
- tripData["routes"][0]["overview_polyline"]["points"]);
-
- for (int i = 0; i < points.length; i++) {
- double lat = points[i][0].toDouble();
- double lng = points[i][1].toDouble();
- polylineCoordinates.add(LatLng(lat, lng));
- }
- var polyline = Polyline(
- polylineId: const PolylineId('begin trip'),
- points: polylineCoordinates,
- width: 10,
- color: Colors.blue,
- );
-
- polyLines.add(polyline);
- timeToPassengerFromDriverAfterApplied = 0;
- remainingTime = 0;
- remainingTimeToPassengerFromDriverAfterApplied = 0;
- remainingTimeDriverWaitPassenger5Minute = 0;
- rideTimerBegin = true;
- isDriverInPassengerWay = false;
- isDriverArrivePassenger = false;
- // update();
- // isCancelRidePageShown = true;
- durationToAdd = tripData['routes'][0]['legs'][0]['duration']['value'];
- rideIsBeginPassengerTimer();
- runWhenRideIsBegin();
- update();
- }
- } catch (e) {
- //print('Error: $e');
- // Handle the error or perform any necessary actions
- }
- }
-
- void driverArrivePassenger() {
- timeToPassengerFromDriverAfterApplied = 0;
- remainingTime = 0;
- // isCancelRidePageShown = true;
- update();
- rideIsBeginPassengerTimer();
- // runWhenRideIsBegin();
- }
-
- void cancelTimerToPassengerFromDriverAfterApplied() {
- timerToPassengerFromDriverAfterApplied?.cancel();
- }
-
- void clearPlacesDestination() {
- placesDestination = [];
- hintTextDestinationPoint = 'Search for your destination'.tr;
- update();
- }
-
- void clearPlacesStart() {
- placesStart = [];
- hintTextStartPoint = 'Search for your Start point'.tr;
- update();
- }
-
- void clearPlaces(int index) {
- placeListResponseAll[index] = [];
- hintTextwayPointStringAll[index] = 'Search for waypoint'.tr;
- update();
- }
-
- void clearPlaces1() {
- wayPoint1 = [];
- hintTextwayPoint1 = 'Search for waypoint'.tr;
- update();
- }
-
- void clearPlaces2() {
- wayPoint2 = [];
- hintTextwayPoint2 = 'Search for waypoint'.tr;
- update();
- }
-
- void clearPlaces3() {
- wayPoint3 = [];
- hintTextwayPoint3 = 'Search for waypoint'.tr;
- update();
- }
-
- void clearPlaces4() {
- wayPoint4 = [];
- hintTextwayPoint4 = 'Search for waypoint'.tr;
- update();
- }
-
- int selectedReason = -1;
- String? cancelNote;
- void selectReason(int index, String note) {
- selectedReason = index;
- cancelNote = note;
- update();
- }
-
- void getDialog(String title, midTitle, VoidCallback onPressed) {
- Get.defaultDialog(
- title: title,
- titleStyle: AppStyle.title,
- middleTextStyle: AppStyle.title,
- content: Column(
- children: [
- IconButton(
- onPressed: () async {
- await textToSpeechController.speakText(midTitle);
- },
- icon: const Icon(Icons.headphones)),
- Text(
- midTitle,
- style: AppStyle.title,
- )
- ],
- ),
- confirm: MyElevatedButton(
- title: 'Ok'.tr,
- onPressed: onPressed,
- kolor: AppColor.greenColor,
- ),
- cancel: MyElevatedButton(
- title: 'Cancel',
- onPressed: () {
- Get.back();
- }));
- }
-
- int currentTimeSearchingCaptainWindow = 0;
- late String driverPhone = '';
- late String driverRate = '';
- late String firstName = '';
- late String carColor = '';
- late String carYear = '';
- late String model = '';
- late String make = '';
- late String licensePlate = '';
- confirmRideForFirstDriver() async {
- await getCarsLocationByPassengerAndReloadMarker();
- await getNearestDriverByPassengerLocationAPIGOOGLE();
-
- if (dataCarsLocationByPassenger != 'failure') {
- driverToken =
- dataCarsLocationByPassenger['message'][carsOrder]['token'].toString();
- driverPhone =
- dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
- firstName = dataCarsLocationByPassenger['message'][carsOrder]
- ['first_name']
- .toString();
- carColor =
- dataCarsLocationByPassenger['message'][carsOrder]['color'].toString();
- driverRate = dataCarsLocationByPassenger['message'][carsOrder]
- ['ratingDriver']
- .toString();
- carYear =
- dataCarsLocationByPassenger['message'][carsOrder]['year'].toString();
- model =
- '${dataCarsLocationByPassenger['message'][carsOrder]['model']} - ${dataCarsLocationByPassenger['message'][carsOrder]['make']}';
- licensePlate = dataCarsLocationByPassenger['message'][carsOrder]
- ['car_plate']
- .toString();
-
- PaymentController paymentController = Get.find();
- rideConfirm = true;
- shouldFetch = true;
- isBottomSheetShown = false;
- timeToPassengerFromDriverAfterApplied = 60;
- isDriversTokensSend = false;
-
- update();
- // //print('rideConfirm= $rideConfirm');
-
- await CRUD().post(link: AppLink.addRides, payload: {
- "start_location": //'${data[0]['start_address']}',
- '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
- "end_location": //'${data[0]['end_address']}',
- '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
- "date": DateTime.now().toString(),
- "time": DateTime.now().toString(),
- "endtime": durationToAdd.toString(),
- "price": totalPassenger.toStringAsFixed(2),
- "passenger_id": box.read(BoxName.passengerID).toString(),
- "driver_id": dataCarsLocationByPassenger['message'][carsOrder]
- ['driver_id']
- .toString(),
- "status": "waiting",
- 'carType': box.read(BoxName.carType),
- "price_for_driver": totalPassenger.toString(),
- "price_for_passenger": totalME.toString(),
- "distance": distance.toString()
- }).then((value) {
- // //print(jsonDecode(value)['message']);
- // List body = [
- rideId = jsonDecode(value)['message'];
- List body = [
- '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
- '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
- totalPassenger.toStringAsFixed(2),
- totalDriver.toStringAsFixed(2),
- durationToRide.toString(),
- distance.toStringAsFixed(2),
- dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
- .toString(),
- box.read(BoxName.passengerID).toString(),
- box.read(BoxName.name).toString(),
- box.read(BoxName.tokenFCM).toString(),
- box.read(BoxName.phone).toString(),
- durationByPassenger.toString(),
- distanceByPassenger.toString(),
- paymentController.isWalletChecked.toString(),
- dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(),
- durationToPassenger.toString(),
- rideId,
- rideTimerBegin.toString(),
- dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
- .toString(),
- durationToRide.toString(),
- Get.find().wayPoints.length > 1
- ? 'haveSteps'
- : 'startEnd',
- placesCoordinate[0],
- placesCoordinate[1],
- placesCoordinate[2],
- placesCoordinate[3],
- placesCoordinate[4],
- costForDriver.toStringAsFixed(2),
- double.parse(box.read(BoxName.passengerWalletTotal)) < 0
- ? double.parse(box.read(BoxName.passengerWalletTotal))
- .toStringAsFixed(2)
- : '0',
- box.read(BoxName.email).toString(),
- startNameAddress,
- endNameAddress,
- box.read(BoxName.carType),
- kazan.toStringAsFixed(0),
- passengerRate.toStringAsFixed(2),
- ]; //
- print(body);
- FirebaseMessagesController().sendNotificationToDriverMAP(
- 'Order',
- jsonDecode(value)['message'].toString(),
- dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(),
- body,
- // polylineCoordinates.toString()
- );
- print(dataCarsLocationByPassenger);
- // //print(dataCarsLocationByPassenger['message'][0]['token'].toString());
- });
- delayAndFetchRideStatus(rideId);
- if (shouldFetch == false) {
- startTimer();
- update();
- }
- update();
- } else {
- Get.defaultDialog(
- title: 'No Car or Driver Found in your area.'.tr,
- titleStyle: AppStyle.title,
- middleText: 'Please Try anther time '.tr,
- middleTextStyle: AppStyle.title.copyWith(color: AppColor.yellowColor),
- confirm:
- MyElevatedButton(title: 'Ok'.tr, onPressed: () => Get.back()));
- }
- }
-
- bool isDriversTokensSend = false;
- confirmRideForAllDriverAvailable() async {
- // isDriversTokensSend = true;
- PaymentController paymentController = Get.find();
- rideConfirm = true;
- shouldFetch = true;
- isBottomSheetShown = false;
- timeToPassengerFromDriverAfterApplied = 60;
- driversToken.remove(driverToken);
- List body = [
- '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
- '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
- totalPassenger.toStringAsFixed(2),
- totalDriver.toStringAsFixed(2),
- durationToRide.toString(),
- distance.toStringAsFixed(2),
- dataCarsLocationByPassenger['message'][carsOrder]['driver_id'].toString(),
- box.read(BoxName.passengerID).toString(),
- box.read(BoxName.name).toString(),
- box.read(BoxName.tokenFCM).toString(),
- box.read(BoxName.phone).toString(),
- durationByPassenger.toString(),
- distanceByPassenger.toString(),
- paymentController.isWalletChecked.toString(),
- dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(),
- durationToPassenger.toString(),
- rideId,
- rideTimerBegin.toString(),
- dataCarsLocationByPassenger['message'][carsOrder]['driver_id'].toString(),
- durationToRide.toString(),
- Get.find().wayPoints.length > 1
- ? 'haveSteps'
- : 'startEnd',
- placesCoordinate[0],
- placesCoordinate[1],
- placesCoordinate[2],
- placesCoordinate[3],
- placesCoordinate[4],
- costForDriver.toStringAsFixed(2),
- double.parse(box.read(BoxName.passengerWalletTotal)) < 0
- ? double.parse(box.read(BoxName.passengerWalletTotal))
- .toStringAsFixed(2)
- : '0',
- box.read(BoxName.email).toString(),
- startNameAddress,
- endNameAddress,
- box.read(BoxName.carType),
- kazan.toStringAsFixed(0),
- passengerRate.toStringAsFixed(2),
- ];
- print('driversToken');
- print(driversToken);
- for (var i = 0; i < driversToken.length; i++) {
- FirebaseMessagesController().sendNotificationToDriverMapPolyline(
- 'OrderSpeed',
- rideId.toString(),
- driversToken[i],
- body,
- polylineCoordinates.toString());
- }
-
- delayAndFetchRideStatusForAllDriverAvailable(rideId);
-
- update();
- }
-
- void delayAndFetchRideStatus(String rideId) {
- Timer(const Duration(milliseconds: 200), () async {
- if (shouldFetch) {
- // //print('shouldFetch is =$shouldFetch');
- var res = await getRideStatus(rideId);
- // print(res);
- // var decod = jsonDecode(res);
- print(
- ' 000000000000000000delayAndFetchRideStatus0000000000000000000000000000000');
- print(res);
- if (res.toString() == 'Apply') {
- // getUpdatedRideForDriverApply(rideId);
- shouldFetch = false; // Stop further fetches
- statusRide = 'Apply';
- rideConfirm = false;
- isSearchingWindow = false;
- update();
- startTimerFromDriverToPassengerAfterApplied();
- // startTimer();
- } else if (res.toString() == 'Refused') {
- // isDriversTokensSend = false;
- if (isDriversTokensSend == false) {
- confirmRideForAllDriverAvailable();
- isDriversTokensSend = true;
- }
- } else if (isDriversTokensSend == false) {
- delayAndFetchRideStatus(
- rideId); // Repeat the delay and fetch operation
- update();
- }
- }
- });
- }
-
- void delayAndFetchRideStatusForAllDriverAvailable(String rideId) {
- Timer(const Duration(milliseconds: 200), () async {
- if (shouldFetch) {
- // //print('shouldFetch is =$shouldFetch');
- var res = await getRideStatus(rideId);
- print(res);
- // var decod = jsonDecode(res);
- print('--------delayAndFetchRideStatusForAllDriverAvailable----');
- // print(decod['data']);
- if (res.toString() == 'Apply') {
- getUpdatedRideForDriverApply(rideId);
-
- shouldFetch = false; // Stop further fetches
- statusRide = 'Apply';
- rideConfirm = false;
- isSearchingWindow = false;
- update();
- startTimerFromDriverToPassengerAfterApplied();
- } else if (res.toString() == 'Refused') {
- delayAndFetchRideStatusForAllDriverAvailable(rideId);
- }
- }
- });
- }
-
- void startTimer() async {
- for (int i = 0; i <= durationTimer; i++) {
- await Future.delayed(const Duration(seconds: 1));
- progress = i / durationTimer;
- remainingTime = durationTimer - i;
- if (remainingTime == 0) {
- rideConfirm = false;
-
- // //print(timeToPassengerFromDriverAfterApplied);
- timeToPassengerFromDriverAfterApplied += durationToPassenger;
- // //print(duration1);
-
- // //print('timeToPassengerFromDriverAfterApplied====' +
- // timeToPassengerFromDriverAfterApplied.toString());
- startTimerFromDriverToPassengerAfterApplied();
- update();
- }
- update();
- }
- timerEnded();
- }
-
- void timerEnded() async {
- //print('Timer ended');
-
- runEvery30SecondsUntilConditionMet();
- isCancelRidePageShown = false;
- update();
- }
-
- Future getRideStatus(String rideId) async {
- final response =
- await CRUD().get(link: AppLink.getRideStatus, payload: {'id': rideId});
-
- return jsonDecode(response)['data'];
- }
-
- late String driverCarModel, driverCarMake, driverLicensePlate, driverName;
- getUpdatedRideForDriverApply(String rideId) async {
- // if (isDriversTokensSend) {
- final res =
- await CRUD().get(link: AppLink.getRideOrderID, payload: {'id': rideId});
- if (res != 'failure') {
- var response = jsonDecode(res);
- print('driverId: ${response['data']['driver_id']}');
- print('driverPhone: ${response['data']['phone']}');
- print('driverCarMake: ${response['data']['make']}');
- print('model: ${response['data']['model']}');
- print('make: ${response['data']['make']}');
- print('licensePlate: ${response['data']['car_plate']}');
- print('firstName: ${response['data']['first_name']}');
- print('driverToken: ${response['data']['token']}');
- print('carYear: ${response['data']['year']}');
- print('driverRate: ${response['data']['ratingDriver']}');
- driverId = response['data']['driver_id'];
- driverPhone = response['data']['phone'];
- driverCarMake = response['data']['make'];
- model = response['data']['model'];
- make = response['data']['make'];
- licensePlate = response['data']['car_plate'];
- firstName = response['data']['first_name'];
- driverToken = response['data']['token'];
- carYear = response['data']['year'];
- driverRate = response['data']['ratingDriver'];
- }
- driversToken.remove(driverToken);
- for (var i = 0; i < driversToken.length; i++) {
- FirebaseMessagesController().sendNotificationToAnyWithoutData(
- 'Order Applied',
- '$driverName Apply order\nTake attention in other order'.tr,
- driversToken[i]);
- }
- // }
- }
-
- late LatLng currentDriverLocation;
- late double headingList;
-
- Future getCarsLocationByPassengerAndReloadMarker() async {
- if (statusRide == 'wait') {
- carsLocationByPassenger = [];
- LatLngBounds bounds = calculateBounds(
- passengerLocation.latitude, passengerLocation.longitude, 7000);
-
- var res =
- await CRUD().get(link: AppLink.getCarsLocationByPassenger, payload: {
- 'southwestLat': bounds.southwest.latitude.toString(),
- 'southwestLon': bounds.southwest.longitude.toString(),
- 'northeastLat': bounds.northeast.latitude.toString(),
- 'northeastLon': bounds.northeast.longitude.toString(),
- });
- if (res == 'failure') {
- noCarString = true;
- dataCarsLocationByPassenger = res;
- update();
- } else {
- // Get.snackbar('no car', 'message');
- noCarString = false;
- dataCarsLocationByPassenger = jsonDecode(res);
- //print(dataCarsLocationByPassenger);
- // if (dataCarsLocationByPassenger.length > carsOrder) {
- driverId = dataCarsLocationByPassenger['message'][carsOrder]
- ['driver_id']
- .toString();
- gender = dataCarsLocationByPassenger['message'][carsOrder]['gender']
- .toString();
- // }
-
- // //print('driverId==============$driverId');
-
- carsLocationByPassenger.clear(); // Clear existing markers
-
- // late LatLng lastDriverLocation; // Initialize a variable for last location
-
- for (var i = 0;
- i < dataCarsLocationByPassenger['message'].length;
- i++) {
- var json = dataCarsLocationByPassenger['message'][i];
- print(json);
- CarLocationModel model = CarLocationModel.fromJson(json);
- if (carLocationsModels.length < i + 1) {
- carLocationsModels.add(model);
- markers.add(
- Marker(
- markerId: MarkerId(json['latitude']),
- position: LatLng(
- double.parse(json['latitude']),
- double.parse(json['longitude']),
- ),
- rotation: double.parse(json['heading']),
- icon: carIcon,
- ),
- );
- driversToken.add(json['token']);
- // driversToken = json['token'];
- } else {
- carLocationsModels[i] = model;
- markers[i] = Marker(
- markerId: MarkerId(json['latitude']),
- position: LatLng(
- double.parse(json['latitude']),
- double.parse(json['longitude']),
- ),
- rotation: double.parse(json['heading']),
- icon: carIcon,
- );
- // driversToken = json['token'];
- driversToken.add(json['token']);
- }
- }
- }
-
- update();
- }
- }
-
- LatLng driverLocationToPassenger = const LatLng(32, 35);
- Future getDriverCarsLocationToPassengerAfterApplied() async {
- driverCarsLocationToPassengerAfterApplied = [];
-
- var res = await CRUD().get(
- link: AppLink.getDriverCarsLocationToPassengerAfterApplied,
- payload: {'driver_id': driverId});
-
- datadriverCarsLocationToPassengerAfterApplied = jsonDecode(res);
- driverLocationToPassenger = LatLng(
- double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
- ['latitude']),
- double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
- ['longitude']));
- driverCarsLocationToPassengerAfterApplied.add(LatLng(
- double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
- ['latitude']),
- double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
- ['longitude'])));
- CarLocationModel model = CarLocationModel.fromJson(
- datadriverCarsLocationToPassengerAfterApplied['message'][0]);
- carLocationsModels.add(model);
- update();
- }
-
- Future runEvery30SecondsUntilConditionMet() async {
- // Calculate the duration of the trip in minutes.
- double tripDurationInMinutes = durationToPassenger / 6;
- int loopCount = tripDurationInMinutes.ceil();
- // If the trip duration is less than or equal to 50 minutes, then break the loop.
- for (var i = 0; i < loopCount; i++) {
- // Wait for 50 seconds.
- await Future.delayed(const Duration(seconds: 4));
- await getDriverCarsLocationToPassengerAfterApplied();
- reloadMarkerDriverCarsLocationToPassengerAfterApplied();
- }
- }
-
- Future runWhenRideIsBegin() async {
- // Calculate the duration of the trip in minutes.
- double tripDurationInMinutes = durationToRide / 6;
- int loopCount = tripDurationInMinutes.ceil();
- // If the trip duration is less than or equal to 50 minutes, then break the loop.
- for (var i = 0; i < loopCount; i++) {
- // Wait for 50 seconds.
- print('loop is $i from $loopCount');
- await Future.delayed(const Duration(seconds: 4));
- await getDriverCarsLocationToPassengerAfterApplied();
- reloadMarkerDriverCarsLocationToPassengerAfterApplied();
- }
- }
-
- void clearMarkersExceptStartEnd() {
- Set markersToRemove = markers
- .where((marker) =>
- marker.markerId != const MarkerId("start") &&
- marker.markerId != const MarkerId("end"))
- .toSet();
-
- for (Marker marker in markersToRemove) {
- markers.remove(marker);
- update();
- }
- }
-
- void reloadMarkerDriverCarsLocationToPassengerAfterApplied() {
- clearMarkersExceptStartEnd();
- // for (var i = 0; i < driverCarsLocationToPassengerAfterApplied.length; i++) {
- LatLng driverPosition = LatLng(
- double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
- ['latitude']),
- double.parse(datadriverCarsLocationToPassengerAfterApplied['message'][0]
- ['longitude']));
- print('driver position $driverPosition');
- final driverAcceptedMarker = Marker(
- markerId: const MarkerId('driverToPassengers'),
- position: driverPosition,
- rotation: double.parse(
- datadriverCarsLocationToPassengerAfterApplied['message'][0]
- ['heading']),
- icon: carIcon,
- );
- markers.add(driverAcceptedMarker);
- // update();
- mapController?.animateCamera(CameraUpdate.newLatLng(driverPosition));
- update();
- // } // Update the map with the new markers
- }
-
- restCounter() {
- clearPlacesDestination();
- clearPolyline();
- data = [];
- rideConfirm = false;
- shouldFetch = false;
- timeToPassengerFromDriverAfterApplied = 0;
- update();
- }
-
- Future cancelRideAfterRejectFromAll() async {
- clearPlacesDestination();
- clearPolyline();
- data = [];
- await CRUD().post(link: AppLink.updateRides, payload: {
- "id": rideId.toString(), // Convert to String
- "status": 'notApplyFromAnyDriver'
- });
- rideConfirm = false;
- statusRide == 'Cancel';
- isSearchingWindow = false;
- shouldFetch = false;
- isPassengerChosen = false;
- isCashConfirmPageShown = false;
- // totalStepDurations = 0;
- isCashSelectedBeforeConfirmRide = false;
- timeToPassengerFromDriverAfterApplied = 0;
- changeCancelRidePageShow();
- remainingTime = 0;
-
- update();
- }
-
- Future cancelRide() async {
- //print("rideConfirm=$rideConfirm");
-
- if (rideConfirm == false && statusRide != 'Apply') {
- clearPlacesDestination();
- clearPolyline();
- // clearPolylineAll();
- print('rideConfirm before is $rideConfirm');
- data = [];
- changeCancelRidePageShow();
- if (rideId != 'yet') {
- await CRUD().post(link: AppLink.updateDriverOrder, payload: {
- "order_id": rideId.toString(), // Convert to String
- "status": 'Cancel'
- });
- }
- rideConfirm = false;
- shouldFetch = false;
- isCashConfirmPageShown = false;
- isSearchingWindow = false;
- statusRide = 'Cancel';
- isPassengerChosen = false;
- isCashSelectedBeforeConfirmRide = false;
- isPickerShown = false;
- isMarkersShown = false;
- haveSteps = false;
- isMarkersShown = false;
- // totalStepDurations = 0;
- timeToPassengerFromDriverAfterApplied = 0;
- remainingTime = 0;
- isWayPointStopsSheetUtilGetMap = false;
- update();
- } else {
- clearPlacesDestination();
- clearPolyline();
- print('rideConfirm is $rideConfirm');
- data = [];
- await CRUD().post(link: AppLink.updateDriverOrder, payload: {
- "order_id": rideId.toString(), // Convert to String
- "status": 'Cancel'
- });
- FirebaseMessagesController().sendNotificationToDriverMAP(
- 'Cancel Trip', 'Trip Cancelled'.tr, driverToken, []);
- isPickerShown = false;
- isWayPointStopsSheetUtilGetMap = false;
- rideConfirm = false;
- shouldFetch = false;
- isCashConfirmPageShown = false;
- isSearchingWindow = false;
- isPassengerChosen = false;
- isCashSelectedBeforeConfirmRide = false;
- statusRide = 'Cancel';
- haveSteps = false;
- isMarkersShown = false;
- timeToPassengerFromDriverAfterApplied = 0;
- changeCancelRidePageShow();
- clearPolyline();
- remainingTime = 0;
- durationTimer = 0;
- update();
- }
- }
-
- void changePickerShown() {
- isPickerShown = !isPickerShown;
- heightPickerContainer = isPickerShown == true ? 150 : 90;
- update();
- }
-
- void changeHeightPointsPageForRider() {
- isPointsPageForRider = !isPointsPageForRider;
- heightPointsPageForRider = isPointsPageForRider == true ? Get.height : 0;
- update();
- }
-
- getCoordinateFromMapWayPoints(int index) {
- placesCoordinate[index] = newStartPointLocation.toString();
- update();
- }
-
- void changeMainBottomMenuMap() {
- if (isWayPointStopsSheetUtilGetMap == true) {
- changeWayPointSheet();
- } else {
- isMainBottomMenuMap = !isMainBottomMenuMap;
- mainBottomMenuMapHeight =
- isMainBottomMenuMap == true ? Get.height * .2 : Get.height * .55;
- isWayPointSheet = false;
- if (heightMenuBool == true) {
- getDrawerMenu();
- }
- initilizeGetStorage();
- update();
- }
- }
-
- void downPoints() {
- if (Get.find().wayPoints.length < 2) {
- isWayPointStopsSheetUtilGetMap = false;
- isWayPointSheet = false;
- wayPointSheetHeight = isWayPointStopsSheet ? Get.height * .45 : 0;
- // changeWayPointStopsSheet();
- update();
- }
- // changeWayPointStopsSheet();
- // isWayPointSheet = false;
- update();
- }
-
- void changeWayPointSheet() {
- isWayPointSheet = !isWayPointSheet;
- wayPointSheetHeight = isWayPointSheet == false ? 0 : Get.height * .45;
- // if (heightMenuBool == true) {
- // getDrawerMenu();
- // }
- update();
- }
-
- void changeWayPointStopsSheet() {
- // int waypointsLength = Get.find().wayPoints.length;
-
- //print('isWayPointStopsSheet $wayPointIndex');
- if (wayPointIndex > -1) {
- isWayPointStopsSheet = true;
- isWayPointStopsSheetUtilGetMap = true;
- }
- isWayPointStopsSheet = !isWayPointStopsSheet;
- wayPointSheetHeight = isWayPointStopsSheet ? Get.height * .45 : 0;
- // if (heightMenuBool == true) {
- // getDrawerMenu();
- // }
- update();
- }
-
- changeHeightPlaces() {
- if (placesDestination.isEmpty) {
- height = 0;
- update();
- }
- height = 150;
- update();
- }
-
- changeHeightStartPlaces() {
- if (placesStart.isEmpty) {
- height = 0;
- update();
- }
- height = 150;
- update();
- }
-
- changeHeightPlacesAll(int index) {
- if (placeListResponseAll[index].isEmpty) {
- height = 0;
- update();
- }
- height = 150;
- update();
- }
-
- changeHeightPlaces1() {
- if (wayPoint1.isEmpty) {
- height = 0;
- update();
- }
- height = 150;
- update();
- }
-
- changeHeightPlaces2() {
- if (wayPoint2.isEmpty) {
- height = 0;
- update();
- }
- height = 150;
- update();
- }
-
- changeHeightPlaces3() {
- if (wayPoint3.isEmpty) {
- height = 0;
- update();
- }
- height = 150;
- update();
- }
-
- changeHeightPlaces4() {
- if (wayPoint4.isEmpty) {
- height = 0;
- update();
- }
- height = 150;
- update();
- }
-
- hidePlaces() {
- height = 0;
-
- update();
- }
-
- Future getPlaces() async {
- var url =
- // '${AppLink.googleMapsLink}place/nearbysearch/json?location=${mylocation.longitude}&radius=25000&language=ar&keyword=&key=${placeController.text}${AK.mapAPIKEY}';
- '${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${placeDestinationController.text}&location=${passengerLocation.latitude},${passengerLocation.longitude}&radius=50000&language=${box.read(BoxName.lang)}&key=${AK.mapAPIKEY.toString()}';
-
- var response = await CRUD().getGoogleApi(link: url, payload: {});
-
- placesDestination = response['results'];
- //print(placesDestination);
- update();
- }
-
- Future getPlacesStart() async {
- var url =
- // '${AppLink.googleMapsLink}place/nearbysearch/json?location=${mylocation.longitude}&radius=25000&language=ar&keyword=&key=${placeController.text}${AK.mapAPIKEY}';
- '${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${placeStartController.text}&location=${passengerLocation.latitude},${passengerLocation.longitude}&radius=50000&language=${box.read(BoxName.lang)}&key=${AK.mapAPIKEY.toString()}';
-
- var response = await CRUD().getGoogleApi(link: url, payload: {});
-
- placesStart = response['results'];
- //print(placesStart);
- update();
- }
-
- Future getPlacesListsWayPoint(int index) async {
- var url =
- '${AppLink.googleMapsLink}place/nearbysearch/json?keyword=${wayPoint0Controller.text}&location=${passengerLocation.latitude},${passengerLocation.longitude}&radius=50000&language=${box.read(BoxName.lang)}&key=${AK.mapAPIKEY.toString()}';
-
- var response = await CRUD().getGoogleApi(link: url, payload: {});
-
- wayPoint0 = response['results'];
- placeListResponseAll[index] = response['results'];
- //print(wayPoint0);
- update();
- }
-
- LatLng fromString(String location) {
- List parts = location.split(',');
- double lat = double.parse(parts[0]);
- double lng = double.parse(parts[1]);
- return LatLng(lat, lng);
- }
-
- void clearPolyline() {
- polyLines = [];
- polylineCoordinates.clear();
- // polylineCoordinates = [];
- polylineCoordinatesPointsAll[0].clear();
- polylineCoordinatesPointsAll[1].clear();
- polylineCoordinatesPointsAll[2].clear();
- polylineCoordinatesPointsAll[3].clear();
- polylineCoordinatesPointsAll[4].clear();
- isMarkersShown = false;
- update();
- }
-
- void addCustomPicker() {
- ImageConfiguration config = ImageConfiguration(
- size: const Size(30, 30), devicePixelRatio: Get.pixelRatio
- // scale: 1.0,
- );
- BitmapDescriptor.fromAssetImage(config, 'assets/images/picker.png',
- mipmaps: false)
- .then((value) {
- markerIcon = value;
- update();
- });
- }
-
- void addCustomStartIcon() async {
-// Create the marker with the resized image
-
- ImageConfiguration config = ImageConfiguration(
- size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
- BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png',
- mipmaps: false)
- .then((value) {
- startIcon = value;
- update();
- });
- }
-
- void addCustomEndIcon() {
- ImageConfiguration config = ImageConfiguration(
- size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
- BitmapDescriptor.fromAssetImage(config, 'assets/images/b.png',
- mipmaps: false)
- .then((value) {
- endIcon = value;
- update();
- });
- }
-
- void addCustomCarIcon() {
- ImageConfiguration config = ImageConfiguration(
- size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
- BitmapDescriptor.fromAssetImage(config, 'assets/images/car.png',
- mipmaps: false)
- .then((value) {
- carIcon = value;
- update();
- });
- }
-
- void addCustomStepIcon() {
- ImageConfiguration config = ImageConfiguration(
- size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
- BitmapDescriptor.fromAssetImage(config, 'assets/images/brand.png',
- mipmaps: false)
- .then((value) {
- tripIcon = value;
- update();
- });
- }
-
- double speed = 0;
- Future getLocation() async {
- isLoading = true;
- update();
- bool serviceEnabled;
- PermissionStatus permissionGranted;
-
- // Check if location services are enabled
- serviceEnabled = await location.serviceEnabled();
- if (!serviceEnabled) {
- serviceEnabled = await location.requestService();
- if (!serviceEnabled) {
- // Location services are still not enabled, handle the error
- return;
- }
- }
-
- // Check if the app has permission to access location
- permissionGranted = await location.hasPermission();
- if (permissionGranted == PermissionStatus.denied) {
- permissionGranted = await location.requestPermission();
- if (permissionGranted != PermissionStatus.granted) {
- // Location permission is still not granted, handle the error
- return;
- }
- }
-
- // Configure location accuracy
- // LocationAccuracy desiredAccuracy = LocationAccuracy.high;
-
- // Get the current location
- LocationData _locationData = await location.getLocation();
- passengerLocation =
- (_locationData.latitude != null && _locationData.longitude != null
- ? LatLng(_locationData.latitude!, _locationData.longitude!)
- : null)!;
- newStartPointLocation = passengerLocation;
- speed = _locationData.speed!;
- // //print location details
- // //print('Accuracy: ${_locationData.accuracy}');
- // //print('Latitude: ${_locationData.latitude}');
- // //print('Longitude: ${_locationData.longitude}');
- // //print('Time: ${_locationData.time}');
- isLoading = false;
- update();
- }
-
- LatLngBounds calculateBounds(
- double centerLat, double centerLng, double radius) {
- // double radius = 4000; // 10 km in meters
-
- southwest = LatLng(
- centerLat - (radius / 111000),
- centerLng - (radius / (111000 * cos(centerLat))),
- );
-
- northeast = LatLng(
- centerLat + (radius / 111000),
- centerLng + (radius / (111000 * cos(centerLat))),
- );
-
- return LatLngBounds(southwest: southwest, northeast: northeast);
- }
-
- GoogleMapController? mapController;
- void onMapCreated(GoogleMapController controller) {
- // myLocation = Get.find().location as LatLng;
- // myLocation = myLocation;
- mapController = controller;
- controller.getVisibleRegion();
- controller.animateCamera(
- CameraUpdate.newLatLng(passengerLocation),
- );
- update();
- }
-
- // void startMarkerReloading() {
- // int count = 0;
- // markerReloadingTimer = Timer.periodic(const Duration(seconds: 30), (timer) {
- // //print('timer==============================');
- // reloadMarkers();
- //
- // count++;
- // if (count == 10) {
- // timer.cancel();
- // }
- // });
- // }
-
- startMarkerReloading() async {
- int reloadCount = 0;
-
- Timer.periodic(const Duration(seconds: 2), (timer) {
- reloadCount++;
-
- //print('Reloading markers ($reloadCount)');
- if (!rideConfirm) {
- reloadMarkers();
- } else {
- // runWhenRideIsBegin();
- }
-
- if (reloadCount >= 35) {
- timer.cancel(); // Stop the timer after 5 reloads
- //print('Marker reloading completed.');
- }
- });
- }
-
- reloadMarkers() async {
- if (statusRide == 'wait') {
- await getCarsLocationByPassengerAndReloadMarker();
- await getNearestDriverByPassengerLocation();
- }
- }
-
- String durationByPassenger = '';
- late DateTime newTime1 = DateTime.now();
- late DateTime timeFromDriverToPassenger = DateTime.now();
- String distanceByPassenger = '';
- late Duration durationFromDriverToPassenger;
- double nearestDistance = double.infinity;
- Future getNearestDriverByPassengerLocation() async {
- if (polyLines.isEmpty || data.isEmpty) {
- return null; // Early return if data is empty
- }
- if (!rideConfirm) {
- if (dataCarsLocationByPassenger != 'failure') {
- if (dataCarsLocationByPassenger['message'].length > 0) {
- for (var i = 0;
- i < dataCarsLocationByPassenger['message'].length;
- i++) {
- var carLocation = dataCarsLocationByPassenger['message'][i];
- durationToPassenger = 100; //////
- // Calculate the distance between the passenger's location and the current driver's location
- final distance = Geolocator.distanceBetween(
- passengerLocation.latitude,
- passengerLocation.longitude,
- double.parse(carLocation['latitude']),
- double.parse(carLocation['longitude']),
- );
-
- // Update the UI with the distance and duration
- update();
-
- // If the distance is less than the nearest distance, update the nearest driver
- if (distance < nearestDistance) {
- nearestDistance = distance;
-
- nearestCar = CarLocation(
- distance: distance,
- duration:
- 0, // We don't have duration information from Geolocator
- id: carLocation['driver_id'],
- latitude: double.parse(carLocation['latitude']),
- longitude: double.parse(carLocation['longitude']),
- );
- print('nearestCar ${nearestDistance.toStringAsFixed(0)}');
-
- // Update the UI with the nearest driver
- update();
- }
- }
- }
- }
- }
-
- // Return the nearest driver
- return nearestCar;
- }
-
- getNearestDriverByPassengerLocationAPIGOOGLE() async {
- if (polyLines.isEmpty || data.isEmpty) {
- 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;
- 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'];
- durationToPassenger =
- data['rows'][0]['elements'][0]['duration']['value'];
-
- durationFromDriverToPassenger =
- Duration(seconds: durationToPassenger.toInt());
- newTime1 = currentTime.add(durationFromDriverToPassenger);
- timeFromDriverToPassenger =
- newTime1.add(Duration(minutes: 2.toInt()));
- durationByPassenger =
- data['rows'][0]['elements'][0]['duration']['text'];
- update();
- if (distance1 < nearestDistance) {
- nearestDistance = distance1.toDouble();
-
- nearestCar = CarLocation(
- distance: distance1.toDouble(),
- duration: durationToPassenger.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
- }
- }
- }
- }
- }
- //print(nearestCar!.distance);
- //print(nearestCar!.duration);
- //print(nearestCar!.latitude);
- //print(nearestCar!.longitude);
- //print(nearestCar!.id);
- }
-
- calculateDistanceBetweenPassengerAndDriverBeforeCancelRide() async {
- await getDriverCarsLocationToPassengerAfterApplied();
- double distance = Geolocator.distanceBetween(
- passengerLocation.latitude,
- passengerLocation.longitude,
- driverCarsLocationToPassengerAfterApplied.last.latitude,
- driverCarsLocationToPassengerAfterApplied.last.longitude,
- );
- if (distance > 500) {
- isCancelRidePageShown = true;
- update();
- } else {
- Get.defaultDialog(
- title: 'The Driver Will be in your location soon .'.tr,
- middleText: 'The distance less than 500 meter.'.tr,
- confirm: MyElevatedButton(
- title: 'Ok'.tr,
- onPressed: () {
- Get.back();
- },
- ),
- );
- // cancel: MyElevatedButton(
- // title: 'No.Iwant Cancel Trip.'.tr, onPressed: () {}));
- }
- }
-
- List headingAngles = [];
- double calculateAngleBetweenLocations(LatLng start, LatLng end) {
- double startLat = start.latitude * math.pi / 180;
- double startLon = start.longitude * math.pi / 180;
- double endLat = end.latitude * math.pi / 180;
- double endLon = end.longitude * math.pi / 180;
-
- double dLon = endLon - startLon;
-
- double y = math.sin(dLon) * cos(endLat);
- double x = cos(startLat) * math.sin(endLat) -
- math.sin(startLat) * cos(endLat) * cos(dLon);
-
- double angle = math.atan2(y, x);
- double angleDegrees = angle * 180 / math.pi;
-
- return angleDegrees;
- }
-
- late LatLngBounds boundsData;
- late String startNameAddress = '';
- late String endNameAddress = '';
- getMap(String origin, destination) async {
- remainingTime = 25; //to make cancel every call
- await getCarsLocationByPassengerAndReloadMarker();
- // //print(carsLocationByPassenger);
- var coordDestination = destination.split(',');
- double latPassengerDestination = double.parse(coordDestination[0]);
- double lngPassengerDestination = double.parse(coordDestination[1]);
- myDestination = LatLng(latPassengerDestination, lngPassengerDestination);
- if (origin.isEmpty) {
- origin =
- '${passengerLocation.latitude.toString().split(',')[0]},${passengerLocation.longitude.toString().split(',')[1]}'; //todo
- }
- isLoading = false;
- update();
- var url =
- ('${AppLink.googleMapsLink}directions/json?&language=${box.read(BoxName.lang)}&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}');
-
- var response = await CRUD().getGoogleApi(link: url, payload: {});
- data = response['routes'][0]['legs'];
- // //print(data);
- box.remove(BoxName.tripData);
- box.write(BoxName.tripData, response);
- startNameAddress = data[0]['start_address'];
- endNameAddress = data[0]['end_address'];
- isLoading = false;
- newStartPointLocation = LatLng(
- data[0]["start_location"]['lat'], data[0]["start_location"]['lng']);
- markers.add(
- Marker(
- markerId: const MarkerId('start'),
- position: newStartPointLocation,
- icon: startIcon,
- ),
- );
- markers.add(
- Marker(
- markerId: const MarkerId('end'),
- position: LatLng(
- data[0]["end_location"]['lat'], data[0]["end_location"]['lng']),
- icon: endIcon,
- ),
- );
- update();
- durationToRide = data[0]['duration']['value'];
- final points =
- decodePolyline(response["routes"][0]["overview_polyline"]["points"]);
- for (int i = 0; i < points.length; i++) {
- double lat = points[i][0].toDouble();
- double lng = points[i][1].toDouble();
- polylineCoordinates.add(LatLng(lat, lng));
- }
-// Define the northeast and southwest coordinates
-
-// Define the northeast and southwest coordinates
- final bounds = response["routes"][0]["bounds"];
- LatLng northeast =
- LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);
- LatLng southwest =
- LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);
-
-// Create the LatLngBounds object
- LatLngBounds boundsData =
- LatLngBounds(northeast: northeast, southwest: southwest);
-
-// Fit the camera to the bounds
- var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 160);
- mapController!.animateCamera(cameraUpdate);
-
- // getDistanceFromText(data[0]['distance']['text']);
- double distanceOfTrip = (data[0]['distance']['value']) / 1000;
- distance = distanceOfTrip;
- // updateCameraForDistanceAfterGetMap();
-
- if (polyLines.isNotEmpty) {
- clearPolyline();
- } else {
- var polyline = Polyline(
- polylineId: PolylineId(response["routes"][0]["summary"]),
- points: polylineCoordinates,
- width: 10,
- color: Colors.blue,
- );
-
- polyLines.add(polyline);
- rideConfirm = false;
- isMarkersShown = true;
- update();
- }
- }
-
- double distanceOfDestination = 0;
- bool haveSteps = false;
- late LatLng latestPosition;
-// getMapPoints(String originSteps, String destinationSteps, int index) async {
-// isWayPointStopsSheetUtilGetMap = false;
-// haveSteps = true;
-// await getCarsLocationByPassenger();
-// // isLoading = true;
-// update();
-// String url = '${AppLink.googleMapsLink}directions/json'
-// '?origin=${coordinatesWithoutEmpty.first}'
-// '&destination=${coordinatesWithoutEmpty.last}';
-// if (coordinatesWithoutEmpty.length > 2) {
-// String waypoints = "";
-// for (int i = 1; i < coordinatesWithoutEmpty.length - 1; i++) {
-// waypoints += "${coordinatesWithoutEmpty[i]}|";
-// }
-// waypoints = waypoints.substring(0, waypoints.length - 1);
-// url += "&waypoints=$waypoints";
-// }
-// url += '&language=en'
-// '&avoid=tolls|ferries'
-// '&key=${AK.mapAPIKEY}';
-// var response = await CRUD().getGoogleApi(link: url, payload: {});
-// data = response['routes'][0]['legs'];
-// // //print(data);
-// // isLoading = false;
-// int durationToRide0 = data[0]['duration']['value'];
-// durationToRide = durationToRide + durationToRide0;
-// print(durationToRide0);
-// print('durationToRide = $durationToRide');
-// distance = distanceOfDestnation + (data[0]['distance']['value']) / 1000;
-// update();
-// final points =
-// decodePolyline(response["routes"][0]["overview_polyline"]["points"]);
-// for (int i = 0; i < points.length; i++) {
-// if (points[i][0].toString() != '') {
-// double lat = points[i][0].toDouble();
-// double lng = points[i][1].toDouble();
-// polylineCoordinatesPointsAll[index].add(LatLng(lat, lng));
-// }
-// }
-// // Define the northeast and southwest coordinates
-// update();
-// if (polyLines.isNotEmpty) {
-// // clearPolyline();
-// } else {
-// var polyline = Polyline(
-// polylineId: PolylineId(response["routes"][0]["summary"]),
-// points: polylineCoordinatesPointsAll[index],
-// width: 10,
-// color: Colors.blue,
-// );
-// polyLines.add(polyline);
-// rideConfirm = false;
-// // isMarkersShown = true;
-// update();
-// }
-// }
-
- getMapPoints(String originSteps, String destinationSteps, int index) async {
- isWayPointStopsSheetUtilGetMap = false;
- // haveSteps = true;
- await getCarsLocationByPassengerAndReloadMarker();
- // isLoading = true;
- update();
- var url =
- ('${AppLink.googleMapsLink}directions/json?&language=${box.read(BoxName.lang)}&avoid=tolls|ferries&destination=$destinationSteps&origin=$originSteps&key=${AK.mapAPIKEY}');
- // //print(url);
- var response = await CRUD().getGoogleApi(link: url, payload: {});
- data = response['routes'][0]['legs'];
- // //print(data);
- // isLoading = false;
-
- int durationToRide0 = data[0]['duration']['value'];
- durationToRide = durationToRide + durationToRide0;
- print(durationToRide0);
- print('durationToRide = $durationToRide');
- distance = distanceOfDestination + (data[0]['distance']['value']) / 1000;
-
- update();
- final points =
- decodePolyline(response["routes"][0]["overview_polyline"]["points"]);
- for (int i = 0; i < points.length; i++) {
- if (points[i][0].toString() != '') {
- double lat = points[i][0].toDouble();
- double lng = points[i][1].toDouble();
- polylineCoordinatesPointsAll[index].add(LatLng(lat, lng));
- }
- }
-// Define the northeast and southwest coordinates
-
- if (polyLines.isNotEmpty) {
- // clearPolyline();
- } else {
- var polyline = Polyline(
- polylineId: PolylineId(response["routes"][0]["summary"]),
- points: polylineCoordinatesPointsAll[index],
- width: 10,
- color: Colors.blue,
- );
-
- polyLines.add(polyline);
- rideConfirm = false;
- // isMarkersShown = true;
- update();
- }
- }
-
- void updateCameraForDistanceAfterGetMap() {
- LatLng coord1 = LatLng(
- double.parse(coordinatesWithoutEmpty.first.split(',')[0]),
- double.parse(coordinatesWithoutEmpty.first.split(',')[1]));
-
- LatLng coord2 = LatLng(
- double.parse(coordinatesWithoutEmpty.last.split(',')[0]),
- double.parse(coordinatesWithoutEmpty.last.split(',')[1]));
-
- LatLng northeast;
- LatLng southwest;
-
- if (coord1.latitude > coord2.latitude) {
- northeast = coord1;
- southwest = coord2;
- } else {
- northeast = coord2;
- southwest = coord1;
- }
-
- // Create the LatLngBounds object
- LatLngBounds bounds =
- LatLngBounds(northeast: northeast, southwest: southwest);
-
- print('boundsbounds');
- print(bounds);
- print('boundsbounds');
-
- // Fit the camera to the bounds
- var cameraUpdate = CameraUpdate.newLatLngBounds(bounds, 180);
- mapController!.animateCamera(cameraUpdate);
- update();
- }
-
- int selectedIndex = -1; // Initialize with no selection
- void selectCarFromList(int index) {
- selectedIndex = index; // Update selected index
- carTypes.forEach(
- (element) => element.isSelected = false); // Reset selection flags
- carTypes[index].isSelected = true;
- update();
- }
-
- showBottomSheet1() async {
- bottomSheet();
- isBottomSheetShown = true;
- heightBottomSheetShown = 250;
-
- update();
- }
-
- final promo = TextEditingController();
- bool promoTaken = false;
- void applyPromoCodeToPassenger() async {
- //TAWJIHI
-
- CRUD().get(link: AppLink.getPassengersPromo, payload: {
- 'promo_code': promo.text,
- }).then((value) {
- if (value == 'failure') {
- Get.defaultDialog(
- title: 'Promo End !'.tr,
- confirm: MyElevatedButton(
- title: 'Back',
- onPressed: () {
- Get.back();
- Get.back();
- },
- ));
- }
- var decode = jsonDecode(value);
-
- if (decode["status"] == "success") {
- //print(totalPassenger);
- var firstElement = decode["message"][0];
- if (double.parse(box.read(BoxName.passengerWalletTotal)) < 0) {
- totalPassenger = totalCostPassenger -
- (totalCostPassenger * int.parse(firstElement['amount']) / 100);
- update();
- } else {
- totalPassenger = totalCostPassenger -
- (totalCostPassenger * int.parse(firstElement['amount']) / 100);
- update();
- }
-
- totalDriver = totalDriver -
- (totalDriver * int.parse(firstElement['amount']) / 100);
- promoTaken = true;
- update();
- //print(totalPassenger);
- Get.back();
- }
- });
- }
-
- double getDistanceFromText(String distanceText) {
- // Remove any non-digit characters from the distance text
- String distanceValue = distanceText.replaceAll(RegExp(r'[^0-9.]+'), '');
-
- // Parse the extracted numerical value as a double
- double distance = double.parse(distanceValue);
-
- return distance;
- }
-
- double costForDriver = 0;
- double totalPassengerSpeed = 0;
- Future bottomSheet() async {
- if (data.isNotEmpty) {
- durationToAdd = Duration(seconds: durationToRide);
- print('durationToRide----- $durationToRide');
- print('durationToAdd----- $durationToAdd');
- hours = durationToAdd.inHours;
- minutes = (durationToAdd.inMinutes % 60).round();
- DateTime currentTime = DateTime.now();
- newTime = currentTime.add(durationToAdd);
- averageDuration = (durationToRide / 60) / distance;
- // costDuration = (durationToRide / 60) * averageDuration * 0.016;
- costDuration = (durationToRide / 60).floorToDouble();
- print('costDuration----- $costDuration');
- print('costDistance----- $costDistance');
- print(
- 'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}');
- double costComfort, costSpeed, costDelivery, costMashwari = 0;
- update();
- if (currentTime.hour >= 22 && currentTime.hour < 5) {
- // costDistance = distance * latePrice;
- costComfort = (distance * comfortPrice) + costDuration * latePrice;
- costMashwari = (distance * mashwariPrice) + costDuration * latePrice;
- costSpeed = (distance * speedPrice) + costDuration * latePrice;
- costDelivery = (distance * deliveryPrice) + costDuration * latePrice;
-
- update();
- } else if (currentTime.hour >= 13 && currentTime.hour <= 16) {
- // if (averageDuration > 2.5) {
- // costDistance = distance * heavyPrice;
- costComfort = (distance * comfortPrice) + costDuration * heavyPrice;
- costMashwari = (distance * mashwariPrice) + costDuration * heavyPrice;
- costSpeed = (distance * speedPrice) + costDuration * heavyPrice;
- costDelivery = (distance * deliveryPrice) + costDuration * heavyPrice;
-
- update();
- // } /
- } else {
- // costDistance = distance * (naturePrice - .1);
- costComfort = (distance * comfortPrice) + costDuration;
- costMashwari = (distance * mashwariPrice) + costDuration;
- costSpeed = (distance * speedPrice) + costDuration;
- costDelivery = (distance * deliveryPrice) + costDuration;
- update();
- }
- //print('cost $cost');
-
- var totalDriver1 = costDistance + costDuration;
- totalCostPassenger = totalDriver1 + (totalDriver1 * kazan / 100);
- totalPassenger = costSpeed + (costSpeed * kazan / 100);
- totalPassengerComfort =
- (costComfort + (costComfort * kazan / 100)).ceilToDouble();
- totalPassengerSpeed =
- (costSpeed + (costSpeed * kazan / 100)).ceilToDouble();
- totalPassengerComfortDiscount =
- totalPassengerComfort + totalPassengerComfort * (kazan - 0) / 100;
- totalPassengerSpeedDiscount =
- totalPassengerSpeed + totalPassengerSpeed * (kazan - 2) / 100;
- totalPassengerMotoDelivery =
- (costDelivery + (costDelivery * kazan / 100)).ceilToDouble();
- totalDriver = totalDriver1 + (totalDriver1 * kazan / 100);
- tax = totalCostPassenger * kazan / 100;
- totalME = totalCostPassenger - tax;
- costForDriver = fuelPrice * (20 / 210) * distance;
- print('cost for driver = $costForDriver');
- if (totalPassengerSpeed < 20) {
- // for eygpt 20 le open ride
- totalCostPassenger = 20;
- totalPassengerSpeed = 20;
- totalPassengerComfort = 30;
- totalPassengerMotoDelivery = 18;
- } else {
- totalPassenger = totalCostPassenger;
- update();
- }
- if (double.parse(box.read(BoxName.passengerWalletTotal)) < 0) {
- totalPassenger = totalPassenger +
- (-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
- totalPassengerComfort = totalPassengerComfort +
- (-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
- totalPassengerMotoDelivery = totalPassengerMotoDelivery +
- (-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
- update();
- }
- // }
-
- // buttomSheetMapPage();
- changeBottomSheetShown();
- }
- }
-
- addToken() async {
- await CRUD().post(link: AppLink.addTokens, payload: {
- 'token': box.read(BoxName.tokenFCM),
- 'passengerID': box.read(BoxName.passengerID).toString()
- });
- }
-
- List polylineCoordinate = [];
- String? cardNumber;
- void readyWayPoints() {
- hintTextwayPointStringAll = [
- hintTextwayPoint0,
- hintTextwayPoint1,
- hintTextwayPoint2,
- hintTextwayPoint3,
- hintTextwayPoint4,
- ];
- polylineCoordinatesPointsAll = [
- polylineCoordinates0,
- polylineCoordinates1,
- polylineCoordinates2,
- polylineCoordinates3,
- polylineCoordinates4,
- ];
- allTextEditingPlaces = [
- wayPoint0Controller,
- wayPoint1Controller,
- wayPoint2Controller,
- wayPoint3Controller,
- wayPoint4Controller,
- ];
- currentLocationToFormPlacesAll = [
- currentLocationToFormPlaces0,
- currentLocationToFormPlaces1,
- currentLocationToFormPlaces2,
- currentLocationToFormPlaces3,
- currentLocationToFormPlaces4,
- ];
- placeListResponseAll = [
- wayPoint0,
- wayPoint1,
- wayPoint2,
- wayPoint3,
- wayPoint4
- ];
- startLocationFromMapAll = [
- startLocationFromMap0,
- startLocationFromMap1,
- startLocationFromMap2,
- startLocationFromMap3,
- startLocationFromMap4,
- ];
- currentLocationStringAll = [
- currentLocationString0,
- currentLocationString1,
- currentLocationString2,
- currentLocationString3,
- currentLocationString4,
- ];
- placesCoordinate = [
- placesCoordinate0,
- placesCoordinate1,
- placesCoordinate2,
- placesCoordinate3,
- placesCoordinate4,
- ];
- update();
- }
-
- initilizeGetStorage() async {
- if (box.read(BoxName.addWork) == null) {
- box.write(BoxName.addWork, 'addWork');
- }
- if (box.read(BoxName.addHome) == null) {
- box.write(BoxName.addHome, 'addHome');
- }
- }
-
- late List recentPlaces = [];
- getFavioratePlaces() async {
- recentPlaces = await sql.getAllData(TableName.recentLocations);
- }
-
- double passengerRate = 5;
- double comfortPrice = 8;
- double speedPrice = 4;
- double mashwariPrice = 4;
- double deliveryPrice = 1.2;
- getKazanPercent() async {
- var res = await CRUD().get(
- link: AppLink.getKazanPercent,
- payload: {'country': box.read(BoxName.countryCode).toString()},
- );
- if (res != 'failure') {
- print(jsonDecode(res));
- var json = jsonDecode(res);
- kazan = double.parse(json['message'][0]['kazan']);
- naturePrice = double.parse(json['message'][0]['naturePrice']);
- heavyPrice = double.parse(json['message'][0]['heavyPrice']);
- latePrice = double.parse(json['message'][0]['latePrice']);
- comfortPrice = double.parse(json['message'][0]['comfortPrice']);
- speedPrice = double.parse(json['message'][0]['speedPrice']);
- deliveryPrice = double.parse(json['message'][0]['deliveryPrice']);
- mashwariPrice = double.parse(json['message'][0]['freePrice']);
- fuelPrice = double.parse(json['message'][0]['fuelPrice']);
- }
- }
-
- getPassengerRate() async {
- var res = await CRUD().get(
- link: AppLink.getPassengerRate,
- payload: {'passenger_id': box.read(BoxName.passengerID)});
- if (res != 'failure') {
- print(jsonDecode(res)['message']['rating']);
- passengerRate = jsonDecode(res)['message']['rating'] ?? 5;
- }
- }
-
- @override
- void onInit() async {
- mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
- getFavioratePlaces();
- readyWayPoints();
- addCustomPicker();
- addCustomCarIcon();
- addCustomStepIcon();
- addCustomStartIcon();
- addCustomEndIcon();
- await getLocation();
- await addToken();
- await getKazanPercent();
- await getPassengerRate();
- await getRideStatusFromStartApp();
- startMarkerReloading();
-
- // await getNearestDriverByPassengerLocation();
-
- initilizeGetStorage();
- cardNumber = await SecureStorage().readData(BoxName.cardNumber);
-
- super.onInit();
- }
-}
-
-class CarLocation {
- final String id;
- final double latitude;
- final double longitude;
- final double distance;
- final double duration;
-
- CarLocation({
- required this.id,
- required this.latitude,
- required this.longitude,
- this.distance = 10000,
- this.duration = 10000,
- });
-}
diff --git a/lib/controller/home/points_for_rider_controller.dart b/lib/controller/home/points_for_rider_controller.dart
index 6cb0021..7876d6e 100644
--- a/lib/controller/home/points_for_rider_controller.dart
+++ b/lib/controller/home/points_for_rider_controller.dart
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
import '../../constant/api_key.dart';
import '../../constant/links.dart';
@@ -122,7 +121,7 @@ class WayPointController extends GetxController {
void onInit() {
Get.put(LocationController());
addWayPoints();
- myLocation = Get.find().passengerLocation;
+ myLocation = Get.find().myLocation;
super.onInit();
}
}
diff --git a/lib/controller/home/splash_screen_controlle.dart b/lib/controller/home/splash_screen_controlle.dart
index b09c927..aa1c3a0 100644
--- a/lib/controller/home/splash_screen_controlle.dart
+++ b/lib/controller/home/splash_screen_controlle.dart
@@ -9,7 +9,6 @@ import '../../main.dart';
import '../../onbording_page.dart';
import '../../views/auth/captin/login_captin.dart';
import '../../views/home/Captin/home_captain/home_captin.dart';
-import '../../views/home/map_page_passenger.dart';
class SplashScreenController extends GetxController
with SingleGetTickerProviderMixin {
@@ -48,13 +47,9 @@ class SplashScreenController extends GetxController
Timer(const Duration(seconds: 4), () {
box.read(BoxName.onBoarding) == null
? Get.off(() => OnBoardingPage())
- : box.read(BoxName.email) != null
- ? Get.off(() => const MapPagePassenger())
- : box.read(BoxName.emailDriver) == null
- ? Get.off(() => LoginPage())
- : box.read(BoxName.emailDriver) != null
- ? Get.off(() => HomeCaptain())
- : Get.off(() => LoginCaptin());
+ : box.read(BoxName.dobDriver) != null
+ ? Get.off(() => HomeCaptain())
+ : Get.off(() => LoginCaptin());
});
}
diff --git a/lib/controller/payment/payment_controller.dart b/lib/controller/payment/payment_controller.dart
index 8687d7c..21b82b3 100644
--- a/lib/controller/payment/payment_controller.dart
+++ b/lib/controller/payment/payment_controller.dart
@@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:SEFER/constant/api_key.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/functions/tts.dart';
+import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
import 'package:SEFER/controller/payment/paymob/paymob_response.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:http/http.dart' as http;
@@ -10,7 +11,6 @@ import 'package:flutter_paypal/flutter_paypal.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
import 'package:get/get.dart';
import 'package:local_auth/local_auth.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
import '../../constant/box_name.dart';
import '../../constant/colors.dart';
@@ -29,7 +29,8 @@ class PaymentController extends GetxController {
bool isPromoSheetDialogue = false;
final formKey = GlobalKey();
final promo = TextEditingController();
- double totalPassenger = Get.find().totalPassenger;
+ double totalPassenger =
+ double.parse(Get.find().totalPassenger);
int? selectedAmount = 0;
List totalPassengerWalletDetails = [];
String passengerTotalWalletAmount = '';
@@ -108,25 +109,6 @@ class PaymentController extends GetxController {
}
}
- void applyPromoCodeToPassenger() async {
- //TAWJIHI
- CRUD().get(link: AppLink.getPassengersPromo, payload: {
- 'promo_code': promo.text,
- }).then((value) {
- var decod = jsonDecode(value);
-
- if (decod["status"] == "success") {
- print(totalPassenger);
- var firstElement = decod["message"][0];
- totalPassenger = totalPassenger -
- (totalPassenger * int.parse(firstElement['amount']));
- MapPassengerController().promoTaken = true;
- update();
- print(totalPassenger);
- }
- });
- }
-
late String clientSecret;
Future makePaymentStripe(
diff --git a/lib/controller/rate/rate_conroller.dart b/lib/controller/rate/rate_conroller.dart
index f4aa324..267ddcb 100644
--- a/lib/controller/rate/rate_conroller.dart
+++ b/lib/controller/rate/rate_conroller.dart
@@ -1,19 +1,14 @@
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
-import 'package:SEFER/views/home/home_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/links.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/functions/crud.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/Captin/home_captain/home_captin.dart';
-import 'package:SEFER/views/home/map_page_passenger.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
-import '../firebase/firbase_messge.dart';
-
// import '../home/captin/home_captain_controller.dart';
class RateController extends GetxController {
@@ -73,55 +68,4 @@ class RateController extends GetxController {
Get.offAll(HomeCaptain());
}
}
-
- void addRateToDriver() async {
- if (selectedRateItemId < 1) {
- Get.defaultDialog(
- title: 'You Should choose rate figure'.tr,
- titleStyle: AppStyle.title,
- middleText: '',
- confirm: MyElevatedButton(title: 'Ok', onPressed: () => Get.back()));
- } else {
- var tip = (Get.find().totalPassenger) *
- (double.parse(box.read(BoxName.tipPercentage.toString())));
- var res = await CRUD().post(link: AppLink.addTips, payload: {
- 'passengerID': box.read(BoxName.passengerID),
- 'driverID': Get.find().driverId.toString(),
- 'rideID': Get.find().rideId.toString(),
- 'tipAmount': tip.toString(),
- });
- await CRUD().post(link: AppLink.addPassengersWallet, payload: {
- 'passenger_id': box.read(BoxName.passengerID).toString(),
- 'balance': ((-1) * tip).toString()
- });
-
- await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
- 'driverID': Get.find().driverId.toString(),
- 'paymentID': '${Get.find().rideId}tip',
- 'amount': box.read(BoxName.countryCode) == 'Egypt'
- ? tip.toStringAsFixed(0)
- : (tip * 100).toString(),
- 'paymentMethod': 'visa-tip',
- });
-
- if (res != 'failure') {
- FirebaseMessagesController().sendNotificationToAnyWithoutData(
- 'You Have Tips',
- '${'${tip.toString()}\$${' tips\nTotal is'.tr}'} ${tip + (Get.find().totalPassenger)}',
- Get.find().driverToken.toString(),
- );
- }
-
- await CRUD().post(link: AppLink.addRateToDriver, payload: {
- 'passenger_id': box.read(BoxName.passengerID).toString(),
- 'driver_id': driverId,
- 'ride_id': rideId,
- 'rating': selectedRateItemId.toString(),
- 'comment': comment.text,
- }).then((value) {
- Get.find().restCounter();
- Get.offAll(const MapPagePassenger());
- });
- }
- }
}
diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart
index 812d8f9..45ef319 100644
--- a/lib/firebase_options.dart
+++ b/lib/firebase_options.dart
@@ -1,5 +1,5 @@
// File generated by FlutterFire CLI.
-// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
+// ignore_for_file: type=lint
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
@@ -17,7 +17,10 @@ import 'package:flutter/foundation.dart'
class DefaultFirebaseOptions {
static FirebaseOptions get currentPlatform {
if (kIsWeb) {
- return web;
+ throw UnsupportedError(
+ 'DefaultFirebaseOptions have not been configured for web - '
+ 'you can reconfigure this by running the FlutterFire CLI again.',
+ );
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
@@ -25,7 +28,10 @@ class DefaultFirebaseOptions {
case TargetPlatform.iOS:
return ios;
case TargetPlatform.macOS:
- return macos;
+ throw UnsupportedError(
+ 'DefaultFirebaseOptions have not been configured for macos - '
+ 'you can reconfigure this by running the FlutterFire CLI again.',
+ );
case TargetPlatform.windows:
throw UnsupportedError(
'DefaultFirebaseOptions have not been configured for windows - '
@@ -43,19 +49,9 @@ class DefaultFirebaseOptions {
}
}
- static const FirebaseOptions web = FirebaseOptions(
- apiKey: 'AIzaSyAVtyV7YVMeLbwA1UlNPxV9FhCzT0kjeAE',
- appId: '1:594687661098:web:8fe3c5b3cacb294c595f53',
- messagingSenderId: '594687661098',
- projectId: 'ride-b1bd8',
- authDomain: 'ride-b1bd8.firebaseapp.com',
- storageBucket: 'ride-b1bd8.appspot.com',
- measurementId: 'G-7YCWM2EHD9',
- );
-
static const FirebaseOptions android = FirebaseOptions(
apiKey: 'AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0',
- appId: '1:594687661098:android:683982cbf71fa423595f53',
+ appId: '1:594687661098:android:46557bd4f534b5bb595f53',
messagingSenderId: '594687661098',
projectId: 'ride-b1bd8',
storageBucket: 'ride-b1bd8.appspot.com',
@@ -63,21 +59,12 @@ class DefaultFirebaseOptions {
static const FirebaseOptions ios = FirebaseOptions(
apiKey: 'AIzaSyCf2mW2h0HD8ZYjwh4VOa2ladw6MJkCDTM',
- appId: '1:594687661098:ios:6f69eee1449be943595f53',
+ appId: '1:594687661098:ios:4f236057ba0383b0595f53',
messagingSenderId: '594687661098',
projectId: 'ride-b1bd8',
storageBucket: 'ride-b1bd8.appspot.com',
- iosClientId: '594687661098-8e26699cris2k3nj5msj1osi59it9kpf.apps.googleusercontent.com',
- iosBundleId: 'com.mobileapp.store.ride',
- );
-
- static const FirebaseOptions macos = FirebaseOptions(
- apiKey: 'AIzaSyCf2mW2h0HD8ZYjwh4VOa2ladw6MJkCDTM',
- appId: '1:594687661098:ios:e8ca02ed508d4737595f53',
- messagingSenderId: '594687661098',
- projectId: 'ride-b1bd8',
- storageBucket: 'ride-b1bd8.appspot.com',
- iosClientId: '594687661098-od4d3lpsdba79shpjmala0a3lrps4spi.apps.googleusercontent.com',
- iosBundleId: 'com.mobileapp.store.ride.RunnerTests',
+ iosClientId:
+ '594687661098-9fnj82nef9oagl98prigdf8qne3ddbto.apps.googleusercontent.com',
+ iosBundleId: 'com.sefer.driver',
);
}
diff --git a/lib/main.dart b/lib/main.dart
index 3134ddc..18d4d6b 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -57,16 +57,9 @@ void main() async {
print(Get.deviceLocale!.countryCode);
Stripe.publishableKey = AK.publishableKey;
- if (box.read(BoxName.driverID) != null) {
- Get.defaultDialog(
- title: 'Gps required',
- middleText: '',
- confirm: MyElevatedButton(
- title: 'ok'.tr,
- onPressed: () {
- Get.put(LocationBackgroundController());
- }));
- }
+
+ Get.put(LocationBackgroundController());
+
if (Platform.isAndroid || Platform.isIOS) {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
diff --git a/lib/views/Rate/rate_captain.dart b/lib/views/Rate/rate_captain.dart
deleted file mode 100644
index aae1db2..0000000
--- a/lib/views/Rate/rate_captain.dart
+++ /dev/null
@@ -1,223 +0,0 @@
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter_rating_bar/flutter_rating_bar.dart';
-import 'package:get/get.dart';
-
-import '../../constant/box_name.dart';
-import '../../constant/colors.dart';
-import '../../constant/style.dart';
-import '../../controller/firebase/firbase_messge.dart';
-import '../../controller/payment/payment_controller.dart';
-import '../../controller/rate/rate_conroller.dart';
-import '../../main.dart';
-import '../widgets/elevated_btn.dart';
-import '../widgets/my_scafold.dart';
-
-class RateDriverFromPassenger extends StatelessWidget {
- RateDriverFromPassenger({super.key});
- final RateController controller = Get.put(RateController());
- @override
- Widget build(BuildContext context) {
- return MyScafolld(
- title: 'Rate Driver'.tr,
- body: [
- Positioned(
- top: 10,
- left: Get.width * .1,
- right: Get.width * .1,
- child: Container(
- // height: Get.height * 6,
- decoration: AppStyle.boxDecoration1,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Padding(
- padding: const EdgeInsets.all(4),
- child: Container(
- height: Get.height * .5,
- decoration: AppStyle.boxDecoration1,
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Text(
- '${'Total price to '.tr}${Get.find().firstName}',
- style: AppStyle.title,
- ),
- Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceEvenly,
- children: [
- Container(
- decoration: BoxDecoration(
- border: Border.all(
- width: 2,
- color: AppColor.redColor,
- )),
- child: Padding(
- padding: const EdgeInsets.all(4),
- child: Text(
- (double.parse(controller.price
- .toString()) *
- .12 +
- double.parse(controller.price
- .toString()))
- .toStringAsFixed(2),
- style: AppStyle.number.copyWith(
- color: AppColor.redColor,
- textBaseline:
- TextBaseline.ideographic,
- decoration:
- TextDecoration.lineThrough,
- decorationColor:
- AppColor.redColor),
- ),
- ),
- ),
- const SizedBox(
- height: 10,
- ),
- Container(
- decoration: BoxDecoration(
- border: Border.all(
- width: 2,
- color: AppColor.greenColor,
- )),
- child: Padding(
- padding: const EdgeInsets.all(4),
- child: Text(
- controller.price.toString(),
- style: AppStyle.number,
- ),
- ),
- ),
- ],
- ),
- const SizedBox(
- height: 10,
- ),
- Padding(
- padding: const EdgeInsets.all(4.0),
- child: Text(
- 'Exclusive offers and discounts always with the Sefer app'
- .tr,
- style: AppStyle.title.copyWith(
- color: AppColor.redColor,
- ),
- textAlign: TextAlign.center,
- ),
- ),
- (Get.find().isCashChecked ==
- false &&
- Get.find()
- .isWalletChecked ==
- true)
- ? const DriverTipWidget()
- : const SizedBox(),
- ],
- ),
- )),
- ),
- Center(
- child: RatingBar.builder(
- initialRating: 0,
- itemCount: 5,
- itemSize: 50,
- itemPadding: const EdgeInsets.symmetric(horizontal: 2),
- itemBuilder: (context, index) {
- switch (index) {
- case 0:
- return const Icon(
- Icons.sentiment_very_dissatisfied,
- color: Colors.red,
- );
- case 1:
- return const Icon(
- Icons.sentiment_dissatisfied,
- color: Colors.redAccent,
- );
- case 2:
- return const Icon(
- Icons.sentiment_neutral,
- color: Colors.amber,
- );
- case 3:
- return const Icon(
- Icons.sentiment_satisfied,
- color: Colors.lightGreen,
- );
- case 4:
- return const Icon(
- Icons.sentiment_very_satisfied,
- color: Colors.green,
- );
- default:
- return const Icon(
- Icons.sentiment_neutral,
- color: Colors.amber,
- );
- } //
- },
- onRatingUpdate: (rating) {
- controller.selectRateItem(rating);
- },
- ),
- ),
- const SizedBox(
- height: 20,
- ),
- SizedBox(
- width: Get.width * .75,
- child: TextFormField(
- maxLines: 4,
- minLines: 1,
- keyboardType: TextInputType.multiline,
- controller: controller.comment,
- decoration: InputDecoration(
- labelText: 'Enter your Note'.tr,
- hintText: 'Type something...'.tr,
- prefixIcon: const Icon(
- Icons.rate_review), // Add an icon as a prefix
- suffixIcon: IconButton(
- icon: const Icon(
- Icons.clear,
- color: AppColor.redColor,
- ), // Add an icon as a suffix
- onPressed: () {
- controller.comment.clear();
- },
- ),
- border:
- const OutlineInputBorder(), // Add a border around the input field
- enabledBorder: const OutlineInputBorder(
- borderSide: BorderSide(
- color:
- Colors.blue), // Customize the border color
- ),
- focusedBorder: const OutlineInputBorder(
- borderSide: BorderSide(
- color: Colors
- .green), // Customize the border color when focused
- ),
- errorBorder: const OutlineInputBorder(
- borderSide: BorderSide(
- color: Colors
- .red), // Customize the border color when there's an error
- ),
- ),
- ),
- ),
- const SizedBox(
- height: 20,
- ),
- MyElevatedButton(
- title: 'Submit rating'.tr,
- onPressed: () => controller.addRateToDriver())
- ],
- ),
- )),
- ],
- isleading: false);
- }
-}
diff --git a/lib/views/auth/captin/ai_page.dart b/lib/views/auth/captin/ai_page.dart
index 6aaba72..2d51be0 100644
--- a/lib/views/auth/captin/ai_page.dart
+++ b/lib/views/auth/captin/ai_page.dart
@@ -1,4 +1,3 @@
-import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/controller/functions/crud.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -25,18 +24,32 @@ class AiPage extends StatelessWidget {
return MyScafolld(
title: 'Documents check'.tr,
body: [
- // box.read(BoxName.countryCode) == 'USA'
- // ? UsaAiDocuments(scanDocumentsByApi: scanDocumentsByApi)
- // : box.read(BoxName.countryCode) == 'Jordan'
- // ? JordanDocumants(contentController: contentController)
- // :
- // EgyptDocuments(contentController: contentController),
- // box.read(BoxName.countryCode) == 'USA'
- // ? usaDriverLicensWidget()
- // : box.read(BoxName.countryCode) == 'Jordan'
- // ? jordanDriverLicenseWidget()
- // :
- egyptDriverLicenseWidget()
+ Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Column(
+ children: [
+ Container(
+ width: Get.width,
+ height: Get.height * .3,
+ decoration: AppStyle.boxDecoration1,
+ child: Center(
+ child: InkWell(
+ onTap: () async {
+ await CRUD().allMethodForAI(
+ 'name,address,dob,nationalNo,',
+ AppLink.uploadEgypt,
+ 'idFront'); //egypt
+ },
+ child: Text(
+ 'Take Picture Of ID Card'.tr,
+ style: AppStyle.title,
+ ),
+ ),
+ ),
+ )
+ ],
+ ),
+ ),
],
isleading: true);
}
@@ -44,260 +57,251 @@ class AiPage extends StatelessWidget {
GetBuilder egyptDriverLicenseWidget() {
return GetBuilder(
builder: (contentController) => contentController.responseMap.isNotEmpty
- ? Positioned(
- top: Get.height * .09,
- left: Get.width * .051,
- right: Get.width * .051,
- child: contentController.isloading
- ? Column(
- children: [
- const MyCircularProgressIndicator(),
- Text(
- 'We are process picture please wait '.tr,
- style: AppStyle.title,
- )
- ],
+ ? contentController.isloading
+ ? Column(
+ children: [
+ const MyCircularProgressIndicator(),
+ Text(
+ 'We are process picture please wait '.tr,
+ style: AppStyle.title,
)
- : SizedBox(
- height: Get.height * .7,
- child: ListView(
- children: [
- Container(
- decoration: AppStyle.boxDecoration1,
- // height: Get.height * .4,
- child: Padding(
- padding: const EdgeInsets.all(5),
- child: contentController.responseMap.isEmpty
- ? Center(
- child: Text(
- 'Take Picture Of ID Card'.tr,
- style: AppStyle.title,
- ),
- )
- : Column(
+ ],
+ )
+ : SizedBox(
+ height: Get.height * .7,
+ child: ListView(
+ children: [
+ Container(
+ decoration: AppStyle.boxDecoration1,
+ // height: Get.height * .4,
+ child: Padding(
+ padding: const EdgeInsets.all(5),
+ child: contentController.responseMap.isEmpty
+ ? Center(
+ child: Text(
+ 'Take Picture Of ID Card'.tr,
+ style: AppStyle.title,
+ ),
+ )
+ : Column(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: [
- Row(
+ children: [
+ Column(
mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- Column(
- mainAxisAlignment:
- MainAxisAlignment.start,
- crossAxisAlignment:
- CrossAxisAlignment.start,
+ MainAxisAlignment.start,
+ crossAxisAlignment:
+ CrossAxisAlignment.start,
+ children: [
+ Row(
children: [
- Row(
- children: [
- Text(
- '${'Name'.tr} :${contentController.responseMap['first_name']}',
- style: AppStyle.subtitle,
- ),
- Text(
- ' ${contentController.responseMap['last_name']}',
- style: AppStyle.subtitle,
- ),
- ],
+ Text(
+ '${'Name'.tr} :${contentController.responseMap['first_name']}',
+ style: AppStyle.subtitle,
),
Text(
- '${'Name in arabic'.tr}: ${contentController.responseMap['name_in_arabic']}',
- style: AppStyle.title,
- ),
- Text(
- '${'Drivers License Class'.tr}: ${contentController.responseMap['class']}',
- style: AppStyle.title,
+ ' ${contentController.responseMap['last_name']}',
+ style: AppStyle.subtitle,
),
],
),
- ],
- ),
- Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- Text(
- '${'National Number'.tr}: ${contentController.responseMap['id']}',
- style: AppStyle.title,
- ),
- // Image.memory(
- // scanDocumentsByApi
- // .imagePortrait,
- // width: 60,
- // ),
- ]),
- Text(
- '${'Address'.tr}: ${contentController.responseMap['address']}',
- style: AppStyle.title,
- ),
- Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
Text(
- '${'Date of Birth'.tr}: ${contentController.responseMap['dob']}',
+ '${'Name in arabic'.tr}: ${contentController.responseMap['name_in_arabic']}',
style: AppStyle.title,
),
Text(
- '${'Age'.tr} : ${contentController.responseMap['age_in_years']}',
+ '${'Drivers License Class'.tr}: ${contentController.responseMap['class']}',
style: AppStyle.title,
),
],
),
- Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- Text(
- '${'Expiry Date'.tr}: ${contentController.responseMap['expiration_date']}',
- style: DateTime.parse(
- contentController
- .responseMap[
- 'expiration_date']
- .toString())
- .isBefore(
- contentController.now)
- ? AppStyle.title.copyWith(
- color: AppColor.redColor)
- : AppStyle.title.copyWith(
- color:
- AppColor.greenColor),
- ),
- ],
- ),
],
),
- ),
- ),
- const SizedBox(
- height: 10,
- ),
- DateTime.parse(contentController
- .responseMap['expiration_date']
- .toString())
- .isBefore(contentController.now)
- ? Text(
- 'You can\'t continue with us .\nYou should renew Driver license'
- .tr,
- style: AppStyle.title
- .copyWith(color: AppColor.redColor),
- )
- : MyElevatedButton(
- kolor: AppColor.greenColor,
- title: 'Lets check Car license '.tr,
- onPressed: () => contentController
- .getCarLicenseJordanContent()),
- const SizedBox(
- height: 10,
- ),
- contentController.responseCarLicenseMap.isNotEmpty
- ? Container(
- decoration: AppStyle.boxDecoration,
- // height: Get.height * .3,
- width: Get.width * .9,
- child: Column(
- children: [
- Text(
- '${'Name'.tr} ${contentController.responseCarLicenseMap['name']}',
- style: AppStyle.title,
- ),
- Text(
- '${'Address'.tr} ${contentController.responseCarLicenseMap['address']}',
- style: AppStyle.title,
- ),
- Text(
- '${'Car Kind'.tr} ${contentController.responseCarLicenseMap['car_kind']}',
- style: AppStyle.title,
- ),
- Text(
- '${'Color'.tr} ${contentController.responseCarLicenseMap['car_color']}',
- style: AppStyle.title,
- ),
- Text(
- '${'Year'.tr} ${contentController.responseCarLicenseMap['car_year']}',
- style: AppStyle.title,
- ),
- Text(
- '${'Car Plate'.tr} ${contentController.responseCarLicenseMap['car_plate']}',
- style: AppStyle.title,
- ),
- Text(
- '${'Car Expire'.tr} ${contentController.responseCarLicenseMap['expire_date_of_license']}',
- style: contentController
- .responseCarLicenseMap
- .isNotEmpty
- ? DateTime.parse(contentController
- .responseCarLicenseMap[
- 'expire_date_of_license']
- .toString())
- .isBefore(
- contentController.now)
- ? AppStyle.title.copyWith(
- color: AppColor.redColor)
- : AppStyle.title.copyWith(
- color: AppColor.greenColor)
- : null,
- ),
- ],
- ),
- )
- : const SizedBox(),
- const SizedBox(
- height: 10,
- ),
- // DateTime.parse(contentController
- // .responseCarLicenseMap[
- // 'expire_date_of_license']
- // .toString())
- // .isBefore(contentController.now)
- // ? Text(
- // 'You can\'t continue with us .\nYou should renew Car license'
- // .tr,
- // style: AppStyle.title.copyWith(
- // color: AppColor.redColor),
- // )
- // :
- MyElevatedButton(
- kolor: AppColor.greenColor,
- title: 'Lets check License Back Face'.tr,
- onPressed: () => contentController
- .generateBackCarLicenseJordanContent()),
- const SizedBox(
- height: 10,
- ),
- contentController.responseBackCarLicenseMap.isNotEmpty
- ? Container(
- decoration: AppStyle.boxDecoration,
- // height: 300,
- child: Column(children: [
+ Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ '${'National Number'.tr}: ${contentController.responseMap['id']}',
+ style: AppStyle.title,
+ ),
+ // Image.memory(
+ // scanDocumentsByApi
+ // .imagePortrait,
+ // width: 60,
+ // ),
+ ]),
Text(
- 'VIN ${contentController.responseBackCarLicenseMap['vin']}',
+ '${'Address'.tr}: ${contentController.responseMap['address']}',
style: AppStyle.title,
),
- Text(
- 'Fuel Type ${contentController.responseBackCarLicenseMap['fuelType']}',
- style: AppStyle.title,
+ Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ '${'Date of Birth'.tr}: ${contentController.responseMap['dob']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ '${'Age'.tr} : ${contentController.responseMap['age_in_years']}',
+ style: AppStyle.title,
+ ),
+ ],
),
- Text(
- 'Insurance Company ${contentController.responseBackCarLicenseMap['insuranceCompany']}',
- style: AppStyle.title,
+ Row(
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ '${'Expiry Date'.tr}: ${contentController.responseMap['expiration_date']}',
+ style: DateTime.parse(
+ contentController
+ .responseMap[
+ 'expiration_date']
+ .toString())
+ .isBefore(
+ contentController.now)
+ ? AppStyle.title.copyWith(
+ color: AppColor.redColor)
+ : AppStyle.title.copyWith(
+ color: AppColor.greenColor),
+ ),
+ ],
),
- Text(
- 'Policy Number ${contentController.responseBackCarLicenseMap['policyNumber']}',
- style: AppStyle.title,
- ),
- Text(
- 'Insurance Type ${contentController.responseBackCarLicenseMap['insuranceType']}',
- style: AppStyle.title,
- )
- ]))
- : const SizedBox()
- ],
+ ],
+ ),
+ ),
),
- ),
- )
+ const SizedBox(
+ height: 10,
+ ),
+ DateTime.parse(contentController
+ .responseMap['expiration_date']
+ .toString())
+ .isBefore(contentController.now)
+ ? Text(
+ 'You can\'t continue with us .\nYou should renew Driver license'
+ .tr,
+ style: AppStyle.title
+ .copyWith(color: AppColor.redColor),
+ )
+ : MyElevatedButton(
+ kolor: AppColor.greenColor,
+ title: 'Lets check Car license '.tr,
+ onPressed: () => contentController
+ .getCarLicenseJordanContent()),
+ const SizedBox(
+ height: 10,
+ ),
+ contentController.responseCarLicenseMap.isNotEmpty
+ ? Container(
+ decoration: AppStyle.boxDecoration,
+ // height: Get.height * .3,
+ width: Get.width * .9,
+ child: Column(
+ children: [
+ Text(
+ '${'Name'.tr} ${contentController.responseCarLicenseMap['name']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ '${'Address'.tr} ${contentController.responseCarLicenseMap['address']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ '${'Car Kind'.tr} ${contentController.responseCarLicenseMap['car_kind']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ '${'Color'.tr} ${contentController.responseCarLicenseMap['car_color']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ '${'Year'.tr} ${contentController.responseCarLicenseMap['car_year']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ '${'Car Plate'.tr} ${contentController.responseCarLicenseMap['car_plate']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ '${'Car Expire'.tr} ${contentController.responseCarLicenseMap['expire_date_of_license']}',
+ style: contentController
+ .responseCarLicenseMap.isNotEmpty
+ ? DateTime.parse(contentController
+ .responseCarLicenseMap[
+ 'expire_date_of_license']
+ .toString())
+ .isBefore(contentController.now)
+ ? AppStyle.title.copyWith(
+ color: AppColor.redColor)
+ : AppStyle.title.copyWith(
+ color: AppColor.greenColor)
+ : null,
+ ),
+ ],
+ ),
+ )
+ : const SizedBox(),
+ const SizedBox(
+ height: 10,
+ ),
+ // DateTime.parse(contentController
+ // .responseCarLicenseMap[
+ // 'expire_date_of_license']
+ // .toString())
+ // .isBefore(contentController.now)
+ // ? Text(
+ // 'You can\'t continue with us .\nYou should renew Car license'
+ // .tr,
+ // style: AppStyle.title.copyWith(
+ // color: AppColor.redColor),
+ // )
+ // :
+ MyElevatedButton(
+ kolor: AppColor.greenColor,
+ title: 'Lets check License Back Face'.tr,
+ onPressed: () => contentController
+ .generateBackCarLicenseJordanContent()),
+ const SizedBox(
+ height: 10,
+ ),
+ contentController.responseBackCarLicenseMap.isNotEmpty
+ ? Container(
+ decoration: AppStyle.boxDecoration,
+ // height: 300,
+ child: Column(children: [
+ Text(
+ 'VIN ${contentController.responseBackCarLicenseMap['vin']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ 'Fuel Type ${contentController.responseBackCarLicenseMap['fuelType']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ 'Insurance Company ${contentController.responseBackCarLicenseMap['insuranceCompany']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ 'Policy Number ${contentController.responseBackCarLicenseMap['policyNumber']}',
+ style: AppStyle.title,
+ ),
+ Text(
+ 'Insurance Type ${contentController.responseBackCarLicenseMap['insuranceType']}',
+ style: AppStyle.title,
+ )
+ ]))
+ : const SizedBox()
+ ],
+ ),
+ )
: Positioned(
top: Get.height * .06,
left: Get.width * .051,
diff --git a/lib/views/auth/captin/login_captin.dart b/lib/views/auth/captin/login_captin.dart
index 52eb36d..19fbba7 100644
--- a/lib/views/auth/captin/login_captin.dart
+++ b/lib/views/auth/captin/login_captin.dart
@@ -1,4 +1,3 @@
-import 'package:SEFER/constant/api_key.dart';
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
@@ -6,9 +5,7 @@ import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:get/get.dart';
import '../../../constant/box_name.dart';
-import '../../../constant/char_map.dart';
import '../../../constant/colors.dart';
-import '../../../constant/credential.dart';
import '../../../constant/info.dart';
import '../../../constant/style.dart';
import '../../../controller/auth/captin/login_captin_controller.dart';
@@ -21,7 +18,7 @@ import '../../widgets/mycircular.dart';
import 'register_captin.dart';
class LoginCaptin extends StatelessWidget {
- final controller = Get.put(LoginController());
+ // final controller = Get.put(LoginController());
LoginCaptin({super.key});
@@ -32,7 +29,7 @@ class LoginCaptin extends StatelessWidget {
return GetBuilder(
builder: (controller) => MyScafolld(
title: 'Login Driver'.tr,
- isleading: true,
+ isleading: false,
body: [
if (box.read(BoxName.agreeTerms) != 'agreed')
agreedPage()
diff --git a/lib/views/home/Captin/home_captain/widget/call_page_From_passenger.dart b/lib/views/home/Captin/home_captain/widget/call_page_From_passenger.dart
deleted file mode 100644
index 1d18154..0000000
--- a/lib/views/home/Captin/home_captain/widget/call_page_From_passenger.dart
+++ /dev/null
@@ -1,116 +0,0 @@
-import 'package:SEFER/constant/colors.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/controller/firebase/firbase_messge.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
-import 'package:SEFER/controller/functions/call_controller.dart';
-import 'package:SEFER/views/widgets/my_scafold.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
-
-class CallPageFromPassenger extends StatelessWidget {
- const CallPageFromPassenger({super.key});
-
- @override
- Widget build(BuildContext context) {
- return MyScafolld(
- title: 'Call Page'.tr, isleading: true, body: [callPage()]);
- }
-}
-
-GetBuilder callPage() {
- CallController callController = Get.put(CallController());
- // callController.initAgoraFull();
- return GetBuilder(
- builder: (controller) => Column(
- children: [
- Padding(
- padding: const EdgeInsets.all(15),
- child: Container(
- decoration: AppStyle.boxDecoration1,
- child: Text(
- 'No SIM card, no problem! Call your driver directly through our app. We use advanced technology to ensure your privacy.'
- .tr,
- style: AppStyle.title,
- ),
- ),
- ),
- const SizedBox(
- height: 30,
- ),
- Padding(
- padding: const EdgeInsets.all(15),
- child: Container(
- height: 100, width: Get.width,
- decoration: AppStyle.boxDecoration,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- GestureDetector(
- onTap: () async {
- // await callController.initAgoraFull();
- // callController.join();
- // FirebaseMessagesController().sendNotificationToPassengerToken(
- // 'Call Income',
- // 'You have call from driver ${box.read(BoxName.nameDriver)}',
- // Get.find().tokenPassenger,
- // [
- // callController.token,
- // callController.channelName,
- // callController.uid.toString(),
- // callController.remoteUid.toString(),
- // ],
- // );
- callController.join();
- },
- child: Container(
- width: 50,
- height: 50,
- decoration: const BoxDecoration(
- shape: BoxShape.circle, color: AppColor.greenColor),
- child: const Icon(
- Icons.phone,
- size: 35,
- color: AppColor.secondaryColor,
- )),
- ),
- Column(
- children: [
- Text(callController.status),
- Text(Get.find()
- .driverName
- .toString()),
- ],
- ),
- GestureDetector(
- onTap: () async {
- FirebaseMessagesController()
- .sendNotificationToPassengerToken(
- 'Call End',
- 'Call End'.tr,
- Get.find().driverToken,
- [],
- );
- callController.leave();
- Get.back();
- },
- child: Container(
- width: 50,
- height: 50,
- decoration: const BoxDecoration(
- shape: BoxShape.circle, color: AppColor.redColor),
- child: const Icon(
- Icons.phone_disabled_sharp,
- size: 35,
- color: AppColor.secondaryColor,
- )),
- )
- ],
- ),
- // ignore: prefer_const_constructors
- ),
- ),
- ],
- ),
- );
-}
diff --git a/lib/views/home/home_page.dart b/lib/views/home/home_page.dart
deleted file mode 100644
index 52aeaca..0000000
--- a/lib/views/home/home_page.dart
+++ /dev/null
@@ -1,187 +0,0 @@
-import 'package:SEFER/controller/functions/tts.dart';
-import 'package:SEFER/views/widgets/elevated_btn.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/colors.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/views/lang/languages.dart';
-import 'package:SEFER/views/widgets/my_scafold.dart';
-import 'package:path/path.dart' as path;
-import 'package:share/share.dart';
-
-import '../../controller/functions/audio_record1.dart';
-import 'profile/passenger_profile_page.dart';
-
-class HomePage extends StatelessWidget {
- const HomePage({super.key});
-
- @override
- Widget build(BuildContext context) {
- return MyScafolld(
- isleading: true,
- title: 'Home Page'.tr,
- body: [
- Column(
- children: [
- ListTile(
- onTap: () {
- Get.to(() => const Language());
- },
- title: Text(
- 'Language'.tr,
- style: AppStyle.headTitle2,
- ),
- subtitle: Text('To change Language the App'.tr),
- trailing: const Icon(
- Icons.arrow_forward_ios,
- size: 30,
- color: AppColor.primaryColor,
- ),
- leading: const Icon(
- Icons.language_sharp,
- color: AppColor.primaryColor,
- ),
- ),
- ListTile(
- leading: const Icon(Icons.location_city_outlined),
- title: Text(
- 'Change Country'.tr,
- style: AppStyle.headTitle2,
- ),
- subtitle:
- Text('You can change the Country to get all features'.tr),
- onTap: () => Get.to(MyScafolld(
- title: 'Change Country'.tr,
- body: [CountryPickerFromSetting()],
- isleading: true)),
- ),
- ListTile(
- leading: const Icon(Icons.record_voice_over_outlined),
- title: Text(
- 'Trips recorded'.tr,
- style: AppStyle.headTitle2,
- ),
- subtitle: Text('Here recorded trips audio'.tr),
- onTap: () async {
- Get.defaultDialog(
- title: 'Select recorded trip'.tr,
- titleStyle: AppStyle.title,
- content:
- GetBuilder(builder: (audio) {
- return Column(
- children: [
- FutureBuilder>(
- future: audio.getRecordedFiles(),
- builder: (context, snapshot) {
- if (snapshot.connectionState ==
- ConnectionState.waiting) {
- return const CircularProgressIndicator();
- } else if (snapshot.hasData) {
- final recordedFiles = snapshot.data!;
- return DropdownButton(
- value: audio.selectedFilePath,
- onChanged: (value) {
- audio.selectedFilePath = value;
- audio.playRecordedFile(value!);
- audio.update();
- },
- items: recordedFiles
- .map((file) => DropdownMenuItem(
- value: file,
- child: Text(path.basename(file)),
- ))
- .toList(),
- );
- } else {
- return Text('Error: ${snapshot.error}');
- }
- },
- ),
- Slider(
- value: audio.currentPosition,
- max: audio.totalDuration,
- inactiveColor: AppColor.accentColor,
- label: audio.currentPosition.toString(),
- onChanged: (value) {
- audio.currentPosition = value;
- // audio.update();
- audio.audioPlayer
- .seek(Duration(seconds: value.toInt()));
- },
- ),
- Align(
- alignment: Alignment.bottomCenter,
- child: Container(
- padding: const EdgeInsets.all(16.0),
- color: Colors.grey[200],
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- Text(
- audio.selectedFilePath != null
- ? '${'Selected file:'.tr} ${path.basename(audio.selectedFilePath!)}'
- : 'No file selected'.tr,
- style: AppStyle.subtitle,
- ),
- if (audio.selectedFilePath != null)
- IconButton(
- icon: const Icon(Icons.share),
- onPressed: () {
- Share.shareFiles(
- [audio.selectedFilePath!]);
- },
- ),
- ],
- ),
- ),
- ),
- IconButton(
- onPressed: () async {
- Get.defaultDialog(
- title: 'Are you sure to delete recorded files'
- .tr,
- content: Column(
- children: [
- IconButton(
- onPressed: () {
- Get.find()
- .speakText(
- 'this will delete all files from your device'
- .tr);
- },
- icon: const Icon(Icons.headphones),
- ),
- Text(
- 'this will delete all files from your device'
- .tr,
- textAlign: TextAlign.center,
- style: AppStyle.title,
- ),
- ],
- ),
- titleStyle: AppStyle.title,
- confirm: MyElevatedButton(
- title: 'Delete'.tr,
- kolor: AppColor.redColor,
- onPressed: () async {
- await audio
- // .deleteRecordedFile(audio.selectedFilePath!);
- .deleteAllRecordedFiles();
- Get.back();
- Get.back();
- }));
- },
- icon: const Icon(Icons.delete),
- ),
- ],
- );
- }),
- );
- }),
- ],
- ),
- ],
- );
- }
-}
diff --git a/lib/views/home/map_page_passenger.dart b/lib/views/home/map_page_passenger.dart
deleted file mode 100644
index 2eb290c..0000000
--- a/lib/views/home/map_page_passenger.dart
+++ /dev/null
@@ -1,131 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import '../../constant/box_name.dart';
-import '../../constant/colors.dart';
-import '../../controller/home/map_passenger_controller.dart';
-import '../../main.dart';
-import '../../views/home/map_widget.dart/cancel_raide_page.dart';
-import '../../views/home/map_widget.dart/ride_begin_passenger.dart';
-
-import '../../controller/home/menu_controller.dart';
-import 'map_widget.dart/apply_order_widget.dart';
-import 'map_widget.dart/buttom_sheet_map_show.dart';
-import 'map_widget.dart/car_details_widget_to_go.dart';
-import 'map_widget.dart/cash_confirm_bottom_page.dart';
-import 'map_widget.dart/google_map_passenger_widget.dart';
-import 'map_widget.dart/left_main_menu_icons.dart';
-import 'map_widget.dart/main_bottom_menu_map.dart';
-import 'map_widget.dart/map_menu_widget.dart';
-import 'map_widget.dart/menu_map_page.dart';
-import 'map_widget.dart/passengerRideLoctionWidget.dart';
-import 'map_widget.dart/payment_method.page.dart';
-import 'map_widget.dart/points_page_for_rider.dart';
-import 'map_widget.dart/ride_from_start_app.dart';
-import 'map_widget.dart/searching_captain_window.dart';
-
-class MapPagePassenger extends StatelessWidget {
- const MapPagePassenger({super.key});
-
- @override
- Widget build(BuildContext context) {
- Get.put(MapPassengerController());
- Get.put(MyMenuController());
- return Scaffold(
- body: SafeArea(
- child: Stack(
- children: [
- GoogleMapPassengerWidget(),
- leftMainMenuIcons(),
- // PaymobPackage(),
- const PickerIconOnMap(),
- // PickerAnimtionContainerFormPlaces(),
- const MainBottomMenuMap(),
- // NewMainBottomSheet(),
- const MapMenuWidget(),
- const MenuIconMapPageWidget(),
- buttomSheetMapPage(),
- CarDetailsTypeToChoose(),
- const Burc(),
- const ApplyOrderWidget(),
- // hexagonClipper(),
- const CancelRidePageShow(),
- CashConfirmPageShown(),
- const PaymentMethodPage(),
- const SearchingCaptainWindow(),
- // timerForCancelTripFromPassenger(),
- // const DriverTimeArrivePassengerPage(),
- // const TimerToPassengerFromDriver(),
- PassengerRideLocationWidget(),
- const RideBeginPassenger(),
- const RideFromStartApp(),
- cancelRidePage(),
- PointsPageForRider()
- ],
- ),
- ),
- );
- }
-}
-
-class CancelRidePageShow extends StatelessWidget {
- const CancelRidePageShow({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (controller) =>
- (controller.data.isNotEmpty && controller.remainingTime > 0)
- // ||
- // controller.timeToPassengerFromDriverAfterApplied == 0
- ? Positioned(
- right: box.read(BoxName.lang) != 'ar' ? 10 : null,
- left: box.read(BoxName.lang) == 'ar' ? 10 : null,
- top: 30,
- child: GestureDetector(
- onTap: () {
- controller.changeCancelRidePageShow();
- },
- child: Container(
- decoration: BoxDecoration(
- color: AppColor.redColor,
- borderRadius: BorderRadius.circular(15)),
- child: const Padding(
- padding: EdgeInsets.all(3),
- child: Icon(
- Icons.clear,
- size: 40,
- color: AppColor.secondaryColor,
- ),
- ),
- ),
- ))
- : const SizedBox());
- }
-}
-
-class PickerIconOnMap extends StatelessWidget {
- const PickerIconOnMap({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (controller) => controller.isPickerShown
- ? Positioned(
- bottom: Get.height * .2,
- top: 0,
- left: 0,
- right: 0,
- child: controller.isPickerShown
- ? const Icon(
- Icons.add_location,
- color: Colors.purple,
- )
- : const SizedBox(),
- )
- : const SizedBox());
- }
-}
diff --git a/lib/views/home/map_widget.dart/apply_order_widget.dart b/lib/views/home/map_widget.dart/apply_order_widget.dart
deleted file mode 100644
index 44a76ba..0000000
--- a/lib/views/home/map_widget.dart/apply_order_widget.dart
+++ /dev/null
@@ -1,415 +0,0 @@
-import 'package:SEFER/constant/colors.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/controller/firebase/firbase_messge.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
-import 'package:SEFER/main.dart';
-import 'package:SEFER/views/home/Captin/home_captain/widget/call_page.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter/services.dart';
-import 'package:get/get.dart';
-
-import '../../../constant/box_name.dart';
-
-class ApplyOrderWidget extends StatelessWidget {
- const ApplyOrderWidget({super.key});
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(builder: (controller) {
- if (controller.statusRide == 'Apply' &&
- controller.isSearchingWindow == false) {
- // double _height = Get.height * .2;
- return Positioned(
- bottom: 0,
- left: 0,
- right: 0,
- child: Container(
- decoration: AppStyle.boxDecoration1,
- height: Get.height * .35,
- child: ListView(
- children: [
- InkWell(
- onTap: () {
- if (box.read(BoxName.carType) == 'Speed' ||
- box.read(BoxName.carType) == 'Delivery') {
- Get.snackbar(
- 'This price is ${controller.totalPassenger.toStringAsFixed(2)}'
- .tr,
- 'This ride type does not allow changes to the destination or additional stops'
- .tr,
- snackPosition: SnackPosition.BOTTOM,
- duration: const Duration(seconds: 2),
- backgroundColor: AppColor.yellowColor,
- );
- } else {
- Get.snackbar(
- 'This price may be changed'.tr,
- 'This ride type allows changes, but the price may increase'
- .tr,
- snackPosition: SnackPosition.BOTTOM,
- duration: const Duration(seconds: 2),
- backgroundColor: AppColor.yellowColor,
- );
- }
- },
- child: Text.rich(
- TextSpan(
- children: [
- TextSpan(
- text: '${'The driver accept your order for'.tr} ',
- style: AppStyle.title,
- ),
- TextSpan(
- text: controller.totalPassenger.toStringAsFixed(2),
- style: AppStyle.title.copyWith(
- fontWeight: FontWeight.bold,
- // fontSize: 22,
- color: AppColor.redColor,
- ),
- ),
- TextSpan(
- text: ' ${'LE'.tr}',
- style: AppStyle.title,
- ),
- ],
- ),
- textAlign: TextAlign.center,
- ),
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- const SizedBox(
- width: 10,
- ),
- Container(
- height: Get.height * .3,
- width: Get.width * .9,
- decoration: AppStyle.boxDecoration1,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- Text(
- // 'Comfort',
- box.read(BoxName.carType
- .toString()), //car type fro box after selected
- style: AppStyle.title,
- ),
- const SizedBox(
- width: 10,
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Image.asset(
- 'assets/images/blob.png',
- width: 100,
- ),
- Column(
- children: [
- Text(
- // 'Toyota Camry',
- controller.model.toString(),
- style: AppStyle.title,
- ),
- Text(
- // 'ر ل 2323',
- controller.licensePlate.toString(),
- style: AppStyle.title,
- ),
- ],
- ),
- Text(
- // 'Black',
- controller.carColor,
- style: AppStyle.title,
- ),
- const SizedBox(
- width: 10,
- ),
- ],
- ),
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- CircleAvatar(
- radius: 30,
- backgroundImage: NetworkImage(
- // '',
- // ),
- 'https://ride.mobile-app.store/portrate_captain_image/${controller.driverId}.jpg'),
- ),
- Column(
- children: [
- Text(
- // 'fadi ahmad',
- controller.firstName,
- style: AppStyle.title,
- ),
- Text(
- // '⭐ 4.8',
- '⭐ ${controller.driverRate}',
- style: AppStyle.title,
- ),
- ],
- ),
- IconButton(
- onPressed: () async {
- Get.defaultDialog(
- title: 'Select one message'.tr,
- titleStyle: AppStyle.title,
- content: Container(
- height: Get.height * .5,
- child: Column(
- mainAxisAlignment:
- MainAxisAlignment.spaceEvenly,
- children: [
- InkWell(
- onTap: () {
- FirebaseMessagesController()
- .sendNotificationToAnyWithoutData(
- 'message From passenger',
- 'Hello, I\'m at the agreed-upon location'
- .tr,
- controller
- .driverToken);
- Get.back();
- },
- child: Container(
- decoration:
- AppStyle.boxDecoration1,
- child: Padding(
- padding:
- const EdgeInsets.all(
- 10),
- child: Text(
- 'Hello, I\'m at the agreed-upon location'
- .tr,
- style: AppStyle.title,
- ),
- ),
- ),
- ),
- InkWell(
- onTap: () {
- FirebaseMessagesController()
- .sendNotificationToAnyWithoutData(
- 'message From passenger',
- 'My location is correct. You can search for me using the navigation app'
- .tr,
- controller
- .driverToken);
- Get.back();
- },
- child: Container(
- decoration:
- AppStyle.boxDecoration1,
- child: Padding(
- padding:
- const EdgeInsets.all(
- 10),
- child: Text(
- 'My location is correct. You can search for me using the navigation app'
- .tr,
- style: AppStyle.title,
- ),
- ),
- ),
- ),
- InkWell(
- onTap: () {
- FirebaseMessagesController()
- .sendNotificationToAnyWithoutData(
- 'message From passenger',
- 'I\'m waiting for you'
- .tr,
- controller
- .driverToken);
- Get.back();
- },
- child: Container(
- decoration:
- AppStyle.boxDecoration1,
- child: Padding(
- padding:
- const EdgeInsets.all(
- 10),
- child: Text(
- 'I\'m waiting for you'.tr,
- style: AppStyle.title,
- ),
- ),
- ),
- ),
- ],
- ),
- ));
- },
- icon: const Icon(
- Icons.message,
- color: AppColor.blueColor,
- size: 35,
- ),
- ),
- IconButton(
- onPressed: () {
- HapticFeedback.heavyImpact();
- Get.to(() => const CallPage());
- // Get.to(() => PassengerCallPage());
- },
- icon: const Icon(
- Icons.call,
- color: AppColor.greenColor,
- size: 35,
- ),
- ),
- ],
- ),
- ),
- controller.isDriverArrivePassenger
- ? const DriverArrivePassengerAndWaitMinute()
- : const TimeDriverToPassenger()
- ],
- ),
- ),
- const SizedBox(
- width: 10,
- ),
- ],
- )
- ],
- ),
- ),
- );
- } else {
- return const SizedBox();
- }
- });
- }
-}
-
-class DriverArrivePassengerAndWaitMinute extends StatelessWidget {
- const DriverArrivePassengerAndWaitMinute({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(builder: (controller) {
- return Stack(
- children: [
- LinearProgressIndicator(
- backgroundColor: AppColor.accentColor,
- color: controller.remainingTimeDriverWaitPassenger5Minute < 60
- ? AppColor.redColor
- : AppColor.greenColor,
- minHeight: 25,
- borderRadius: BorderRadius.circular(15),
- value:
- controller.progressTimerDriverWaitPassenger5Minute.toDouble(),
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- 'The driver waiting you in picked location .'.tr,
- style: AppStyle.subtitle,
- textAlign: TextAlign.center,
- ),
- const SizedBox(
- width: 20,
- ),
- Text(
- controller.stringRemainingTimeDriverWaitPassenger5Minute,
- style: AppStyle.title,
- ),
- ],
- )
- ],
- );
- });
- }
-}
-
-class TimeDriverToPassenger extends StatelessWidget {
- const TimeDriverToPassenger({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(builder: (controller) {
- return controller.isDriverInPassengerWay == false ||
- controller.timeToPassengerFromDriverAfterApplied > 0
- ? Container(
- decoration: AppStyle.boxDecoration1,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1),
- child: Stack(
- children: [
- Container(
- decoration: AppStyle.boxDecoration1,
- width: Get.width * .7,
- height: 35,
- // color: AppColor.yellowColor,
- ),
- Stack(
- children: [
- LinearProgressIndicator(
- backgroundColor: AppColor.accentColor,
- color: controller
- .remainingTimeToPassengerFromDriverAfterApplied <
- 60
- ? AppColor.redColor
- : AppColor.greenColor,
- minHeight: 25,
- borderRadius: BorderRadius.circular(15),
- value: () {
- // Ensure valid value between 0.0 and 1.0
- double progress = controller
- .progressTimerToPassengerFromDriverAfterApplied
- .toDouble();
- if (progress.isNaN || progress.isInfinite) {
- // Handle invalid progress (e.g., set to 0.0)
- return 0.0;
- } else {
- return progress.clamp(
- 0.0, 1.0); // Clamp to valid range
- }
- }(),
- ),
- Center(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- 'The driver on your way'.tr,
- textAlign: TextAlign.center,
- ),
- const SizedBox(
- width: 20,
- ),
- Text(
- controller.stringRemainingTimeToPassenger,
- style: AppStyle.title,
- ),
- ],
- ),
- )
- ],
- ),
- ],
- ),
- ),
- )
- : const SizedBox();
- });
- }
-}
diff --git a/lib/views/home/map_widget.dart/buttom_sheet_map_show.dart b/lib/views/home/map_widget.dart/buttom_sheet_map_show.dart
deleted file mode 100644
index e982d88..0000000
--- a/lib/views/home/map_widget.dart/buttom_sheet_map_show.dart
+++ /dev/null
@@ -1,565 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/box_name.dart';
-import 'package:SEFER/constant/info.dart';
-import 'package:SEFER/controller/payment/payment_controller.dart';
-import 'package:SEFER/main.dart';
-import 'package:SEFER/views/widgets/elevated_btn.dart';
-
-import '../../../constant/colors.dart';
-import '../../../constant/style.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-
-GetBuilder buttomSheetMapPage() {
- Get.put(PaymentController());
- return GetBuilder(
- 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.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,
- ),
- ))
- : 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: ListView.builder(
- scrollDirection: Axis.horizontal,
- itemCount: controller
- .dataCarsLocationByPassenger.length -
- 1,
- itemBuilder:
- (BuildContext context, int index) {
- return Container(
- color: controller.gender == 'Female'
- ? const Color.fromARGB(
- 255, 246, 52, 181)
- : AppColor.secondaryColor,
- width: Get.width,
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- 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,
- ),
- ),
- ),
- SizedBox(
- width: Get.width * .55,
- child: Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- mainAxisAlignment:
- MainAxisAlignment.spaceEvenly,
- children: [
- Text(
- controller.hours > 0
- ? '${'Your Ride Duration is '.tr}${controller.hours} ${'H and'.tr} ${controller.minutes} ${'m'.tr}'
- : '${'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'.tr}',
- style: AppStyle.subtitle,
- )
- ],
- ),
- ),
- SizedBox(
- width: Get.width * .2,
- child: Padding(
- padding: const EdgeInsets.only(
- right: 5, left: 5),
- child: Column(
- crossAxisAlignment:
- CrossAxisAlignment.center,
- 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,
- ),
- ),
- ),
- controller.promoTaken
- ? const Icon(
- Icons
- .filter_vintage_rounded,
- color:
- AppColor.redColor,
- )
- : 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(
- 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(
- 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,
- titleStyle: AppStyle.title,
- content: Column(
- children: [
- SizedBox(
- width: Get.width * .7,
- child: TextFormField(
- controller: controller.promo,
- decoration: InputDecoration(
- labelText: 'Promo Code'.tr,
- hintText: 'Enter promo code'.tr,
- labelStyle: AppStyle.subtitle,
- hintStyle: AppStyle.subtitle,
- 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();
- },
- )
- :
- // 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
- .confirmRideForFirstDriver();
- },
- ),
- ],
- ),
- )
- ],
- ),
- ),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- )
- : const SizedBox());
-}
-
-class Details extends StatelessWidget {
- const Details({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (controller) => Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Text(
- '${'Distance is'.tr} ${controller.data[0]['distance']['text']}',
- style: AppStyle.title,
- ),
- Text(
- '${'Duration is'.tr} ${controller.data[0]['duration']['text']}',
- style: AppStyle.title,
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Text(
- 'Cost for .21/km ${controller.costDistance.toStringAsFixed(2)} ',
- style: AppStyle.title,
- ),
- Text(
- '${'Cost Duration'.tr} ${controller.averageDuration.toStringAsFixed(2)} is ${controller.costDuration.toStringAsFixed(2)} ',
- style: AppStyle.title,
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Text(
- 'Total Driver ${controller.totalDriver.toStringAsFixed(2)}',
- style: AppStyle.title,
- ),
- Text(
- 'totaME ${controller.totalME.toStringAsFixed(2)} ',
- style: AppStyle.title,
- ),
- ],
- ),
- Text(
- 'Cost for passenger ${controller.totalPassenger.toStringAsFixed(2)} ',
- style: AppStyle.title,
- ),
- ],
- ));
- }
-}
diff --git a/lib/views/home/map_widget.dart/call_passenger_page.dart b/lib/views/home/map_widget.dart/call_passenger_page.dart
deleted file mode 100644
index 82106b8..0000000
--- a/lib/views/home/map_widget.dart/call_passenger_page.dart
+++ /dev/null
@@ -1,180 +0,0 @@
-import 'dart:async';
-import 'package:SEFER/constant/box_name.dart';
-import 'package:SEFER/main.dart';
-import 'package:SEFER/views/widgets/my_scafold.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:permission_handler/permission_handler.dart';
-
-import 'package:agora_rtc_engine/agora_rtc_engine.dart';
-
-import '../../../../constant/api_key.dart';
-
-String appId = AK.agoraAppId;
-
-class PassengerCallPage extends StatefulWidget {
- const PassengerCallPage({
- super.key,
- required this.channelName,
- required this.token,
- required this.remoteID,
- });
- final String channelName, token, remoteID;
- @override
- State createState() => _PassengerCallPageState();
-}
-
-class _PassengerCallPageState extends State {
- int uid = 0;
- int? _remoteUid = 0; // uid of the remote user
- bool _isJoined = false; // Indicates if the local user has joined the channel
- late RtcEngine agoraEngine; // Agora engine instance
-
- final GlobalKey scaffoldMessengerKey =
- GlobalKey(); // Global key to access the scaffold
-
- showMessage(String message) {
- scaffoldMessengerKey.currentState?.showSnackBar(SnackBar(
- content: Text(message),
- ));
- }
-
- initAgora() async {
- await setupVoiceSDKEngine();
- }
-
- @override
- void initState() {
- super.initState();
- _remoteUid = int.parse(widget.remoteID);
- uid = int.parse(box.read(BoxName.phone));
- print('remoteid is ${widget.remoteID}');
- print('token is ${widget.token}');
- print('channelName is ${widget.channelName}');
- // Set up an instance of Agora engine
- initAgora();
- }
-
- Future setupVoiceSDKEngine() async {
- // retrieve or request microphone permission
- await [Permission.microphone].request();
-
- //create an instance of the Agora engine
- agoraEngine = createAgoraRtcEngine();
- await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId));
- print('eeeeeeeeeeeeeeeeeeee');
- print(agoraEngine);
- // Register the event handler
- agoraEngine.registerEventHandler(
- RtcEngineEventHandler(
- onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
- showMessage(
- "Local user uid:${connection.localUid} joined the channel");
- setState(() {
- _isJoined = true;
- });
- },
- onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
- showMessage("Remote user uid:$remoteUid joined the channel");
- setState(() {
- _remoteUid = remoteUid;
- });
- },
- onUserOffline: (RtcConnection connection, int? remoteUid,
- UserOfflineReasonType reason) {
- showMessage("Remote user uid:$remoteUid left the channel");
- setState(() {
- _remoteUid = null;
- });
- },
- ),
- );
- }
-
- void join() async {
- // Set channel options including the client role and channel profile
- ChannelMediaOptions options = const ChannelMediaOptions(
- clientRoleType: ClientRoleType.clientRoleBroadcaster,
- channelProfile: ChannelProfileType.channelProfileCommunication,
- );
-
- await agoraEngine.joinChannel(
- token: widget.token,
- channelId: widget.channelName,
- options: options,
- uid: uid,
- );
- }
- //https://console.agora.io/invite?sign=5e9e22d06f22caeeada9954c9e908572%253A5ba8aed978a35eab5a5113742502ded2a41478b2a81cb19c71a30776e125b58a
-
- void leave() {
- setState(() {
- _isJoined = false;
- _remoteUid = null;
- });
- agoraEngine.leaveChannel();
- }
-
-// Clean up the resources when you leave
- @override
- void dispose() async {
- await agoraEngine.leaveChannel();
- super.dispose();
- }
-
-// Build UI
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- scaffoldMessengerKey: scaffoldMessengerKey,
- home: MyScafolld(
- // appBar: AppBar(
- // title: const Text('Get started with Voice Calling'),
- // ),
- title: 'Voice Calling'.tr,
- isleading: true,
- body: [
- ListView(
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
- children: [
- // Status text
- Container(height: 40, child: Center(child: _status())),
- // Button Row
- Row(
- children: [
- Expanded(
- child: ElevatedButton(
- child: Text("Join".tr),
- onPressed: () => {join()},
- ),
- ),
- const SizedBox(width: 10),
- Expanded(
- child: ElevatedButton(
- child: Text("Leave".tr),
- onPressed: () => {leave()},
- ),
- ),
- ],
- ),
- ],
- ),
- ]),
- );
- }
-
- Widget _status() {
- String statusText;
-
- if (!_isJoined) {
- statusText = 'Join a channel';
- } else if (_remoteUid == null)
- statusText = 'Waiting for a remote user to join...';
- else
- statusText = 'Connected to remote user, uid:$_remoteUid';
-
- return Text(
- statusText,
- );
- }
-}
diff --git a/lib/views/home/map_widget.dart/cancel_raide_page.dart b/lib/views/home/map_widget.dart/cancel_raide_page.dart
deleted file mode 100644
index a0c90e1..0000000
--- a/lib/views/home/map_widget.dart/cancel_raide_page.dart
+++ /dev/null
@@ -1,103 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/colors.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
-
-import '../../widgets/elevated_btn.dart';
-
-GetBuilder cancelRidePage() {
- Get.put(MapPassengerController());
- final List reasons = [
- "I don't need a ride anymore".tr,
- "I was just trying the application".tr,
- "No driver accepted my request".tr,
- "I added the wrong pick-up/drop-off location".tr,
- "I don't have a reason".tr,
- "Other".tr,
- ];
- return GetBuilder(
- builder: (controller) => controller.isCancelRidePageShown
- ? Positioned(
- left: Get.width * .1,
- top: Get.width * .2,
- right: Get.width * .1,
- bottom: Get.width * .15,
- child: Container(
- decoration: BoxDecoration(
- color: AppColor.secondaryColor,
- boxShadow: [
- const BoxShadow(
- color: AppColor.accentColor,
- offset: Offset(2, 2),
- blurRadius: 5),
- BoxShadow(
- color: AppColor.accentColor.withOpacity(.4),
- offset: const Offset(-2, -2),
- blurRadius: 5)
- ],
- borderRadius: const BorderRadius.all(Radius.circular(15)),
- ),
- height: Get.height * .7,
- width: Get.width * .7,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10),
- child: Text(
- 'Can we know why you want to cancel Ride ?'.tr,
- style: AppStyle.title,
- textAlign: TextAlign.center,
- ),
- ),
- SizedBox(
- height: 380,
- width: 300,
- child: ListView.builder(
- itemCount: reasons.length,
- itemBuilder: (context, index) {
- return ListTile(
- title: InkWell(
- onTap: () {
- controller.selectReason(
- index,
- reasons[index].toString(),
- );
- },
- child: Text(reasons[index])),
- leading: Radio(
- value: index,
- groupValue: controller.selectedReason,
- onChanged: (int? value) {
- // print(value);
- // print(reasons[index]);
- controller.selectReason(
- value!,
- reasons[index].toString(),
- );
- },
- ),
- );
- },
- ),
- ),
- MyElevatedButton(
- title: 'Cancel Ride'.tr,
- onPressed: () {
- if (controller.selectedReason == -1) {
- Get.snackbar('You Should be select reason.'.tr, '',
- snackPosition: SnackPosition.BOTTOM,
- backgroundColor: AppColor.redColor);
- } else {
- controller.cancelRide();
- }
- },
- ),
- ],
- ),
- ),
- )
- : const SizedBox(),
- );
-}
diff --git a/lib/views/home/map_widget.dart/car_details_widget_to_go.dart b/lib/views/home/map_widget.dart/car_details_widget_to_go.dart
deleted file mode 100644
index 785d2f9..0000000
--- a/lib/views/home/map_widget.dart/car_details_widget_to_go.dart
+++ /dev/null
@@ -1,509 +0,0 @@
-import 'package:SEFER/constant/box_name.dart';
-import 'package:SEFER/constant/colors.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/main.dart';
-import 'package:SEFER/views/widgets/elevated_btn.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-
-import '../../../constant/info.dart';
-import '../../../controller/functions/tts.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-
-class CarType {
- final String carType;
- final String carDetail;
- final String image;
- bool isSelected = false; // Track selection state
-
- CarType(
- {required this.carType, required this.carDetail, required this.image});
-}
-
-List carTypes = [
- CarType(
- carType: 'Comfort',
- carDetail: 'Comfort choice'.tr,
- image: 'assets/images/blob.png'),
- CarType(
- carType: 'Speed',
- carDetail: 'Closest & Cheapest'.tr,
- image: 'assets/images/carspeed.png'),
- CarType(
- carType: 'Delivery',
- carDetail: 'Delivery service'.tr,
- image: 'assets/images/moto.png'),
- CarType(
- carType: 'Mashwari',
- carDetail: 'Mashwari without end point'.tr,
- image: 'assets/images/freeRide.png'),
-];
-
-class CarDetailsTypeToChoose extends StatelessWidget {
- CarDetailsTypeToChoose({super.key});
- final textToSpeechController = Get.put(TextToSpeechController());
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (mapPassengerController) {
- return mapPassengerController.data.isNotEmpty &&
- mapPassengerController.isBottomSheetShown &&
- mapPassengerController.rideConfirm == false
- ? Positioned(
- bottom: 0,
- left: 5,
- right: 5,
- child: Container(
- decoration: const BoxDecoration(
- color: Color.fromARGB(255, 255, 255, 255),
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(8),
- topRight: Radius.circular(8),
- ),
- ),
- height: Get.height * .4,
- child: Column(
- children: [
- SizedBox(
- height: Get.height * .4,
- child: ListView.builder(
- itemCount: carTypes.length,
- itemBuilder: (context, index) {
- final carType = carTypes[index];
- return ListTile(
- title: Container(
- width: Get.width,
- decoration: BoxDecoration(
- color: AppColor.secondaryColor,
- borderRadius: const BorderRadius.all(
- Radius.circular(20)),
- boxShadow: [
- carType.isSelected
- ? const BoxShadow(
- spreadRadius: 3,
- blurStyle: BlurStyle.solid,
- color: AppColor.accentColor,
- blurRadius: 3,
- offset: Offset(1, 3))
- : const BoxShadow(),
- ]),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- Image.asset(
- carType.image,
- width: 50,
- height: 50,
- ),
- SizedBox(
- width: Get.width * .4,
- child: Column(
- children: [
- Text(
- carType.carType,
- style: AppStyle.title.copyWith(
- fontWeight: FontWeight.bold,
- fontSize: 20),
- ),
- Text(
- carType.carDetail,
- style: AppStyle.subtitle,
- ),
- ],
- ),
- ),
- Column(
- children: [
- Text(
- carType.carType == 'Comfort'
- ? mapPassengerController
- .totalPassengerComfort
- .toStringAsFixed(2)
- : carType.carType == 'Speed'
- ? mapPassengerController
- .totalPassengerSpeed
- .toStringAsFixed(2)
- : carType.carType == 'Delivery'
- ? mapPassengerController
- .totalPassengerMotoDelivery
- .toStringAsFixed(2)
- : '50',
- style: AppStyle.title
- .copyWith(fontSize: 20),
- ),
- carType.carType == 'Comfort' &&
- (mapPassengerController
- .totalPassengerSpeed >
- 20)
- ? Row(
- children: [
- Container(
- decoration:
- AppStyle.boxDecoration1,
- child: Text(
- '-12%',
- style: AppStyle.subtitle
- .copyWith(
- color: AppColor
- .greenColor),
- )),
- const SizedBox(
- width: 10,
- ),
- Text(
- mapPassengerController
- .totalPassengerComfortDiscount
- .toStringAsFixed(2),
- style:
- AppStyle.title.copyWith(
- color: AppColor.redColor,
- decoration: TextDecoration
- .lineThrough, // Strikethrough line
- ),
- )
- ],
- )
- : carType.carType == 'Speed' &&
- (mapPassengerController
- .totalPassengerSpeed >
- 20)
- ? Row(
- children: [
- Container(
- decoration: AppStyle
- .boxDecoration1,
- child: Text(
- '-10%',
- style: AppStyle
- .subtitle
- .copyWith(
- color: AppColor
- .greenColor),
- )),
- const SizedBox(
- width: 10,
- ),
- Text(
- mapPassengerController
- .totalPassengerSpeedDiscount
- .toStringAsFixed(2),
- style: AppStyle.title
- .copyWith(
- color:
- AppColor.redColor,
- decoration: TextDecoration
- .lineThrough, // Strikethrough line
- ),
- )
- ],
- )
- : const SizedBox(
- width: 3,
- ),
- ],
- ),
- const SizedBox(
- width: 4,
- )
- ],
- ),
- ),
-
- selected: mapPassengerController.selectedIndex ==
- index, // Set selected based on index
- selectedColor:
- Colors.blue, // Color for selected item
-
- onTap: () {
- mapPassengerController.selectCarFromList(index);
-
- if (mapPassengerController.selectedIndex != -1) {
- // Get.snackbar('You should select one'.tr, '',
- // backgroundColor: AppColor.greenColor);
- if (mapPassengerController.selectedIndex == 0) {
- box.write(BoxName.carType, 'Comfort');
- mapPassengerController.totalPassenger =
- mapPassengerController
- .totalPassengerComfort;
- Get.defaultDialog(
- title: 'Comfort',
- titleStyle: AppStyle.title,
- content: CarDialogue(
- textToSpeechController:
- textToSpeechController,
- image: 'assets/images/blob.png',
- text:
- 'Best choice for comfort car and flexible route and stops point'
- .tr),
- confirm: MyElevatedButton(
- kolor: AppColor.greenColor,
- title: 'Next'.tr,
- onPressed: () {
- Get.back();
- mapPassengerController
- .isBottomSheetShown = false;
- mapPassengerController.update();
- mapPassengerController
- .changeCashConfirmPageShown();
- }),
- cancel: MyElevatedButton(
- title: 'Cancel'.tr,
- kolor: AppColor.redColor,
- onPressed: () {
- Get.back();
- }));
- } else if (mapPassengerController
- .selectedIndex ==
- 1) {
- box.write(BoxName.carType, 'Speed');
- mapPassengerController.totalPassenger =
- mapPassengerController
- .totalPassengerSpeed;
- Get.defaultDialog(
- title: 'Speed',
- titleStyle: AppStyle.title,
- content: CarDialogue(
- textToSpeechController:
- textToSpeechController,
- image: 'assets/images/carspeed.png',
- text:
- 'This trip goes directly from your starting point to your destination for a fixed price. The driver must follow the planned route'
- .tr),
- confirm: MyElevatedButton(
- kolor: AppColor.greenColor,
- title: 'Next'.tr,
- onPressed: () {
- Get.back();
- mapPassengerController
- .isBottomSheetShown = false;
- mapPassengerController.update();
- mapPassengerController
- .changeCashConfirmPageShown();
- }),
- cancel: MyElevatedButton(
- title: 'Cancel'.tr,
- kolor: AppColor.redColor,
- onPressed: () {
- Get.back();
- }));
- } else if (mapPassengerController
- .selectedIndex ==
- 2) {
- box.write(BoxName.carType, 'Delivery');
- mapPassengerController.totalPassenger =
- mapPassengerController
- .totalPassengerMotoDelivery;
- Get.defaultDialog(
- title: 'Delivery',
- titleStyle: AppStyle.title,
- content: CarDialogue(
- textToSpeechController:
- textToSpeechController,
- image: 'assets/images/moto.png',
- text:
- 'This is for delivery or a motorcycle.'
- .tr),
- confirm: MyElevatedButton(
- kolor: AppColor.greenColor,
- title: 'Next'.tr,
- onPressed: () {
- Get.back();
- mapPassengerController
- .isBottomSheetShown = false;
- mapPassengerController.update();
- mapPassengerController
- .changeCashConfirmPageShown();
- }),
- cancel: MyElevatedButton(
- title: 'Cancel'.tr,
- kolor: AppColor.redColor,
- onPressed: () {
- Get.back();
- }));
- } else if (mapPassengerController
- .selectedIndex ==
- 3) {
- box.write(BoxName.carType, 'Mashwari');
- mapPassengerController.totalPassenger = 50;
- Get.defaultDialog(
- title: 'Mashwari',
- titleStyle: AppStyle.title,
- content: CarDialogue(
- textToSpeechController:
- textToSpeechController,
- image: 'assets/images/freeRide.png',
- text:
- 'Perfect for adventure seekers who want to experience something new and exciting'
- .tr),
- confirm: MyElevatedButton(
- kolor: AppColor.greenColor,
- title: 'Next'.tr,
- onPressed: () {
- Get.back();
- mapPassengerController
- .isBottomSheetShown = false;
- mapPassengerController.update();
- mapPassengerController
- .changeCashConfirmPageShown();
- }),
- cancel: MyElevatedButton(
- title: 'Cancel'.tr,
- kolor: AppColor.redColor,
- onPressed: () {
- Get.back();
- }));
- }
- } else {
- Get.snackbar('You should select one'.tr, '',
- backgroundColor: AppColor.redColor);
- }
- },
- );
- },
- ),
- ),
- // MyElevatedButton(
- // title: 'Next'.tr,
- // onPressed: () {
- // if (mapPassengerController.selectedIndex != -1) {
- // // Get.snackbar('You should select one'.tr, '',
- // // backgroundColor: AppColor.greenColor);
- // if (mapPassengerController.selectedIndex == 0) {
- // box.write(BoxName.carType, 'Comfort');
- // mapPassengerController.totalPassenger =
- // mapPassengerController.totalPassengerComfort;
- // } else if (mapPassengerController.selectedIndex ==
- // 1) {
- // box.write(BoxName.carType, 'Speed');
- // } else if (mapPassengerController.selectedIndex ==
- // 2) {
- // box.write(BoxName.carType, 'Delivery');
- // mapPassengerController.totalPassenger =
- // mapPassengerController
- // .totalPassengerMotoDelivery;
- // } else if (mapPassengerController.selectedIndex ==
- // 3) {
- // box.write(BoxName.carType, 'FreeRide');
- // mapPassengerController.totalPassenger = 50;
- // }
- // mapPassengerController.isBottomSheetShown = false;
- // mapPassengerController.update();
- // mapPassengerController.changeCashConfirmPageShown();
- // // mapPassengerController.confirmRideForFirstDriver();
- // } else {
- // Get.snackbar('You should select one'.tr, '',
- // backgroundColor: AppColor.redColor);
- // }
- // })
- ],
- ),
- ),
- )
- : const SizedBox();
- // ;
- });
- }
-}
-
-class Burc extends StatelessWidget {
- const Burc({super.key});
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (mapPassengerController) {
- final passengerWallet =
- double.tryParse(box.read(BoxName.passengerWalletTotal)) ??
- 0.0; // Handle potential parsing errors
-
- return mapPassengerController.data.isNotEmpty &&
- mapPassengerController.isBottomSheetShown &&
- !mapPassengerController.rideConfirm
- ? Positioned(
- bottom: Get.height * .41,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- if (passengerWallet < 0.0) // Use if statement for clarity
- Container(
- decoration: AppStyle.boxDecoration.copyWith(
- color: AppColor.redColor.withOpacity(.5),
- ),
- height: 50,
- width: Get.width,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 8),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- IconButton(
- onPressed: () async => await Get.find<
- TextToSpeechController>()
- .speakText('you have a negative balance of'
- .tr +
- '${passengerWallet.toStringAsFixed(2)}'
- ' in your'
- .tr +
- ' ${AppInformation.appName}'
- ' wallet due to a previous trip.'
- .tr),
- icon: const Icon(Icons.headphones)),
- Text(
- '${'you have a negative balance of'.tr}${'${passengerWallet.toStringAsFixed(2)}\n${' in your'.tr}'} ${AppInformation.appName}${' wallet due to a previous trip.'.tr}',
- textAlign: TextAlign.center,
- style: AppStyle.subtitle,
- ),
- ],
- ),
- ),
- ),
- ],
- ),
- )
- : const SizedBox();
- },
- );
- }
-}
-
-class CarDialogue extends StatelessWidget {
- const CarDialogue({
- super.key,
- required this.textToSpeechController,
- required this.image,
- required this.text,
- });
-
- final TextToSpeechController textToSpeechController;
- final String image, text;
-
- @override
- Widget build(BuildContext context) {
- return Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Image.asset(
- image,
- width: 50,
- ),
- IconButton(
- onPressed: () {
- textToSpeechController.speakText(
- text,
- );
- },
- icon: const Icon(Icons.headphones)),
- ],
- ),
- Text(
- text.tr,
- style: AppStyle.title,
- textAlign: TextAlign.center,
- ),
- ],
- );
- }
-}
diff --git a/lib/views/home/map_widget.dart/cash_confirm_bottom_page.dart b/lib/views/home/map_widget.dart/cash_confirm_bottom_page.dart
deleted file mode 100644
index 005ba56..0000000
--- a/lib/views/home/map_widget.dart/cash_confirm_bottom_page.dart
+++ /dev/null
@@ -1,191 +0,0 @@
-import 'package:SEFER/constant/info.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/box_name.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/views/home/my_wallet/passenger_wallet.dart';
-
-import '../../../constant/colors.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import '../../../controller/payment/payment_controller.dart';
-import '../../../main.dart';
-import '../../widgets/elevated_btn.dart';
-
-class CashConfirmPageShown extends StatelessWidget {
- CashConfirmPageShown({
- super.key,
- });
- PaymentController paymentController = Get.put(PaymentController());
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (controller) => Positioned(
- right: 5,
- bottom: 5,
- left: 5,
- child: AnimatedContainer(
- duration: const Duration(milliseconds: 400),
- height: controller.isCashConfirmPageShown
- ? controller.cashConfirmPageShown
- : 0,
- decoration: BoxDecoration(
- color: AppColor.secondaryColor,
- borderRadius: BorderRadius.circular(15)),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20),
- child: Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- 'Payment Method'.tr,
- style: AppStyle.title.copyWith(fontSize: 22),
- ),
- // IconButton(
- // onPressed: () =>
- // controller.changeCashConfirmPageShown(),
- // icon: const Icon(Icons.close),
- // ),
- ],
- ),
- GetBuilder(
- builder: (paymentController) => Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- const Icon(
- Icons.wallet_outlined,
- size: 25,
- color: AppColor.redColor,
- ),
- const SizedBox(
- width: 20,
- ),
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- '${AppInformation.appName} Wallet'.tr,
- style: AppStyle.title,
- ),
- Text(
- // '${'Your Wallet balance is '.tr}JD ',
- '${'Your Wallet balance is '.tr} ${box.read(BoxName.passengerWalletTotal).toString()}${' \$'.tr}',
- style: AppStyle.subtitle,
- ),
- ],
- ),
- const Spacer(),
- Checkbox.adaptive(
- value: paymentController.isWalletChecked,
- onChanged: (value) {
- paymentController
- .onChangedPaymentMethodWallet(value);
- },
- )
- ],
- ),
- ),
- const Divider(
- color: AppColor.accentColor,
- thickness: 1,
- height: 2,
- indent: 1,
- ),
- Row(
- children: [
- Icon(
- Icons.monetization_on,
- color: Colors.green[400],
- ),
- const SizedBox(
- width: 20,
- ),
- InkWell(
- onTap: () {
- controller.changeCashConfirmPageShown();
- controller.isSearchingWindow = true;
- controller.confirmRideForFirstDriver();
- controller.update();
- },
- child: Text(
- 'CASH',
- style: AppStyle.title,
- ),
- ),
- const Spacer(),
- GetBuilder(
- builder: (controller) => Checkbox.adaptive(
- value: controller.isCashChecked,
- onChanged: (value) {
- controller
- .onChangedPaymentMethodCash(value);
- },
- ))
- ],
- ),
- const Divider(
- color: AppColor.accentColor,
- thickness: 1,
- height: 2,
- indent: 1,
- ),
- // GetBuilder(
- // builder: (paymentController) =>
- // (paymentController.isWalletChecked == false &&
- // paymentController.isCashChecked == true
- // ? MyElevatedButton(
- // title: 'Next'.tr,
- // onPressed: () {
- // controller.changeCashConfirmPageShown();
- // },
- // )
- // : const SizedBox())),
- GetBuilder(
- builder: (paymentController) => (box
- .read(BoxName.passengerWalletTotal) ==
- null ||
- double.parse(box
- .read(BoxName.passengerWalletTotal)) <
- controller.totalPassenger)
- ? Column(
- children: [
- MyElevatedButton(
- title: 'To use Wallet charge it'.tr,
- onPressed: () {
- Get.to(() => const PassengerWallet());
- },
- kolor: AppColor.redColor,
- ),
- MyElevatedButton(
- kolor: AppColor.greenColor,
- title: 'Next as Cash \$\$!'.tr,
- onPressed: () {
- paymentController.isCashChecked = true;
- paymentController.isWalletChecked = false;
- paymentController.update();
- controller.changeCashConfirmPageShown();
- controller.isSearchingWindow = true;
- controller.confirmRideForFirstDriver();
- controller.update();
- },
- ),
- ],
- )
- : MyElevatedButton(
- title: 'Next'.tr,
- onPressed: () {
- controller.changeCashConfirmPageShown();
- controller.isSearchingWindow = true;
- controller.confirmRideForFirstDriver();
- controller.update();
- },
- ), // Add a fallback widget if none of the conditions are met
- )
- ],
- ),
- ),
- ),
- ));
- }
-}
diff --git a/lib/views/home/map_widget.dart/driver_card_from_passenger.dart b/lib/views/home/map_widget.dart/driver_card_from_passenger.dart
deleted file mode 100644
index 660c009..0000000
--- a/lib/views/home/map_widget.dart/driver_card_from_passenger.dart
+++ /dev/null
@@ -1,107 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-
-import '../../../constant/style.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import 'hexegone_clipper.dart';
-
-GetBuilder hexagonClipper() {
- return GetBuilder(
- builder: ((controller) => controller.rideConfirm
- ? Positioned(
- top: Get.height * .1,
- left: Get.width * .1,
- right: Get.width * .1,
- child: ClipPath(
- clipper:
- HexagonClipper(), // CustomClipper to create a hexagon shape
- child: AnimatedContainer(
- duration: const Duration(microseconds: 300),
- height: 250,
- width: 250,
- // decoration: AppStyle.boxDecoration,
- // gradient: const LinearGradient(
- // colors: [AppColor.greenColor, AppColor.secondaryColor],
- // begin: Alignment.topLeft,
- // end: Alignment.bottomCenter,
- // ),
- // border: Border.all(),
- // color: AppColor.secondaryColor,
- // borderRadius: BorderRadius.circular(15)),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- 'Waiting for Driver ...'.tr,
- style: AppStyle.title,
- ),
- // IconButton(
- // onPressed: () {
- // print(controller.dataCarsLocationByPassenger);
- // },
- // icon: const Icon(Icons.add),
- // ),
- // Text(
- // controller.dataCarsLocationByPassenger['message']
- // [controller.carsOrder]['phone']
- // .toString(),
- // style: AppStyle.title,
- // ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Text(
- '${controller.dataCarsLocationByPassenger['message'][controller.carsOrder]['first_name']} ${controller.dataCarsLocationByPassenger['message'][controller.carsOrder]['last_name']}',
- style: AppStyle.title,
- ),
- Text(
- 'Age is '.tr +
- controller
- .dataCarsLocationByPassenger['message']
- [controller.carsOrder]['age']
- .toString(),
- style: AppStyle.title,
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Text(
- controller.dataCarsLocationByPassenger['message']
- [controller.carsOrder]['make']
- .toString(),
- style: AppStyle.title,
- ),
- Text(
- controller.dataCarsLocationByPassenger['message']
- [controller.carsOrder]['model']
- .toString(),
- style: AppStyle.title,
- ),
- ],
- ),
- Text(
- 'Rating is '.tr +
- controller.dataCarsLocationByPassenger['message']
- [controller.carsOrder]['ratingDriver']
- .toString(),
- style: AppStyle.title,
- ),
- Container(
- decoration: BoxDecoration(border: Border.all(width: 2)),
- child: Text(
- controller.dataCarsLocationByPassenger['message']
- [controller.carsOrder]['car_plate']
- .toString(),
- style: AppStyle.title,
- ),
- ),
- ],
- ),
- ),
- ),
- )
- : const SizedBox()));
-}
diff --git a/lib/views/home/map_widget.dart/driver_time_arrive_passenger.dart b/lib/views/home/map_widget.dart/driver_time_arrive_passenger.dart
deleted file mode 100644
index 680f899..0000000
--- a/lib/views/home/map_widget.dart/driver_time_arrive_passenger.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:intl/intl.dart';
-// import 'package:intl/intl.dart';
-
-import '../../../constant/style.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-
-class DriverTimeArrivePassengerPage extends StatelessWidget {
- const DriverTimeArrivePassengerPage({super.key});
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (controller) {
- return controller.remainingTime == 0
- ? Positioned(
- bottom: Get.height * .35,
- right: Get.width * .05,
- child: Stack(
- alignment: Alignment.center,
- children: [
- Container(
- decoration: AppStyle.boxDecoration,
- // width: 50,
- // height: 50,
- child: Padding(
- padding: const EdgeInsetsDirectional.only(
- start: 5, end: 5),
- child: Column(
- children: [
- Text(
- controller.durationByPassenger.toString() +
- ' to arrive you.'.tr,
- style: AppStyle.title,
- ),
- Text(
- " ${DateFormat('h:mm a').format(controller.newTime)}",
- style: AppStyle.title,
- ),
- ],
- ),
- ))
- ],
- ),
- )
- : const SizedBox();
- },
- );
- }
-}
diff --git a/lib/views/home/map_widget.dart/form_search_places_destenation.dart b/lib/views/home/map_widget.dart/form_search_places_destenation.dart
deleted file mode 100644
index e0a2447..0000000
--- a/lib/views/home/map_widget.dart/form_search_places_destenation.dart
+++ /dev/null
@@ -1,305 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:google_maps_flutter/google_maps_flutter.dart';
-import 'package:SEFER/constant/box_name.dart';
-import 'package:SEFER/constant/table_names.dart';
-import 'package:SEFER/views/widgets/elevated_btn.dart';
-
-import '../../../constant/colors.dart';
-import '../../../constant/style.dart';
-import '../../../controller/functions/toast.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import '../../../main.dart';
-
-GetBuilder formSearchPlacesDestenation() {
- // DbSql sql = DbSql.instance;
- if (box.read(BoxName.addWork).toString() == '' ||
- box.read(BoxName.addHome).toString() == '') {
- box.write(BoxName.addWork, 'addWork');
- box.write(BoxName.addHome, 'addHome');
- }
-
- return GetBuilder(
- builder: (controller) => Column(
- children: [
- Padding(
- padding: const EdgeInsets.all(6),
- child: Column(
- children: [
- Container(
- width: Get.width * .9,
- height: 40,
- decoration:
- const BoxDecoration(color: AppColor.secondaryColor),
- child: TextField(
- decoration: InputDecoration(
- border: const OutlineInputBorder(
- borderRadius: BorderRadius.only(),
- gapPadding: 4,
- borderSide: BorderSide(
- color: AppColor.redColor,
- width: 2,
- )),
- suffixIcon: const Icon(Icons.search),
- hintText: controller.hintTextDestinationPoint,
- hintStyle: AppStyle.title,
- hintMaxLines: 1,
- prefixIcon: IconButton(
- onPressed: () {
- controller.placeDestinationController.clear();
- controller.clearPlacesDestination();
- },
- icon: Icon(
- Icons.clear,
- color: Colors.red[300],
- ),
- ),
- ),
- controller: controller.placeDestinationController,
- onChanged: (value) {
- if (controller
- .placeDestinationController.text.length >
- 5) {
- controller.getPlaces();
- controller.changeHeightPlaces();
- }
- },
- // onEditingComplete: () => controller.changeHeight(),
- ),
- ),
- const SizedBox(
- height: 10,
- ),
- Container(
- decoration: AppStyle.boxDecoration1,
- child: InkWell(
- onTap: () {
- controller.changeMainBottomMenuMap();
- controller.changePickerShown();
- },
- child: Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 20, vertical: 4),
- child: Text(
- 'Pick from map'.tr,
- style: AppStyle.headTitle2,
- ),
- ),
- )),
- const SizedBox(
- height: 10,
- ),
- SizedBox(
- height: 50,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- InkWell(
- onTap: () {
- if (box.read(BoxName.addWork) == 'addWork') {
- controller.workLocationFromMap = true;
- controller.changeMainBottomMenuMap();
- controller.changePickerShown();
- } else {
- controller.hintTextDestinationPoint = 'To Work';
- print(box.read(BoxName.addWork));
- final latLng = LatLng(
- double.parse(
- box.read(BoxName.addWork).split(',')[0]),
- double.parse(
- box.read(BoxName.addWork).split(',')[1]),
- );
- print(latLng);
- controller.newMyLocation = latLng;
- controller.update();
- }
- },
- onLongPress: () {
- Get.defaultDialog(
- title: 'Do you want to change Work location',
- middleText: '',
- confirm: MyElevatedButton(
- title: 'Yes'.tr,
- onPressed: () {
- Get.back();
- controller.workLocationFromMap = true;
- controller.changeMainBottomMenuMap();
- controller.changePickerShown();
- }));
- },
- child: Container(
- decoration: BoxDecoration(
- color: AppColor.greenColor.withOpacity(.4),
- border: Border.all()),
- child: Text(
- '${'Work :'.tr} ${box.read(BoxName.addWork).toString() == 'addWork' ? 'Add Work' : box.read(BoxName.addWork).toString().split(',')[0] + box.read(BoxName.addWork).toString().split(',')[1]} '),
- ),
- ),
- InkWell(
- onLongPress: () {
- Get.defaultDialog(
- title:
- 'Do you want to change Home location'.tr,
- middleText: '',
- confirm: MyElevatedButton(
- title: 'Yes'.tr,
- onPressed: () {
- Get.back();
- controller.homeLocationFromMap = true;
- controller.changeMainBottomMenuMap();
- controller.changePickerShown();
- }));
- },
- onTap: () {
- if (box.read(BoxName.addHome) == 'addHome') {
- controller.homeLocationFromMap = true;
- controller.changeMainBottomMenuMap();
- controller.changePickerShown();
- } else {
- controller.hintTextDestinationPoint = 'To Home';
- print(box.read(BoxName.addHome));
- final latLng = LatLng(
- double.parse(
- box.read(BoxName.addHome).split(',')[0]),
- double.parse(
- box.read(BoxName.addHome).split(',')[1]),
- );
- print(latLng);
- controller.newMyLocation = latLng;
- controller.update();
- }
- },
- child: Container(
- decoration: BoxDecoration(
- color: AppColor.yellowColor.withOpacity(.4),
- border: Border.all()),
- child: Text(
- 'Home : ${box.read(BoxName.addHome) == 'addHome' ? 'Add Home' : box.read(BoxName.addHome)} '),
- ),
- ),
- ],
- ),
- )
- ],
- ), //
- ),
- // controller.placesDestination.isEmpty
- // ? InkWell(
- // onTap: () {
- // controller.changeMainBottomMenuMap();
- // controller.changePickerShown();
- // },
- // child: Text(
- // 'Choose from Map'.tr,
- // style:
- // AppStyle.title.copyWith(color: AppColor.blueColor),
- // ),
- // )
- // : const SizedBox(),
- Container(
- height: controller.placesDestination.isNotEmpty
- ? controller.height
- : 0,
- color: AppColor.secondaryColor,
- child: ListView.builder(
- itemCount: controller.placesDestination.length,
- itemBuilder: (BuildContext context, int index) {
- var res = controller.placesDestination[index];
- return InkWell(
- onTap: () async {
- controller.changeHeightPlaces();
- await sql.insertData({
- 'latitude': res['geometry']['location']['lat'],
- 'longitude': res['geometry']['location']['lng'],
- 'name': res['name'].toString(),
- 'rate': res['rating'].toString(),
- }, TableName.recentLocations);
-
- controller.changeHeightPlaces();
-
- controller.passengerLocation = controller.newMyLocation;
- controller.myDestination = LatLng(
- double.parse(
- res['geometry']['location']['lat'].toString()),
- double.parse(
- res['geometry']['location']['lng'].toString()),
- );
- controller.convertHintTextDestinationNewPlaces(index);
-
- controller.placesDestination = [];
- controller.placeDestinationController.clear();
- controller.changeMainBottomMenuMap();
- controller.passengerStartLocationFromMap = true;
- controller.isPickerShown = true;
- },
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10),
- child: Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Column(
- children: [
- Image.network(
- res['icon'],
- width: 20,
- ),
- IconButton(
- onPressed: () async {
- await sql.insertData({
- 'latitude': res['geometry']
- ['location']['lat'],
- 'longitude': res['geometry']
- ['location']['lng'],
- 'name': res['name'].toString(),
- 'rate': res['rating'].toString(),
- }, TableName.placesFavorite);
- Toast.show(
- context,
- '${res['name']} ${'Saved Sucssefully'.tr}',
- AppColor.primaryColor);
- },
- icon: const Icon(Icons.favorite_border),
- ),
- ],
- ),
- Column(
- children: [
- Text(
- res['name'].toString(),
- style: AppStyle.title,
- ),
- Text(
- res['vicinity'].toString(),
- style: AppStyle.subtitle,
- ),
- ],
- ),
- Column(
- children: [
- Text(
- 'rate',
- style: AppStyle.subtitle,
- ),
- Text(
- res['rating'].toString(),
- style: AppStyle.subtitle,
- ),
- ],
- ),
- ],
- ),
- const Divider(
- thickness: 1,
- )
- ],
- ),
- ),
- );
- },
- ),
- )
- ],
- ));
-}
diff --git a/lib/views/home/map_widget.dart/form_search_start.dart b/lib/views/home/map_widget.dart/form_search_start.dart
deleted file mode 100644
index 171ec03..0000000
--- a/lib/views/home/map_widget.dart/form_search_start.dart
+++ /dev/null
@@ -1,188 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/table_names.dart';
-
-import '../../../constant/colors.dart';
-import '../../../constant/style.dart';
-import '../../../controller/functions/toast.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import '../../../main.dart';
-
-GetBuilder formSearchPlacesStart() {
- // DbSql sql = DbSql.instance;
- return GetBuilder(
- builder: (controller) => Column(
- children: [
- Padding(
- padding: const EdgeInsets.all(8),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: Get.width * .75,
- height: 40,
- decoration:
- const BoxDecoration(color: AppColor.secondaryColor),
- child: TextFormField(
- decoration: InputDecoration(
- border: const OutlineInputBorder(
- borderRadius: BorderRadius.only(),
- gapPadding: 4,
- borderSide: BorderSide(
- color: AppColor.redColor,
- width: 2,
- )),
- suffixIcon: const Icon(Icons.search),
- hintText: controller.hintTextStartPoint,
- hintStyle: AppStyle.title,
- hintMaxLines: 1,
- prefixIcon: IconButton(
- onPressed: () {
- controller.placeStartController.clear();
- controller.clearPlacesStart();
- },
- icon: Icon(
- Icons.clear,
- color: Colors.red[300],
- ),
- ),
- ),
- controller: controller.placeStartController,
- onChanged: (value) {
- if (controller.placeStartController.text.length > 5) {
- controller.getPlacesStart();
- controller.changeHeightStartPlaces();
- }
- },
- // onEditingComplete: () => controller.changeHeight(),
- ),
- ),
- IconButton(
- onPressed: () {
- controller.startLocationFromMap = true;
- controller.changeMainBottomMenuMap();
- controller.changePickerShown();
- },
- icon: const Icon(
- Icons.map_outlined,
- color: AppColor.yellowColor,
- ),
- ),
- ],
- ),
- ),
- // controller.placesDestination.isEmpty
- // ? InkWell(
- // onTap: () {
- // controller.startLocationFromMap = true;
- // controller.changeMainBottomMenuMap();
- // controller.changePickerShown();
- // },
- // child: Text(
- // 'Choose from Map Start Point'.tr,
- // style:
- // AppStyle.title.copyWith(color: AppColor.blueColor),
- // ),
- // )
- // : const SizedBox(),
- Container(
- height:
- controller.placesStart.isNotEmpty ? controller.height : 0,
- color: AppColor.secondaryColor,
- child: ListView.builder(
- itemCount: controller.placesStart.length,
- itemBuilder: (BuildContext context, int index) {
- var res = controller.placesStart[index];
- return InkWell(
- onTap: () async {
- controller.changeHeightPlaces();
- // if (controller.currentLocationToFormPlaces == true) {
- // controller.newStartPointLocation =
- // controller.myLocation;
- // } else {
- // controller.myLocation =
- // controller.newStartPointLocation;
- // }
- await sql.insertData({
- 'latitude': res['geometry']['location']['lat'],
- 'longitude': res['geometry']['location']['lng'],
- 'name': res['name'].toString(),
- 'rate': res['rating'].toString(),
- }, TableName.recentLocations);
-
- controller.convertHintTextStartNewPlaces(index);
- controller.currentLocationString = res['name'];
- controller.placesStart = [];
- controller.placeStartController.clear();
- },
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10),
- child: Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Column(
- children: [
- Image.network(
- res['icon'],
- width: 20,
- ),
- IconButton(
- onPressed: () async {
- await sql.insertData({
- 'latitude': res['geometry']
- ['location']['lat'],
- 'longitude': res['geometry']
- ['location']['lng'],
- 'name': res['name'].toString(),
- 'rate': res['rating'].toString(),
- }, TableName.placesFavorite);
- Toast.show(
- context,
- '${res['name']} ${'Saved Sucssefully'.tr}',
- AppColor.primaryColor);
- },
- icon: const Icon(Icons.favorite_border),
- ),
- ],
- ),
- Column(
- children: [
- Text(
- res['name'].toString(),
- style: AppStyle.title,
- ),
- Text(
- res['vicinity'].toString(),
- style: AppStyle.subtitle,
- ),
- ],
- ),
- Column(
- children: [
- Text(
- 'rate',
- style: AppStyle.subtitle,
- ),
- Text(
- res['rating'].toString(),
- style: AppStyle.subtitle,
- ),
- ],
- ),
- ],
- ),
- const Divider(
- thickness: 1,
- )
- ],
- ),
- ),
- );
- },
- ),
- )
- ],
- ));
-}
diff --git a/lib/views/home/map_widget.dart/form_serch_multiy_point.dart b/lib/views/home/map_widget.dart/form_serch_multiy_point.dart
deleted file mode 100644
index e8ea2b2..0000000
--- a/lib/views/home/map_widget.dart/form_serch_multiy_point.dart
+++ /dev/null
@@ -1,168 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/table_names.dart';
-
-import '../../../constant/colors.dart';
-import '../../../constant/style.dart';
-import '../../../controller/functions/toast.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import '../../../main.dart';
-
-GetBuilder formSearchPlaces(int index) {
- // DbSql sql = DbSql.instance;
- return GetBuilder(
- builder: (controller) => Column(
- children: [
- Padding(
- padding: const EdgeInsets.all(16),
- child: Container(
- decoration:
- const BoxDecoration(color: AppColor.secondaryColor),
- child: TextField(
- decoration: InputDecoration(
- border: const OutlineInputBorder(
- borderRadius: BorderRadius.only(),
- gapPadding: 4,
- borderSide: BorderSide(
- color: AppColor.redColor,
- width: 2,
- )),
- suffixIcon: const Icon(Icons.search),
- hintText: controller.hintTextwayPoint0.tr,
- hintStyle: AppStyle.title,
- hintMaxLines: 1,
- prefixIcon: IconButton(
- onPressed: () {
- controller.allTextEditingPlaces[index].clear();
- controller.clearPlaces(index);
- },
- icon: Icon(
- Icons.clear,
- color: Colors.red[300],
- ),
- ),
- ),
- controller: controller.allTextEditingPlaces[index],
- onChanged: (value) {
- if (controller.allTextEditingPlaces[index].text.length >
- 5) {
- controller.getPlacesListsWayPoint(index);
- controller.changeHeightPlacesAll(index);
- }
- },
- // onEditingComplete: () => controller.changeHeight(),
- ),
- ),
- ),
- controller.placeListResponseAll[index].isEmpty
- ? InkWell(
- onTap: () {
- controller.startLocationFromMapAll[index] = true;
- controller.wayPointIndex = index;
- print(controller.wayPointIndex);
- Get.back();
- // controller.changeMainBottomMenuMap();
- controller.changeWayPointStopsSheet();
- controller.changePickerShown();
- },
- child: Text(
- 'Choose from Map'.tr + ' $index'.tr,
- style:
- AppStyle.title.copyWith(color: AppColor.blueColor),
- ),
- )
- : const SizedBox(),
- Container(
- height: controller.placeListResponseAll[index].isNotEmpty
- ? controller.height
- : 0,
- color: AppColor.secondaryColor,
- child: ListView.builder(
- itemCount: controller.placeListResponseAll[index].length,
- itemBuilder: (BuildContext context, int i) {
- var res = controller.placeListResponseAll[index][i];
- return InkWell(
- onTap: () async {
- controller.changeHeightPlaces();
- if (controller.currentLocationToFormPlacesAll[index] ==
- true) {
- controller.newStartPointLocation =
- controller.passengerLocation;
- } else {
- controller.passengerLocation =
- controller.newStartPointLocation;
- }
-
- controller.convertHintTextPlaces(index, res);
- },
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10),
- child: Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Column(
- children: [
- Image.network(
- res['icon'],
- width: 20,
- ),
- IconButton(
- onPressed: () async {
- await sql.insertData({
- 'latitude': res['geometry']
- ['location']['lat'],
- 'longitude': res['geometry']
- ['location']['lng'],
- 'name': res['name'].toString(),
- 'rate': res['rating'].toString(),
- }, TableName.placesFavorite);
- Toast.show(
- context,
- '${res['name']} ${'Saved Sucssefully'.tr}',
- AppColor.primaryColor);
- },
- icon: const Icon(Icons.favorite_border),
- ),
- ],
- ),
- Column(
- children: [
- Text(
- res['name'].toString(),
- style: AppStyle.title,
- ),
- Text(
- res['vicinity'].toString(),
- style: AppStyle.subtitle,
- ),
- ],
- ),
- Column(
- children: [
- Text(
- 'rate',
- style: AppStyle.subtitle,
- ),
- Text(
- res['rating'].toString(),
- style: AppStyle.subtitle,
- ),
- ],
- ),
- ],
- ),
- const Divider(
- thickness: 1,
- )
- ],
- ),
- ),
- );
- },
- ),
- )
- ],
- ));
-}
diff --git a/lib/views/home/map_widget.dart/google_map_passenger_widget.dart b/lib/views/home/map_widget.dart/google_map_passenger_widget.dart
deleted file mode 100644
index db8808a..0000000
--- a/lib/views/home/map_widget.dart/google_map_passenger_widget.dart
+++ /dev/null
@@ -1,367 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:google_maps_flutter/google_maps_flutter.dart';
-import 'package:SEFER/controller/home/points_for_rider_controller.dart';
-
-import '../../../constant/colors.dart';
-import '../../../constant/style.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import '../../widgets/elevated_btn.dart';
-import '../../widgets/mycircular.dart';
-
-class GoogleMapPassengerWidget extends StatelessWidget {
- GoogleMapPassengerWidget({
- super.key,
- });
- WayPointController wayPointController = Get.put(WayPointController());
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (controller) => controller.isLoading
- ? const MyCircularProgressIndicator()
- : Positioned(
- bottom: Get.height * .2,
- top: 0,
- left: 0,
- right: 0,
- child: GoogleMap(
- onMapCreated: controller.onMapCreated,
- cameraTargetBounds: CameraTargetBounds(controller.boundsdata),
- minMaxZoomPreference: const MinMaxZoomPreference(6, 18),
- onLongPress: (argument) {
- Get.defaultDialog(
- title: 'Are you want to go to this site'.tr,
- content: Column(
- children: [
- Text('${argument.latitude},${argument.longitude}'),
- ],
- ),
- confirm: MyElevatedButton(
- title: 'Ok'.tr,
- onPressed: () async {
- controller.clearPolyline();
- if (controller.dataCarsLocationByPassenger != null) {
- await controller.getMap(
- '${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
- '${argument.latitude.toString()},${argument.longitude.toString()}');
-
- Get.back();
- controller.bottomSheet();
- controller.showBottomSheet1();
- } else {
- Get.back();
- Get.snackbar(
- 'We Are Sorry That we dont have cars in your Location!'
- .tr,
- '',
- colorText: AppColor.redColor,
- duration: const Duration(seconds: 11),
- instantInit: true,
- snackPosition: SnackPosition.TOP,
- titleText: Text(
- 'Error'.tr,
- style:
- const TextStyle(color: AppColor.redColor),
- ),
- messageText: Text(
- 'We Are Sorry That we dont have cars in your Location!'
- .tr,
- style: AppStyle.title,
- ),
- icon: const Icon(Icons.error),
- shouldIconPulse: true,
- maxWidth: double.infinity,
- margin: const EdgeInsets.all(16),
- padding: const EdgeInsets.all(16),
- borderRadius: 8,
- borderColor: AppColor.redColor,
- borderWidth: 2,
- backgroundColor: AppColor.secondaryColor,
- leftBarIndicatorColor: AppColor.redColor,
- boxShadows: [
- BoxShadow(
- color: Colors.black.withOpacity(0.25),
- blurRadius: 4,
- spreadRadius: 2,
- offset: const Offset(0, 4),
- ),
- ],
- backgroundGradient: const LinearGradient(
- colors: [
- AppColor.redColor,
- AppColor.accentColor
- ],
- begin: Alignment.topLeft,
- end: Alignment.bottomRight,
- ),
- // mainButton: TextButton(
- // onPressed: () {
- // controller.getCarsLocationByPassenger();
- // },
- // child: Text(
- // 'Try Again'.tr,
- // style: const TextStyle(
- // color: AppColor.secondaryColor),
- // ),
- // ),
- onTap: (GetSnackBar snackBar) {
- // Do something when the snackbar is tapped.
- },
- isDismissible: true,
- showProgressIndicator: false,
- dismissDirection: DismissDirection.up,
- progressIndicatorController: null,
- progressIndicatorBackgroundColor:
- Colors.transparent,
- progressIndicatorValueColor: null,
- snackStyle: SnackStyle.GROUNDED,
- forwardAnimationCurve: Curves.easeInToLinear,
- reverseAnimationCurve: Curves.easeInOut,
- animationDuration:
- const Duration(milliseconds: 4000),
- barBlur: 8,
- overlayBlur: 0,
- snackbarStatus: null,
- overlayColor:
- AppColor.primaryColor.withOpacity(0.5),
- userInputForm: null,
- );
- }
-
- //
- }),
- );
- },
-
- onTap: (argument) {
- controller.hidePlaces();
-
- // controller.changeBottomSheetShown();
- // controller.bottomSheet();
- },
- initialCameraPosition: CameraPosition(
- target: controller.passengerLocation,
- zoom: 15,
- ),
- markers: controller.markers.toSet(),
- // {
- // if (controller.statusRide != 'Apply' ||
- // !controller.rideTimerBegin)
- // for (var carLocation in controller.carLocationsModels)
-
- // // Marker(
- // // // anchor: const Offset(4, 4),
- // // position: LatLng(
- // // carLocation.latitude,
- // // carLocation.longitude,
- // // ),
- // // icon: controller.carIcon,
- // // markerId: MarkerId(carLocation.toString()),
- // // rotation: carLocation.heading,
- // // ),
- // // controller.carMarrkerAplied,
- // if (controller.statusRide == 'Apply')
- // // for (var carLocation
- // // in controller.driverCarsLocationToPassengerAfterApplied)
- // Marker(
- // // anchor: const Offset(4, 4),
- // position: LatLng(
- // double.parse(
- // controller
- // .datadriverCarsLocationToPassengerAfterApplied[
- // 'message'][0]['latitude'],
- // ),
- // double.parse(
- // controller
- // .datadriverCarsLocationToPassengerAfterApplied[
- // 'message'][0]['longitude'],
- // ),
- // ), //carLocation,
- // icon: controller.carIcon,
- // rotation: double.parse(controller
- // .datadriverCarsLocationToPassengerAfterApplied[
- // 'message'][0]['heading']),
- // markerId: MarkerId(controller
- // .datadriverCarsLocationToPassengerAfterApplied[
- // 'message'][0]['longitude']
- // .toString())),
- // for (int i = 1;
- // i < controller.coordinatesWithoutEmpty.length - 1;
- // i++)
- // Marker(
- // // anchor: const Offset(4, 4),
- // position: LatLng(
- // double.parse(controller.coordinatesWithoutEmpty[i]
- // .split(',')[0]),
- // double.parse(controller.coordinatesWithoutEmpty[i]
- // .split(',')[1])),
- // icon: controller.tripIcon,
- // markerId: MarkerId(
- // controller.coordinatesWithoutEmpty[i].toString())),
- // if (controller.isMarkersShown)
- // Marker(
- // markerId: MarkerId('MyLocation'.tr),
- // position: controller.newStartPointLocation,
- // draggable: true,
- // icon: controller.startIcon,
- // ),
- // if (controller.isMarkersShown)
- // Marker(
- // markerId: MarkerId('Destination'.tr),
- // position: controller.myDestination,
- // draggable: true,
- // icon: controller.endIcon,
- // ),
- // if (controller.haveSteps)
- // Marker(
- // markerId: MarkerId('StartSteps'.tr),
- // position: LatLng(
- // double.parse(
- // controller.placesCoordinate[0].split(',')[0]),
- // double.parse(
- // controller.placesCoordinate[0].split(',')[1])),
- // draggable: true,
- // icon: controller.startIcon,
- // ),
- // if (controller.haveSteps)
- // Marker(
- // markerId: MarkerId('EndSteps'.tr),
- // position: controller.latestPosition,
- // draggable: true,
- // icon: controller.endIcon,
- // ),
- // },
-
- polylines: {
- Polyline(
- zIndex: 2,
- consumeTapEvents: true,
- geodesic: true,
- endCap: Cap.buttCap,
- startCap: Cap.buttCap,
- visible: true,
- polylineId: const PolylineId('route'),
- points: controller.polylineCoordinates,
- color: AppColor.primaryColor,
- width: 5,
- ),
-
- Polyline(
- zIndex: 1,
- consumeTapEvents: true,
- geodesic: true,
- endCap: Cap.buttCap,
- startCap: Cap.buttCap,
- visible: true,
- polylineId: const PolylineId('route0'),
- points: controller.polylineCoordinatesPointsAll[0],
- color: AppColor.blueColor,
- width: 5,
- ),
- Polyline(
- zIndex: 2,
- consumeTapEvents: true,
- geodesic: true,
- endCap: Cap.buttCap,
- startCap: Cap.buttCap,
- visible: true,
- polylineId: const PolylineId('route1'),
- points: controller.polylineCoordinatesPointsAll[1],
- color: AppColor.yellowColor,
- width: 5,
- ),
- Polyline(
- zIndex: 2,
- consumeTapEvents: true,
- geodesic: true,
- endCap: Cap.buttCap,
- startCap: Cap.buttCap,
- visible: true,
- polylineId: const PolylineId('route2'),
- points: controller.polylineCoordinatesPointsAll[2],
- color: AppColor.greenColor,
- width: 5,
- ),
- Polyline(
- zIndex: 2,
- consumeTapEvents: true,
- geodesic: true,
- endCap: Cap.buttCap,
- startCap: Cap.buttCap,
- visible: true,
- polylineId: const PolylineId('route3'),
- points: controller.polylineCoordinatesPointsAll[2],
- color: AppColor.deepPurpleAccent,
- width: 5,
- ),
- // Polyline(
- // zIndex: 2,
- // consumeTapEvents: true,
- // geodesic: true,
- // endCap: Cap.buttCap,
- // startCap: Cap.buttCap,
- // visible: true,
- // polylineId: PolylineId('g'),
- // points: [
- // LatLng(controller.southwest.latitude,
- // controller.southwest.longitude),
- // LatLng(controller.northeast.latitude,
- // controller.northeast.longitude)
- // ],
- // color: AppColor.primaryColor,
- // width: 5,
- // ),
- },
- // circles: {
- // Circle(
- // circleId: const CircleId('kk'),
- // center: controller.mylocation,
- // radius: 60,
- // fillColor: AppColor.primaryColor,)
- // },
-
- circles: {
- Circle(
- circleId: const CircleId('circle_id'),
- center: controller.passengerLocation,
- radius: 100,
- fillColor: Colors.blue.withOpacity(0.3),
- strokeColor: Colors.blue,
- strokeWidth: 2,
- ),
- },
-
- mapType:
- controller.mapType ? MapType.satellite : MapType.normal,
- myLocationButtonEnabled: true,
- // liteModeEnabled: true, tiltGesturesEnabled: false,
-
- // indoorViewEnabled: true,
- trafficEnabled: controller.mapTrafficON,
- buildingsEnabled: true,
- mapToolbarEnabled: true,
- onCameraMove: (position) {
- int waypointsLength =
- Get.find().wayPoints.length;
- int index = controller.wayPointIndex;
- if (waypointsLength > 0) {
- controller.placesCoordinate[index] =
- '${position.target.latitude.toString()},${position.target.longitude}';
- }
- if (controller.startLocationFromMap == true) {
- controller.newStartPointLocation = position.target;
- } else if (controller.passengerStartLocationFromMap == true) {
- controller.newStartPointLocation = position.target;
- }
- controller.newMyLocation = position.target;
-
- // print('my' + controller.mylocation.toString());
- // print('new' + controller.newMylocation.toString());
- },
- myLocationEnabled: true,
- // liteModeEnabled: true,
- ),
- ),
- );
- }
-}
diff --git a/lib/views/home/map_widget.dart/hexegone_clipper.dart b/lib/views/home/map_widget.dart/hexegone_clipper.dart
deleted file mode 100644
index 8cd0555..0000000
--- a/lib/views/home/map_widget.dart/hexegone_clipper.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-import 'dart:math';
-
-import 'package:flutter/material.dart';
-
-class HexagonClipper extends CustomClipper {
- @override
- Path getClip(Size size) {
- final path = Path();
- final height = size.height;
- final width = size.width;
- final centerX = width / 2;
- final centerY = height / 2;
- final radius = width / 2;
-
- const angle = 2 * pi / 10; // Angle between each side of the hexagon
-
- // Start at the top right vertex of the hexagon
- final startX = centerX + radius * cos(0);
- final startY = centerY + radius * sin(0);
- path.moveTo(startX, startY);
-
- // Draw the remaining sides of the hexagon
- for (int i = 1; i < 10; i++) {
- final x = centerX + radius * cos(angle * i);
- final y = centerY + radius * sin(angle * i);
- path.lineTo(x, y);
- }
-
- path.close();
-
- return path;
- }
-
- @override
- bool shouldReclip(HexagonClipper oldClipper) => false;
-}
-
-class ArrowClipper extends CustomClipper {
- @override
- Path getClip(Size size) {
- final path = Path();
- path.moveTo(0, size.height / 2);
- path.lineTo(size.width / 2, 0);
- path.lineTo(size.width, size.height / 2);
- path.lineTo(size.width / 2, size.height);
- path.close();
- return path;
- }
-
- @override
- bool shouldReclip(ArrowClipper oldClipper) => false;
-}
diff --git a/lib/views/home/map_widget.dart/left_main_menu_icons.dart b/lib/views/home/map_widget.dart/left_main_menu_icons.dart
deleted file mode 100644
index 1b1661e..0000000
--- a/lib/views/home/map_widget.dart/left_main_menu_icons.dart
+++ /dev/null
@@ -1,172 +0,0 @@
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/controller/functions/crud.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:google_maps_flutter/google_maps_flutter.dart';
-import 'package:path/path.dart' as path;
-import '../../../constant/colors.dart';
-import '../../../constant/links.dart';
-import '../../../controller/functions/audio_record1.dart';
-import '../../../controller/functions/tts.dart';
-import '../../../controller/functions/upload_image.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-
-GetBuilder leftMainMenuIcons() {
- final textToSpeechController = Get.put(TextToSpeechController());
- return GetBuilder(
- builder: (controller) => Positioned(
- top: 85,
- left: 6,
- child: Builder(builder: (context) {
- return Column(
- children: [
- AnimatedContainer(
- duration: const Duration(microseconds: 200),
- width: controller.widthMapTypeAndTraffic,
- decoration: BoxDecoration(
- border: Border.all(),
- color: AppColor.secondaryColor,
- borderRadius: BorderRadius.circular(15)),
- child: IconButton(
- onPressed: () {
- controller.changeMapType();
- // Toast.show(context, 'This is a toast message!');
- },
- icon: const Icon(
- Icons.satellite_alt,
- size: 29,
- ),
- ),
- ),
- const SizedBox(
- height: 5,
- ),
- AnimatedContainer(
- duration: const Duration(microseconds: 200),
- width: controller.widthMapTypeAndTraffic,
- decoration: BoxDecoration(
- color: AppColor.secondaryColor,
- border: Border.all(),
- borderRadius: BorderRadius.circular(15)),
- child: IconButton(
- onPressed: () {
- controller.changeMapTraffic();
- // Toast.show(context, 'This is a toast message!');
- },
- icon: const Icon(
- Icons.streetview_sharp,
- size: 29,
- ),
- ),
- ),
- const SizedBox(
- height: 5,
- ),
- // if (Platform.isIOS)
- AnimatedContainer(
- duration: const Duration(microseconds: 200),
- width: controller.widthMapTypeAndTraffic,
- decoration: BoxDecoration(
- color: AppColor.secondaryColor,
- border: Border.all(),
- borderRadius: BorderRadius.circular(15)),
- child: IconButton(
- onPressed: () {
- controller.mapController?.animateCamera(
- CameraUpdate.newLatLng(LatLng(
- controller.passengerLocation.latitude,
- controller.passengerLocation.longitude)));
- },
- icon: const Icon(
- Icons.location_on,
- size: 29,
- ),
- ),
- ),
- const SizedBox(
- height: 5,
- ),
- // AnimatedContainer(
- // duration: const Duration(microseconds: 200),
- // width: controller.widthMapTypeAndTraffic,
- // decoration: BoxDecoration(
- // color: AppColor.secondaryColor,
- // border: Border.all(),
- // borderRadius: BorderRadius.circular(15)),
- // child: IconButton(
- // onPressed: () async {
- // await Get.find().stopRecording();
- // },
- // icon: const Icon(
- // Icons.voice_chat,
- // size: 29,
- // ),
- // ),
- // ),
- // AnimatedContainer(
- // duration: const Duration(microseconds: 200),
- // width: controller.widthMapTypeAndTraffic,
- // decoration: BoxDecoration(
- // color: AppColor.secondaryColor,
- // border: Border.all(),
- // borderRadius: BorderRadius.circular(15)),
- // child: IconButton(
- // onPressed: () async {
- // await CRUD().allMethodForAI(
- // 'name,fullName,address,idNumber,cardId,dob',
- // AppLink.uploadEgypt,
- // 'idFront');
- //
- // // await ImageController().choosImage(
- // // 'https://api.sefer.live/sefer/uploadEgypt.php',
- // // 'FrontId');
- // // AC credentials = AC();
- // // String apiKey = AK.payPalSecret;
- // // String convertedStringN = credentials.c(
- // // credentials.c(credentials.c(apiKey, cs), cC), cn);
- // // print('Converted v: $convertedStringN');
- //
- // // String retrievedStringS = credentials.r(
- // // credentials.r(credentials.r(convertedStringN, cn), cC),
- // // cs);
- // // print('Retrieved String: $retrievedStringS');
- // // //
- // // if (retrievedStringS == apiKey) {
- // // print('same');
- // // }
- //
- // // print(box.read(BoxName.passengerWalletTotal));
- // // print(box.read(BoxName.name));
- // // print(box.read(BoxName.phone));
- // // print(box.read(BoxName.email));
- // // await Get.find()
- // // .payWithPayMob(context, '1100', 'EGP');
- // // Initiates a payment with a card using the FlutterPaymob instance
- //
- // // NotificationController()
- // // .showNotification('Order', 'hi this is', 'tone1');
- // // Get.to(() => DriverCallPage());
- // // print(controller.carLocationsModels);
- // // controller.getKazanPercent();
- // // PassengerCallPage(
- // // channelName: '',
- // // token: '',
- // // remoteID: '',
- // // )
- // // Get.to(() => const CallPage());
- // // print(box.read(BoxName.lang));
- // await Get.find().startRecording();
- // },
- // icon: Icon(
- // Get.put(AudioRecorderController()).isRecording
- // ? Icons.stop
- // : Icons.start,
- // size: 29,
- // ),
- // ),
- // ),
- ],
- );
- })),
- );
-}
diff --git a/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart b/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart
deleted file mode 100644
index 121248c..0000000
--- a/lib/views/home/map_widget.dart/main_bottom_Menu_map.dart
+++ /dev/null
@@ -1,479 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/box_name.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
-import 'package:SEFER/main.dart';
-import 'package:SEFER/views/home/map_widget.dart/form_search_places_destenation.dart';
-import 'package:SEFER/views/widgets/elevated_btn.dart';
-import 'package:google_maps_flutter/google_maps_flutter.dart';
-
-import '../../../constant/colors.dart';
-import '../../../constant/table_names.dart';
-import '../../../controller/functions/toast.dart';
-import '../../../controller/functions/tts.dart';
-
-class MainBottomMenuMap extends StatelessWidget {
- const MainBottomMenuMap({super.key});
-
- @override
- Widget build(BuildContext context) {
- Get.put(MapPassengerController());
- return GetBuilder(
- builder: (controller) => Positioned(
- bottom: 3,
- left: 5,
- right: 5,
- child: GestureDetector(
- onVerticalDragUpdate: (DragUpdateDetails details) {
- // Update the size of the GestureDetector based on the user's finger position.
-
- // _height = details.globalPosition.dy;
- controller.changeMainBottomMenuMap();
- },
- child: AnimatedContainer(
- duration: const Duration(milliseconds: 500),
- height: controller.mainBottomMenuMapHeight,
- decoration: AppStyle.boxDecoration,
- child: SingleChildScrollView(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- controller.isMainBottomMenuMap
- ? Padding(
- padding: const EdgeInsets.all(15),
- child: InkWell(
- onTap: () =>
- controller.changeMainBottomMenuMap(),
- child: Container(
- width: Get.width * .8,
- height: Get.height * .1,
- decoration: AppStyle.boxDecoration1,
- child: DefaultTextStyle(
- style: AppStyle.title,
- child: Center(
- child: controller.isPickerShown
- ? clickPointPosition(
- controller, context)
- : whereWidgetsmall(controller),
- ),
- )),
- ),
- )
- : IconButton(
- onPressed: () {
- controller.changeMainBottomMenuMap();
- },
- icon: controller.isMainBottomMenuMap
- ? const Icon(
- Icons.ads_click,
- size: 35,
- )
- : const Icon(
- Icons.arrow_circle_down_rounded,
- size: 35,
- ),
- ),
- controller.isMainBottomMenuMap
- ? recentPlacesWidget(controller)
- : const SizedBox(),
- // controller.isMainBottomMenuMap
- // ? const SizedBox()
- // : InkWell(
- // onTap: () async {
- // controller.getCurrentLocationFormString();
- // },
- // child: Text(
- // 'From :'.tr +
- // ' ${controller.currentLocationString}'.tr,
- // style: AppStyle.subtitle,
- // ),
- // ),
- controller.isMainBottomMenuMap
- ? const SizedBox()
- : Column(
- children: [
- // controller.currentLocationToFormPlaces
- // ? const SizedBox()
- // :
- // formSearchPlacesStart(),
- formSearchPlacesDestenation(),
- const SizedBox(
- height: 10,
- ),
- // MyElevatedButton(
- // title: 'Get Details of Trip'.tr,
- // onPressed: () async {
- // controller.changeMainBottomMenuMap();
- //
- // await controller.getMap(
- // '${controller.newStartPointLocation.latitude},${controller.newStartPointLocation.longitude}',
- // '${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}',
- // );
- // controller.currentLocationToFormPlaces =
- // false;
- // controller.placesDestination = [];
- // // controller.isCancelRidePageShown = true;
- // controller.clearPlacesStart();
- // controller.clearPlacesDestination();
- //
- // controller.showBottomSheet1();
- // Get.back();
- // controller.showBottomSheet1();
- // }),
- TextButton(
- onPressed: () {
- controller.changeMainBottomMenuMap();
- controller.changeWayPointSheet();
- },
- child: Text(
- "If you want add stop click here".tr,
- style: AppStyle.title,
- ),
- ),
- ],
- )
- ],
- ),
- ),
- ),
- ),
- ));
- }
-
- SizedBox recentPlacesWidget(MapPassengerController controller) {
- final textToSpeechController = Get.put(TextToSpeechController());
- return SizedBox(
- height: 50,
- child: ListView.builder(
- itemCount: controller.recentPlaces.length,
- scrollDirection: Axis.horizontal,
- itemBuilder: (BuildContext context, int index) {
- return TextButton(
- onPressed: () {
- Get.defaultDialog(
- title: 'Are you want to go this site'.tr,
- titleStyle: AppStyle.title,
- middleText: '',
- content: IconButton(
- onPressed: () {
- textToSpeechController
- .speakText('Are you want to go this site'.tr);
- },
- icon: const Icon(
- Icons.headphones,
- size: 45,
- ),
- ),
- confirm: MyElevatedButton(
- title: 'Yes'.tr,
- onPressed: () async {
- await controller.getLocation();
- await controller.getMap(
- '${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
- '${controller.recentPlaces[index]['latitude']},${controller.recentPlaces[index]['longitude']}',
- );
- // controller.changePickerShown();
- controller.showBottomSheet1();
-
- // controller.showBottomSheet1();
- Get.back();
- },
- ));
- },
- child: Container(
- decoration: AppStyle.boxDecoration1,
- child: Padding(
- padding: const EdgeInsets.all(2),
- child: Text(
- controller.recentPlaces[index]['name'],
- style: AppStyle.title,
- ),
- ),
- ),
- );
- },
- ),
- );
- }
-
- TextButton clickPointPosition(
- MapPassengerController controller, BuildContext context) {
- return TextButton(
- onPressed: () async {
- controller.clearPolyline();
- controller.data = [];
- if (controller.passengerStartLocationFromMap == true) {
- controller.newMyLocation = controller.newStartPointLocation;
- controller.changeMainBottomMenuMap();
-
- await controller.getMap(
- '${controller.newStartPointLocation.latitude},${controller.newStartPointLocation.longitude}',
- '${controller.myDestination.latitude},${controller.myDestination.longitude}',
- );
- controller.currentLocationToFormPlaces = false;
- controller.placesDestination = [];
- // controller.isCancelRidePageShown = true;
- controller.clearPlacesStart();
- controller.clearPlacesDestination();
- controller.passengerStartLocationFromMap = false;
- controller.isPickerShown = false;
- // controller.showBottomSheet1();
- // Get.back();
- controller.showBottomSheet1();
- // controller.hintTextStartPoint =
- // '${controller.newStartPointLocation.latitude.toStringAsFixed(4)} , ${controller.newStartPointLocation.longitude.toStringAsFixed(4)}';
- } else if (controller.startLocationFromMap == true) {
- controller.newMyLocation = controller.newStartPointLocation;
- controller.hintTextStartPoint =
- '${controller.newStartPointLocation.latitude.toStringAsFixed(4)} , ${controller.newStartPointLocation.longitude.toStringAsFixed(4)}';
- controller.startLocationFromMap = false;
- controller.isPickerShown = false;
- } else if (controller.workLocationFromMap == true) {
- controller.hintTextDestinationPoint = 'To Work'.tr;
- box.write(BoxName.addWork,
- '${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}');
- controller.newMyLocation = controller.newMyLocation;
- controller.isPickerShown = false;
- controller.workLocationFromMap = false;
- Get.snackbar('Work Saved'.tr, '',
- backgroundColor: AppColor.greenColor);
- } else if (controller.homeLocationFromMap == true) {
- controller.hintTextDestinationPoint = 'To Home'.tr;
- box.write(BoxName.addHome,
- '${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}');
- controller.newMyLocation = controller.newMyLocation;
- controller.isPickerShown = false;
- controller.homeLocationFromMap = false;
- controller.update();
- Get.snackbar('Home Saved'.tr, '',
- backgroundColor: AppColor.greenColor);
- } else {
- controller.hintTextDestinationPoint =
- '${controller.newMyLocation.latitude.toStringAsFixed(4)} , ${controller.newMyLocation.longitude.toStringAsFixed(4)}';
- controller.myDestination = controller.newMyLocation;
- controller.isPickerShown = false;
-
- controller.changeMainBottomMenuMap();
- controller.passengerStartLocationFromMap = true;
- controller.isPickerShown = true;
- await controller.mapController?.animateCamera(CameraUpdate.newLatLng(
- LatLng(controller.passengerLocation.latitude,
- controller.passengerLocation.longitude)));
- Get.defaultDialog(
- title: 'Destination selected'.tr,
- titleStyle: AppStyle.title,
- content: Text(
- 'Now select start pick'.tr,
- style: AppStyle.title,
- ),
- confirm: MyElevatedButton(
- title: 'OK'.tr,
- onPressed: () {
- Get.back();
- }));
- }
-
- controller.placesDestination = [];
- controller.placeDestinationController.clear();
-
- controller.showBottomSheet1();
- // Get.back();
- // controller.showBottomSheet1();
-
- controller.changeMainBottomMenuMap();
- },
- child: Row(
- children: [
- IconButton(
- onPressed: () {
- controller.changeMainBottomMenuMap();
- },
- icon: controller.isMainBottomMenuMap
- ? const Icon(
- Icons.arrow_circle_up_rounded,
- size: 35,
- )
- : const Icon(
- Icons.arrow_circle_down_rounded,
- size: 35,
- ),
- ),
- Text(
- controller.passengerStartLocationFromMap
- ? 'Pick or Tap to confirm'.tr
- // ? 'Pick your ride location on the map - Tap to confirm'.tr
- : "Click here point".tr,
- style: AppStyle.title,
- ),
- ],
- ),
- );
- }
-
- Row whereWidgetsmall(MapPassengerController controller) {
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- IconButton(
- onPressed: () {
- controller.changeMainBottomMenuMap();
- },
- icon: controller.isMainBottomMenuMap
- ? const Icon(
- Icons.ads_click,
- size: 35,
- )
- : const Icon(
- Icons.arrow_circle_down_rounded,
- size: 35,
- ),
- ),
- Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- SizedBox(
- height: 30,
- child: Text('${'Where to'.tr} ${box.read(BoxName.name)}')),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- controller.noCarString == false
- ? Text('Nearest Car for you about '.tr)
- : Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(12),
- color: AppColor.redColor,
- ),
- child: null
- // Padding(
- // padding: const EdgeInsets.all(6),
- // child: Text(
- // 'No Car in your site. Sorry!'.tr,
- // style: AppStyle.title
- // .copyWith(color: AppColor.secondaryColor),
- // ),
- // ),
- ),
- controller.noCarString == false
- ? Container(
- decoration: BoxDecoration(
- border:
- Border.all(color: AppColor.redColor, width: 3)),
- child: Padding(
- padding: const EdgeInsets.all(4),
- child: Text((controller.nearestCar != null
- ? controller.nearestDistance.toStringAsFixed(0)
- : 'N/A')),
- ),
- )
- : const SizedBox(),
- ],
- )
- ],
- ),
- ],
- );
- }
-}
-
-class FavioratePlacesDialogu extends StatelessWidget {
- const FavioratePlacesDialogu({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- Get.put(MapPassengerController());
- return GetBuilder(
- builder: (controller) => DefaultTextStyle(
- style: AppStyle.title,
- child: Center(
- child: InkWell(
- onTap: () async {
- List favoritePlaces =
- await sql.getAllData(TableName.placesFavorite);
- // print(favoritePlaces);
- Get.defaultDialog(
- title: 'Favorite Places'.tr,
- content: SizedBox(
- width: Get.width * .8,
- height: 300,
- child: favoritePlaces.isEmpty
- ? Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- const Icon(
- Icons.hourglass_empty_rounded,
- size: 99,
- color: AppColor.primaryColor,
- ),
- Text(
- 'You Dont Have Any places yet !'.tr,
- style: AppStyle.title,
- ),
- ],
- ),
- )
- : ListView.builder(
- itemCount: favoritePlaces.length,
- itemBuilder: (BuildContext context, int index) {
- return Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- TextButton(
- onPressed: () async {
- Get.back();
- await controller.getLocation();
- await controller.getMap(
- '${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
- '${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
- );
- // controller.changePickerShown();
- controller.showBottomSheet1();
-
- controller.showBottomSheet1();
- },
- child: Text(
- favoritePlaces[index]['name'],
- style: AppStyle.title,
- ),
- ),
- IconButton(
- onPressed: () async {
- await sql.deleteData(
- TableName.placesFavorite,
- favoritePlaces[index]['id']);
- Get.back();
- // ignore: use_build_context_synchronously
- Toast.show(
- context,
- '${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
- AppColor.redColor);
- // Get.snackbar('Deleted'.tr,
- // '${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
- // backgroundColor:
- // AppColor.accentColor);
- },
- icon: const Icon(Icons.favorite_outlined),
- ),
- ],
- );
- },
- ),
- ),
- cancel: MyElevatedButton(
- title: 'Back'.tr, onPressed: () => Get.back()),
- );
- },
- child: Text(
- '\u{1F3D8} ' 'Favorite Places'.tr,
- style: AppStyle.title,
- ),
- )),
- ));
- }
-}
diff --git a/lib/views/home/map_widget.dart/map_menu_widget.dart b/lib/views/home/map_widget.dart/map_menu_widget.dart
deleted file mode 100644
index 83d1b4e..0000000
--- a/lib/views/home/map_widget.dart/map_menu_widget.dart
+++ /dev/null
@@ -1,245 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_font_icons/flutter_font_icons.dart';
-import 'package:get/get.dart';
-import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/views/auth/captin/register_captin.dart';
-import 'package:SEFER/views/home/my_wallet/passenger_wallet.dart';
-import 'package:SEFER/views/home/profile/feed_back_page.dart';
-import 'package:SEFER/views/home/profile/order_history.dart';
-import 'package:SEFER/views/home/profile/promos_passenger_page.dart';
-import 'package:SEFER/views/home/profile/taarif_page.dart';
-
-import '../../../constant/colors.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import '../../notification/notification_page.dart';
-import '../../widgets/icon_widget_menu.dart';
-import '../home_page.dart';
-import '../profile/passenger_profile_page.dart';
-
-class MapMenuWidget extends StatelessWidget {
- const MapMenuWidget({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (controller) => Stack(children: [
- Positioned(
- right: 60,
- left: 60,
- child: Padding(
- padding: const EdgeInsets.only(right: 20),
- child: Opacity(
- alwaysIncludeSemantics: false,
- opacity: 1, // Adjust the opacity value as needed
- child: AnimatedContainer(
- width: Get.width * .6,
- decoration: AppStyle.boxDecoration,
- transform: Matrix4.translationValues(
- controller.heightMenu * .1, 1, 1),
- curve: Curves.easeOutCubic,
- clipBehavior: Clip.hardEdge,
- duration: const Duration(milliseconds: 300),
- height: controller.heightMenu,
- child: controller.heightMenuBool
- ? Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- IconWidgetMenu(
- onpressed: () {
- Get.to(
- () => const NotificationPage(),
- transition: Transition.circularReveal,
- );
- },
- title: 'Notifications'.tr,
- icon: Icons.notifications),
- IconWidgetMenu(
- onpressed: () {
- Get.to(
- () => PassengerProfilePage(),
- transition: Transition.zoom,
- );
- },
- icon: Icons.person,
- title: 'Profile'.tr,
- ),
- IconWidgetMenu(
- title: 'Home'.tr,
- onpressed: () {
- Get.to(
- () => const HomePage(),
- transition: Transition.downToUp,
- curve: Curves.easeInOutExpo,
- );
- },
- icon: Icons.home),
- ],
- )
- : const SizedBox(), // Choose the desired overlay color
- )),
- ),
- ),
- Positioned(
- right: 5,
- top: 110,
- child: AnimatedContainer(
- duration: const Duration(milliseconds: 300),
- decoration: const BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(12)),
- color: AppColor.secondaryColor,
- boxShadow: [
- BoxShadow(
- color: AppColor.accentColor,
- offset: Offset(-3, -3),
- blurRadius: 0,
- spreadRadius: 0,
- blurStyle: BlurStyle.outer),
- BoxShadow(
- color: AppColor.accentColor,
- offset: Offset(3, 3),
- blurRadius: 0,
- spreadRadius: 0,
- blurStyle: BlurStyle.outer)
- ]),
- width: controller.widthMenu,
- height: Get.height * .3,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- IconMainPageMap(
- onTap: () {
- Get.to(() => const PassengerWallet());
- },
- title: 'My Wallet'.tr,
- icon: Icons.wallet,
- ),
- IconMainPageMap(
- onTap: () async {
- Get.to(() => const OrderHistory());
- },
- title: 'Order History'.tr,
- icon: Icons.history,
- ),
- IconMainPageMap(
- onTap: () {
- Get.to(() => const TaarifPage());
- },
- title: 'Tariff'.tr,
- icon: Icons.money,
- ),
- ],
- ),
- )),
- Positioned(
- left: 5,
- top: 110,
- child: AnimatedContainer(
- duration: const Duration(milliseconds: 300),
- decoration: const BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(12)),
- color: AppColor.secondaryColor,
- boxShadow: [
- BoxShadow(
- color: AppColor.accentColor,
- offset: Offset(-3, -3),
- blurRadius: 0,
- spreadRadius: 0,
- blurStyle: BlurStyle.outer),
- BoxShadow(
- color: AppColor.accentColor,
- offset: Offset(3, 3),
- blurRadius: 0,
- spreadRadius: 0,
- blurStyle: BlurStyle.outer)
- ]),
- width: controller.widthMenu,
- height: Get.height * .3,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- IconMainPageMap(
- onTap: () {
- Get.to(const RegisterCaptin());
- },
- title: 'Driver'.tr,
- icon: WeatherIcons.wi_moon_14,
- ),
- IconMainPageMap(
- onTap: () {
- Get.to(() => FeedBackPage());
- },
- title: 'Feed Back'.tr,
- icon: Icons.feedback,
- ),
- IconMainPageMap(
- onTap: () {
- Get.to(() => const PromosPassengerPage());
- },
- title: 'Promos'.tr,
- icon: Icons.monetization_on,
- ),
- ],
- ),
- ))
- ]),
- );
- }
-}
-
-class IconMainPageMap extends StatelessWidget {
- const IconMainPageMap({
- super.key,
- required this.title,
- required this.onTap,
- required this.icon,
- });
-
- final String title;
- final IconData icon;
- final Callback onTap;
-
- @override
- Widget build(BuildContext context) {
- return FutureBuilder(
- future: Future.delayed(const Duration(milliseconds: 400)),
- builder: (context, snapshot) {
- return GestureDetector(
- onTap: onTap,
- child: Padding(
- padding: const EdgeInsets.all(4),
- child: Container(
- width: double.maxFinite,
- decoration: const BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(16)),
- color: AppColor.secondaryColor,
- boxShadow: [
- BoxShadow(
- color: AppColor.accentColor,
- offset: Offset(3, 3),
- blurRadius: 0,
- spreadRadius: 0,
- blurStyle: BlurStyle.outer,
- ),
- ],
- ),
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- children: [
- Icon(icon),
- Text(
- title.tr,
- style: AppStyle.subtitle,
- ),
- ],
- ),
- ),
- ),
- ),
- );
- });
- }
-}
diff --git a/lib/views/home/map_widget.dart/menu_map_page.dart b/lib/views/home/map_widget.dart/menu_map_page.dart
deleted file mode 100644
index 32d8dea..0000000
--- a/lib/views/home/map_widget.dart/menu_map_page.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-
-import '../../../constant/box_name.dart';
-import '../../../constant/colors.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import '../../../main.dart';
-
-class MenuIconMapPageWidget extends StatelessWidget {
- const MenuIconMapPageWidget({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (controller) => Positioned(
- top: 30,
- left: box.read(BoxName.lang) != 'ar' ? 5 : null,
- right: box.read(BoxName.lang) == 'ar' ? 5 : null,
- child: Container(
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: AppColor.secondaryColor,
- border: Border.all(color: AppColor.accentColor)),
- child: AnimatedCrossFade(
- sizeCurve: Curves.bounceOut,
- duration: const Duration(
- milliseconds: 300), // Adjust the duration as needed
- crossFadeState: controller.heightMenuBool
- ? CrossFadeState.showFirst
- : CrossFadeState.showSecond,
- firstChild: IconButton(
- onPressed: () {
- controller.getDrawerMenu();
- },
- icon: const Icon(
- Icons.close,
- color: AppColor.primaryColor,
- ),
- ),
- secondChild: IconButton(
- onPressed: () {
- controller.getDrawerMenu();
- },
- icon: const Icon(
- Icons.menu,
- color: AppColor.accentColor,
- ),
- ),
- ),
- ),
- ));
- }
-}
diff --git a/lib/views/home/map_widget.dart/new_main_bottom_sheet.dart b/lib/views/home/map_widget.dart/new_main_bottom_sheet.dart
deleted file mode 100644
index e8270df..0000000
--- a/lib/views/home/map_widget.dart/new_main_bottom_sheet.dart
+++ /dev/null
@@ -1,86 +0,0 @@
-import 'package:SEFER/constant/box_name.dart';
-import 'package:SEFER/constant/colors.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/main.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-
-class NewMainBottomSheet extends StatelessWidget {
- const NewMainBottomSheet({super.key});
-
- @override
- Widget build(BuildContext context) {
- return Positioned(
- bottom: 0,
- left: 5,
- right: 5,
- child: Container(
- decoration: AppStyle.boxDecoration,
- width: Get.width,
- height: Get.height * .15,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Container(
- decoration: BoxDecoration(
- border: Border.all(),
- borderRadius: BorderRadius.circular(15)),
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- children: [
- Text('Home'.tr),
- const Icon(Icons.home),
- ],
- ),
- ),
- ),
- Container(
- decoration: BoxDecoration(
- border: Border.all(),
- borderRadius: BorderRadius.circular(15)),
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- children: [
- Text('Work'.tr),
- const Icon(Icons.work_outline),
- ],
- ),
- ),
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Container(
- decoration: BoxDecoration(
- border: Border.all(),
- borderRadius: BorderRadius.circular(15),
- color: AppColor.blueColor.withOpacity(.5),
- ),
- child: Padding(
- padding: const EdgeInsets.all(12),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- const Icon(Icons.search),
- Text(
- "${"Where you want go ".tr}${box.read(BoxName.name)} ?",
- ),
- ],
- ),
- ),
- )
- ],
- )
- ],
- ),
- ),
- );
- }
-}
diff --git a/lib/views/home/map_widget.dart/passengerRideLoctionWidget.dart b/lib/views/home/map_widget.dart/passengerRideLoctionWidget.dart
deleted file mode 100644
index a463e19..0000000
--- a/lib/views/home/map_widget.dart/passengerRideLoctionWidget.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-
-class PassengerRideLocationWidget extends StatelessWidget {
- const PassengerRideLocationWidget({super.key});
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (mapPassengerController) {
- return mapPassengerController.isPassengerRideLocationWidget
- ? Positioned(
- bottom: 1,
- right: 1,
- left: 1,
- child: Container(
- height: Get.height * .2,
- decoration: AppStyle.boxDecoration1,
- child: Center(
- child: Text('Choose ride location'.tr),
- ),
- ),
- )
- : const SizedBox();
- });
- }
-}
diff --git a/lib/views/home/map_widget.dart/payment_method.page.dart b/lib/views/home/map_widget.dart/payment_method.page.dart
deleted file mode 100644
index 284c3ee..0000000
--- a/lib/views/home/map_widget.dart/payment_method.page.dart
+++ /dev/null
@@ -1,418 +0,0 @@
-import 'package:flutter/material.dart';
-
-import 'package:get/get.dart';
-import 'package:SEFER/constant/box_name.dart';
-import 'package:SEFER/controller/functions/secure_storage.dart';
-import 'package:SEFER/controller/home/payment/credit_card_controller.dart';
-import 'package:SEFER/views/widgets/elevated_btn.dart';
-
-import '../../../constant/colors.dart';
-import '../../../constant/style.dart';
-import '../../../controller/functions/digit_obsecur_formate.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-
-class PaymentMethodPage extends StatelessWidget {
- const PaymentMethodPage({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (controller) => Positioned(
- right: 5,
- bottom: 5,
- left: 5,
- child: AnimatedContainer(
- duration: const Duration(milliseconds: 400),
- height: controller.isPaymentMethodPageShown
- ? controller.paymentPageShown
- : 0,
- decoration: BoxDecoration(
- color: AppColor.secondaryColor,
- borderRadius: BorderRadius.circular(15)),
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 20),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- 'My Card'.tr,
- style: AppStyle.title.copyWith(fontSize: 22),
- ),
- IconButton(
- onPressed: () =>
- controller.changePaymentMethodPageShown(),
- icon: const Icon(Icons.close),
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- 'Add Card'.tr,
- style: AppStyle.title,
- ),
- // GetBuilder(
- // builder: (controller) => IconButton(
- // onPressed: () {
- // // controller.scanCard();
- // // Get.defaultDialog(content: OptionConfigureWidget(
- // // initialOptions: scanOptions,
- // // onScanOptionChanged: (newOptions) =>
- // // scanOptions = newOptions,
- // // ),
- // // );
- // },
- // icon: const Icon(Icons.contact_emergency_sharp),
- // ),
- // )
- ],
- ),
- const SizedBox(
- height: 10,
- ),
- const MyCreditCardWidget(),
- const Spacer(),
- GetBuilder(
- builder: (controller) => Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- MyElevatedButton(
- title: 'Add Credit Card'.tr,
- onPressed: () async {
- if (controller.formKey.currentState!
- .validate()) {
- SecureStorage().saveData(
- BoxName.cardNumber,
- controller
- .cardNumberController.text);
- SecureStorage().saveData(
- BoxName.cardHolderName,
- controller
- .cardHolderNameController.text);
- SecureStorage().saveData(
- BoxName.cvvCode,
- controller.cvvCodeController.text);
- SecureStorage().saveData(
- BoxName.expiryDate,
- controller
- .expiryDateController.text);
- }
- },
- ),
- ],
- ))
- ],
- ),
- ),
- ),
- ));
- }
-}
-
-class MyCreditCardWidget extends StatelessWidget {
- const MyCreditCardWidget({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- Get.put(CreditCardController());
- return GetBuilder(
- builder: (controller) => Container(
- height: Get.height * .4,
- width: Get.width * .9,
- decoration: const BoxDecoration(
- color: AppColor.secondaryColor,
- borderRadius: BorderRadius.all(Radius.circular(15)),
- gradient: LinearGradient(colors: [
- AppColor.secondaryColor,
- // AppColor.blueColor,
- // AppColor.greenColor,
- AppColor.accentColor,
- // AppColor.primaryColor,
- // AppColor.redColor,
- // AppColor.yellowColor
- ]),
- boxShadow: [
- BoxShadow(
- spreadRadius: 3,
- offset: Offset(3, 3),
- blurRadius: 3,
- color: AppColor.redColor),
- BoxShadow(
- offset: Offset(-3, -3),
- blurRadius: 3,
- spreadRadius: 3,
- color: AppColor.redColor),
- ],
- ),
- child: Form(
- key: controller.formKey,
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- SizedBox(
- child: Row(
- children: [
- getCardIcon(controller.cardNumberController
- .text), // Dynamic credit card icon
- SizedBox(
- width: Get.width * .03,
- ),
- SizedBox(
- width: Get.width * .25,
- child: Text(
- 'Card Number'.tr,
- style: AppStyle.title,
- ),
- ),
- SizedBox(
- width: Get.width * .03,
- ),
- SizedBox(
- width: Get.width * .4,
- height: 70,
- child: TextFormField(
- maxLength: 16,
- keyboardType: TextInputType.number,
- controller: controller.cardNumberController,
- style: const TextStyle(
- color: AppColor.blueColor,
- fontFamily: 'digital-counter-7',
- fontWeight: FontWeight.bold),
- decoration: const InputDecoration(
- helperStyle: TextStyle(
- fontFamily: 'digital-counter-7'),
- // labelText: 'Card Number',
- ),
- inputFormatters: [DigitObscuringFormatter()],
- validator: (value) {
- if (value!.isEmpty || value.length != 16) {
- return 'Please enter a valid 16-digit card number'
- .tr;
- }
- return null;
- },
- ),
- ),
- ],
- ),
- ),
- Row(
- children: [
- const Icon(Icons.person),
- SizedBox(
- width: Get.width * .03,
- ),
- SizedBox(
- width: Get.width * .25,
- child: Text(
- 'Holder Name',
- style: AppStyle.title,
- ),
- ),
- SizedBox(
- width: Get.width * .03,
- ),
- SizedBox(
- width: Get.width * .3,
- child: SizedBox(
- // height: 50,
- child: TextFormField(
- style: AppStyle.title,
- keyboardType: TextInputType.text,
- // maxLength: 16,
- controller: controller.cardHolderNameController,
- decoration: const InputDecoration(
- // labelText: 'Cardholder Name',
- ),
- validator: (value) {
- if (value!.isEmpty) {
- return 'Please enter the cardholder name'
- .tr;
- }
- return null;
- },
- ),
- ),
- )
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- SizedBox(
- width: Get.width * .4,
- child: Row(
- children: [
- const Icon(Icons.date_range_outlined),
- SizedBox(
- width: Get.width * .03,
- ),
- Column(
- children: [
- SizedBox(
- width: Get.width * .2,
- child: Text(
- 'Expiry Date',
- style: AppStyle.subtitle,
- ),
- ),
- SizedBox(
- width: Get.width * .1,
- child: SizedBox(
- height: 60,
- child: TextFormField(
- maxLength: 4,
- keyboardType: TextInputType.datetime,
- controller:
- controller.expiryDateController,
- style: AppStyle.title,
- decoration: const InputDecoration(),
- validator: (value) {
- if (value!.isEmpty) {
- return 'Please enter the expiry date'
- .tr;
- }
- return null;
- },
- ),
- ),
- )
- ],
- ),
- ],
- ),
- ),
- SizedBox(
- width: Get.width * .4,
- child: Row(
- children: [
- const Icon(Icons.security),
- SizedBox(
- width: Get.width * .021,
- ),
- Column(
- children: [
- SizedBox(
- width: Get.width * .2,
- child: Text(
- 'CVV Code',
- style: AppStyle.subtitle,
- ),
- ),
- SizedBox(
- width: Get.width * .2,
- child: SizedBox(
- height: 60,
- child: TextFormField(
- obscureText: true,
- keyboardType: TextInputType.number,
- style: const TextStyle(
- color: AppColor.primaryColor,
- fontFamily: 'digital-counter-7'),
- maxLength: 3,
- controller:
- controller.cvvCodeController,
- decoration: const InputDecoration(
- // labelText: 'CVV Code',
- ),
- validator: (value) {
- if (value!.isEmpty &&
- value.length != 3) {
- return 'Please enter the CVV code'
- .tr;
- }
- return null;
- },
- ),
- ),
- ),
- ],
- )
- ],
- ),
- ),
- ],
- ),
- // const SizedBox(
- // height: 20,
- // ),
- MyElevatedButton(
- title: 'Save'.tr,
- onPressed: () {
- if (controller.formKey.currentState!.validate()) {
- // final creditCard = CreditCardModel(
- // cardNumber: controller.cardNumberController.text,
- // cardHolderName:
- // controller.cardHolderNameController.text,
- // expiryDate: controller.expiryDateController.text,
- // cvvCode: controller.cvvCodeController.text,
- // );
- // Process the credit card details
- // You can use GetX to handle the logic here
-
- if (controller.formKey.currentState!.validate()) {
- SecureStorage().saveData(BoxName.cardNumber,
- controller.cardNumberController.text);
- SecureStorage().saveData(BoxName.cardHolderName,
- controller.cardHolderNameController.text);
- SecureStorage().saveData(BoxName.cvvCode,
- controller.cvvCodeController.text);
- SecureStorage().saveData(BoxName.expiryDate,
- controller.expiryDateController.text);
- }
- }
- },
- ),
- ],
- ),
- ))));
- }
-
- Widget getCardIcon(String cardNumber) {
- String cardType = detectCardType(
- cardNumber); // Function to detect card type based on the first digit
-
- IconData iconData;
- Color iconColor;
-
- switch (cardType) {
- case 'Visa':
- iconData = Icons.credit_card_rounded;
- iconColor = Colors.blue; // Change color for Visa cards
- break;
- case 'Mastercard':
- iconData = Icons.credit_card_rounded;
- iconColor = Colors.red; // Change color for Mastercard cards
- break;
- default:
- iconData = Icons.credit_card_rounded;
- iconColor = Colors.black; // Default color for other card types
- break;
- }
-
- return Icon(
- iconData,
- color: iconColor,
- );
- }
-
- String detectCardType(String cardNumber) {
- if (cardNumber.startsWith('4')) {
- return 'Visa';
- } else if (cardNumber.startsWith('5')) {
- return 'Mastercard';
- } else {
- return 'Other';
- }
- }
-}
diff --git a/lib/views/home/map_widget.dart/picker_animation_container.dart b/lib/views/home/map_widget.dart/picker_animation_container.dart
deleted file mode 100644
index 40798d6..0000000
--- a/lib/views/home/map_widget.dart/picker_animation_container.dart
+++ /dev/null
@@ -1,217 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/table_names.dart';
-
-import '../../../constant/colors.dart';
-import '../../../constant/style.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import '../../../main.dart';
-import '../../widgets/elevated_btn.dart';
-import 'form_search_places_destenation.dart';
-
-class PickerAnimtionContainerFormPlaces extends StatelessWidget {
- PickerAnimtionContainerFormPlaces({
- super.key,
- });
- final controller = MapPassengerController();
- @override
- Widget build(BuildContext context) {
- // DbSql sql = DbSql.instance;
- return GetBuilder(
- builder: (controller) => Positioned(
- bottom: 0,
- left: 0,
- right: 5,
- child: AnimatedContainer(
- duration: const Duration(milliseconds: 300),
- height: controller.heightPickerContainer,
- decoration: const BoxDecoration(
- boxShadow: [
- BoxShadow(
- color: AppColor.accentColor, offset: Offset(2, 2)),
- BoxShadow(
- color: AppColor.accentColor, offset: Offset(-2, -2))
- ],
- color: AppColor.secondaryColor,
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(15),
- topRight: Radius.circular(15),
- )),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- controller.isPickerShown
- ? const SizedBox()
- : Text(
- 'Hi, Where to '.tr,
- style: AppStyle.title,
- ),
- Column(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- const SizedBox(
- height: 5,
- ),
- controller.isPickerShown
- ? InkWell(
- onTapDown: (details) {
- controller.changePickerShown();
- controller.changeHeightPlaces();
- },
- child: Container(
- height: 7,
- width: Get.width * .3,
- decoration: BoxDecoration(
- color: AppColor.accentColor,
- borderRadius: BorderRadius.circular(10),
- border: Border.all(
- color: AppColor.accentColor,
- )),
- ),
- )
- : const SizedBox(),
- controller.isPickerShown
- ? InkWell(
- onTap: () {},
- child: formSearchPlacesDestenation(),
- )
- : Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceEvenly,
- children: [
- TextButton(
- onPressed: () {
- controller.changePickerShown();
- },
- child: Text(
- "Pick your destination from Map".tr,
- style: AppStyle.subtitle,
- ),
- ),
- TextButton(
- onPressed: () async {
- List favoritePlaces = await sql
- .getAllData(TableName.placesFavorite);
- print(favoritePlaces);
- Get.defaultDialog(
- title: 'Favorite Places'.tr,
- content: SizedBox(
- width: Get.width * .8,
- height: 300,
- child: favoritePlaces.isEmpty
- ? Center(
- child: Column(
- mainAxisAlignment:
- MainAxisAlignment
- .center,
- children: [
- const Icon(
- Icons
- .hourglass_empty_rounded,
- size: 99,
- color: AppColor
- .primaryColor,
- ),
- Text(
- 'You Dont Have Any places yet !'
- .tr,
- style: AppStyle.title,
- ),
- ],
- ),
- )
- : ListView.builder(
- itemCount:
- favoritePlaces.length,
- itemBuilder:
- (BuildContext context,
- int index) {
- return Row(
- mainAxisAlignment:
- MainAxisAlignment
- .spaceBetween,
- children: [
- TextButton(
- onPressed: () async {
- await controller
- .getMap(
- '${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
- '${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
- );
- controller
- .changePickerShown();
- controller
- .changeBottomSheetShown();
- controller
- .bottomSheet();
- Get.back();
- },
- child: Text(
- favoritePlaces[
- index]['name'],
- style:
- AppStyle.title,
- ),
- ),
- IconButton(
- onPressed: () async {
- await sql.deleteData(
- TableName
- .placesFavorite,
- favoritePlaces[
- index]
- ['id']);
- Get.back();
- Get.snackbar(
- 'Deleted ',
- '${'You are Delete'.tr} ${favoritePlaces[index]['name']} from your list',
- backgroundColor:
- AppColor
- .accentColor);
- },
- icon: const Icon(Icons
- .favorite_outlined),
- ),
- ],
- );
- },
- ),
- ),
- onCancel: () {},
- );
- },
- child: Text(
- "Go To Favorite Places".tr,
- style: AppStyle.subtitle,
- ),
- ),
- ],
- ),
- if (controller.isPickerShown &&
- controller.placesDestination.isEmpty)
- MyElevatedButton(
- title: 'Go to this Target'.tr,
- onPressed: () async {
- await controller.getMap(
- '${controller.passengerLocation.latitude},${controller.passengerLocation.longitude}',
- '${controller.newMyLocation.latitude},${controller.newMyLocation.longitude}',
- );
- controller.changePickerShown();
- controller.changeBottomSheetShown();
- controller.bottomSheet();
- // await sql
- // .getAllData(TableName.placesFavorite)
- // .then((value) => print(value));
- },
- ),
- if (controller.isPickerShown &&
- controller.placesDestination.isEmpty)
- const SizedBox(),
- ],
- ),
- ],
- ),
- ),
- ));
- }
-}
diff --git a/lib/views/home/map_widget.dart/points_page_for_rider.dart b/lib/views/home/map_widget.dart/points_page_for_rider.dart
deleted file mode 100644
index 8a20764..0000000
--- a/lib/views/home/map_widget.dart/points_page_for_rider.dart
+++ /dev/null
@@ -1,328 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/views/admin/captain/form_captain.dart';
-
-import '../../../constant/colors.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import '../../../controller/home/points_for_rider_controller.dart';
-
-class PointsPageForRider extends StatelessWidget {
- PointsPageForRider({
- super.key,
- });
- MapPassengerController mapPassengerController =
- Get.put(MapPassengerController());
-
- @override
- Widget build(BuildContext context) {
- Get.put(WayPointController());
-
- return GetBuilder(builder: (controller) {
- return Positioned(
- bottom: 2,
- left: 2,
- right: 2,
- child: AnimatedContainer(
- duration: const Duration(milliseconds: 300),
- height: controller.wayPointSheetHeight,
- decoration: AppStyle.boxDecoration,
- child: ListView(
- children: [
- // const AppBarPointsPageForRider(),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- IconButton(
- onPressed: () {
- mapPassengerController.downPoints();
- },
- icon: const Icon(Icons.arrow_drop_down_circle_outlined),
- ),
- GetBuilder(builder: (wayPointController) {
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- ElevatedButton(
- onPressed: () {
- wayPointController.addWayPoints();
- controller.isWayPointStopsSheetUtilGetMap = true;
- },
- child: const Text('Add Stops'),
- ),
- wayPointController.wayPoints.length > 1
- ? ElevatedButton(
- onPressed: () async {
- mapPassengerController
- .getMapPointsForAllMethods();
- },
- child: const Text('Get Direction'),
- )
- : const SizedBox()
- ],
- );
- }),
- ],
- ),
- SizedBox(
- height: Get.height * .36,
- child: GetBuilder(
- builder: (wayPointController) {
- return ReorderableListView(
- // The children of the list are the text fields
- children: wayPointController.wayPoints
- .asMap()
- .entries
- .map((entry) {
- final index = entry.key;
- final wayPoint = entry.value;
- return Padding(
- key: ValueKey(index),
- padding: const EdgeInsets.all(1),
- child: ListTile(
- leading: Container(
- decoration: BoxDecoration(
- color: AppColor.deepPurpleAccent,
- border: Border.all(),
- shape: BoxShape.rectangle),
- child: Padding(
- padding: const EdgeInsets.all(2),
- child: Text(
- index.toString(),
- style: AppStyle.title,
- ),
- )),
- title: InkWell(
- onTap: () {
- // showAddLocationDialog(context);
- Get.defaultDialog(
- content: SizedBox(
- width: Get.width,
- height: 400,
- child: mapPassengerController
- .placeListResponse[index]),
- );
- },
- child: Container(
- decoration: BoxDecoration(
- border: Border.all(),
- color:
- AppColor.accentColor.withOpacity(.5)),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- Text(mapPassengerController
- .currentLocationStringAll[index]
- .toString()),
- const Icon(
- Icons.reorder,
- size: 20,
- ),
- ],
- ),
- ),
- ),
- trailing: index > 0
- ? IconButton(
- icon: const Icon(Icons.close),
- onPressed: () {
- wayPointController.removeTextField(index);
- },
- )
- : IconButton(
- icon: const Icon(
- Icons.close,
- color: AppColor.secondaryColor,
- ),
- onPressed: () {},
- )),
- );
- }).toList(),
-
- // The callback when the user reorders the text fields
- onReorder: (int oldIndex, int newIndex) {
- wayPointController.reorderTextFields(oldIndex, newIndex);
- },
- );
- }),
- ),
- ],
- ),
- ),
- );
- });
- }
-
- // GetBuilder(
- // builder: (controller) => Container(
- // decoration: AppStyle.boxDecoration,
- // height: Get.height *
- // .5, // height: controller.heightPointsPageForRider,
- // width: Get.width,
- // child: Column(
- // children: [
- // SizedBox(
- // height: 300,
- // child: ReorderableListView(
- // onReorder: (oldIndex, newIndex) {
- // if (oldIndex < newIndex) {
- // newIndex -= 1;
- // }
- // pointsForRiderController.locations.insert(
- // newIndex,
- // pointsForRiderController.locations
- // .removeAt(oldIndex));
- // },
- // children: [
- // for (int i = 0;
- // i < pointsForRiderController.locations.length;
- // i++)
- // ListTile(
- // key: Key('$i'),
- // title: DragTarget(
- // onAccept: (int data) {
- // pointsForRiderController.locations
- // .insert(i, 'New Text Field');
- // },
- // builder: (context, candidateData, rejectedData) {
- // return Row(
- // children: [
- // SizedBox(
- // width: 300,
- // child: TextField(
- // controller: TextEditingController(
- // text: pointsForRiderController
- // .locations[i]),
- // onChanged: (value) {
- // pointsForRiderController
- // .locations[i] = value;
- // },
- // decoration: InputDecoration(
- // prefixIcon: IconButton(
- // onPressed: () {
- // pointsForRiderController
- // .removeLocation(i);
- // },
- // icon: const Icon(Icons.delete),
- // ),
- // labelText: 'Text Field ${i + 1}',
- // border: const OutlineInputBorder(),
- // ),
- // ),
- // ),
- // IconButton(
- // onPressed: () {
- // // pointsForRiderController.onReorder(
- // // index, newIndex);
- // },
- // icon: const Icon(Icons.reorder),
- // ),
- // ],
- // );
- // },
- // ),
- // ),
- // ],
- // ),
- // ),
- // ElevatedButton(
- // onPressed: () {
- // pointsForRiderController.addLocation('location');
- // },
- // child: const Text('Add Text Field'),
- // ),
- // ],
- // ),
- // ));
-}
-
-void showAddLocationDialog(BuildContext context, int index) {
- final TextEditingController locationController = TextEditingController();
- // Get.put(WayPointController());
- showDialog(
- context: context,
- builder: (context) {
- return Dialog.fullscreen(
- // title: const Text('Add Location'),
- child: Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- IconButton(
- onPressed: () {
- Get.back();
- },
- icon: const Icon(
- Icons.close,
- size: 40,
- ),
- ),
- Text(
- 'Add Location'.tr,
- style: AppStyle.title,
- ),
- const Icon(
- Icons.clear,
- color: AppColor.secondaryColor,
- )
- ],
- ),
- SizedBox(
- width: Get.width,
- child: formSearchCaptain(),
- ),
- ],
- ),
- );
- },
- );
-}
-
-class AppBarPointsPageForRider extends StatelessWidget {
- const AppBarPointsPageForRider({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- IconButton(
- onPressed: () {},
- icon: const Icon(
- Icons.arrow_back_ios_new_rounded,
- color: AppColor.primaryColor,
- ),
- ),
- Container(
- child: Row(
- children: [
- const CircleAvatar(
- backgroundColor: AppColor.primaryColor,
- maxRadius: 15,
- child: Icon(
- Icons.person,
- color: AppColor.secondaryColor,
- ),
- ),
- TextButton(
- onPressed: () {},
- child: Text(
- "Switch Rider".tr,
- style: AppStyle.title,
- ),
- ),
- ],
- ),
- ),
- const Icon(
- Icons.clear,
- color: AppColor.secondaryColor,
- )
- ],
- );
- }
-}
diff --git a/lib/views/home/map_widget.dart/ride_begin_passenger.dart b/lib/views/home/map_widget.dart/ride_begin_passenger.dart
deleted file mode 100644
index 82260ef..0000000
--- a/lib/views/home/map_widget.dart/ride_begin_passenger.dart
+++ /dev/null
@@ -1,341 +0,0 @@
-import 'package:SEFER/views/home/profile/feed_back_page.dart';
-import 'package:SEFER/views/widgets/elevated_btn.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter_font_icons/flutter_font_icons.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/box_name.dart';
-import 'package:SEFER/controller/profile/profile_controller.dart';
-import 'package:SEFER/main.dart';
-
-import '../../../constant/colors.dart';
-import '../../../constant/style.dart';
-import '../../../controller/functions/audio_record1.dart';
-import '../../../controller/functions/toast.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-
-class RideBeginPassenger extends StatelessWidget {
- const RideBeginPassenger({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- ProfileController profileController = Get.put(ProfileController());
- AudioRecorderController audioController =
- Get.put(AudioRecorderController());
- // Get.put(MapPassengerController());
- return GetBuilder(builder: (controller) {
- if (controller.statusRide == 'Begin' || !controller.statusRideFromStart) {
- return Positioned(
- left: 10,
- right: 10,
- bottom: 4,
- child: Container(
- decoration: AppStyle.boxDecoration,
- height: controller.statusRide == 'Begin' ? Get.height * .33 : 0,
- // width: 100,
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- CircleAvatar(
- radius: 30,
- backgroundImage: NetworkImage(
- 'https://ride.mobile-app.store/portrate_captain_image/${controller.driverId}.jpg'),
- ),
- Column(
- children: [
- Container(
- decoration: AppStyle.boxDecoration1,
- child: Text(
- controller.firstName,
- style: AppStyle.title,
- ),
- ),
- Container(
- decoration: AppStyle.boxDecoration1,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Text(
- controller.make,
- style: AppStyle.title,
- ),
- Text(
- controller.model,
- style: AppStyle.title,
- ),
- ],
- ),
- ),
- ],
- ),
- Column(
- children: [
- const Text(''),
- Container(
- decoration: AppStyle.boxDecoration1,
- child: Padding(
- padding:
- const EdgeInsets.symmetric(horizontal: 4),
- child: Text(
- controller.licensePlate,
- style: AppStyle.title,
- ),
- ),
- ),
- ],
- ),
- Column(
- children: [
- Container(
- decoration: AppStyle.boxDecoration1,
- child: Padding(
- padding: const EdgeInsets.all(3),
- child: Text(
- '${box.read(BoxName.carType)}',
- style: AppStyle.title,
- ),
- ),
- ),
- Text(
- '${controller.driverRate} 📈',
- style: AppStyle.title,
- ),
- ],
- ),
- ],
- ),
- // SizedBox(
- // height: 5,
- // ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- InkWell(
- onTap: () {
- controller.getDialog('Arrival time'.tr,
- 'arrival time to reach your point'.tr, () {});
- },
- child: Container(
- width: Get.width * .15,
- decoration: AppStyle.boxDecoration1,
- child: Column(
- children: [
- Text(
- '⏱️',
- style: AppStyle.title,
- ),
- Text(
- controller.arrivalTime,
- style: AppStyle.title,
- ),
- ],
- ),
- ),
- ),
- InkWell(
- onTap: () {
- controller.getDialog(
- 'Price of trip'.tr,
- 'For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance'
- .tr, () {
- Get.back();
- });
- },
- child: Container(
- width: Get.width * .15,
- decoration: AppStyle.boxDecoration1,
- child: Column(
- children: [
- Text(
- '💵 ',
- style: AppStyle.title,
- ),
- Text(
- controller.totalPassenger.toStringAsFixed(2),
- style: AppStyle.title,
- ),
- ],
- ),
- ),
- ),
- Container(
- width: Get.width * .15,
- decoration: AppStyle.boxDecoration1,
- child: IconButton(
- onPressed: () => Get.to(
- () => FeedBackPage(),
- transition: Transition.downToUp,
- ),
- icon: const Icon(
- Icons.note_add,
- color: AppColor.redColor,
- ),
- tooltip: ' Add Note', // Optional tooltip for clarity
- ),
- ),
- Container(
- width: Get.width * .15,
- decoration: AppStyle.boxDecoration1,
- child: audioController.isRecording == false
- ? IconButton(
- onPressed: () async {
- await audioController.startRecording();
- Toast.show(context, 'Start Record'.tr,
- AppColor.greenColor);
- },
- icon: const Icon(
- Icons.play_circle_fill_outlined,
- color: AppColor.greenColor,
- ),
- tooltip:
- ' Add Note', // Optional tooltip for clarity
- )
- : IconButton(
- onPressed: () async {
- await audioController.stopRecording();
- Toast.show(context, 'Record saved'.tr,
- AppColor.greenColor);
- },
- icon: const Icon(
- Icons.stop_circle,
- color: AppColor.greenColor,
- ),
- tooltip:
- ' Add Note', // Optional tooltip for clarity
- ),
- ),
- ],
- ),
- Stack(
- children: [
- // StreamCounter(),
- LinearProgressIndicator(
- backgroundColor: AppColor.accentColor,
- color: controller.remainingTimeTimerRideBegin < 60
- ? AppColor.redColor
- : AppColor.greenColor,
- minHeight: 25,
- borderRadius: BorderRadius.circular(15),
- value: controller.progressTimerRideBegin.toDouble(),
- ),
- Center(
- child: Text(
- controller.stringRemainingTimeRideBegin,
- style: AppStyle.title,
- ),
- )
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Container(
- decoration: AppStyle.boxDecoration1,
- width: Get.width * .15,
- child: IconButton(
- onPressed: () async {
- if (box.read(BoxName.sosPhonePassenger) == null) {
- {
- await profileController.updatField(
- 'sosPhone', TextInputType.phone);
- box.write(BoxName.sosPhonePassenger,
- profileController.prfoileData['sosPhone']);
- }
- } else {
- controller
- .sendSMS(box.read(BoxName.sosPhonePassenger));
- }
- },
- icon: const Icon(
- Icons.sos_rounded,
- color: AppColor.redColor,
- ),
- ),
- ),
- Container(
- decoration: AppStyle.boxDecoration1,
- width: Get.width * .15,
- child: IconButton(
- 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 {
- String phoneNumber = box
- .read(BoxName.sosPhonePassenger)
- .toString();
- // phoneNumber = phoneNumber.replaceAll('0', '');
- print(phoneNumber); // Output: 798583061
- var phone =
- // '+${box.read(BoxName.countryCode)}${box.read(BoxName.sosPhonePassenger)}';
- '${box.read(BoxName.sosPhonePassenger)}';
- controller.sendWhatsapp(phone);
- }
- },
- icon: const Icon(
- FontAwesome.whatsapp,
- color: AppColor.greenColor,
- ),
- ),
- ),
- ],
- )
- ],
- ),
- ),
- ),
- );
- } else {
- return const SizedBox();
- }
- });
- }
-}
-
-class StreamCounter extends StatelessWidget {
- const StreamCounter({Key? key}) : super(key: key);
-
- @override
- // Build the UI based on the timer value
- Widget build(BuildContext context) {
- Get.put(MapPassengerController());
- return GetBuilder(builder: (controller) {
- return StreamBuilder(
- initialData: 0,
- stream: controller.timerController.stream,
- builder: (context, snapshot) {
- // Calculate the remaining time based on the current tick
- final remainingTime = controller.durationToRide - snapshot.data!;
-
- // Format the remaining time as a string
- final formattedRemainingTime =
- '${(remainingTime / 60).floor()}:${(remainingTime % 60).toString().padLeft(2, '0')}';
-
- // Return the UI widgets based on the remaining time
- return Column(
- children: [
- Text(formattedRemainingTime),
- // ElevatedButton(
- // onPressed: () {
- // // Handle button press here
- // },
- // ),
- ],
- );
- },
- );
- });
- }
-}
diff --git a/lib/views/home/map_widget.dart/ride_from_start_app.dart b/lib/views/home/map_widget.dart/ride_from_start_app.dart
deleted file mode 100644
index 9085d82..0000000
--- a/lib/views/home/map_widget.dart/ride_from_start_app.dart
+++ /dev/null
@@ -1,176 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_font_icons/flutter_font_icons.dart';
-import 'package:get/get.dart';
-
-import '../../../constant/box_name.dart';
-import '../../../constant/colors.dart';
-import '../../../constant/style.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import '../../../controller/profile/profile_controller.dart';
-import '../../../main.dart';
-
-class RideFromStartApp extends StatelessWidget {
- const RideFromStartApp({super.key});
-
- @override
- Widget build(BuildContext context) {
- ProfileController profileController = Get.put(ProfileController());
- return GetBuilder(builder: (controller) {
- return (controller.statusRideFromStart
- // || controller.statusRide == 'Begin'
- )
- ? Positioned(
- left: 10,
- right: 10,
- bottom: 4,
- child: Container(
- decoration: AppStyle.boxDecoration1,
- height: Get.height * .3,
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- Container(
- width: Get.width * .15,
- decoration: AppStyle.boxDecoration1,
- child: Column(
- children: [
- Text(
- '⏱️',
- style: AppStyle.title,
- ),
- Text(
- box.read(BoxName.arrivalTime),
- style: AppStyle.title,
- ),
- ],
- ),
- ),
- Container(
- width: Get.width * .15,
- decoration: AppStyle.boxDecoration1,
- child: Column(
- children: [
- Text(
- '📍',
- style: AppStyle.title,
- ),
- Text(
- controller.rideStatusFromStartApp['data']
- ['distance']
- .toString(),
- style: AppStyle.title,
- ),
- ],
- ),
- ),
- Container(
- width: Get.width * .15,
- decoration: AppStyle.boxDecoration1,
- child: Column(
- children: [
- Text(
- '💵 ',
- style: AppStyle.title,
- ),
- Text(
- controller.rideStatusFromStartApp['data']
- ['price'],
- style: AppStyle.title,
- ),
- ],
- ),
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: [
- CircleAvatar(
- radius: 30,
- backgroundImage: NetworkImage(
- // '',
- // ),
- 'https://ride.mobile-app.store/portrate_captain_image/${controller.rideStatusFromStartApp['data']['driver_id']}.jpg'),
- ),
- Text(
- '${controller.rideStatusFromStartApp['data']['driverName']}',
- style: AppStyle.title,
- ),
- Column(
- children: [
- Text(
- '${controller.rideStatusFromStartApp['data']['rateDriver']} 📈',
- style: AppStyle.title,
- ),
- Text(
- '${controller.rideStatusFromStartApp['data']['carType']}',
- style: AppStyle.title,
- ),
- ],
- ),
- ],
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- IconButton(
- onPressed: () async {
- if (box.read(BoxName.sosPhonePassenger) == null) {
- {
- await profileController.updatField(
- 'sosPhone', TextInputType.phone);
- box.write(BoxName.sosPhonePassenger,
- profileController.prfoileData['sosPhone']);
- }
- } else {
- controller
- .sendSMS(box.read(BoxName.sosPhonePassenger));
- }
- },
- icon: const Icon(
- Icons.sos_rounded,
- color: AppColor.redColor,
- ),
- ),
- IconButton(
- 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 {
- String phoneNumber = box
- .read(BoxName.sosPhonePassenger)
- .toString();
- // phoneNumber = phoneNumber.replaceAll('0', '');
- print(phoneNumber); // Output: 798583061
- var phone =
- // '+${box.read(BoxName.countryCode)}${box.read(BoxName.sosPhonePassenger)}';
- '${box.read(BoxName.sosPhonePassenger)}';
- controller.sendWhatsapp(phone);
- }
- },
- icon: const Icon(
- FontAwesome.whatsapp,
- color: AppColor.greenColor,
- ),
- ),
- ],
- )
- ],
- ),
- ),
- )
- : const SizedBox();
- });
- }
-}
diff --git a/lib/views/home/map_widget.dart/searching_captain_window.dart b/lib/views/home/map_widget.dart/searching_captain_window.dart
deleted file mode 100644
index 24b32eb..0000000
--- a/lib/views/home/map_widget.dart/searching_captain_window.dart
+++ /dev/null
@@ -1,211 +0,0 @@
-import 'dart:async';
-
-import 'package:SEFER/constant/colors.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
-import 'package:SEFER/views/widgets/elevated_btn.dart';
-import 'package:SEFER/views/widgets/my_textField.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-
-class SearchingCaptainWindow extends StatelessWidget {
- const SearchingCaptainWindow({super.key});
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(
- builder: (mapPassengerController) {
- return mapPassengerController.isSearchingWindow
- ? Positioned(
- bottom: 0,
- left: 0,
- right: 0,
- child: Container(
- decoration: AppStyle.boxDecoration1,
- height: Get.height * .2,
- child: Column(
- // Use Stack for overlapping widgets
- children: [
- // Text elements
- SizedBox(
- width: Get.width * .7,
- child: const LinearProgressIndicator(
- minHeight: 6,
- backgroundColor: AppColor.yellowColor,
- color: AppColor.secondaryColor,
- ),
- ),
- Text(
- 'We search nearst Driver to you'.tr,
- style: AppStyle.headTitle2,
- ),
- Text(
- 'please wait till driver accept your order'.tr,
- style: AppStyle.title,
- ), // Timer logic
- _buildTimer(mapPassengerController),
- ],
- ),
- ),
- )
- : const SizedBox();
- },
- );
- }
-}
-
-Widget _buildTimer(MapPassengerController mapPassengerController) {
- // Start timer at 0
- Timer? timer;
-
- return StreamBuilder(
- // Use StreamBuilder for timer updates
- stream: Stream.periodic(const Duration(seconds: 1))
- .map((_) => ++mapPassengerController.currentTimeSearchingCaptainWindow),
- initialData: 0,
- builder: (context, snapshot) {
- if (snapshot.hasData && snapshot.data! > 30) {
- timer?.cancel(); // Cancel timer after 60 seconds
- return GestureDetector(
- onTap: () {
- Get.defaultDialog(
- barrierDismissible: false,
- title: "Increase Your Trip Fee (Optional)".tr,
- titleStyle: AppStyle.title,
- content: Column(
- children: [
- Text(
- "We haven't found any drivers yet. Consider increasing your trip fee to make your offer more attractive to drivers."
- .tr,
- style: AppStyle.title,
- textAlign: TextAlign.center,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- IconButton(
- onPressed: () {
- mapPassengerController.increasFeeFromPassenger.text =
- (mapPassengerController.totalPassenger + 3)
- .toStringAsFixed(1);
- // mapPassengerController.increasFeeFromPassenger.text =
- // mapPassengerController.totalPassenger
- // .toStringAsFixed(1);
- mapPassengerController.update();
- },
- icon: Column(
- children: [
- Text(
- '3',
- style: AppStyle.number,
- ),
- Container(
- decoration: const BoxDecoration(
- shape: BoxShape.circle,
- color: AppColor.greenColor),
- child: const Icon(
- Icons.arrow_circle_up,
- size: 30,
- color: AppColor.secondaryColor,
- ),
- ),
- ],
- ),
- ),
- SizedBox(
- width: 100,
- child: Form(
- key: mapPassengerController.increasFeeFormKey,
- child: MyTextForm(
- controller: mapPassengerController
- .increasFeeFromPassenger,
- label: mapPassengerController.totalPassenger
- .toStringAsFixed(2),
- hint: mapPassengerController.totalPassenger
- .toStringAsFixed(2),
- type: TextInputType.number),
- ),
- ),
- IconButton(
- onPressed: () {
- // if ((double.parse(mapPassengerController
- // .increasFeeFromPassenger.text) >
- // totalPassenger)) {}
- mapPassengerController.increasFeeFromPassenger.text =
- (mapPassengerController.totalPassenger - 3)
- .toStringAsFixed(1);
- // mapPassengerController.increasFeeFromPassenger.text =
- // mapPassengerController.totalPassenger
- // .toStringAsFixed(1);
- mapPassengerController.update();
- },
- icon: Column(
- children: [
- Text(
- '3',
- style: AppStyle.number,
- ),
- Container(
- decoration: const BoxDecoration(
- shape: BoxShape.circle,
- color: AppColor.redColor),
- child: const Icon(
- Icons.arrow_drop_down_circle_outlined,
- size: 30,
- color: AppColor.secondaryColor,
- ),
- ),
- ],
- ),
- ),
- ],
- )
- ],
- ),
- actions: [
- MyElevatedButton(
- title: "No, thanks",
- onPressed: () {
- Get.back();
- }),
- MyElevatedButton(
- title: "Increase Fee".tr,
- onPressed: () {
- mapPassengerController.increaseFeeByPassengerAndReOrder();
- })
- ],
- );
- },
- child: Text(
- "No accepted orders? Try raising your trip fee to attract riders."
- .tr,
- style: AppStyle.title.copyWith(color: AppColor.blueColor),
- ),
- );
- }
-
- // Update progress for circular indicator (0.0 to 1.0)
- final double progress =
- snapshot.data!.toDouble() / 30.0; // Normalize progress
-
- return Stack(
- children: [
- Center(
- child: CircularProgressIndicator(
- value: progress, // Use calculated progress
- color: AppColor.blueColor,
- backgroundColor: AppColor.yellowColor,
- ),
- ),
- Center(
- child: Text(
- '${snapshot.data} ', // Display elapsed time
- style: AppStyle.title.copyWith(
- color: AppColor.greenColor), // Adjust color for timer
- ),
- )
- ],
- );
- },
- );
-}
diff --git a/lib/views/home/map_widget.dart/timer_for_cancell_trip_from_passenger.dart b/lib/views/home/map_widget.dart/timer_for_cancell_trip_from_passenger.dart
deleted file mode 100644
index ed0c2d0..0000000
--- a/lib/views/home/map_widget.dart/timer_for_cancell_trip_from_passenger.dart
+++ /dev/null
@@ -1,63 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-
-import '../../../constant/style.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-
-GetBuilder timerForCancelTripFromPassenger() {
- return GetBuilder(
- builder: (controller) {
- final isNearEnd =
- controller.remainingTime <= 5; // Define a threshold for "near end"
-
- return controller.remainingTime > 0 && controller.remainingTime != 25
- ? Positioned(
- bottom: 5,
- left: 10,
- right: 10,
- child: Container(
- height: 180,
- decoration: AppStyle.boxDecoration,
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- Stack(
- alignment: Alignment.center,
- children: [
- CircularProgressIndicator(
- value: controller.progress,
- // Set the color based on the "isNearEnd" condition
- color: isNearEnd ? Colors.red : Colors.blue,
- ),
- Text(
- '${controller.remainingTime}',
- style: AppStyle.number,
- ),
- ],
- ),
- const SizedBox(
- width: 30,
- ),
- Text(
- 'You can cancel Ride now'.tr,
- style: AppStyle.title,
- )
- ],
- ),
- Text(
- 'After this period\nYou can\'t cancel!'.tr,
- style: AppStyle.title,
- )
- ],
- ),
- ),
- ),
- )
- : const SizedBox();
- },
- );
-}
diff --git a/lib/views/home/map_widget.dart/timer_to_passenger_from_driver.dart b/lib/views/home/map_widget.dart/timer_to_passenger_from_driver.dart
deleted file mode 100644
index 065a7d7..0000000
--- a/lib/views/home/map_widget.dart/timer_to_passenger_from_driver.dart
+++ /dev/null
@@ -1,148 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/views/widgets/elevated_btn.dart';
-
-import '../../../constant/colors.dart';
-import '../../../constant/style.dart';
-import '../../../controller/home/map_passenger_controller.dart';
-import 'ride_begin_passenger.dart';
-
-class TimerToPassengerFromDriver extends StatelessWidget {
- const TimerToPassengerFromDriver({
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- return GetBuilder(builder: (controller) {
- if (controller.remainingTime == 0 &&
- (controller.isDriverInPassengerWay == true ||
- controller.timeToPassengerFromDriverAfterApplied > 0)) {
- // ) {
- return Positioned(
- left: 10,
- right: 10,
- bottom: 5,
- child: Container(
- decoration: AppStyle.boxDecoration,
- height: controller.remainingTime == 0 &&
- (controller.isDriverInPassengerWay == true ||
- controller.timeToPassengerFromDriverAfterApplied > 0)
- ? 200
- : 0,
- // width: 100,
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- children: [
- Text(
- 'You Can cancel Ride After Captain did not come in the time'
- .tr,
- style: AppStyle.title,
- textAlign: TextAlign.center,
- ),
- Stack(
- children: [
- LinearProgressIndicator(
- backgroundColor: AppColor.accentColor,
- color: controller
- .remainingTimeToPassengerFromDriverAfterApplied <
- 60
- ? AppColor.redColor
- : AppColor.greenColor,
- minHeight: 25,
- borderRadius: BorderRadius.circular(15),
- value: controller
- .progressTimerToPassengerFromDriverAfterApplied
- .toDouble(),
- ),
- Center(
- child: Text(
- controller.stringRemainingTimeToPassenger,
- style: AppStyle.title,
- ),
- )
- ],
- ),
- IconButton(
- onPressed: () {},
- icon: const Icon(
- Icons.phone,
- color: AppColor.blueColor,
- ),
- ),
- controller.remainingTimeToPassengerFromDriverAfterApplied < 60
- ? MyElevatedButton(
- title: 'You can cancel trip'.tr,
- onPressed: () async {
- await controller
- .calculateDistanceBetweenPassengerAndDriverBeforeCancelRide();
- })
- : const SizedBox()
- ],
- ),
- ),
- ),
- );
- } else if (controller.remainingTime == 0 &&
- controller.isDriverArrivePassenger == true) {
- return Positioned(
- left: 10,
- right: 10,
- bottom: 5,
- child: Container(
- decoration: AppStyle.boxDecoration,
- height: controller.remainingTime == 0 &&
- controller.isDriverArrivePassenger == true
- ? 150
- : 0,
- // width: 100,
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- children: [
- Text(
- 'The driver waitting you in picked location .'.tr,
- style: AppStyle.title,
- textAlign: TextAlign.center,
- ),
- Stack(
- children: [
- LinearProgressIndicator(
- backgroundColor: AppColor.accentColor,
- color:
- controller.remainingTimeDriverWaitPassenger5Minute <
- 60
- ? AppColor.redColor
- : AppColor.greenColor,
- minHeight: 50,
- borderRadius: BorderRadius.circular(15),
- value: controller
- .progressTimerDriverWaitPassenger5Minute
- .toDouble(),
- ),
- Center(
- child: Text(
- controller
- .stringRemainingTimeDriverWaitPassenger5Minute,
- style: AppStyle.title,
- ),
- )
- ],
- ),
- Text(
- 'Please go to Car now '.tr,
- style: AppStyle.title,
- textAlign: TextAlign.center,
- ),
- ],
- ),
- ),
- ),
- );
- } else {
- return const RideBeginPassenger();
- }
- });
- }
-}
diff --git a/lib/views/home/my_wallet/walet_captain.dart b/lib/views/home/my_wallet/walet_captain.dart
index 9c18ec0..57e1594 100644
--- a/lib/views/home/my_wallet/walet_captain.dart
+++ b/lib/views/home/my_wallet/walet_captain.dart
@@ -6,7 +6,6 @@ import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/info.dart';
import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
import 'package:SEFER/controller/payment/payment_controller.dart';
import 'package:SEFER/main.dart';
@@ -24,7 +23,7 @@ class WalletCaptain extends StatelessWidget {
Get.put(CaptainWalletController());
@override
Widget build(BuildContext context) {
- Get.put(MapPassengerController());
+ // Get.put(MapPassengerController());
return MyScafolld(
title: 'Driver Wallet'.tr,
body: [
diff --git a/lib/views/home/profile/order_history.dart b/lib/views/home/profile/order_history.dart
deleted file mode 100644
index d14ce97..0000000
--- a/lib/views/home/profile/order_history.dart
+++ /dev/null
@@ -1,151 +0,0 @@
-import 'package:SEFER/controller/home/map_passenger_controller.dart';
-import 'package:SEFER/main.dart';
-import 'package:flutter/material.dart';
-import 'package:get/get.dart';
-import 'package:SEFER/constant/style.dart';
-import 'package:SEFER/views/widgets/my_scafold.dart';
-import 'package:SEFER/views/widgets/mycircular.dart';
-import 'package:google_maps_flutter/google_maps_flutter.dart';
-
-import '../../../constant/colors.dart';
-import '../../../controller/functions/launch.dart';
-import '../../../controller/home/profile/order_history_controller.dart';
-
-class OrderHistory extends StatelessWidget {
- const OrderHistory({super.key});
-
- @override
- Widget build(BuildContext context) {
- // Instantiate the OrderHistoryController class
- Get.put(OrderHistoryController());
-
- return MyScafolld(
- title: 'Order History'.tr,
- isleading: true,
- body: [
- GetBuilder(
- builder: (orderHistoryController) => orderHistoryController.isloading
- ? const MyCircularProgressIndicator()
- : orderHistoryController.orderHistoryListPassenger.isEmpty
- ? Center(
- child: Text(
- 'No trip yet found'.tr,
- style: AppStyle.headTitle2,
- ),
- )
- : ListView.builder(
- itemCount: orderHistoryController
- .orderHistoryListPassenger.length,
- itemBuilder: (BuildContext context, int index) {
- // Use integer index here
- final rides =
- orderHistoryController.orderHistoryListPassenger[
- index]; // Access data using index
-
- return Padding(
- padding: const EdgeInsets.all(8.0),
- child: Container(
- decoration: AppStyle.boxDecoration1,
- child: InkWell(
- onTap: () {
- String mapUrl =
- 'https://www.google.com/maps/dir/${rides['start_location']}/${rides['end_location']}/';
- // print(mapUrl);
- showInBrowser(mapUrl);
- },
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Column(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- SizedBox(
- height: Get.height * .2,
- width: Get.width * .75,
- child: GoogleMap(
- initialCameraPosition: CameraPosition(
- target: Get.find<
- MapPassengerController>()
- .passengerLocation, // Assuming passenger location is available
- zoom: 15,
- ),
- zoomControlsEnabled: true,
- liteModeEnabled: true,
- polylines: {
- Polyline(
- zIndex: 2,
- consumeTapEvents: true,
- geodesic: true,
- endCap: Cap.buttCap,
- startCap: Cap.buttCap,
- visible: true,
- polylineId:
- const PolylineId('route'),
- points: [
- LatLng(
- double.parse(
- rides['start_location']
- .toString()
- .split(',')[0]),
- double.parse(
- rides['start_location']
- .toString()
- .split(',')[1]),
- ),
- LatLng(
- double.parse(
- rides['end_location']
- .toString()
- .split(',')[0]),
- double.parse(
- rides['end_location']
- .toString()
- .split(',')[1]),
- )
- ],
- color: AppColor.primaryColor,
- width: 5,
- ),
- },
- ),
- ),
- Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- Text(
- rides['date'],
- style: AppStyle.subtitle,
- ),
- Text(
- rides['time'],
- style: AppStyle.subtitle,
- ),
- Text(
- rides['status'],
- style: rides['status'] !=
- 'Canceled'.tr
- ? AppStyle.subtitle.copyWith(
- color: AppColor.greenColor)
- : AppStyle.subtitle.copyWith(
- color: AppColor.redColor),
- ),
- Text(
- '${'Price is'.tr} ${rides['price']}',
- style: AppStyle.subtitle,
- ),
- ],
- ),
- ],
- ),
- ),
- ),
- ),
- );
- },
- ),
- )
- ],
- );
- }
-}
diff --git a/lib/views/home/profile/passenger_profile_page.dart b/lib/views/home/profile/passenger_profile_page.dart
index 104b228..128c9c0 100644
--- a/lib/views/home/profile/passenger_profile_page.dart
+++ b/lib/views/home/profile/passenger_profile_page.dart
@@ -1,4 +1,4 @@
-import 'package:SEFER/views/auth/login_page.dart';
+import 'package:SEFER/views/auth/captin/login_captin.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -379,7 +379,7 @@ class CountryPicker extends StatelessWidget {
BoxName.countryCode, //
controller.selectedCountry); // Already saved in English
Get.snackbar(controller.selectedCountry.toString().tr, '');
- Get.off(LoginPage());
+ Get.off(LoginCaptin());
},
)
],
diff --git a/lib/views/lang/languages.dart b/lib/views/lang/languages.dart
index 364f1f9..f08d448 100644
--- a/lib/views/lang/languages.dart
+++ b/lib/views/lang/languages.dart
@@ -6,7 +6,6 @@ import 'package:SEFER/views/widgets/elevated_btn.dart';
import '../../constant/box_name.dart';
import '../../controller/local/local_controller.dart';
import '../auth/login_page.dart';
-import '../home/map_page_passenger.dart';
class Language extends StatelessWidget {
const Language({Key? key}) : super(key: key);
@@ -30,27 +29,21 @@ class Language extends StatelessWidget {
title: 'Ar',
onPressed: () {
controller.changeLang("ar");
- box.read(BoxName.email) != null
- ? Get.offAll(() => const MapPagePassenger())
- : Get.offAll(() => LoginPage());
+ Get.offAll(() => const MyApp());
},
),
MyElevatedButton(
title: "En",
onPressed: () {
controller.changeLang("en");
- box.read(BoxName.email) != null
- ? Get.offAll(() => const MapPagePassenger())
- : Get.offAll(() => LoginPage());
+ Get.offAll(() => const MyApp());
},
),
MyElevatedButton(
title: "Tr",
onPressed: () {
controller.changeLang("tr");
- box.read(BoxName.email) != null
- ? Get.offAll(() => const MapPagePassenger())
- : Get.offAll(() => LoginPage());
+ Get.offAll(() => const MyApp());
},
),
],
diff --git a/t dataBounds = [] b/t dataBounds = []
deleted file mode 100644
index f81492a..0000000
--- a/t dataBounds = []
+++ /dev/null
@@ -1,344 +0,0 @@
-warning: in the working copy of 'linux/flutter/generated_plugin_registrant.cc', LF will be replaced by CRLF the next time Git touches it
-warning: in the working copy of 'linux/flutter/generated_plugin_registrant.h', LF will be replaced by CRLF the next time Git touches it
-warning: in the working copy of 'linux/flutter/generated_plugins.cmake', LF will be replaced by CRLF the next time Git touches it
-warning: in the working copy of 'macos/Flutter/GeneratedPluginRegistrant.swift', LF will be replaced by CRLF the next time Git touches it
-warning: in the working copy of 'windows/flutter/generated_plugin_registrant.cc', LF will be replaced by CRLF the next time Git touches it
-warning: in the working copy of 'windows/flutter/generated_plugin_registrant.h', LF will be replaced by CRLF the next time Git touches it
-warning: in the working copy of 'windows/flutter/generated_plugins.cmake', LF will be replaced by CRLF the next time Git touches it
-[1mdiff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart[m
-[1mindex 8c72810..34875b4 100644[m
-[1m--- a/lib/controller/home/captin/map_driver_controller.dart[m
-[1m+++ b/lib/controller/home/captin/map_driver_controller.dart[m
-[36m@@ -226,7 +226,7 @@[m [mclass MapDriverController extends GetxController {[m
- });[m
- rideIsBeginPassengerTimer();[m
- double pointsSubstraction = 0;[m
-[31m- pointsSubstraction = double.parse(paymentAmount) * -1;[m
-[32m+[m[32m pointsSubstraction = double.parse(paymentAmount) * -100;[m
- var res = await CRUD().post(link: AppLink.addDriversWallet, payload: {[m
- 'paymentID': 'rideId$rideId',[m
- 'amount': (pointsSubstraction).toString(),[m
-[36m@@ -429,7 +429,12 @@[m [mclass MapDriverController extends GetxController {[m
- width: 10,[m
- color: AppColor.blueColor,[m
- );[m
-[31m- mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 14));[m
-[32m+[m[32m // final dataBounds = response["routes"][0]["bounds"];[m
-[32m+[m
-[32m+[m[32m // updateCameraFromBoundsAfterGetMap(dataBounds);[m
-[32m+[m
-[32m+[m[32m// Fit the camera to the bounds[m
-[32m+[m
- polyLines.add(polyline);[m
- // rideConfirm = false;[m
- update();[m
-[36m@@ -468,13 +473,31 @@[m [mclass MapDriverController extends GetxController {[m
- width: 10,[m
- color: AppColor.redColor,[m
- );[m
-[32m+[m[32m // final dataBounds = response["routes"][0]["bounds"];[m
- [m
-[31m- polyLinesDestination.add(polyline);[m
-[32m+[m[32m // updateCameraFromBoundsAfterGetMap(dataBounds);[m
-[32m+[m[32m // polyLinesDestination.add(polyline);[m
- // rideConfirm = false;[m
- update();[m
- }[m
- }[m
- [m
-[32m+[m[32m void updateCameraFromBoundsAfterGetMap(dynamic response) {[m
-[32m+[m[32m final bounds = response["routes"][0]["bounds"];[m
-[32m+[m[32m LatLng northeast =[m
-[32m+[m[32m LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);[m
-[32m+[m[32m LatLng southwest =[m
-[32m+[m[32m LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);[m
-[32m+[m
-[32m+[m[32m// Create the LatLngBounds object[m
-[32m+[m[32m LatLngBounds boundsData =[m
-[32m+[m[32m LatLngBounds(northeast: northeast, southwest: southwest);[m
-[32m+[m
-[32m+[m[32m// Fit the camera to the bounds[m
-[32m+[m[32m var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140);[m
-[32m+[m[32m mapController!.animateCamera(cameraUpdate);[m
-[32m+[m[32m }[m
-[32m+[m
- void changePassengerInfoWindow() {[m
- isPassengerInfoWindow = !isPassengerInfoWindow;[m
- passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0;[m
-[1mdiff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart[m
-[1mindex a2d4712..d4adf6f 100644[m
-[1m--- a/lib/controller/home/map_passenger_controller.dart[m
-[1m+++ b/lib/controller/home/map_passenger_controller.dart[m
-[36m@@ -186,6 +186,7 @@[m [mclass MapPassengerController extends GetxController {[m
- late double cost = 0;[m
- late double distance = 0;[m
- late double duration = 0;[m
-[32m+[m[32m List dataBounds = [];[m
- [m
- late Duration durationToAdd;[m
- late DateTime newTime = DateTime.now();[m
-[36m@@ -218,8 +219,9 @@[m [mclass MapPassengerController extends GetxController {[m
- durationToRide = 0;[m
- distanceOfDestnation = 0;[m
- wayPointSheetHeight = 0;[m
-[31m- for (var i = 0; i < Get.find().wayPoints.length; i++) {[m
-[31m- if (placesCoordinate[i + 1].toString() != '') {[m
-[32m+[m[32m for (var i = 0; i < placesCoordinate.length; i++) {[m
-[32m+[m[32m if (placesCoordinate[i + 1].toString() != '' ||[m
-[32m+[m[32m placesCoordinate[i + 1].toString() != null) {[m
- await getMapPoints([m
- placesCoordinate[i].toString(),[m
- placesCoordinate[i + 1].toString(),[m
-[36m@@ -227,7 +229,7 @@[m [mclass MapPassengerController extends GetxController {[m
- );[m
- }[m
- }[m
-[31m- updateCameraForDistanceAfterGetMap();[m
-[32m+[m[32m // updateCameraForDistanceAfterGetMap();[m
- // isWayPointStopsSheet = false;[m
- if (haveSteps) {[m
- String latestWaypoint =[m
-[36m@@ -378,13 +380,9 @@[m [mclass MapPassengerController extends GetxController {[m
- }[m
- [m
- void sendSMS(String to) async {[m
-[31m- // Get the driver's phone number.[m
-[31m- String driverPhone =[m
-[31m- dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();[m
-[31m-[m
- // Format the message.[m
- String message =[m
-[31m- 'Hi! This is ${box.read(BoxName.name)}. I am using ${box.read(AppInformation.appName)} to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} is driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()} with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}. I am currently located at $passengerLocation. If you need to reach me, please contact the driver directly at $driverPhone.';[m
-[32m+[m[32m 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with $firstName as the driver. $firstName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone .';[m
- [m
- // Launch the URL to send the SMS.[m
- launchCommunication('sms', to, message);[m
-[36m@@ -392,12 +390,10 @@[m [mclass MapPassengerController extends GetxController {[m
- [m
- void sendWhatsapp(String to) async {[m
- // Get the driver's phone number.[m
-[31m- String driverPhone =[m
-[31m- dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();[m
- [m
- // Format the message.[m
- String message =[m
-[31m- 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} as the driver. ${dataCarsLocationByPassenger['message'][carsOrder]['first_name'].toString()} \nis driving a ${dataCarsLocationByPassenger['message'][carsOrder]['model'].toString()}\n with license plate ${dataCarsLocationByPassenger['message'][carsOrder]['license_plate'].toString()}.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone.';[m
-[32m+[m[32m 'Hi! This is ${box.read(BoxName.name)}.\n I am using ${box.read(AppInformation.appName)} to ride with $firstName as the driver. $firstName \nis driving a $model\n with license plate $licensePlate.\n I am currently located at $passengerLocation.\n If you need to reach me, please contact the driver directly at\n\n $driverPhone .';[m
- [m
- // Launch the URL to send the SMS.[m
- launchCommunication('whatsapp', to, message);[m
-[36m@@ -444,6 +440,44 @@[m [mclass MapPassengerController extends GetxController {[m
- }[m
- }[m
- [m
-[32m+[m[32m // void startTimerToPassengerFromDriverAfterApplied() async {[m
-[32m+[m[32m // for (int i = 0; i <= timeToPassengerFromDriverAfterApplied; i++) {[m
-[32m+[m[32m // await Future.delayed(const Duration(seconds: 1));[m
-[32m+[m[32m // progressTimerToPassengerFromDriverAfterApplied =[m
-[32m+[m[32m // i / timeToPassengerFromDriverAfterApplied;[m
-[32m+[m[32m // remainingTimeToPassengerFromDriverAfterApplied =[m
-[32m+[m[32m // timeToPassengerFromDriverAfterApplied - i;[m
-[32m+[m
-[32m+[m[32m // var response = await CRUD().post([m
-[32m+[m[32m // link: AppLink.addAdminUser, ////////change to nnew endpoint[m
-[32m+[m[32m // payload: {[m
-[32m+[m[32m // 'ride_id': rideId,[m
-[32m+[m[32m // 'time_to_passenger_from_driver_after_applied':[m
-[32m+[m[32m // timeToPassengerFromDriverAfterApplied,[m
-[32m+[m[32m // });[m
-[32m+[m
-[32m+[m[32m // if (response.statusCode == 200) {[m
-[32m+[m[32m // // Update progress and remaining time[m
-[32m+[m[32m // int minutes =[m
-[32m+[m[32m // (remainingTimeToPassengerFromDriverAfterApplied / 60).floor();[m
-[32m+[m[32m // int seconds = remainingTimeToPassengerFromDriverAfterApplied % 60;[m
-[32m+[m[32m // stringRemainingTimeToPassenger =[m
-[32m+[m[32m // '$minutes:${seconds.toString().padLeft(2, '0')}';[m
-[32m+[m[32m // update();[m
-[32m+[m
-[32m+[m[32m // if (remainingTimeToPassengerFromDriverAfterApplied < 69) {[m
-[32m+[m[32m // if (rideTimerBegin == false) {[m
-[32m+[m[32m // getBeginRideFromDriver();[m
-[32m+[m[32m // }[m
-[32m+[m[32m // }[m
-[32m+[m[32m // } else {[m
-[32m+[m[32m // // Handle error[m
-[32m+[m[32m // print([m
-[32m+[m[32m // 'Error updating time to passenger: ${response.statusCode} ${response.reasonPhrase} ${response.body}');[m
-[32m+[m[32m // }[m
-[32m+[m[32m // }[m
-[32m+[m[32m // }[m
-[32m+[m
- // Create a StreamController to manage the timer values[m
- final timerController = StreamController();[m
- [m
-[36m@@ -579,10 +613,24 @@[m [mclass MapPassengerController extends GetxController {[m
- update();[m
- }[m
- [m
-[32m+[m[32m late String driverPhone;[m
-[32m+[m[32m late String firstName;[m
-[32m+[m[32m late String model;[m
-[32m+[m[32m late String licensePlate;[m
- changeConfirmRide() async {[m
- if (dataCarsLocationByPassenger != 'failure') {[m
- driverToken =[m
- dataCarsLocationByPassenger['message'][carsOrder]['token'].toString();[m
-[32m+[m[32m driverPhone =[m
-[32m+[m[32m dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();[m
-[32m+[m[32m firstName = dataCarsLocationByPassenger['message'][carsOrder][m
-[32m+[m[32m ['first_name'][m
-[32m+[m[32m .toString();[m
-[32m+[m[32m model =[m
-[32m+[m[32m dataCarsLocationByPassenger['message'][carsOrder]['model'].toString();[m
-[32m+[m[32m licensePlate = dataCarsLocationByPassenger['message'][carsOrder][m
-[32m+[m[32m ['license_plate'][m
-[32m+[m[32m .toString();[m
- PaymentController paymentController = Get.find();[m
- rideConfirm = true;[m
- shouldFetch = true;[m
-[36m@@ -617,9 +665,9 @@[m [mclass MapPassengerController extends GetxController {[m
- List body = [[m
- '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',[m
- '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',[m
-[31m- totalPassenger.toString(),[m
-[32m+[m[32m totalPassenger.toStringAsFixed(2),[m
- totalDriver.toString(),[m
-[31m- duration.toString(),[m
-[32m+[m[32m Duration(seconds: durationToRide).toString(),[m
- distance.toString(),[m
- dataCarsLocationByPassenger['message'][carsOrder]['driver_id'][m
- .toString(),[m
-[36m@@ -1442,23 +1490,29 @@[m [mclass MapPassengerController extends GetxController {[m
- double lng = points[i][1].toDouble();[m
- polylineCoordinates.add(LatLng(lat, lng));[m
- }[m
-[32m+[m[32m newStartPointLocation = LatLng([m
-[32m+[m[32m data[0]["start_location"]['lat'], data[0]["start_location"]['lng']);[m
- // Define the northeast and southwest coordinates[m
- final bounds = response["routes"][0]["bounds"];[m
-[31m-[m
- LatLng northeast =[m
- LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);[m
- LatLng southwest =[m
- LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);[m
- [m
-[31m- // Create the LatLngBounds object[m
-[31m- boundsData = LatLngBounds(northeast: northeast, southwest: southwest);[m
-[32m+[m[32m// Create the LatLngBounds object[m
-[32m+[m[32m LatLngBounds boundsData =[m
-[32m+[m[32m LatLngBounds(northeast: northeast, southwest: southwest);[m
-[32m+[m
-[32m+[m[32m// Fit the camera to the bounds[m
-[32m+[m[32m var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 130);[m
-[32m+[m[32m mapController!.animateCamera(cameraUpdate);[m
- [m
- // Calculate the zoom level based on the distance and screen size[m
- [m
- // getDistanceFromText(data[0]['distance']['text']);[m
- double distanceOfTrip = (data[0]['distance']['value']) / 1000;[m
- distance = distanceOfTrip;[m
-[31m- updateCameraForDistanceAfterGetMap();[m
-[32m+[m[32m // updateCameraForDistanceAfterGetMap();[m
- [m
- if (polyLines.isNotEmpty) {[m
- clearPolyline();[m
-[36m@@ -1506,15 +1560,6 @@[m [mclass MapPassengerController extends GetxController {[m
- polylineCoordinatesPointsAll[index].add(LatLng(lat, lng));[m
- }[m
- // Define the northeast and southwest coordinates[m
-[31m- final bounds = response["routes"][0]["bounds"];[m
-[31m-[m
-[31m- LatLng northeast =[m
-[31m- LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);[m
-[31m- LatLng southwest =[m
-[31m- LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);[m
-[31m-[m
-[31m- // Create the LatLngBounds object[m
-[31m- boundsData = LatLngBounds(northeast: northeast, southwest: southwest);[m
- [m
- if (polyLines.isNotEmpty) {[m
- // clearPolyline();[m
-[36m@@ -1533,6 +1578,22 @@[m [mclass MapPassengerController extends GetxController {[m
- }[m
- }[m
- [m
-[32m+[m[32m void updateCameraFromBoundsAfterGetMap(dynamic response) {[m
-[32m+[m[32m final bounds = response["routes"][0]["bounds"];[m
-[32m+[m[32m LatLng northeast =[m
-[32m+[m[32m LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);[m
-[32m+[m[32m LatLng southwest =[m
-[32m+[m[32m LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);[m
-[32m+[m
-[32m+[m[32m// Create the LatLngBounds object[m
-[32m+[m[32m LatLngBounds boundsData =[m
-[32m+[m[32m LatLngBounds(northeast: northeast, southwest: southwest);[m
-[32m+[m
-[32m+[m[32m// Fit the camera to the bounds[m
-[32m+[m[32m var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 140);[m
-[32m+[m[32m mapController!.animateCamera(cameraUpdate);[m
-[32m+[m[32m }[m
-[32m+[m
- updateCameraForDistanceAfterGetMap() {[m
- if (distance <= 5) {[m
- mapController![m
-[1mdiff --git a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart[m
-[1mindex f37bea3..eb5e3a0 100644[m
-[1m--- a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart[m
-[1m+++ b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart[m
-[36m@@ -20,7 +20,7 @@[m [mGetBuilder driverEndRideBar() {[m
- child: Column([m
- children: [[m
- Row([m
-[31m- mainAxisAlignment: MainAxisAlignment.spaceAround,[m
-[32m+[m[32m mainAxisAlignment: MainAxisAlignment.spaceEvenly,[m
- children: [[m
- Column([m
- children: [[m
-[36m@@ -31,15 +31,6 @@[m [mGetBuilder driverEndRideBar() {[m
- ),[m
- ],[m
- ),[m
-[31m- mapDriverController.remainingTimeTimerRideBegin < 60[m
-[31m- ? MyElevatedButton([m
-[31m- title: 'End Ride'.tr,[m
-[31m- onPressed: () {[m
-[31m- mapDriverController.finishRideFromDriver();[m
-[31m- },[m
-[31m- kolor: AppColor.redColor,[m
-[31m- )[m
-[31m- : const SizedBox(),[m
- Column([m
- children: [[m
- const Icon(Icons.timelapse),[m
-[36m@@ -48,8 +39,30 @@[m [mGetBuilder driverEndRideBar() {[m
- style: AppStyle.title),[m
- ],[m
- ),[m
-[32m+[m[32m Column([m
-[32m+[m[32m children: [[m
-[32m+[m[32m const Icon(Icons.money_sharp),[m
-[32m+[m[32m Text([m
-[32m+[m[32m '${mapDriverController.paymentAmount} ${'\$'.tr}',[m
-[32m+[m[32m style: AppStyle.title),[m
-[32m+[m[32m ],[m
-[32m+[m[32m ),[m
- ],[m
- ),[m
-[32m+[m[32m mapDriverController.remainingTimeTimerRideBegin < 60[m
-[32m+[m[32m ? Row([m
-[32m+[m[32m mainAxisAlignment: MainAxisAlignment.center,[m
-[32m+[m[32m children: [[m
-[32m+[m[32m MyElevatedButton([m
-[32m+[m[32m title: 'End Ride'.tr,[m
-[32m+[m[32m onPressed: () {[m
-[32m+[m[32m mapDriverController.finishRideFromDriver();[m
-[32m+[m[32m },[m
-[32m+[m[32m kolor: AppColor.redColor,[m
-[32m+[m[32m ),[m
-[32m+[m[32m ],[m
-[32m+[m[32m )[m
-[32m+[m[32m : const SizedBox(),[m
- Stack([m
- children: [[m
- LinearProgressIndicator([m