This commit is contained in:
Hamza-Ayed
2024-09-04 14:49:36 +03:00
parent 04c47d3431
commit e23709c924
19 changed files with 568 additions and 266 deletions

2
.env
View File

@@ -19,6 +19,8 @@ seferAlexandriaServer=https://seferalexandria.site/sefer
seferPaymentServer=https://seferpw.shop/sefer seferPaymentServer=https://seferpw.shop/sefer
seferCairoServer=https://sefer.click/sefer seferCairoServer=https://sefer.click/sefer
seferGizaServer=https://sefergiza.site/sefer seferGizaServer=https://sefergiza.site/sefer
whatappID=369939736211879
whatsapp=EAAOtbZBSUK74BO6yE1QwIBsRCjPDANdum66xap0ZA7OZA8LqEu8MZAts1kwr12eRiNXtvpJ2ZAFSY5dw3KVSyrUuH8boLjynxdFI4Gh1Q7BCHx275X2uZBwKWZCSrsVN17i6mZAFNYYd25sQv0ZBomeTk02ZCIJot4UqWxK9ZBvxsq1k2yS7lD2NsjZB5EHbpaYGLzxFJ2FCCSX6iHyKXab6ckfK7m19wo77in7Dl3YZD
cohere=Aulwd8y5SPWos0hJhG0toUf8gOhUUrpf5Q2TPmVGXrXlBl cohere=Aulwd8y5SPWos0hJhG0toUf8gOhUUrpf5Q2TPmVGXrXlBl
claudeAiAPI=zg-qbc-qvo39-xWOxIGwWTOzCFBnIYSKKhfyz_KVAvrH-6_4ZEJL68G_QBH26oeTOMMoQug9KuOjjKSP_A4S3SUDlbxR9duVzoQ-MkX_UQQQXrXlBl claudeAiAPI=zg-qbc-qvo39-xWOxIGwWTOzCFBnIYSKKhfyz_KVAvrH-6_4ZEJL68G_QBH26oeTOMMoQug9KuOjjKSP_A4S3SUDlbxR9duVzoQ-MkX_UQQQXrXlBl
payPalClientId=QALymfNI5Tzt4s-ysoz6vD4_nqX0SUtkC_qYV-Ugk5gaM_8Z-kg4L53k8Uux_4jEWXDkNpXGSWPpIzDFXrXlBl payPalClientId=QALymfNI5Tzt4s-ysoz6vD4_nqX0SUtkC_qYV-Ugk5gaM_8Z-kg4L53k8Uux_4jEWXDkNpXGSWPpIzDFXrXlBl

BIN
assets/images/balash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

BIN
assets/start.wav Normal file

Binary file not shown.

View File

@@ -20,8 +20,6 @@
C624C4652BD56D34002834AF /* start.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C45D2BD56D34002834AF /* start.wav */; }; C624C4652BD56D34002834AF /* start.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C45D2BD56D34002834AF /* start.wav */; };
C624C4672BD56D34002834AF /* promo.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C45F2BD56D34002834AF /* promo.wav */; }; C624C4672BD56D34002834AF /* promo.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C45F2BD56D34002834AF /* promo.wav */; };
C624C4682BD56D34002834AF /* cancel.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C4602BD56D34002834AF /* cancel.wav */; }; C624C4682BD56D34002834AF /* cancel.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C4602BD56D34002834AF /* cancel.wav */; };
C624C4692BD56D34002834AF /* iphone_ringtone.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C4612BD56D34002834AF /* iphone_ringtone.wav */; };
C624C46A2BD56D34002834AF /* order1.wav in Resources */ = {isa = PBXBuildFile; fileRef = C624C4622BD56D34002834AF /* order1.wav */; };
C628BC412C316B1200E4D33B /* ding.wav in Resources */ = {isa = PBXBuildFile; fileRef = C628BC402C316B1100E4D33B /* ding.wav */; }; C628BC412C316B1200E4D33B /* ding.wav in Resources */ = {isa = PBXBuildFile; fileRef = C628BC402C316B1100E4D33B /* ding.wav */; };
C6B15AA12B5FB24600746405 /* order.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15A9F2B5FB24600746405 /* order.wav */; }; C6B15AA12B5FB24600746405 /* order.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15A9F2B5FB24600746405 /* order.wav */; };
C6B15AA22B5FB24600746405 /* tone2.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15AA02B5FB24600746405 /* tone2.wav */; }; C6B15AA22B5FB24600746405 /* tone2.wav in Resources */ = {isa = PBXBuildFile; fileRef = C6B15AA02B5FB24600746405 /* tone2.wav */; };
@@ -78,8 +76,6 @@
C624C45D2BD56D34002834AF /* start.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = start.wav; path = ../../android/app/src/main/res/raw/start.wav; sourceTree = "<group>"; }; C624C45D2BD56D34002834AF /* start.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = start.wav; path = ../../android/app/src/main/res/raw/start.wav; sourceTree = "<group>"; };
C624C45F2BD56D34002834AF /* promo.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = promo.wav; path = ../../android/app/src/main/res/raw/promo.wav; sourceTree = "<group>"; }; C624C45F2BD56D34002834AF /* promo.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = promo.wav; path = ../../android/app/src/main/res/raw/promo.wav; sourceTree = "<group>"; };
C624C4602BD56D34002834AF /* cancel.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = cancel.wav; path = ../../android/app/src/main/res/raw/cancel.wav; sourceTree = "<group>"; }; C624C4602BD56D34002834AF /* cancel.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = cancel.wav; path = ../../android/app/src/main/res/raw/cancel.wav; sourceTree = "<group>"; };
C624C4612BD56D34002834AF /* iphone_ringtone.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = iphone_ringtone.wav; path = ../../android/app/src/main/res/raw/iphone_ringtone.wav; sourceTree = "<group>"; };
C624C4622BD56D34002834AF /* order1.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = order1.wav; path = ../../android/app/src/main/res/raw/order1.wav; sourceTree = "<group>"; };
C628BC402C316B1100E4D33B /* ding.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = ding.wav; path = ../../android/app/src/main/res/raw/ding.wav; sourceTree = "<group>"; }; C628BC402C316B1100E4D33B /* ding.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = ding.wav; path = ../../android/app/src/main/res/raw/ding.wav; sourceTree = "<group>"; };
C69588332A8C1F6B00C3AC67 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; }; C69588332A8C1F6B00C3AC67 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
C6B15A9F2B5FB24600746405 /* order.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = order.wav; sourceTree = "<group>"; }; C6B15A9F2B5FB24600746405 /* order.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = order.wav; sourceTree = "<group>"; };
@@ -168,8 +164,6 @@
C6B15A9F2B5FB24600746405 /* order.wav */, C6B15A9F2B5FB24600746405 /* order.wav */,
C6B15AA02B5FB24600746405 /* tone2.wav */, C6B15AA02B5FB24600746405 /* tone2.wav */,
C624C4602BD56D34002834AF /* cancel.wav */, C624C4602BD56D34002834AF /* cancel.wav */,
C624C4612BD56D34002834AF /* iphone_ringtone.wav */,
C624C4622BD56D34002834AF /* order1.wav */,
C628BC402C316B1100E4D33B /* ding.wav */, C628BC402C316B1100E4D33B /* ding.wav */,
C624C45F2BD56D34002834AF /* promo.wav */, C624C45F2BD56D34002834AF /* promo.wav */,
C624C45D2BD56D34002834AF /* start.wav */, C624C45D2BD56D34002834AF /* start.wav */,
@@ -295,14 +289,12 @@
C6B15AA22B5FB24600746405 /* tone2.wav in Resources */, C6B15AA22B5FB24600746405 /* tone2.wav in Resources */,
C624C4652BD56D34002834AF /* start.wav in Resources */, C624C4652BD56D34002834AF /* start.wav in Resources */,
C624C4672BD56D34002834AF /* promo.wav in Resources */, C624C4672BD56D34002834AF /* promo.wav in Resources */,
C624C46A2BD56D34002834AF /* order1.wav in Resources */,
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
C624C4682BD56D34002834AF /* cancel.wav in Resources */, C624C4682BD56D34002834AF /* cancel.wav in Resources */,
C6B15AA12B5FB24600746405 /* order.wav in Resources */, C6B15AA12B5FB24600746405 /* order.wav in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
C628BC412C316B1200E4D33B /* ding.wav in Resources */, C628BC412C316B1200E4D33B /* ding.wav in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
C624C4692BD56D34002834AF /* iphone_ringtone.wav in Resources */,
C624C4642BD56D34002834AF /* tone1.mp3 in Resources */, C624C4642BD56D34002834AF /* tone1.mp3 in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
C60CA7372BE9EF38002095B2 /* GoogleService-Info.plist in Resources */, C60CA7372BE9EF38002095B2 /* GoogleService-Info.plist in Resources */,

