passnger/5/3/4

This commit is contained in:
Hamza-Ayed
2024-05-03 12:33:24 +03:00
parent d26feb7595
commit 90acb96e40
60 changed files with 478 additions and 10752 deletions

View File

@@ -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

View File

@@ -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"
}
}
]
}

View File

@@ -1,4 +1,4 @@
package com.mobileapp.store.ride
package com.sefer_driver
import io.flutter.embedding.android.FlutterActivity

View File

@@ -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"
}

View File

@@ -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"}}}}}}

View File

@@ -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;

View File

@@ -3,9 +3,9 @@
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>594687661098-8e26699cris2k3nj5msj1osi59it9kpf.apps.googleusercontent.com</string>
<string>594687661098-9fnj82nef9oagl98prigdf8qne3ddbto.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.594687661098-8e26699cris2k3nj5msj1osi59it9kpf</string>
<string>com.googleusercontent.apps.594687661098-9fnj82nef9oagl98prigdf8qne3ddbto</string>
<key>API_KEY</key>
<string>AIzaSyCf2mW2h0HD8ZYjwh4VOa2ladw6MJkCDTM</string>
<key>GCM_SENDER_ID</key>
@@ -13,7 +13,7 @@
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>com.mobileapp.store.ride</string>
<string>com.sefer.driver</string>
<key>PROJECT_ID</key>
<string>ride-b1bd8</string>
<key>STORAGE_BUCKET</key>
@@ -29,6 +29,6 @@
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:594687661098:ios:6f69eee1449be943595f53</string>
<string>1:594687661098:ios:4f236057ba0383b0595f53</string>
</dict>
</plist>

View File

@@ -2,25 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<!-- Replace with your own iOS client ID -->
<string>com.googleusercontent.apps.594687661098-8e26699cris2k3nj5msj1osi59it9kpf</string>
<!--
<string>594687661098-8e26699cris2k3nj5msj1osi59it9kpf.apps.googleusercontent.com</string> -->
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>googlechromes</string>
<string>comgooglemaps</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true />
<key>CFBundleDevelopmentRegion</key>
@@ -36,13 +17,26 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Sefer</string>
<string>Sefer Driver</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>21</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.594687661098-9fnj82nef9oagl98prigdf8qne3ddbto</string>
<!--
<string>com.googleusercontent.apps.594687661098-8e26699cris2k3nj5msj1osi59it9kpf</string> -->
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.41</string>
<key>FirebaseAppDelegateProxyEnabled</key>
@@ -51,6 +45,11 @@
<string>YOUR_API_KEY</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>googlechromes</string>
<string>comgooglemaps</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true />
<key>NSCameraUsageDescription</key>

View File

@@ -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());
}
}

View File

@@ -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);

View File

@@ -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());
}
}

View File

@@ -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<dynamic>;
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<MapPassengerController>().isDriverInPassengerWay = true;
Get.find<MapPassengerController>().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<MapPassengerController>().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<dynamic>;
NotificationController().showNotification(
'Driver Finish Trip'.tr,
'you will pay to Driver'.tr + ' ${driverList[3].toString()} \$'.tr,
'tone1');
Get.find<MapPassengerController>().tripFinishedFromDriver();
// if (Get.find<PaymentController>().isCashChecked == false &&
// Get.find<PaymentController>().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<MapPassengerController>().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<dynamic> 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<MapPassengerController>().driverToken, []);
Get.find<MapPassengerController>()
.startTimerDriverWaitPassenger5Minute();
// Future<dynamic> 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<MapDriverController>().driverToken, []);
// Get.find<MapPassengerController>()
// .startTimerDriverWaitPassenger5Minute();
Get.back();
}));
}
// Get.back();
// }));
// }
Future<dynamic> passengerDialog(String message) {
return Get.defaultDialog(
@@ -386,60 +310,60 @@ class FirebaseMessagesController extends GetxController {
}));
}
Future<dynamic> driverFinishTripDialoge(List<dynamic> driverList) {
return Get.defaultDialog(
title: 'Driver Finish Trip'.tr,
content: const DriverTipWidget(),
confirm: MyElevatedButton(
title: 'Yes'.tr,
onPressed: () async {
var tip = (Get.find<MapPassengerController>().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<dynamic> driverFinishTripDialoge(List<dynamic> driverList) {
// return Get.defaultDialog(
// title: 'Driver Finish Trip'.tr,
// content: const DriverTipWidget(),
// confirm: MyElevatedButton(
// title: 'Yes'.tr,
// onPressed: () async {
// var tip = (Get.find<MapPassengerController>().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<MapPassengerController>().rideId}tip',
'amount': (tip * 100).toString(),
'paymentMethod': 'visa-tip',
});
// await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
// 'driverID': driverList[0].toString(),
// 'paymentID': '${Get.find<MapPassengerController>().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<MapPassengerController>().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<MapPassengerController>().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<MapPassengerController>(builder: (controller) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
// Text(
// '${'Your fee is '.tr}${Get.find<MapPassengerController>().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,
),
),
),
],
)
],
);
});
}
}

