4/11/6
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
|
import 'package:SEFER/main.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_tts/flutter_tts.dart';
|
import 'package:flutter_tts/flutter_tts.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -23,7 +25,9 @@ class TextToSpeechController extends GetxController {
|
|||||||
Future<void> initTts() async {
|
Future<void> initTts() async {
|
||||||
String? lang =
|
String? lang =
|
||||||
WidgetsBinding.instance.platformDispatcher.locale.countryCode;
|
WidgetsBinding.instance.platformDispatcher.locale.countryCode;
|
||||||
await flutterTts.setLanguage(lang!); //'en-US' Set language
|
await flutterTts.setLanguage(box.read(BoxName.lang)); //'en-US' Set language
|
||||||
|
// await flutterTts.setLanguage('ar-SA'); //'en-US' Set language
|
||||||
|
// await flutterTts.setLanguage(lang!); //'en-US' Set language
|
||||||
await flutterTts.setSpeechRate(0.5); // Adjust speech rate
|
await flutterTts.setSpeechRate(0.5); // Adjust speech rate
|
||||||
await flutterTts.setVolume(1.0); // Set volume
|
await flutterTts.setVolume(1.0); // Set volume
|
||||||
}
|
}
|
||||||
@@ -31,7 +35,12 @@ class TextToSpeechController extends GetxController {
|
|||||||
// Function to speak the given text
|
// Function to speak the given text
|
||||||
Future<void> speakText(String text) async {
|
Future<void> speakText(String text) async {
|
||||||
try {
|
try {
|
||||||
await flutterTts.speak(text);
|
await flutterTts.awaitSpeakCompletion(true);
|
||||||
|
var result = await flutterTts.speak(text);
|
||||||
|
if (result == 1) {
|
||||||
|
// TTS operation has started
|
||||||
|
// You can perform additional operations here, if needed
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Handle error gracefully, e.g., show a message
|
// Handle error gracefully, e.g., show a message
|
||||||
Get.snackbar('Error', 'Failed to speak text: $error');
|
Get.snackbar('Error', 'Failed to speak text: $error');
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ class MapDriverController extends GetxController {
|
|||||||
? totalPassenger
|
? totalPassenger
|
||||||
: price < double.parse(totalPassenger)
|
: price < double.parse(totalPassenger)
|
||||||
? totalPassenger
|
? totalPassenger
|
||||||
: price.toStringAsFixed(1);
|
: price.toStringAsFixed(2);
|
||||||
paymentAmount = totalCost;
|
paymentAmount = totalCost;
|
||||||
box.write(BoxName.statusDriverLocation, 'off');
|
box.write(BoxName.statusDriverLocation, 'off');
|
||||||
// changeRideToBeginToPassenger();
|
// changeRideToBeginToPassenger();
|
||||||
|
|||||||
@@ -833,6 +833,25 @@ class MapPassengerController extends GetxController {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getDialog(String title, midTitle, VoidCallback onPressed) {
|
||||||
|
Get.defaultDialog(
|
||||||
|
title: title,
|
||||||
|
titleStyle: AppStyle.title,
|
||||||
|
middleTextStyle: AppStyle.title,
|
||||||
|
content: IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await textToSpeechController.speakText(midTitle);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.headphones)),
|
||||||
|
middleText: midTitle,
|
||||||
|
confirm: MyElevatedButton(title: 'Ok'.tr, onPressed: onPressed),
|
||||||
|
cancel: MyElevatedButton(
|
||||||
|
title: 'Cancel',
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
int currentTimeSearchingCaptainWindow = 0;
|
int currentTimeSearchingCaptainWindow = 0;
|
||||||
late String driverPhone = '';
|
late String driverPhone = '';
|
||||||
late String driverRate = '';
|
late String driverRate = '';
|
||||||
|
|||||||
@@ -442,6 +442,8 @@ class MyTranslation extends Translations {
|
|||||||
'Total points is ': "إجمالي النقاط هو",
|
'Total points is ': "إجمالي النقاط هو",
|
||||||
'Total Connection Duration:': "إجمالي مدة الإتصال:",
|
'Total Connection Duration:': "إجمالي مدة الإتصال:",
|
||||||
' H and': "ساعة و",
|
' H and': "ساعة و",
|
||||||
|
'For Speed and Delivery trips, the price is calculated dynamically. For Comfort trips, the price is based on time and distance':
|
||||||
|
'بالنسبة لرحلات Speed والتوصيل، يتم حساب السعر بشكل ديناميكي. أما بالنسبة لرحلات الراحة، فيتم حساب السعر بناءً على الوقت والمسافة.',
|
||||||
'Hello this is Driver': "مرحبا هذا السائق",
|
'Hello this is Driver': "مرحبا هذا السائق",
|
||||||
'Is the Passenger in your Car ?': "هل الراكب في سيارتك؟",
|
'Is the Passenger in your Car ?': "هل الراكب في سيارتك؟",
|
||||||
'Please wait for the passenger to enter the car before starting the trip.':
|
'Please wait for the passenger to enter the car before starting the trip.':
|
||||||
|
|||||||
@@ -73,8 +73,11 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.timer),
|
const Icon(Icons.timer),
|
||||||
Text(mapDriverController
|
Text(
|
||||||
.stringRemainingTimeRideBegin1),
|
mapDriverController
|
||||||
|
.stringRemainingTimeRideBegin1,
|
||||||
|
style: AppStyle.number,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
@@ -87,7 +90,9 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
|||||||
children: [
|
children: [
|
||||||
const Icon(Icons.location_on),
|
const Icon(Icons.location_on),
|
||||||
Text(
|
Text(
|
||||||
'${mapDriverController.recentDistanceToDash.toStringAsFixed(0)} ${'KM'.tr}'),
|
'${mapDriverController.recentDistanceToDash.toStringAsFixed(0)} ${'KM'.tr}',
|
||||||
|
style: AppStyle.number,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -100,8 +105,10 @@ GetBuilder<MapDriverController> driverEndRideBar() {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
const Icon(Icons.attach_money),
|
const Icon(Icons.attach_money),
|
||||||
Text(mapDriverController.price
|
Text(
|
||||||
.toStringAsFixed(2)),
|
mapDriverController.price.toStringAsFixed(2),
|
||||||
|
style: AppStyle.number,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import 'package:SEFER/views/home/profile/feed_back_page.dart';
|
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/material.dart';
|
||||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:SEFER/constant/box_name.dart';
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
import 'package:SEFER/controller/profile/profile_controller.dart';
|
import 'package:SEFER/controller/profile/profile_controller.dart';
|
||||||
import 'package:SEFER/main.dart';
|
import 'package:SEFER/main.dart';
|
||||||
|
import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
|
||||||
|
|
||||||
import '../../../constant/colors.dart';
|
import '../../../constant/colors.dart';
|
||||||
import '../../../constant/style.dart';
|
import '../../../constant/style.dart';
|
||||||
@@ -44,16 +46,32 @@ class RideBeginPassenger extends StatelessWidget {
|
|||||||
backgroundImage: NetworkImage(
|
backgroundImage: NetworkImage(
|
||||||
'https://ride.mobile-app.store/portrate_captain_image/${controller.driverId}.jpg'),
|
'https://ride.mobile-app.store/portrate_captain_image/${controller.driverId}.jpg'),
|
||||||
),
|
),
|
||||||
Container(
|
Column(
|
||||||
decoration: AppStyle.boxDecoration1,
|
children: [
|
||||||
child: Column(
|
Container(
|
||||||
children: [
|
decoration: AppStyle.boxDecoration1,
|
||||||
Text(
|
child: Text(
|
||||||
controller.firstName,
|
controller.firstName,
|
||||||
style: AppStyle.title,
|
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(
|
Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -97,56 +115,74 @@ class RideBeginPassenger extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
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(
|
Container(
|
||||||
width: Get.width * .15,
|
width: Get.width * .15,
|
||||||
decoration: AppStyle.boxDecoration1,
|
decoration: AppStyle.boxDecoration1,
|
||||||
child: Column(
|
child: IconButton(
|
||||||
children: [
|
onPressed: () => Get.to(
|
||||||
Text(
|
() => FeedBackPage(),
|
||||||
'💵 ',
|
transition: Transition.downToUp,
|
||||||
style: AppStyle.title,
|
),
|
||||||
),
|
icon: const Icon(
|
||||||
Text(
|
Icons.note_add,
|
||||||
controller.totalPassenger.toStringAsFixed(2),
|
color: AppColor.redColor,
|
||||||
style: AppStyle.title,
|
),
|
||||||
),
|
tooltip: ' Add Note', // Optional tooltip for clarity
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
Container(
|
||||||
onPressed: () => Get.to(
|
width: Get.width * .15,
|
||||||
() => FeedBackPage(),
|
decoration: AppStyle.boxDecoration1,
|
||||||
transition: Transition.downToUp,
|
child: audioController.isRecording == false
|
||||||
),
|
? IconButton(
|
||||||
icon: const Icon(
|
onPressed: () async {
|
||||||
Icons.note_add,
|
await audioController.startRecording();
|
||||||
color: AppColor.redColor,
|
},
|
||||||
),
|
icon: const Icon(
|
||||||
tooltip: ' Add Note', // Optional tooltip for clarity
|
Icons.play_circle_fill_outlined,
|
||||||
|
color: AppColor.greenColor,
|
||||||
|
),
|
||||||
|
tooltip:
|
||||||
|
' Add Note', // Optional tooltip for clarity
|
||||||
|
)
|
||||||
|
: IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await audioController.stopRecording();
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.stop_circle,
|
||||||
|
color: AppColor.greenColor,
|
||||||
|
),
|
||||||
|
tooltip:
|
||||||
|
' Add Note', // Optional tooltip for clarity
|
||||||
|
),
|
||||||
),
|
),
|
||||||
audioController.isRecording == false
|
|
||||||
? IconButton(
|
|
||||||
onPressed: () async {
|
|
||||||
await audioController.startRecording();
|
|
||||||
},
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.play_circle_fill_outlined,
|
|
||||||
color: AppColor.greenColor,
|
|
||||||
),
|
|
||||||
tooltip:
|
|
||||||
' Add Note', // Optional tooltip for clarity
|
|
||||||
)
|
|
||||||
: IconButton(
|
|
||||||
onPressed: () async {
|
|
||||||
await audioController.stopRecording();
|
|
||||||
},
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.stop_circle,
|
|
||||||
color: AppColor.greenColor,
|
|
||||||
),
|
|
||||||
tooltip:
|
|
||||||
' Add Note', // Optional tooltip for clarity
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Stack(
|
Stack(
|
||||||
|
|||||||
Reference in New Issue
Block a user