4/9/2
This commit is contained in:
@@ -1,159 +1,159 @@
|
|||||||
// import 'dart:io';
|
// // import 'dart:io';
|
||||||
//
|
// //
|
||||||
|
// // import 'package:flutter/material.dart';
|
||||||
|
// // import 'package:flutter_sound/flutter_sound.dart';
|
||||||
|
// // import 'package:get/get.dart';
|
||||||
|
// // import 'package:permission_handler/permission_handler.dart';
|
||||||
|
// //
|
||||||
|
// // import '../home/map_passenger_controller.dart';
|
||||||
|
// //
|
||||||
|
// // class AudioController extends GetxController {
|
||||||
|
// // final recorder = FlutterSoundRecorder();
|
||||||
|
// // bool isRecording = false;
|
||||||
|
// //
|
||||||
|
// // @override
|
||||||
|
// // void onInit() {
|
||||||
|
// // super.onInit();
|
||||||
|
// // initRecorder();
|
||||||
|
// // }
|
||||||
|
// //
|
||||||
|
// // Future<void> initRecorder() async {
|
||||||
|
// // final status = await Permission.microphone.request();
|
||||||
|
// // if (status != PermissionStatus.granted) {
|
||||||
|
// // if (status.isPermanentlyDenied) {
|
||||||
|
// // // Handle permission permanently denied
|
||||||
|
// // showPermissionDeniedDialog();
|
||||||
|
// // } else if (status.isDenied) {
|
||||||
|
// // // Handle permission denied
|
||||||
|
// // showPermissionDeniedSnackbar();
|
||||||
|
// // } else if (status.isRestricted) {
|
||||||
|
// // // Handle permission restricted
|
||||||
|
// // showPermissionDeniedSnackbar();
|
||||||
|
// // }
|
||||||
|
// // return;
|
||||||
|
// // }
|
||||||
|
// // await recorder.openRecorder();
|
||||||
|
// // recorder.setSubscriptionDuration(const Duration(minutes: 50));
|
||||||
|
// // }
|
||||||
|
// //
|
||||||
|
// // Future<void> startRecording() async {
|
||||||
|
// // if (!recorder.isStopped) {
|
||||||
|
// // await recorder.startRecorder();
|
||||||
|
// // }
|
||||||
|
// // isRecording = true;
|
||||||
|
// // update();
|
||||||
|
// // }
|
||||||
|
// //
|
||||||
|
// // Future<void> stopRecording() async {
|
||||||
|
// // final filePath = await recorder.stopRecorder();
|
||||||
|
// // final audioFile = File(filePath!);
|
||||||
|
// // print('Recorded file path: $audioFile');
|
||||||
|
// // // Now you can send this file to the server
|
||||||
|
// // isRecording = false;
|
||||||
|
// // update();
|
||||||
|
// // }
|
||||||
|
// //
|
||||||
|
// // @override
|
||||||
|
// // void onClose() {
|
||||||
|
// // recorder.stopRecorder();
|
||||||
|
// // super.onClose();
|
||||||
|
// // }
|
||||||
|
// //
|
||||||
|
// // void showPermissionDeniedDialog() {
|
||||||
|
// // showDialog(
|
||||||
|
// // context: Get.context!,
|
||||||
|
// // builder: (context) => AlertDialog(
|
||||||
|
// // title: const Text('Microphone Permission'),
|
||||||
|
// // content:
|
||||||
|
// // const Text('Microphone permission is required to record audio.'),
|
||||||
|
// // actions: [
|
||||||
|
// // TextButton(
|
||||||
|
// // onPressed: () {
|
||||||
|
// // Navigator.of(context).pop();
|
||||||
|
// // openAppSettings();
|
||||||
|
// // },
|
||||||
|
// // child: const Text('Open Settings'),
|
||||||
|
// // ),
|
||||||
|
// // TextButton(
|
||||||
|
// // onPressed: () {
|
||||||
|
// // Navigator.of(context).pop();
|
||||||
|
// // },
|
||||||
|
// // child: const Text('Cancel'),
|
||||||
|
// // ),
|
||||||
|
// // ],
|
||||||
|
// // ),
|
||||||
|
// // );
|
||||||
|
// // }
|
||||||
|
// //
|
||||||
|
// // void showPermissionDeniedSnackbar() {
|
||||||
|
// // Get.snackbar(
|
||||||
|
// // 'Microphone Permission',
|
||||||
|
// // 'Microphone permission is required to record audio.',
|
||||||
|
// // snackPosition: SnackPosition.BOTTOM,
|
||||||
|
// // duration: const Duration(seconds: 5),
|
||||||
|
// // mainButton: TextButton(
|
||||||
|
// // onPressed: () {
|
||||||
|
// // openAppSettings();
|
||||||
|
// // },
|
||||||
|
// // child: const Text(
|
||||||
|
// // 'Open Settings',
|
||||||
|
// // style: TextStyle(color: Colors.white),
|
||||||
|
// // ),
|
||||||
|
// // ),
|
||||||
|
// // );
|
||||||
|
// // }
|
||||||
|
// // }
|
||||||
// import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
// import 'package:flutter_sound/flutter_sound.dart';
|
|
||||||
// import 'package:get/get.dart';
|
// import 'package:get/get.dart';
|
||||||
|
// // import 'package:flutter_sound/flutter_sound.dart';
|
||||||
// import 'package:permission_handler/permission_handler.dart';
|
// import 'package:permission_handler/permission_handler.dart';
|
||||||
//
|
//
|
||||||
// import '../home/map_passenger_controller.dart';
|
|
||||||
//
|
|
||||||
// class AudioController extends GetxController {
|
// class AudioController extends GetxController {
|
||||||
// final recorder = FlutterSoundRecorder();
|
// final flutterSoundHelper = FlutterSoundHelper();
|
||||||
|
//
|
||||||
// bool isRecording = false;
|
// bool isRecording = false;
|
||||||
//
|
//
|
||||||
// @override
|
// Future<void> startRecording() async {
|
||||||
// void onInit() {
|
// if (!await flutterSoundHelper.hasPermissions()) {
|
||||||
// super.onInit();
|
// await flutterSoundHelper.requestPermissions();
|
||||||
// initRecorder();
|
// }
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// Future<void> initRecorder() async {
|
// if (!await flutterSoundHelper.hasPermissions()) {
|
||||||
// final status = await Permission.microphone.request();
|
|
||||||
// if (status != PermissionStatus.granted) {
|
|
||||||
// if (status.isPermanentlyDenied) {
|
|
||||||
// // Handle permission permanently denied
|
|
||||||
// showPermissionDeniedDialog();
|
|
||||||
// } else if (status.isDenied) {
|
|
||||||
// // Handle permission denied
|
|
||||||
// showPermissionDeniedSnackbar();
|
|
||||||
// } else if (status.isRestricted) {
|
|
||||||
// // Handle permission restricted
|
|
||||||
// showPermissionDeniedSnackbar();
|
|
||||||
// }
|
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
// await recorder.openRecorder();
|
|
||||||
// recorder.setSubscriptionDuration(const Duration(minutes: 50));
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// Future<void> startRecording() async {
|
// await flutterSoundHelper.startRecorder();
|
||||||
// if (!recorder.isStopped) {
|
|
||||||
// await recorder.startRecorder();
|
|
||||||
// }
|
|
||||||
// isRecording = true;
|
// isRecording = true;
|
||||||
// update();
|
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// Future<void> stopRecording() async {
|
// Future<void> stopRecording() async {
|
||||||
// final filePath = await recorder.stopRecorder();
|
// if (!isRecording) {
|
||||||
// final audioFile = File(filePath!);
|
// return;
|
||||||
// print('Recorded file path: $audioFile');
|
// }
|
||||||
// // Now you can send this file to the server
|
//
|
||||||
|
// await flutterSoundHelper.stopRecorder();
|
||||||
// isRecording = false;
|
// isRecording = false;
|
||||||
// update();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @override
|
|
||||||
// void onClose() {
|
|
||||||
// recorder.stopRecorder();
|
|
||||||
// super.onClose();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// void showPermissionDeniedDialog() {
|
|
||||||
// showDialog(
|
|
||||||
// context: Get.context!,
|
|
||||||
// builder: (context) => AlertDialog(
|
|
||||||
// title: const Text('Microphone Permission'),
|
|
||||||
// content:
|
|
||||||
// const Text('Microphone permission is required to record audio.'),
|
|
||||||
// actions: [
|
|
||||||
// TextButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.of(context).pop();
|
|
||||||
// openAppSettings();
|
|
||||||
// },
|
|
||||||
// child: const Text('Open Settings'),
|
|
||||||
// ),
|
|
||||||
// TextButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// Navigator.of(context).pop();
|
|
||||||
// },
|
|
||||||
// child: const Text('Cancel'),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// void showPermissionDeniedSnackbar() {
|
|
||||||
// Get.snackbar(
|
|
||||||
// 'Microphone Permission',
|
|
||||||
// 'Microphone permission is required to record audio.',
|
|
||||||
// snackPosition: SnackPosition.BOTTOM,
|
|
||||||
// duration: const Duration(seconds: 5),
|
|
||||||
// mainButton: TextButton(
|
|
||||||
// onPressed: () {
|
|
||||||
// openAppSettings();
|
|
||||||
// },
|
|
||||||
// child: const Text(
|
|
||||||
// 'Open Settings',
|
|
||||||
// style: TextStyle(color: Colors.white),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
import 'package:flutter/material.dart';
|
//
|
||||||
import 'package:get/get.dart';
|
// class FlutterSoundHelper {
|
||||||
import 'package:flutter_sound/flutter_sound.dart';
|
// final flutterSound = FlutterSoundRecorder();
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
//
|
||||||
|
// Future<bool> hasPermissions() async {
|
||||||
class AudioController extends GetxController {
|
// return await Permission.microphone.isGranted;
|
||||||
final flutterSoundHelper = FlutterSoundHelper();
|
// }
|
||||||
|
//
|
||||||
bool isRecording = false;
|
// Future<void> requestPermissions() async {
|
||||||
|
// await Permission.microphone.request();
|
||||||
Future<void> startRecording() async {
|
// }
|
||||||
if (!await flutterSoundHelper.hasPermissions()) {
|
//
|
||||||
await flutterSoundHelper.requestPermissions();
|
// Future<void> startRecorder() async {
|
||||||
}
|
// await flutterSound.openRecorder();
|
||||||
|
// await flutterSound.startRecorder(toFile: 'audio.wav');
|
||||||
if (!await flutterSoundHelper.hasPermissions()) {
|
// }
|
||||||
return;
|
//
|
||||||
}
|
// Future<void> stopRecorder() async {
|
||||||
|
// await flutterSound.stopRecorder();
|
||||||
await flutterSoundHelper.startRecorder();
|
// await flutterSound.closeRecorder();
|
||||||
isRecording = true;
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
Future<void> stopRecording() async {
|
|
||||||
if (!isRecording) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await flutterSoundHelper.stopRecorder();
|
|
||||||
isRecording = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class FlutterSoundHelper {
|
|
||||||
final flutterSound = FlutterSoundRecorder();
|
|
||||||
|
|
||||||
Future<bool> hasPermissions() async {
|
|
||||||
return await Permission.microphone.isGranted;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> requestPermissions() async {
|
|
||||||
await Permission.microphone.request();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> startRecorder() async {
|
|
||||||
await flutterSound.openRecorder();
|
|
||||||
await flutterSound.startRecorder(toFile: 'audio.wav');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> stopRecorder() async {
|
|
||||||
await flutterSound.stopRecorder();
|
|
||||||
await flutterSound.closeRecorder();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -937,13 +937,13 @@ class MapPassengerController extends GetxController {
|
|||||||
passengerRate.toStringAsFixed(2),
|
passengerRate.toStringAsFixed(2),
|
||||||
];
|
];
|
||||||
print(body);
|
print(body);
|
||||||
FirebaseMessagesController().sendNotificationToDriverMapPolyline(
|
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||||
'Order',
|
'Order',
|
||||||
jsonDecode(value)['message'].toString(),
|
jsonDecode(value)['message'].toString(),
|
||||||
dataCarsLocationByPassenger['message'][carsOrder]['token']
|
dataCarsLocationByPassenger['message'][carsOrder]['token'].toString(),
|
||||||
.toString(),
|
body,
|
||||||
body,
|
// polylineCoordinates.toString()
|
||||||
polylineCoordinates.toString());
|
);
|
||||||
print(dataCarsLocationByPassenger);
|
print(dataCarsLocationByPassenger);
|
||||||
// //print(dataCarsLocationByPassenger['message'][0]['token'].toString());
|
// //print(dataCarsLocationByPassenger['message'][0]['token'].toString());
|
||||||
});
|
});
|
||||||
@@ -1777,7 +1777,7 @@ class MapPassengerController extends GetxController {
|
|||||||
if (!rideConfirm) {
|
if (!rideConfirm) {
|
||||||
reloadMarkers();
|
reloadMarkers();
|
||||||
} else {
|
} else {
|
||||||
runWhenRideIsBegin();
|
// runWhenRideIsBegin();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reloadCount >= 35) {
|
if (reloadCount >= 35) {
|
||||||
|
|||||||
@@ -48,16 +48,7 @@ class RatePassenger extends StatelessWidget {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(4),
|
padding: const EdgeInsets.all(4),
|
||||||
child: Text(
|
child: Text(
|
||||||
Get.find<MapDriverController>().carType ==
|
Get.find<MapDriverController>().paymentAmount,
|
||||||
'Comfort' ||
|
|
||||||
Get.find<MapDriverController>()
|
|
||||||
.carType ==
|
|
||||||
'Free Ride'
|
|
||||||
? Get.find<MapDriverController>()
|
|
||||||
.price
|
|
||||||
.toStringAsFixed(1)
|
|
||||||
: Get.find<MapDriverController>()
|
|
||||||
.totalPassenger,
|
|
||||||
style: AppStyle.number,
|
style: AppStyle.number,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -436,6 +436,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
title: 'Ok'.tr,
|
title: 'Ok'.tr,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
|
Get.back();
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
kolor: AppColor.redColor,
|
kolor: AppColor.redColor,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class RideBeginPassenger extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
ProfileController profileController = Get.put(ProfileController());
|
ProfileController profileController = Get.put(ProfileController());
|
||||||
AudioController audioController = Get.put(AudioController());
|
// AudioController audioController = Get.put(AudioController());
|
||||||
return GetBuilder<MapPassengerController>(builder: (controller) {
|
return GetBuilder<MapPassengerController>(builder: (controller) {
|
||||||
if (controller.rideTimerBegin ||
|
if (controller.rideTimerBegin ||
|
||||||
controller.statusRide == 'Begin' && !controller.statusRideFromStart) {
|
controller.statusRide == 'Begin' && !controller.statusRideFromStart) {
|
||||||
@@ -82,29 +82,29 @@ class RideBeginPassenger extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
tooltip: ' Add Note', // Optional tooltip for clarity
|
tooltip: ' Add Note', // Optional tooltip for clarity
|
||||||
),
|
),
|
||||||
audioController.isRecording == false
|
// audioController.isRecording == false
|
||||||
? IconButton(
|
// ? IconButton(
|
||||||
onPressed: () async {
|
// onPressed: () async {
|
||||||
await audioController.startRecording();
|
// await audioController.startRecording();
|
||||||
},
|
// },
|
||||||
icon: const Icon(
|
// icon: const Icon(
|
||||||
Icons.play_circle_fill_outlined,
|
// Icons.play_circle_fill_outlined,
|
||||||
color: AppColor.greenColor,
|
// color: AppColor.greenColor,
|
||||||
),
|
// ),
|
||||||
tooltip:
|
// tooltip:
|
||||||
' Add Note', // Optional tooltip for clarity
|
// ' Add Note', // Optional tooltip for clarity
|
||||||
)
|
// )
|
||||||
: IconButton(
|
// : IconButton(
|
||||||
onPressed: () async {
|
// onPressed: () async {
|
||||||
await audioController.stopRecording();
|
// await audioController.stopRecording();
|
||||||
},
|
// },
|
||||||
icon: const Icon(
|
// icon: const Icon(
|
||||||
Icons.stop_circle,
|
// Icons.stop_circle,
|
||||||
color: AppColor.greenColor,
|
// color: AppColor.greenColor,
|
||||||
),
|
// ),
|
||||||
tooltip:
|
// tooltip:
|
||||||
' Add Note', // Optional tooltip for clarity
|
// ' Add Note', // Optional tooltip for clarity
|
||||||
),
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
|
|||||||
32
pubspec.lock
32
pubspec.lock
@@ -638,30 +638,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.0"
|
version: "3.0.0"
|
||||||
flutter_sound:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: flutter_sound
|
|
||||||
sha256: "090a4694b11ecc744c2010621c4ffc5fe7c3079d304ea014961a72c7b72cfe6c"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "9.2.13"
|
|
||||||
flutter_sound_platform_interface:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: flutter_sound_platform_interface
|
|
||||||
sha256: "4537eaeb58a32748c42b621ad6116f7f4c6ee0a8d6ffaa501b165fe1c9df4753"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "9.2.13"
|
|
||||||
flutter_sound_web:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: flutter_sound_web
|
|
||||||
sha256: ad4ca92671a1879e1f613e900bbbdb8170b20d57d1e4e6363018fe56b055594f
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "9.2.13"
|
|
||||||
flutter_spinkit:
|
flutter_spinkit:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1304,14 +1280,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.0"
|
version: "4.2.0"
|
||||||
logger:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: logger
|
|
||||||
sha256: "7ad7215c15420a102ec687bb320a7312afd449bac63bfb1c60d9787c27b9767f"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "1.4.0"
|
|
||||||
logging:
|
logging:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -50,14 +50,14 @@ dependencies:
|
|||||||
cached_network_image: ^3.3.0
|
cached_network_image: ^3.3.0
|
||||||
calendar_builder: ^0.0.6
|
calendar_builder: ^0.0.6
|
||||||
fl_chart: ^0.66.0
|
fl_chart: ^0.66.0
|
||||||
agora_rtc_engine: ^6.3.0
|
agora_rtc_engine: ^6.2.6
|
||||||
flutter_tts: ^3.8.5
|
flutter_tts: ^3.8.5
|
||||||
permission_handler: ^11.3.0
|
permission_handler: ^11.3.0
|
||||||
google_generative_ai: ^0.0.1-dev
|
google_generative_ai: ^0.0.1-dev
|
||||||
vibration: ^1.8.4
|
vibration: ^1.8.4
|
||||||
wakelock_plus:
|
wakelock_plus:
|
||||||
background_location: ^0.13.0
|
background_location: ^0.13.0
|
||||||
flutter_sound: ^9.2.13
|
# flutter_sound: ^9.2.13
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user