View File

@@ -4,7 +4,7 @@ import 'package:SEFER/main.dart';
class AppLink { class AppLink {
static final String seferPaymentServer0 = Env.seferPaymentServer; static final String seferPaymentServer0 = Env.seferPaymentServer;
static final String seferPaymentServer = '${Env.seferCairoServer}/ride'; static final String seferPaymentServer = '${Env.seferPaymentServer}/ride';
static final String seferAlexandriaServer = Env.seferAlexandriaServer; static final String seferAlexandriaServer = Env.seferAlexandriaServer;
static final String seferCairoServer = Env.seferCairoServer; static final String seferCairoServer = Env.seferCairoServer;
static final String seferGizaServer = Env.seferGizaServer; static final String seferGizaServer = Env.seferGizaServer;
@@ -188,6 +188,7 @@ class AppLink {
static String addpassengerLocation = "$location/addpassengerLocation.php"; static String addpassengerLocation = "$location/addpassengerLocation.php";
static String getCarsLocationByPassengerSpeed = "$location/getSpeed.php"; static String getCarsLocationByPassengerSpeed = "$location/getSpeed.php";
static String getCarsLocationByPassengerComfort = "$location/getComfort.php"; static String getCarsLocationByPassengerComfort = "$location/getComfort.php";
static String getCarsLocationByPassengerBalash = "$location/getBalash.php";
static String getCarsLocationByPassengerDelivery = static String getCarsLocationByPassengerDelivery =
"$location/getDelivery.php"; "$location/getDelivery.php";
static String getLocationParents = "$location/getLocationParents.php"; static String getLocationParents = "$location/getLocationParents.php";

View File

@@ -96,6 +96,22 @@ class RegisterController extends GetxController {
return validPrefixes.hasMatch(phoneNumber); return validPrefixes.hasMatch(phoneNumber);
} }
bool isValidPhoneNumber(String phoneNumber) {
// Remove any whitespace from the phone number
phoneNumber = phoneNumber.replaceAll(RegExp(r'\s+'), '');
// Check if the phone number has at least 10 digits
if (phoneNumber.length < 10) {
return false;
}
// Check for valid prefixes (modify this to match your use case)
RegExp validPrefixes = RegExp(r'^[0-9]+$');
// Check if the phone number contains only digits
return validPrefixes.hasMatch(phoneNumber);
}
sendOtpMessage() async { sendOtpMessage() async {
SmsEgyptController smsEgyptController = Get.put(SmsEgyptController()); SmsEgyptController smsEgyptController = Get.put(SmsEgyptController());
@@ -104,7 +120,7 @@ class RegisterController extends GetxController {
update(); update();
if (formKey3.currentState!.validate()) { if (formKey3.currentState!.validate()) {
if (box.read(BoxName.countryCode) == 'Egypt') { if (box.read(BoxName.countryCode) == 'Egypt') {
if (isValidEgyptianPhoneNumber(phoneController.text)) { if (isValidEgyptianPhoneNumber(phoneController.text) == true) {
var responseCheker = await CRUD() var responseCheker = await CRUD()
.post(link: AppLink.checkPhoneNumberISVerfiedPassenger, payload: { .post(link: AppLink.checkPhoneNumberISVerfiedPassenger, payload: {
'phone_number': '+2${phoneController.text}', 'phone_number': '+2${phoneController.text}',
@@ -148,16 +164,32 @@ class RegisterController extends GetxController {
// Get.snackbar(responseCheker, 'message'); // Get.snackbar(responseCheker, 'message');
} }
} else if (isValidPhoneNumber(phoneController.text)) {
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
'phone_number': '+${phoneController.text}',
'token': randomNumber.toString(),
});
await smsEgyptController.sendWhatsAppAuth(
phoneController.text, randomNumber.toString());
// await smsEgyptController.sendSmsEgypt(
// phoneController.text.toString(), randomNumber.toString());
isSent = true;
remainingTime = 300; // Reset to 5 minutes
startTimer();
isLoading = false;
update();
} else { } else {
Get.snackbar('Phone Number wrong'.tr, '', Get.snackbar('Phone Number wrong'.tr, '',
backgroundColor: AppColor.redColor); backgroundColor: AppColor.redColor,
duration: const Duration(seconds: 5));
} }
} }
} }
} }
verifySMSCode() async { verifySMSCode() async {
if (formKey3.currentState!.validate()) { // if (formKey3.currentState!.validate()) {
if (isValidEgyptianPhoneNumber(phoneController.text)) {
var res = await CRUD().post(link: AppLink.verifyOtpMessage, payload: { var res = await CRUD().post(link: AppLink.verifyOtpMessage, payload: {
'phone_number': '+2${phoneController.text}', 'phone_number': '+2${phoneController.text}',
'token': verifyCode.text.toString(), 'token': verifyCode.text.toString(),
@@ -199,6 +231,48 @@ class RegisterController extends GetxController {
'Error'.tr, "The email or phone number is already registered.".tr, 'Error'.tr, "The email or phone number is already registered.".tr,
backgroundColor: Colors.redAccent); backgroundColor: Colors.redAccent);
} }
} else {
var res = await CRUD().post(link: AppLink.verifyOtpMessage, payload: {
'phone_number': '+${phoneController.text}',
'token': verifyCode.text.toString(),
});
if (res != 'failure') {
// var dec = jsonDecode(res);
box.write(BoxName.phoneDriver, '+${phoneController.text}');
var payload = {
'id': box.read(BoxName.passengerID),
'phone': '+${phoneController.text}',
'email': box.read(BoxName.email),
'password': 'unknown',
'gender': 'unknown',
'birthdate': '2002-01-01',
'site': 'unknown',
'first_name': box.read(BoxName.name).toString().split(' ')[0],
'last_name': box.read(BoxName.name).toString().split(' ')[1],
};
var res1 = await CRUD().post(
link: AppLink.signUp,
payload: payload,
);
if (res1 != 'failure') {
CRUD().post(
link: '${AppLink.seferAlexandriaServer}/auth/signup.php',
payload: payload,
);
CRUD().post(
link: '${AppLink.seferGizaServer}/auth/signup.php',
payload: payload,
);
box.write(BoxName.isVerified, '1');
box.write(BoxName.phone, '+${phoneController.text}');
Get.offAll(const MapPagePassenger());
}
} else {
Get.snackbar(
'Error'.tr, "The email or phone number is already registered.".tr,
backgroundColor: Colors.redAccent);
}
} }
} }

View File

@@ -1,6 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:SEFER/controller/home/map_passenger_controller.dart';
// import 'package:flutter_sound/flutter_sound.dart'; // import 'package:flutter_sound/flutter_sound.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
@@ -13,12 +12,23 @@ class AudioRecorderController extends GetxController {
AudioRecorder recorder = AudioRecorder(); AudioRecorder recorder = AudioRecorder();
bool isRecording = false; bool isRecording = false;
bool isPlaying = false;
bool isPaused = false;
String filePath = ''; String filePath = '';
String? selectedFilePath; String? selectedFilePath;
double currentPosition = 0; double currentPosition = 0;
double totalDuration = 0; double totalDuration = 0;
String? selectedFile;
Future<void> playSoundFromAssets(String sound) async {
try {
await audioPlayer.setAsset(sound);
audioPlayer.play();
} catch (e) {
print("Error playing sound: $e");
}
}
// Start recording
Future<void> startRecording() async { Future<void> startRecording() async {
final bool isPermissionGranted = await recorder.hasPermission(); final bool isPermissionGranted = await recorder.hasPermission();
if (!isPermissionGranted) { if (!isPermissionGranted) {
@@ -48,26 +58,76 @@ class AudioRecorderController extends GetxController {
update(); update();
} }
Future<void> stopRecording() async { // Pause recording
final path = await recorder.stop(); Future<void> pauseRecording() async {
isRecording = false; if (isRecording && !isPaused) {
update(); await recorder.pause();
} isPaused = true;
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(); update();
} }
} }
// Resume recording
Future<void> resumeRecording() async {
if (isRecording && isPaused) {
await recorder.resume();
isPaused = false;
update();
}
}
// Stop recording
Future<void> stopRecording() async {
await recorder.stop();
isRecording = false;
isPaused = false;
update();
}
// Play the selected recorded file
Future<void> playRecordedFile(String filePath) async {
await audioPlayer.setFilePath(filePath);
totalDuration = audioPlayer.duration?.inSeconds.toDouble() ?? 0;
audioPlayer.play();
isPlaying = true;
isPaused = false;
audioPlayer.positionStream.listen((position) {
currentPosition = position.inSeconds.toDouble();
update();
});
selectedFilePath = filePath;
update();
}
// Pause playback
Future<void> pausePlayback() async {
if (isPlaying && !isPaused) {
await audioPlayer.pause();
isPaused = true;
update();
}
}
// Resume playback
Future<void> resumePlayback() async {
if (isPlaying && isPaused) {
await audioPlayer.play();
isPaused = false;
update();
}
}
// Stop playback
Future<void> stopPlayback() async {
await audioPlayer.stop();
isPlaying = false;
isPaused = false;
currentPosition = 0;
update();
}
// Get a list of recorded files
Future<List<String>> getRecordedFiles() async { Future<List<String>> getRecordedFiles() async {
final directory = await getApplicationDocumentsDirectory(); final directory = await getApplicationDocumentsDirectory();
final files = await directory.list().toList(); final files = await directory.list().toList();
@@ -77,25 +137,16 @@ class AudioRecorderController extends GetxController {
.toList(); .toList();
} }
Future<void> playRecordedFile(String filePath) async { // Delete a specific recorded file
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 { Future<void> deleteRecordedFile(String filePath) async {
final file = File(filePath); final file = File(filePath);
if (await file.exists()) { if (await file.exists()) {
await file.delete(); await file.delete();
await getRecordedFiles(); update();
} else {} }
} }
// Delete all recorded files
Future<void> deleteAllRecordedFiles() async { Future<void> deleteAllRecordedFiles() async {
final directory = await getApplicationDocumentsDirectory(); final directory = await getApplicationDocumentsDirectory();
final files = await directory.list().toList(); final files = await directory.list().toList();

View File

@@ -5,6 +5,7 @@ import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/info.dart'; import 'package:SEFER/constant/info.dart';
import 'package:SEFER/constant/links.dart'; import 'package:SEFER/constant/links.dart';
import 'package:SEFER/controller/auth/login_controller.dart'; import 'package:SEFER/controller/auth/login_controller.dart';
import 'package:SEFER/env/env.dart';
import 'package:SEFER/main.dart'; import 'package:SEFER/main.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -58,7 +59,7 @@ class SmsEgyptController extends GetxController {
); );
} else { } else {
Get.defaultDialog( Get.defaultDialog(
title: 'You will receive code in sms message'.tr, title: 'You will receive a code in SMS message'.tr,
middleText: '', middleText: '',
confirm: MyElevatedButton( confirm: MyElevatedButton(
title: 'OK'.tr, title: 'OK'.tr,
@@ -107,4 +108,52 @@ class SmsEgyptController extends GetxController {
headers: headers, headers: headers,
); );
} }
Future sendWhatsAppAuth(String to, String token) async {
var headers = {
'Authorization': 'Bearer ${Env.whatsapp}',
'Content-Type': 'application/json'
};
var request = http.Request(
'POST',
Uri.parse(
'https://graph.facebook.com/v20.0/${Env.whatappID}/messages'));
request.body = json.encode({
"messaging_product": "whatsapp",
"to": to, //"962798583052",
"type": "template",
"template": {
"name": "sefer1",
"language": {"code": "en"},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": token,
}
]
}
]
}
});
request.headers.addAll(headers);
http.StreamedResponse response = await request.send();
if (response.statusCode == 200) {
print(await response.stream.bytesToString());
Get.defaultDialog(
title: 'You will receive a code in WhatsApp Messenger'.tr,
middleText: '',
confirm: MyElevatedButton(
title: 'OK'.tr,
onPressed: () {
Get.back();
}));
} else {
print(response.reasonPhrase);
}
}
} }

View File

@@ -231,6 +231,7 @@ class MapPassengerController extends GetxController {
late double totalPassengerComfortDiscount = 0; late double totalPassengerComfortDiscount = 0;
late double totalPassengerLadyDiscount = 0; late double totalPassengerLadyDiscount = 0;
late double totalPassengerSpeedDiscount = 0; late double totalPassengerSpeedDiscount = 0;
late double totalPassengerBalashDiscount = 0;
late double totalPassengerRaihGaiDiscount = 0; late double totalPassengerRaihGaiDiscount = 0;
late double totalPassengerMotoDelivery = 0; late double totalPassengerMotoDelivery = 0;
late double totalDriver = 0; late double totalDriver = 0;
@@ -1132,50 +1133,50 @@ class MapPassengerController extends GetxController {
Log.print( Log.print(
'body: ${dataCarsLocationByPassenger['message'][carsOrder]['token']}'); 'body: ${dataCarsLocationByPassenger['message'][carsOrder]['token']}');
}); });
// CRUD().post( CRUD().post(
// link: '${AppLink.seferAlexandriaServer}/ride/rides/add.php', link: '${AppLink.seferAlexandriaServer}/ride/rides/add.php',
// payload: { payload: {
// "start_location": //'${data[0]['start_address']}', "start_location": //'${data[0]['start_address']}',
// '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}', '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
// "end_location": //'${data[0]['end_address']}', "end_location": //'${data[0]['end_address']}',
// '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}', '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
// "date": DateTime.now().toString(), "date": DateTime.now().toString(),
// "time": DateTime.now().toString(), "time": DateTime.now().toString(),
// "endtime": durationToAdd.toString(), "endtime": durationToAdd.toString(),
// "price": totalPassenger.toStringAsFixed(2), "price": totalPassenger.toStringAsFixed(2),
// "passenger_id": box.read(BoxName.passengerID).toString(), "passenger_id": box.read(BoxName.passengerID).toString(),
// "driver_id": dataCarsLocationByPassenger['message'][carsOrder] "driver_id": dataCarsLocationByPassenger['message'][carsOrder]
// ['driver_id'] ['driver_id']
// .toString(), .toString(),
// "status": "waiting", "status": "waiting",
// 'carType': box.read(BoxName.carType), 'carType': box.read(BoxName.carType),
// "price_for_driver": totalPassenger.toString(), "price_for_driver": totalPassenger.toString(),
// "price_for_passenger": totalME.toString(), "price_for_passenger": totalME.toString(),
// "distance": distance.toString(), "distance": distance.toString(),
// "paymentMethod": paymentController.isWalletChecked.toString(), "paymentMethod": paymentController.isWalletChecked.toString(),
// }); });
// CRUD().post( CRUD().post(
// link: '${AppLink.seferGizaServer}/ride/rides/add.php', link: '${AppLink.seferGizaServer}/ride/rides/add.php',
// payload: { payload: {
// "start_location": //'${data[0]['start_address']}', "start_location": //'${data[0]['start_address']}',
// '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}', '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
// "end_location": //'${data[0]['end_address']}', "end_location": //'${data[0]['end_address']}',
// '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}', '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
// "date": DateTime.now().toString(), "date": DateTime.now().toString(),
// "time": DateTime.now().toString(), "time": DateTime.now().toString(),
// "endtime": durationToAdd.toString(), "endtime": durationToAdd.toString(),
// "price": totalPassenger.toStringAsFixed(2), "price": totalPassenger.toStringAsFixed(2),
// "passenger_id": box.read(BoxName.passengerID).toString(), "passenger_id": box.read(BoxName.passengerID).toString(),
// "driver_id": dataCarsLocationByPassenger['message'][carsOrder] "driver_id": dataCarsLocationByPassenger['message'][carsOrder]
// ['driver_id'] ['driver_id']
// .toString(), .toString(),
// "status": "waiting", "status": "waiting",
// 'carType': box.read(BoxName.carType), 'carType': box.read(BoxName.carType),
// "price_for_driver": totalPassenger.toString(), "price_for_driver": totalPassenger.toString(),
// "price_for_passenger": totalME.toString(), "price_for_passenger": totalME.toString(),
// "distance": distance.toString(), "distance": distance.toString(),
// "paymentMethod": paymentController.isWalletChecked.toString(), "paymentMethod": paymentController.isWalletChecked.toString(),
// }); });
delayAndFetchRideStatus(rideId); delayAndFetchRideStatus(rideId);
if (shouldFetch == false) { if (shouldFetch == false) {
@@ -1292,6 +1293,9 @@ class MapPassengerController extends GetxController {
showAndResearchForCaptain(); showAndResearchForCaptain();
// delayAndFetchRideStatusForAllDriverAvailable(rideId); // delayAndFetchRideStatusForAllDriverAvailable(rideId);
} else if (res.toString() == 'Apply') { } else if (res.toString() == 'Apply') {
// todo play sound
Get.find<AudioRecorderController>()
.playSoundFromAssets('assets/start.wav');
timer.cancel(); // Stop the current timer timer.cancel(); // Stop the current timer
shouldFetch = false; // Stop further fetches shouldFetch = false; // Stop further fetches
statusRide = 'Apply'; statusRide = 'Apply';
@@ -1326,6 +1330,7 @@ class MapPassengerController extends GetxController {
"No Captain Accepted Your Order".tr, "No Captain Accepted Your Order".tr,
"We are looking for a captain but the price may increase to let a captain accept" "We are looking for a captain but the price may increase to let a captain accept"
.tr, .tr,
duration: const Duration(seconds: 5),
backgroundColor: AppColor.yellowColor, backgroundColor: AppColor.yellowColor,
); );
} }
@@ -1338,7 +1343,7 @@ class MapPassengerController extends GetxController {
Log.print('tick delayAndFetchRideStatusForAllDriverAvailable: ${tick}'); Log.print('tick delayAndFetchRideStatusForAllDriverAvailable: ${tick}');
void fetchRideStatus() async { void fetchRideStatus() async {
if (attemptCounter < maxAttempts && !isApplied) { if (attemptCounter < maxAttempts && !isApplied && tick < 20) {
attemptCounter++; attemptCounter++;
tick++; tick++;
var res = await getRideStatus(rideId); var res = await getRideStatus(rideId);
@@ -1673,6 +1678,9 @@ class MapPassengerController extends GetxController {
timer.cancel(); timer.cancel();
} else { } else {
attempt++; attempt++;
if (reloadCount >= 3 || tick > 18 || reloadCount > 15) {
timer.cancel();
}
Log.print( Log.print(
'Incrementing attempt to: ${attempt}'); // Log incremented attempt 'Incrementing attempt to: ${attempt}'); // Log incremented attempt
@@ -1761,6 +1769,15 @@ class MapPassengerController extends GetxController {
'northeastLon': bounds.northeast.longitude.toString(), 'northeastLon': bounds.northeast.longitude.toString(),
}); });
break; break;
case 'Balash':
res = await CRUD()
.get(link: AppLink.getCarsLocationByPassengerBalash, payload: {
'southwestLat': bounds.southwest.latitude.toString(),
'southwestLon': bounds.southwest.longitude.toString(),
'northeastLat': bounds.northeast.latitude.toString(),
'northeastLon': bounds.northeast.longitude.toString(),
});
break;
default: default:
res = await CRUD() res = await CRUD()
.get(link: AppLink.getCarsLocationByPassenger, payload: { .get(link: AppLink.getCarsLocationByPassenger, payload: {
@@ -2667,10 +2684,10 @@ class MapPassengerController extends GetxController {
// }); // });
// } // }
bool reloadStartApp = false; bool reloadStartApp = false;
int reloadCount = 0;
startMarkerReloading() async { startMarkerReloading() async {
Log.print('AppLink.endPoint: ${AppLink.endPoint}'); Log.print('AppLink.endPoint: ${AppLink.endPoint}');
int reloadCount = 0;
if (reloadStartApp == false) { if (reloadStartApp == false) {
Timer.periodic(const Duration(seconds: 5), (timer) async { Timer.periodic(const Duration(seconds: 5), (timer) async {
reloadCount++; reloadCount++;
@@ -3249,6 +3266,7 @@ class MapPassengerController extends GetxController {
double costForDriver = 0; double costForDriver = 0;
double totalPassengerSpeed = 0; double totalPassengerSpeed = 0;
double totalPassengerBalash = 0;
double totalPassengerLady = 0; double totalPassengerLady = 0;
double totalPassengerRayehGai = 0; double totalPassengerRayehGai = 0;
Future bottomSheet() async { Future bottomSheet() async {
@@ -3262,12 +3280,18 @@ class MapPassengerController extends GetxController {
// costDuration = (durationToRide / 60) * averageDuration * 0.016; // costDuration = (durationToRide / 60) * averageDuration * 0.016;
costDuration = (durationToRide / 60).floorToDouble(); costDuration = (durationToRide / 60).floorToDouble();
'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}'; 'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}';
double costComfort, costSpeed, costDelivery, costLady, costRayehGai = 0; double costComfort,
costSpeed,
costDelivery,
costBalash,
costLady,
costRayehGai = 0;
update(); update();
if (currentTime.hour >= 22 && currentTime.hour < 5) { if (currentTime.hour >= 22 && currentTime.hour < 5) {
// costDistance = distance * latePrice; // costDistance = distance * latePrice;
costComfort = (distance * comfortPrice) + costDuration * latePrice; costComfort = (distance * comfortPrice) + costDuration * latePrice;
costSpeed = (distance * speedPrice) + costDuration * latePrice; costSpeed = (distance * speedPrice) + costDuration * latePrice;
costBalash = (distance * (speedPrice - 1)) + costDuration * latePrice;
costDelivery = (distance * deliveryPrice) + costDuration * latePrice; costDelivery = (distance * deliveryPrice) + costDuration * latePrice;
costLady = (distance * comfortPrice + 2) + costDuration * latePrice; costLady = (distance * comfortPrice + 2) + costDuration * latePrice;
costRayehGai = (distance * 2 * speedPrice) - costRayehGai = (distance * 2 * speedPrice) -
@@ -3280,6 +3304,7 @@ class MapPassengerController extends GetxController {
// costDistance = distance * heavyPrice; // costDistance = distance * heavyPrice;
costComfort = (distance * comfortPrice) + costDuration * heavyPrice; costComfort = (distance * comfortPrice) + costDuration * heavyPrice;
costSpeed = (distance * speedPrice) + costDuration * heavyPrice; costSpeed = (distance * speedPrice) + costDuration * heavyPrice;
costBalash = (distance * (speedPrice - 1)) + costDuration * heavyPrice;
costDelivery = (distance * deliveryPrice) + costDuration * heavyPrice; costDelivery = (distance * deliveryPrice) + costDuration * heavyPrice;
costLady = (distance * comfortPrice + 2) + costDuration * heavyPrice; costLady = (distance * comfortPrice + 2) + costDuration * heavyPrice;
costRayehGai = (distance * 2 * speedPrice) - costRayehGai = (distance * 2 * speedPrice) -
@@ -3292,6 +3317,7 @@ class MapPassengerController extends GetxController {
// costDistance = distance * (naturePrice - .1); // costDistance = distance * (naturePrice - .1);
costComfort = (distance * comfortPrice) + costDuration; costComfort = (distance * comfortPrice) + costDuration;
costSpeed = (distance * speedPrice) + costDuration; costSpeed = (distance * speedPrice) + costDuration;
costBalash = (distance * (speedPrice - 1)) + costDuration;
costDelivery = (distance * deliveryPrice) + costDuration; costDelivery = (distance * deliveryPrice) + costDuration;
costLady = (distance * comfortPrice + 2) + costDuration; costLady = (distance * comfortPrice + 2) + costDuration;
costRayehGai = (distance * 2 * speedPrice) - costRayehGai = (distance * 2 * speedPrice) -
@@ -3308,6 +3334,8 @@ class MapPassengerController extends GetxController {
totalPassengerLady = (costLady + (costLady * kazan / 100)).ceilToDouble(); totalPassengerLady = (costLady + (costLady * kazan / 100)).ceilToDouble();
totalPassengerSpeed = totalPassengerSpeed =
(costSpeed + (costSpeed * kazan / 100)).ceilToDouble(); (costSpeed + (costSpeed * kazan / 100)).ceilToDouble();
totalPassengerBalash =
(costBalash + (costBalash * kazan / 100)).ceilToDouble();
totalPassengerRayehGai = totalPassengerRayehGai =
(costRayehGai + (costRayehGai * kazan / 100)).ceilToDouble(); (costRayehGai + (costRayehGai * kazan / 100)).ceilToDouble();
totalPassengerComfortDiscount = totalPassengerComfortDiscount =
@@ -3315,15 +3343,19 @@ class MapPassengerController extends GetxController {
totalPassengerLadyDiscount = totalPassengerLadyDiscount =
totalPassengerLady + totalPassengerLady * (kazan - 0) / 100; totalPassengerLady + totalPassengerLady * (kazan - 0) / 100;
totalPassengerSpeedDiscount = totalPassengerSpeedDiscount =
totalPassengerSpeed + totalPassengerSpeed * (kazan - 2) / 100; totalPassengerSpeed + totalPassengerSpeed * (kazan) / 100;
totalPassengerBalashDiscount =
totalPassengerBalash + totalPassengerBalash * (kazan) / 100;
totalPassengerRaihGaiDiscount = totalPassengerRaihGaiDiscount =
totalPassengerRayehGai + totalPassengerRayehGai * (kazan - 2) / 100; totalPassengerRayehGai + totalPassengerRayehGai * (kazan) / 100;
totalPassengerMotoDelivery = totalPassengerMotoDelivery =
(costDelivery + (costDelivery * kazan / 100)).ceilToDouble(); (costDelivery + (costDelivery * kazan / 100)).ceilToDouble();
totalPassengerComfort = totalPassengerComfortDiscount - totalPassengerComfort = totalPassengerComfortDiscount -
(totalPassengerComfortDiscount * kazan / 100); (totalPassengerComfortDiscount * kazan / 100);
totalPassengerSpeed = totalPassengerSpeedDiscount - totalPassengerSpeed = totalPassengerSpeedDiscount -
(totalPassengerSpeedDiscount * kazan / 100); (totalPassengerSpeedDiscount * kazan / 100);
totalPassengerBalash = totalPassengerBalashDiscount -
(totalPassengerBalashDiscount * kazan / 100);
totalPassengerLady = totalPassengerLadyDiscount - totalPassengerLady = totalPassengerLadyDiscount -
(totalPassengerLadyDiscount * kazan / 100); (totalPassengerLadyDiscount * kazan / 100);
totalDriver = totalDriver1 + (totalDriver1 * kazan / 100); totalDriver = totalDriver1 + (totalDriver1 * kazan / 100);
@@ -3334,6 +3366,7 @@ class MapPassengerController extends GetxController {
// for eygpt 20 le open ride // for eygpt 20 le open ride
totalCostPassenger = 20; totalCostPassenger = 20;
totalPassengerSpeed = 20; totalPassengerSpeed = 20;
totalPassengerBalash = 20;
totalPassengerComfort = 30; totalPassengerComfort = 30;
totalPassengerLady = 30; totalPassengerLady = 30;
totalPassengerMotoDelivery = 18; totalPassengerMotoDelivery = 18;
@@ -3348,6 +3381,8 @@ class MapPassengerController extends GetxController {
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal))); (-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
totalPassengerLady = totalPassengerLady + totalPassengerLady = totalPassengerLady +
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal))); (-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
totalPassengerBalash = totalPassengerBalash +
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
totalPassengerMotoDelivery = totalPassengerMotoDelivery + totalPassengerMotoDelivery = totalPassengerMotoDelivery +
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal))); (-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
update(); update();

View File

@@ -590,6 +590,11 @@ iOS [https://getapp.cc/app/6458734951]
" I am currently located at ": "أَنَا حَالِيًّا فِي", " I am currently located at ": "أَنَا حَالِيًّا فِي",
"Please go to Car now ": "Please go to Car now ":
'الرَّجَاء التَّحَرُّك إِلَى السَّيَّارَة الآن', 'الرَّجَاء التَّحَرُّك إِلَى السَّيَّارَة الآن',
'You will receive a code in WhatsApp Messenger':
"سوف تتلقى رمزًا في واتساب ماسنجر",
'Balash': 'أوفر كار',
"Old and affordable, perfect for budget rides.":
"سيارة ميسورة التكلفة، مثالية للرحلات الاقتصادية.",
" If you need to reach me, please contact the driver directly at": " If you need to reach me, please contact the driver directly at":
"إِذَا كُنْت تَحْتَاج إِلَى التَّوَاصُل مَعِي، يُرْجَى التَّوَاصُل مَع السَّائِق مُبَاشَرَةً عَلَى", "إِذَا كُنْت تَحْتَاج إِلَى التَّوَاصُل مَعِي، يُرْجَى التَّوَاصُل مَع السَّائِق مُبَاشَرَةً عَلَى",
"No Car or Driver Found in your area.": "No Car or Driver Found in your area.":
@@ -920,6 +925,8 @@ iOS [https://getapp.cc/app/6458734951]
"Point": "نقطة", "Point": "نقطة",
"Driver Wallet": "محفظة السائق", "Driver Wallet": "محفظة السائق",
"Total Points is": "إجمالي النقاط هو", "Total Points is": "إجمالي النقاط هو",
"You will receive a code in SMS message":
"سوف تتلقى رمزًا في رسالة SMS",
"Total Budget from trips is ": "إجمالي الميزانية من الرحلات هو ", "Total Budget from trips is ": "إجمالي الميزانية من الرحلات هو ",
"Total Amount:": "المبلغ الإجمالي:", "Total Amount:": "المبلغ الإجمالي:",
"Total Budget from trips by\nCredit card is ": "Total Budget from trips by\nCredit card is ":

View File

@@ -72,7 +72,7 @@ class SplashScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Text(
box.read(BoxName.packagInfo) ?? '1.4.54', box.read(BoxName.packagInfo) ?? '1.4.61',
style: AppStyle.subtitle, style: AppStyle.subtitle,
), ),
], ],

View File

@@ -0,0 +1,153 @@
import 'package:SEFER/views/widgets/my_scafold.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:share/share.dart';
import 'package:path/path.dart' as path;
import '../../../constant/colors.dart';
import '../../../constant/style.dart';
import '../../../controller/functions/audio_record1.dart';
import '../../../controller/functions/tts.dart';
import '../../widgets/elevated_btn.dart';
class TripsRecordedPage extends StatelessWidget {
const TripsRecordedPage({
super.key,
});
@override
Widget build(BuildContext context) {
return MyScafolld(
title: 'Trips recorded'.tr,
body: [
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.audioPlayer.seek(Duration(seconds: value.toInt()));
},
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
IconButton(
icon: Icon(
audio.isPlaying ? Icons.pause : Icons.play_arrow),
onPressed: () {
if (audio.isPlaying) {
audio.pausePlayback();
} else {
audio.resumePlayback();
}
audio.update();
},
),
IconButton(
icon: const Icon(Icons.stop),
onPressed: () {
audio.stopPlayback();
audio.update();
},
),
IconButton(
icon: const Icon(Icons.delete),
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.deleteAllRecordedFiles();
Get.back();
Get.back();
},
),
);
},
),
],
),
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!]);
},
),
],
),
),
),
],
);
}),
],
isleading: true);
}
}

View File

@@ -1,18 +1,14 @@
import 'package:SEFER/controller/functions/tts.dart';
import 'package:SEFER/controller/home/home_page_controller.dart'; import 'package:SEFER/controller/home/home_page_controller.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:SEFER/constant/colors.dart'; import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart'; import 'package:SEFER/constant/style.dart';
import 'package:SEFER/views/lang/languages.dart'; import 'package:SEFER/views/lang/languages.dart';
import 'package:SEFER/views/widgets/my_scafold.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 'HomePage/about_page.dart'; import 'HomePage/about_page.dart';
import 'HomePage/frequentlyQuestionsPage.dart'; import 'HomePage/frequentlyQuestionsPage.dart';
import 'HomePage/trip_record_page.dart';
import 'profile/passenger_profile_page.dart'; import 'profile/passenger_profile_page.dart';
class HomePage extends StatelessWidget { class HomePage extends StatelessWidget {
@@ -106,121 +102,7 @@ class HomePage extends StatelessWidget {
style: AppStyle.title, style: AppStyle.title,
), ),
onTap: () async { onTap: () async {
Get.defaultDialog( Get.to(() => TripsRecordedPage());
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),
),
],
);
}),
);
}), }),
ListTile( ListTile(
leading: const Icon(Icons.account_balance_outlined), leading: const Icon(Icons.account_balance_outlined),

View File

@@ -34,6 +34,11 @@ List<CarType> carTypes = [
carDetail: 'Closest & Cheapest'.tr, carDetail: 'Closest & Cheapest'.tr,
image: 'assets/images/carspeed.png', image: 'assets/images/carspeed.png',
), ),
CarType(
carType: 'Balash',
carDetail: "Old and affordable, perfect for budget rides.".tr,
image: 'assets/images/balash.png',
),
CarType( CarType(
carType: 'Lady', carType: 'Lady',
carDetail: 'Lady Captain for girls'.tr, carDetail: 'Lady Captain for girls'.tr,
@@ -49,11 +54,11 @@ List<CarType> carTypes = [
carDetail: 'Mashwari without end point'.tr, carDetail: 'Mashwari without end point'.tr,
image: 'assets/images/freeRide.png', image: 'assets/images/freeRide.png',
), ),
// CarType( CarType(
// carType: 'Family', carType: 'Rayeh Gai',
// carDetail: 'Family for 7 passenger'.tr, carDetail: "Best choice for cities".tr,
// image: 'assets/images/Family.png', image: 'assets/images/roundtrip.png',
// ), ),
]; ];
class CarDetailsTypeToChoose extends StatelessWidget { class CarDetailsTypeToChoose extends StatelessWidget {
@@ -63,25 +68,6 @@ class CarDetailsTypeToChoose extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GetBuilder<MapPassengerController>( return GetBuilder<MapPassengerController>(
builder: (mapPassengerController) { builder: (mapPassengerController) {
if (mapPassengerController.distance > 80) {
carTypes.add(
CarType(
carType: 'Rayeh Gai',
carDetail: "Best choice for cities".tr,
image: 'assets/images/roundtrip.png',
),
);
} // Create a Set to remove duplicates based on the `carType` field
Set<CarType> uniqueCarTypes = {};
uniqueCarTypes.addAll(carTypes);
// Convert the Set back to a List
carTypes = uniqueCarTypes.toList();
if (carTypes.length > 6) {
carTypes.removeRange(6, carTypes.length);
}
return mapPassengerController.data.isNotEmpty && return mapPassengerController.data.isNotEmpty &&
mapPassengerController.isBottomSheetShown && mapPassengerController.isBottomSheetShown &&
mapPassengerController.rideConfirm == false mapPassengerController.rideConfirm == false
@@ -152,20 +138,25 @@ class CarDetailsTypeToChoose extends StatelessWidget {
? mapPassengerController ? mapPassengerController
.totalPassengerSpeed .totalPassengerSpeed
.toStringAsFixed(2) .toStringAsFixed(2)
: carType.carType == 'Delivery' : carType.carType == 'Balash'
? mapPassengerController ? mapPassengerController
.totalPassengerMotoDelivery .totalPassengerBalash
.toStringAsFixed(2) .toStringAsFixed(2)
: carType.carType == 'Lady' : carType.carType == 'Delivery'
? mapPassengerController ? mapPassengerController
.totalPassengerLady .totalPassengerMotoDelivery
.toStringAsFixed(2) .toStringAsFixed(2)
: carType.carType == : carType.carType == 'Lady'
'Rayeh Gai'
? mapPassengerController ? mapPassengerController
.totalPassengerRayehGai .totalPassengerLady
.toStringAsFixed(2) .toStringAsFixed(2)
: '50', : carType.carType ==
'Rayeh Gai'
? mapPassengerController
.totalPassengerRayehGai
.toStringAsFixed(
2)
: '50',
style: style:
AppStyle.title.copyWith(fontSize: 20), AppStyle.title.copyWith(fontSize: 20),
), ),
@@ -237,10 +228,10 @@ class CarDetailsTypeToChoose extends StatelessWidget {
) )
], ],
) )
: carType.carType == 'Lady' && : carType.carType == 'Balash' &&
(mapPassengerController (mapPassengerController
.totalPassengerSpeed > .totalPassengerBalash >
20) 15)
? Row( ? Row(
children: [ children: [
Container( Container(
@@ -259,7 +250,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
), ),
Text( Text(
mapPassengerController mapPassengerController
.totalPassengerLadyDiscount .totalPassengerBalashDiscount
.toStringAsFixed( .toStringAsFixed(
2), 2),
style: AppStyle.title style: AppStyle.title
@@ -273,9 +264,46 @@ class CarDetailsTypeToChoose extends StatelessWidget {
) )
], ],
) )
: const SizedBox( : carType.carType == 'Lady' &&
width: 3, (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
.totalPassengerLadyDiscount
.toStringAsFixed(
2),
style: AppStyle
.title
.copyWith(
color: AppColor
.redColor,
decoration:
TextDecoration
.lineThrough, // Strikethrough line
),
)
],
)
: const SizedBox(
width: 3,
),
], ],
), ),
const SizedBox( const SizedBox(
@@ -371,7 +399,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
})); }));
} else if (mapPassengerController } else if (mapPassengerController
.selectedIndex == .selectedIndex ==
3) { 4) {
box.write(BoxName.carType, 'Delivery'); box.write(BoxName.carType, 'Delivery');
mapPassengerController.totalPassenger = mapPassengerController.totalPassenger =
mapPassengerController mapPassengerController
@@ -405,7 +433,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
})); }));
} else if (mapPassengerController } else if (mapPassengerController
.selectedIndex == .selectedIndex ==
4) { 5) {
box.write(BoxName.carType, 'Mashwari'); box.write(BoxName.carType, 'Mashwari');
mapPassengerController.totalPassenger = 50; mapPassengerController.totalPassenger = 50;
Get.defaultDialog( Get.defaultDialog(
@@ -435,6 +463,40 @@ class CarDetailsTypeToChoose extends StatelessWidget {
} else if (mapPassengerController } else if (mapPassengerController
.selectedIndex == .selectedIndex ==
2) { 2) {
box.write(BoxName.carType, 'Balash');
mapPassengerController.totalPassenger =
mapPassengerController
.totalPassengerBalash;
Get.defaultDialog(
title: 'Balash'.tr,
titleStyle: AppStyle.title,
content: CarDialogue(
textToSpeechController:
textToSpeechController,
image: 'assets/images/balash.png',
text:
"Old and affordable, perfect for budget rides."
.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, 'Lady'); box.write(BoxName.carType, 'Lady');
mapPassengerController.totalPassenger = mapPassengerController.totalPassenger =
mapPassengerController.totalPassengerLady; mapPassengerController.totalPassengerLady;
@@ -477,7 +539,7 @@ class CarDetailsTypeToChoose extends StatelessWidget {
})); }));
} else if (mapPassengerController } else if (mapPassengerController
.selectedIndex == .selectedIndex ==
5) { 6) {
box.write(BoxName.carType, 'Rayeh Gai'); box.write(BoxName.carType, 'Rayeh Gai');
mapPassengerController.totalPassenger = mapPassengerController.totalPassenger =
mapPassengerController.totalPassengerLady; mapPassengerController.totalPassengerLady;

View File

@@ -1,10 +1,12 @@
import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/main.dart'; import 'package:SEFER/main.dart';
import 'package:SEFER/views/auth/sms_verfy_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../constant/colors.dart'; import '../../../constant/colors.dart';
import '../../../controller/firebase/firbase_messge.dart'; import '../../../controller/firebase/firbase_messge.dart';
import '../../../controller/functions/audio_record1.dart';
import '../../../controller/functions/tts.dart'; import '../../../controller/functions/tts.dart';
import '../../../controller/home/map_passenger_controller.dart'; import '../../../controller/home/map_passenger_controller.dart';
@@ -119,15 +121,7 @@ GetBuilder<MapPassengerController> leftMainMenuIcons() {
borderRadius: BorderRadius.circular(15)), borderRadius: BorderRadius.circular(15)),
child: IconButton( child: IconButton(
onPressed: () async { onPressed: () async {
FirebaseMessagesController().sendNotificationToDriverMAP( Get.to(SmsSignupEgypt());
'message From passenger'.tr,
'My location is correct. You can search for me using the navigation app'
.tr,
'db9hQ9BfT_2U-ocVHbEAej:APA91bG2YiVN8Dw3bNitehENk0sUPKt7A3zoT6GY_NdbxsMVKX8ouZRI6Ix9ScLSGYz31gugsb2Ag087FXmbPbQkD9E7nwOR7USPrai5euFjZXVHNrz2Byacn8gBTGr8HPV-CGHG81lk',
[],
'ding.wav',
);
// print(box.read(BoxName.tokenFCM));
}, },
icon: const Icon( icon: const Icon(
Icons.chat, Icons.chat,