|
|
|
|
@ -63,7 +63,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/foundation.dart' show TargetPlatform;
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_tts/flutter_tts.dart';
|
|
|
|
|
// import 'package:flutter_tts/flutter_tts.dart';
|
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:speech_to_text/speech_recognition_error.dart';
|
|
|
|
|
@ -84,7 +84,7 @@ class _FloatingSearchButton extends State<FloatingSearchButton> with TickerProvi
|
|
|
|
|
bool isLoading = false;
|
|
|
|
|
bool isError = false;
|
|
|
|
|
stt.SpeechToText speech = stt.SpeechToText();
|
|
|
|
|
FlutterTts tts = FlutterTts();
|
|
|
|
|
// FlutterTts tts = FlutterTts();
|
|
|
|
|
String error = '';
|
|
|
|
|
String _currentLocaleId = "";
|
|
|
|
|
late String lastError;
|
|
|
|
|
@ -236,12 +236,12 @@ class _FloatingSearchButton extends State<FloatingSearchButton> with TickerProvi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startIosTts() async{
|
|
|
|
|
await tts.setSharedInstance(true);
|
|
|
|
|
await tts.setLanguage("en-US");
|
|
|
|
|
tts.setIosAudioCategory(
|
|
|
|
|
IosTextToSpeechAudioCategory.playback,
|
|
|
|
|
[IosTextToSpeechAudioCategoryOptions.mixWithOthers],
|
|
|
|
|
IosTextToSpeechAudioMode.voicePrompt);
|
|
|
|
|
// await tts.setSharedInstance(true);
|
|
|
|
|
// await tts.setLanguage("en-US");
|
|
|
|
|
// tts.setIosAudioCategory(
|
|
|
|
|
// IosTextToSpeechAudioCategory.playback,
|
|
|
|
|
// [IosTextToSpeechAudioCategoryOptions.mixWithOthers],
|
|
|
|
|
// IosTextToSpeechAudioMode.voicePrompt);
|
|
|
|
|
}
|
|
|
|
|
startVoiceSearch() async {
|
|
|
|
|
bool available = await speech.initialize();
|
|
|
|
|
@ -844,12 +844,12 @@ class _FloatingSearchButton extends State<FloatingSearchButton> with TickerProvi
|
|
|
|
|
if (isArabic == false && results['ReturnMessage'] != null && isInit == false) {
|
|
|
|
|
// await tts.synthesizeToFile("Hello World", Platform.isAndroid ? "tts.wav" : "tts.caf");
|
|
|
|
|
|
|
|
|
|
await tts.setVoice({"name": "Karen", "locale": "en-AU"});
|
|
|
|
|
// await tts.setVoice({"name": "Karen", "locale": "en-AU"});
|
|
|
|
|
// await tts.setVoice({"name" : voice[35]["name"],"locale": voice[35]["locale"]});
|
|
|
|
|
await tts.speak(results['ReturnMessage']);
|
|
|
|
|
// await tts.speak(results['ReturnMessage']);
|
|
|
|
|
} else if (results['ReturnMessage_Ar'] != null && isInit == false) {
|
|
|
|
|
//await tts.setVoice({"name" : voice[0]["name"],"locale": voice[0]["locale"]});
|
|
|
|
|
await tts.speak(results['ReturnMessage_Ar']);
|
|
|
|
|
// await tts.speak(results['ReturnMessage_Ar']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stopAnimation(isInit: isInit);
|
|
|
|
|
|