From b2773aa320461c74f221aadea61ff07987ab2618 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Mon, 9 Jan 2023 11:34:27 +0300 Subject: [PATCH] ios fixed for speech to text --- ios/Runner.xcodeproj/project.pbxproj | 20 ++++++------------- .../profile/notes/note/update_note.dart | 13 +++++++----- lib/widgets/shared/speech-text-popup.dart | 4 ++-- .../shared/text_fields/html_rich_editor.dart | 5 +++-- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index af797b24..2475931a 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -501,10 +501,7 @@ ); INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", @@ -520,6 +517,7 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB31CF90195004384FC /* Generated.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -639,10 +637,7 @@ ); INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", @@ -673,10 +668,7 @@ ); INFOPLIST_FILE = Runner/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 11.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; LIBRARY_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", @@ -701,7 +693,7 @@ 249021D3217E4FDB00AE95B9 /* Profile */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; + defaultConfigurationName = Debug; }; 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { isa = XCConfigurationList; @@ -711,7 +703,7 @@ 249021D4217E4FDB00AE95B9 /* Profile */, ); defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; + defaultConfigurationName = Debug; }; /* End XCConfigurationList section */ }; diff --git a/lib/screens/patients/profile/notes/note/update_note.dart b/lib/screens/patients/profile/notes/note/update_note.dart index 71e86a4a..4369506f 100644 --- a/lib/screens/patients/profile/notes/note/update_note.dart +++ b/lib/screens/patients/profile/notes/note/update_note.dart @@ -14,6 +14,7 @@ import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; +import 'package:doctor_app_flutter/utils/extenstions_utils.dart'; import 'package:doctor_app_flutter/utils/utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; @@ -377,12 +378,14 @@ class _UpdateNoteOrderState extends State { void resultListener(result) { recognizedWord = result.recognizedWords; event.setValue({"searchText": recognizedWord}); - - if (result.finalResult == true) { + if (result.finalResult ==true) { setState(() { - SpeechToText.closeAlertDialog(context); - speech.stop(); - progressNoteController.text += recognizedWord + '\n'; + if (mounted) { + // speech.stop(); + progressNoteController.text += recognizedWord + '\n'; + SpeechToText.closeAlertDialog(context); + + } }); } else { print(result.finalResult); diff --git a/lib/widgets/shared/speech-text-popup.dart b/lib/widgets/shared/speech-text-popup.dart index ecb001b5..d911b86c 100644 --- a/lib/widgets/shared/speech-text-popup.dart +++ b/lib/widgets/shared/speech-text-popup.dart @@ -66,10 +66,10 @@ class _MyStatefulBuilderState extends State { if ((p['searchText'] != 'null' && p['searchText'] != null && p['searchText'] != "" && - isClosed == false) && - mounted) { + isClosed == false)) { setState(() { searchText = p['searchText']; + SpeechToText.closeAlertDialog(context); }); } else if (p['searchText'] == 'null') { setState(() { diff --git a/lib/widgets/shared/text_fields/html_rich_editor.dart b/lib/widgets/shared/text_fields/html_rich_editor.dart index 041bd8a8..6b5cd080 100644 --- a/lib/widgets/shared/text_fields/html_rich_editor.dart +++ b/lib/widgets/shared/text_fields/html_rich_editor.dart @@ -149,9 +149,10 @@ class _HtmlRichEditorState extends State { String txt = await widget.controller.getText(); if (result.finalResult == true) { setState(() { - SpeechToText.closeAlertDialog(context); - speech.stop(); widget.controller.setText(txt + recognizedWord); + SpeechToText.closeAlertDialog(context); + // speech.stop(); + }); } else { print(result.finalResult);