View File

@@ -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<void> 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<MapPassengerController>().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<void> stopRecording() async {
final path = await recorder.stop();
print(path);
isRecording = false;
update();
}
Future<void> 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<List<String>> 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<void> 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<void> 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<void> 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();
}
}

View File

@@ -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<MapPassengerController>().rideId; // 'sefer300'; //
remoteUid = int.parse(Get.find<MapPassengerController>().driverPhone);
uid = int.parse(box.read(BoxName.phone));
} else {
channelName = Get.find<MapDriverController>().rideId; // 'sefer300'; //
remoteUid = int.parse(Get.find<MapDriverController>().passengerPhone);
uid = int.parse(box.read(BoxName.phoneDriver));
}
channelName = Get.find<MapDriverController>().rideId; // 'sefer300'; //
remoteUid = int.parse(Get.find<MapDriverController>().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<MapPassengerController>().driverToken
: Get.find<MapDriverController>().tokenPassenger,
'${'You have call from driver'.tr} ${box.read(BoxName.nameDriver)}',
Get.find<MapDriverController>().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<MapPassengerController>().driverName : Get.find<MapDriverController>().passengerName}'
' joined'
.tr;
status = '${Get.find<MapDriverController>().passengerName}'
' joined'
.tr;
remoteUid = remoteUid;
update();
},

View File

@@ -106,7 +106,36 @@ class CRUD {
Future.delayed(const Duration(seconds: 2));
String extracted =
await arabicTextExtractByVisionAndAI(imagePath: imagePath);
await AI().geminiAiExtraction(prompt, extracted);
Map<String, dynamic> extractedData = extractText(extracted);
print(extractedData);
// await AI().geminiAiExtraction(prompt, extractedData);
}
Map<String, dynamic> extractText(String jsonData) {
Map<String, dynamic> data = jsonDecode(jsonData);
List<List<String>> textLines = [];
for (var region in data['regions']) {
List<String> 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<String> (lines with words)
// return textLines;
}
Future<dynamic> 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();
}

File diff suppressed because it is too large Load Diff

View File

@@ -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<MapPassengerController>().passengerLocation;
myLocation = Get.find<LocationController>().myLocation;
super.onInit();
}
}

View File

@@ -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());
});
}

View File

@@ -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<FormState>();
final promo = TextEditingController();
double totalPassenger = Get.find<MapPassengerController>().totalPassenger;
double totalPassenger =
double.parse(Get.find<MapDriverController>().totalPassenger);
int? selectedAmount = 0;
List<dynamic> 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<void> makePaymentStripe(

View File

@@ -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<MapPassengerController>().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<MapPassengerController>().driverId.toString(),
'rideID': Get.find<MapPassengerController>().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<MapPassengerController>().driverId.toString(),
'paymentID': '${Get.find<MapPassengerController>().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<MapPassengerController>().totalPassenger)}',
Get.find<MapPassengerController>().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<MapPassengerController>().restCounter();
Get.offAll(const MapPagePassenger());
});
}
}
}

View File

@@ -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',
);
}

View File

@@ -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,

View File

@@ -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<MapPassengerController>().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<PaymentController>().isCashChecked ==
false &&
Get.find<PaymentController>()
.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);
}
}

View File

