|
|
|
@ -1202,19 +1202,35 @@ class ChatProviderModel with ChangeNotifier, DiagnosticableTreeMixin {
|
|
|
|
|
|
|
|
|
|
void startRecoding() async {
|
|
|
|
|
PermissionStatus status = await Permission.microphone.request();
|
|
|
|
|
if (status.isDenied == true) {
|
|
|
|
|
if (status.isDenied) {
|
|
|
|
|
startRecoding();
|
|
|
|
|
} else if (status.isGranted) {
|
|
|
|
|
sRecoding();
|
|
|
|
|
} else {
|
|
|
|
|
isVoiceMsg = true;
|
|
|
|
|
recorderController.reset();
|
|
|
|
|
await recorderController.record(path);
|
|
|
|
|
_recodeDuration = 0;
|
|
|
|
|
_startTimer();
|
|
|
|
|
isRecoding = !isRecoding;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
startRecoding();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// else {
|
|
|
|
|
// isVoiceMsg = true;
|
|
|
|
|
// recorderController.reset();
|
|
|
|
|
// await recorderController.record(path);
|
|
|
|
|
// _recodeDuration = 0;
|
|
|
|
|
// _startTimer();
|
|
|
|
|
// isRecoding = !isRecoding;
|
|
|
|
|
// notifyListeners();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
void sRecoding() async {
|
|
|
|
|
isVoiceMsg = true;
|
|
|
|
|
recorderController.reset();
|
|
|
|
|
await recorderController.record(path);
|
|
|
|
|
_recodeDuration = 0;
|
|
|
|
|
_startTimer();
|
|
|
|
|
isRecoding = !isRecoding;
|
|
|
|
|
notifyListeners();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> _startTimer() async {
|
|
|
|
|
_timer?.cancel();
|
|
|
|
|
_timer = Timer.periodic(const Duration(seconds: 1), (Timer t) async {
|
|
|
|
|