4/7/2
This commit is contained in:
@@ -1,4 +1,9 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||||
|
<!-- Optional: Add this permission if you want to use bluetooth telephony device like headset/earbuds (min SDK: 23) -->
|
||||||
|
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||||
|
<!-- Optional: Add this permission if you want to save your recordings in public folders -->
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
|
<string>We want to use record the sound of trip between you and the driver for your safety and to make this app more secure.</string>
|
||||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
|||||||
49
lib/controller/functions/audio_recorder_controller.dart
Normal file
49
lib/controller/functions/audio_recorder_controller.dart
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:SEFER/controller/home/captin/map_driver_controller.dart';
|
||||||
|
import 'package:flutter_sound/flutter_sound.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
|
class AudioController extends GetxController {
|
||||||
|
final recorder = FlutterSoundRecorder();
|
||||||
|
bool isRecoding = false;
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
initRecorder();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> initRecorder() async {
|
||||||
|
final status = await Permission.microphone.request();
|
||||||
|
if (status != PermissionStatus.granted) {
|
||||||
|
// Handle permission denied
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await recorder.openRecorder();
|
||||||
|
recorder.setSubscriptionDuration(const Duration(milliseconds: 500));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> startRecording() async {
|
||||||
|
await recorder.startRecorder(
|
||||||
|
toFile:
|
||||||
|
'audio_${Get.find<MapDriverController>().rideId}.wav'); // Specify the file name
|
||||||
|
isRecoding = 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
|
||||||
|
isRecoding = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
recorder.closeRecorder();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import 'package:SEFER/main.dart';
|
|||||||
|
|
||||||
import '../../../constant/colors.dart';
|
import '../../../constant/colors.dart';
|
||||||
import '../../../constant/style.dart';
|
import '../../../constant/style.dart';
|
||||||
|
import '../../../controller/functions/audio_recorder_controller.dart';
|
||||||
import '../../../controller/home/map_passenger_controller.dart';
|
import '../../../controller/home/map_passenger_controller.dart';
|
||||||
|
|
||||||
class RideBeginPassenger extends StatelessWidget {
|
class RideBeginPassenger extends StatelessWidget {
|
||||||
@@ -18,6 +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());
|
||||||
return GetBuilder<MapPassengerController>(builder: (controller) {
|
return GetBuilder<MapPassengerController>(builder: (controller) {
|
||||||
if (controller.rideTimerBegin) {
|
if (controller.rideTimerBegin) {
|
||||||
return Positioned(
|
return Positioned(
|
||||||
@@ -71,6 +73,29 @@ class RideBeginPassenger extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
tooltip: ' Add Note', // Optional tooltip for clarity
|
tooltip: ' Add Note', // Optional tooltip for clarity
|
||||||
),
|
),
|
||||||
|
audioController.isRecoding
|
||||||
|
? IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
audioController.startRecording();
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.play_circle_fill_outlined,
|
||||||
|
color: AppColor.greenColor,
|
||||||
|
),
|
||||||
|
tooltip:
|
||||||
|
' Add Note', // Optional tooltip for clarity
|
||||||
|
)
|
||||||
|
: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
audioController.stopRecording();
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.stop_circle,
|
||||||
|
color: AppColor.greenColor,
|
||||||
|
),
|
||||||
|
tooltip:
|
||||||
|
' Add Note', // Optional tooltip for clarity
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Stack(
|
Stack(
|
||||||
|
|||||||
60
pubspec.lock
60
pubspec.lock
@@ -21,10 +21,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: agora_rtc_engine
|
name: agora_rtc_engine
|
||||||
sha256: "1ff249665a6a86fe0db13c7026853a92a715abeb819d8ad68bf5927f890e2c45"
|
sha256: ec84db08cd6727e3e480abe9089df4a9522aa4315f688ac2abf25a82f26c4055
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.2.6"
|
version: "6.3.0"
|
||||||
analyzer:
|
analyzer:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -405,10 +405,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: file
|
name: file
|
||||||
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
|
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.0.0"
|
version: "6.1.4"
|
||||||
file_selector_linux:
|
file_selector_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -638,6 +638,30 @@ 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:
|
||||||
@@ -772,10 +796,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: geolocator_android
|
name: geolocator_android
|
||||||
sha256: "741579fa6c9e412984d2bdb2fbaa54e3c3f7587c60aeacfe6e058358a11f40f8"
|
sha256: "93906636752ea4d4e778afa981fdfe7409f545b3147046300df194330044d349"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.4.0"
|
version: "4.3.1"
|
||||||
geolocator_apple:
|
geolocator_apple:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1132,10 +1156,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: iris_method_channel
|
name: iris_method_channel
|
||||||
sha256: "708a862849b26452d86a0ab1ff010eb43d03cc811084b185270ceda45ff473e6"
|
sha256: "78caede20be4a1dd258262fb13704aab2f16fd05ef414bed06e7b1e3b95b3413"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0-dev.4"
|
version: "2.0.1"
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1280,6 +1304,14 @@ 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:
|
||||||
@@ -1605,14 +1637,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0"
|
version: "1.10.0"
|
||||||
sprintf:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: sprintf
|
|
||||||
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "7.0.0"
|
|
||||||
sqflite:
|
sqflite:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -1801,10 +1825,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: uuid
|
name: uuid
|
||||||
sha256: "22c94e5ad1e75f9934b766b53c742572ee2677c56bc871d850a57dad0f82127f"
|
sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.2"
|
version: "3.0.7"
|
||||||
vector_graphics:
|
vector_graphics:
|
||||||
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.2.6
|
agora_rtc_engine: ^6.3.0
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user