@@ -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<AI> egyptDriverLicenseWidget() {
return GetBuilder<AI>(
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: <Widget>[
Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
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,

View File

@@ -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<LoginCaptinController>(
builder: (controller) => MyScafolld(
title: 'Login Driver'.tr,
isleading: true,
isleading: false,
body: [
if (box.read(BoxName.agreeTerms) != 'agreed')
agreedPage()

View File

@@ -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<HomeCaptainController> callPage() {
CallController callController = Get.put(CallController());
// callController.initAgoraFull();
return GetBuilder<HomeCaptainController>(
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<MapDriverController>().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<MapPassengerController>()
.driverName
.toString()),
],
),
GestureDetector(
onTap: () async {
FirebaseMessagesController()
.sendNotificationToPassengerToken(
'Call End',
'Call End'.tr,
Get.find<MapPassengerController>().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
),
),
],
),
);
}

View File

@@ -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<AudioRecorderController>(builder: (audio) {
return Column(
children: [
FutureBuilder<List<String>>(
future: audio.getRecordedFiles(),
builder: (context, snapshot) {
if (snapshot.connectionState ==
ConnectionState.waiting) {
return const CircularProgressIndicator();
} else if (snapshot.hasData) {
final recordedFiles = snapshot.data!;
return DropdownButton<String>(
value: audio.selectedFilePath,
onChanged: (value) {
audio.selectedFilePath = value;
audio.playRecordedFile(value!);
audio.update();
},
items: recordedFiles
.map((file) => DropdownMenuItem<String>(
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<TextToSpeechController>()
.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),
),
],
);
}),
);
}),
],
),
],
);
}
}

View File

@@ -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<MapPassengerController>(
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<MapPassengerController>(
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());
}
}

View File

@@ -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<MapPassengerController>(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<MapPassengerController>(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<MapPassengerController>(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();
});
}
}

View File

@@ -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<MapPassengerController> buttomSheetMapPage() {
Get.put(PaymentController());
return GetBuilder<MapPassengerController>(
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<PaymentController>(
builder:
(paymentController) =>
Container(
decoration:
BoxDecoration(
color: AppColor
.secondaryColor,
borderRadius:
BorderRadius
.circular(
12),
),
child: Row(
children: [
Icon(
Icons
.qr_code_2_rounded,
color: Colors
.green[
400],
),
InkWell(
onTap: () {
if (controller
.promoTaken ==
false) {
Get.defaultDialog(
title: 'Add Promo'.tr,
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<MapPassengerController>(
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,
),
],
));
}
}

View File

@@ -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<PassengerCallPage> createState() => _PassengerCallPageState();
}
class _PassengerCallPageState extends State<PassengerCallPage> {
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<ScaffoldMessengerState> scaffoldMessengerKey =
GlobalKey<ScaffoldMessengerState>(); // 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<void> 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: <Widget>[
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,
);
}
}

View File

@@ -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<MapPassengerController> cancelRidePage() {
Get.put(MapPassengerController());
final List<String> 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<MapPassengerController>(
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(),
);
}

View File

@@ -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<CarType> 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<MapPassengerController>(
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<MapPassengerController>(
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,
),
],
);
}
}

View File

@@ -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<MapPassengerController>(
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<PaymentController>(
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<PaymentController>(
builder: (controller) => Checkbox.adaptive(
value: controller.isCashChecked,
onChanged: (value) {
controller
.onChangedPaymentMethodCash(value);
},
))
],
),
const Divider(
color: AppColor.accentColor,
thickness: 1,
height: 2,
indent: 1,
),
// GetBuilder<PaymentController>(
// builder: (paymentController) =>
// (paymentController.isWalletChecked == false &&
// paymentController.isCashChecked == true
// ? MyElevatedButton(
// title: 'Next'.tr,
// onPressed: () {
// controller.changeCashConfirmPageShown();
// },
// )
// : const SizedBox())),
GetBuilder<PaymentController>(
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
)
],
),
),
),
));
}
}

View File

@@ -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<MapPassengerController> hexagonClipper() {
return GetBuilder<MapPassengerController>(
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()));
}

View File

@@ -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<MapPassengerController>(
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();
},
);
}
}

View File

@@ -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<MapPassengerController> 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<MapPassengerController>(
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,
)
],
),
),
);
},
),
)
],
));
}

View File

@@ -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<MapPassengerController> formSearchPlacesStart() {
// DbSql sql = DbSql.instance;
return GetBuilder<MapPassengerController>(
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,
)
],
),
),
);
},
),
)
],
));
}

View File

@@ -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<MapPassengerController> formSearchPlaces(int index) {
// DbSql sql = DbSql.instance;
return GetBuilder<MapPassengerController>(
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,
)
],
),
),
);
},
),
)
],
));
}

View File

@@ -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<MapPassengerController>(
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>{
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<WayPointController>().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,
),
),
);
}
}

View File

@@ -1,52 +0,0 @@
import 'dart:math';
import 'package:flutter/material.dart';
class HexagonClipper extends CustomClipper<Path> {
@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<Path> {
@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;
}

View File

@@ -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<MapPassengerController> leftMainMenuIcons() {
final textToSpeechController = Get.put(TextToSpeechController());
return GetBuilder<MapPassengerController>(
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<AudioRecorderController>().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<PaymentController>()
// // .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<AudioRecorderController>().startRecording();
// },
// icon: Icon(
// Get.put(AudioRecorderController()).isRecording
// ? Icons.stop
// : Icons.start,
// size: 29,
// ),
// ),
// ),
],
);
})),
);
}

View File

@@ -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<MapPassengerController>(
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<MapPassengerController>(
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,
),
)),
));
}
}

View File

@@ -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<MapPassengerController>(
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,
),
],
),
),
),
),
);
});
}
}

View File

@@ -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<MapPassengerController>(
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,
),
),
),
),
));
}
}

View File

@@ -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)} ?",
),
],
),
),
)
],
)
],
),
),
);
}
}

View File

@@ -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<MapPassengerController>(
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();
});
}
}

View File

@@ -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<MapPassengerController>(
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<CreditCardController>(
// 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<CreditCardController>(
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<CreditCardController>(
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';
}
}
}

View File

@@ -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<MapPassengerController>(
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(),
],
),
],
),
),
));
}
}

View File

@@ -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<MapPassengerController>(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<WayPointController>(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<WayPointController>(
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<PointsForRiderController>(
// 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<int>(
// 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,
)
],
);
}
}

View File

@@ -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<MapPassengerController>(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: <Widget>[
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<MapPassengerController>(builder: (controller) {
return StreamBuilder<int>(
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
// },
// ),
],
);
},
);
});
}
}

View File

@@ -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<MapPassengerController>(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: <Widget>[
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();
});
}
}

View File

@@ -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<MapPassengerController>(
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<int>(
// 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
),
)
],
);
},
);
}

View File

@@ -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<MapPassengerController> timerForCancelTripFromPassenger() {
return GetBuilder<MapPassengerController>(
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: <Widget>[
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();
},
);
}

View File

@@ -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<MapPassengerController>(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();
}
});
}
}

View File

@@ -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: [

View File

@@ -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<OrderHistoryController>(
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,
),
],
),
],
),
),
),
),
);
},
),
)
],
);
}
}

View File

@@ -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());
},
)
],

View File

@@ -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());
},
),
],

View File

@@ -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
diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart
index 8c72810..34875b4 100644
--- a/lib/controller/home/captin/map_driver_controller.dart
+++ b/lib/controller/home/captin/map_driver_controller.dart
@@ -226,7 +226,7 @@ class MapDriverController extends GetxController {
});
rideIsBeginPassengerTimer();
double pointsSubstraction = 0;
- pointsSubstraction = double.parse(paymentAmount) * -1;
+ pointsSubstraction = double.parse(paymentAmount) * -100;
var res = await CRUD().post(link: AppLink.addDriversWallet, payload: {
'paymentID': 'rideId$rideId',
'amount': (pointsSubstraction).toString(),
@@ -429,7 +429,12 @@ class MapDriverController extends GetxController {
width: 10,
color: AppColor.blueColor,
);
- mapController!.animateCamera(CameraUpdate.newLatLngZoom(myLocation, 14));
+ // final dataBounds = response["routes"][0]["bounds"];
+
+ // updateCameraFromBoundsAfterGetMap(dataBounds);
+
+// Fit the camera to the bounds
+
polyLines.add(polyline);
// rideConfirm = false;
update();
@@ -468,13 +473,31 @@ class MapDriverController extends GetxController {
width: 10,
color: AppColor.redColor,
);
+ // final dataBounds = response["routes"][0]["bounds"];

- polyLinesDestination.add(polyline);
+ // updateCameraFromBoundsAfterGetMap(dataBounds);
+ // polyLinesDestination.add(polyline);
// rideConfirm = false;
update();
}
}

+ void updateCameraFromBoundsAfterGetMap(dynamic response) {
+ 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, 140);
+ mapController!.animateCamera(cameraUpdate);
+ }
+
void changePassengerInfoWindow() {
isPassengerInfoWindow = !isPassengerInfoWindow;
passengerInfoWindow = isPassengerInfoWindow == true ? 200 : 0;
diff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart
index a2d4712..d4adf6f 100644
--- a/lib/controller/home/map_passenger_controller.dart
+++ b/lib/controller/home/map_passenger_controller.dart
@@ -186,6 +186,7 @@ class MapPassengerController extends GetxController {
late double cost = 0;
late double distance = 0;
late double duration = 0;
+ List dataBounds = [];

late Duration durationToAdd;
late DateTime newTime = DateTime.now();
@@ -218,8 +219,9 @@ class MapPassengerController extends GetxController {
durationToRide = 0;
distanceOfDestnation = 0;
wayPointSheetHeight = 0;
- for (var i = 0; i < Get.find<WayPointController>().wayPoints.length; i++) {
- if (placesCoordinate[i + 1].toString() != '') {
+ for (var i = 0; i < placesCoordinate.length; i++) {
+ if (placesCoordinate[i + 1].toString() != '' ||
+ placesCoordinate[i + 1].toString() != null) {
await getMapPoints(
placesCoordinate[i].toString(),
placesCoordinate[i + 1].toString(),
@@ -227,7 +229,7 @@ class MapPassengerController extends GetxController {
);
}
}
- updateCameraForDistanceAfterGetMap();
+ // updateCameraForDistanceAfterGetMap();
// isWayPointStopsSheet = false;
if (haveSteps) {
String latestWaypoint =
@@ -378,13 +380,9 @@ class MapPassengerController extends GetxController {
}

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)}. 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.';
+ '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);
@@ -392,12 +390,10 @@ class MapPassengerController extends GetxController {

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 ${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.';
+ '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('whatsapp', to, message);
@@ -444,6 +440,44 @@ class MapPassengerController extends GetxController {
}
}

+ // void startTimerToPassengerFromDriverAfterApplied() async {
+ // for (int i = 0; i <= timeToPassengerFromDriverAfterApplied; i++) {
+ // await Future.delayed(const Duration(seconds: 1));
+ // progressTimerToPassengerFromDriverAfterApplied =
+ // i / timeToPassengerFromDriverAfterApplied;
+ // remainingTimeToPassengerFromDriverAfterApplied =
+ // timeToPassengerFromDriverAfterApplied - i;
+
+ // var response = await CRUD().post(
+ // link: AppLink.addAdminUser, ////////change to nnew endpoint
+ // payload: {
+ // 'ride_id': rideId,
+ // 'time_to_passenger_from_driver_after_applied':
+ // timeToPassengerFromDriverAfterApplied,
+ // });
+
+ // if (response.statusCode == 200) {
+ // // Update progress and remaining time
+ // int minutes =
+ // (remainingTimeToPassengerFromDriverAfterApplied / 60).floor();
+ // int seconds = remainingTimeToPassengerFromDriverAfterApplied % 60;
+ // stringRemainingTimeToPassenger =
+ // '$minutes:${seconds.toString().padLeft(2, '0')}';
+ // update();
+
+ // if (remainingTimeToPassengerFromDriverAfterApplied < 69) {
+ // if (rideTimerBegin == false) {
+ // getBeginRideFromDriver();
+ // }
+ // }
+ // } else {
+ // // Handle error
+ // print(
+ // 'Error updating time to passenger: ${response.statusCode} ${response.reasonPhrase} ${response.body}');
+ // }
+ // }
+ // }
+
// Create a StreamController to manage the timer values
final timerController = StreamController<int>();

@@ -579,10 +613,24 @@ class MapPassengerController extends GetxController {
update();
}

+ late String driverPhone;
+ late String firstName;
+ late String model;
+ late String licensePlate;
changeConfirmRide() async {
if (dataCarsLocationByPassenger != 'failure') {
driverToken =
dataCarsLocationByPassenger['message'][carsOrder]['token'].toString();
+ driverPhone =
+ dataCarsLocationByPassenger['message'][carsOrder]['phone'].toString();
+ firstName = dataCarsLocationByPassenger['message'][carsOrder]
+ ['first_name']
+ .toString();
+ model =
+ dataCarsLocationByPassenger['message'][carsOrder]['model'].toString();
+ licensePlate = dataCarsLocationByPassenger['message'][carsOrder]
+ ['license_plate']
+ .toString();
PaymentController paymentController = Get.find<PaymentController>();
rideConfirm = true;
shouldFetch = true;
@@ -617,9 +665,9 @@ class MapPassengerController extends GetxController {
List<String> body = [
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
- totalPassenger.toString(),
+ totalPassenger.toStringAsFixed(2),
totalDriver.toString(),
- duration.toString(),
+ Duration(seconds: durationToRide).toString(),
distance.toString(),
dataCarsLocationByPassenger['message'][carsOrder]['driver_id']
.toString(),
@@ -1442,23 +1490,29 @@ class MapPassengerController extends GetxController {
double lng = points[i][1].toDouble();
polylineCoordinates.add(LatLng(lat, lng));
}
+ newStartPointLocation = LatLng(
+ data[0]["start_location"]['lat'], data[0]["start_location"]['lng']);
// 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
- boundsData = LatLngBounds(northeast: northeast, southwest: southwest);
+// Create the LatLngBounds object
+ LatLngBounds boundsData =
+ LatLngBounds(northeast: northeast, southwest: southwest);
+
+// Fit the camera to the bounds
+ var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 130);
+ mapController!.animateCamera(cameraUpdate);

// Calculate the zoom level based on the distance and screen size

// getDistanceFromText(data[0]['distance']['text']);
double distanceOfTrip = (data[0]['distance']['value']) / 1000;
distance = distanceOfTrip;
- updateCameraForDistanceAfterGetMap();
+ // updateCameraForDistanceAfterGetMap();

if (polyLines.isNotEmpty) {
clearPolyline();
@@ -1506,15 +1560,6 @@ class MapPassengerController extends GetxController {
polylineCoordinatesPointsAll[index].add(LatLng(lat, lng));
}
// 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
- boundsData = LatLngBounds(northeast: northeast, southwest: southwest);

if (polyLines.isNotEmpty) {
// clearPolyline();
@@ -1533,6 +1578,22 @@ class MapPassengerController extends GetxController {
}
}

+ void updateCameraFromBoundsAfterGetMap(dynamic response) {
+ 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, 140);
+ mapController!.animateCamera(cameraUpdate);
+ }
+
updateCameraForDistanceAfterGetMap() {
if (distance <= 5) {
mapController!
diff --git a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart
index f37bea3..eb5e3a0 100644
--- a/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart
+++ b/lib/views/home/Captin/mapDriverWidgets/driver_end_ride_bar.dart
@@ -20,7 +20,7 @@ GetBuilder<MapDriverController> driverEndRideBar() {
child: Column(
children: [
Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
children: [
@@ -31,15 +31,6 @@ GetBuilder<MapDriverController> driverEndRideBar() {
),
],
),
- mapDriverController.remainingTimeTimerRideBegin < 60
- ? MyElevatedButton(
- title: 'End Ride'.tr,
- onPressed: () {
- mapDriverController.finishRideFromDriver();
- },
- kolor: AppColor.redColor,
- )
- : const SizedBox(),
Column(
children: [
const Icon(Icons.timelapse),
@@ -48,8 +39,30 @@ GetBuilder<MapDriverController> driverEndRideBar() {
style: AppStyle.title),
],
),
+ Column(
+ children: [
+ const Icon(Icons.money_sharp),
+ Text(
+ '${mapDriverController.paymentAmount} ${'\$'.tr}',
+ style: AppStyle.title),
+ ],
+ ),
],
),
+ mapDriverController.remainingTimeTimerRideBegin < 60
+ ? Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ MyElevatedButton(
+ title: 'End Ride'.tr,
+ onPressed: () {
+ mapDriverController.finishRideFromDriver();
+ },
+ kolor: AppColor.redColor,
+ ),
+ ],
+ )
+ : const SizedBox(),
Stack(
children: [
LinearProgressIndicator(