From f2a57255fc4e40e50e41e8f14173d8c0d9562582 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Mon, 4 Dec 2023 11:45:14 +0300 Subject: [PATCH] no message --- .../widgets/reminder_dialog.dart | 8 +-- lib/pages/feedback/send_feedback_page.dart | 53 +++++++------------ pubspec.yaml | 2 +- 3 files changed, 24 insertions(+), 39 deletions(-) diff --git a/lib/pages/BookAppointment/widgets/reminder_dialog.dart b/lib/pages/BookAppointment/widgets/reminder_dialog.dart index 37f343ad..c327ce35 100644 --- a/lib/pages/BookAppointment/widgets/reminder_dialog.dart +++ b/lib/pages/BookAppointment/widgets/reminder_dialog.dart @@ -34,9 +34,11 @@ showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, S }); } } else { - if (await Permission.calendarFullAccess.request().isGranted) { - _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, - onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); + if (await Permission.calendarWriteOnly.request().isGranted) { + if (await Permission.calendarFullAccess.request().isGranted) { + _showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted, + onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess ?? (int) {}); + } } } } diff --git a/lib/pages/feedback/send_feedback_page.dart b/lib/pages/feedback/send_feedback_page.dart index 4072f102..7316b8c1 100644 --- a/lib/pages/feedback/send_feedback_page.dart +++ b/lib/pages/feedback/send_feedback_page.dart @@ -27,7 +27,7 @@ import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; // import 'package:speech_to_text/speech_recognition_error.dart'; -// import 'package:speech_to_text/speech_to_text.dart' as stt; +import 'package:speech_to_text/speech_to_text.dart' as stt; class SendFeedbackPage extends StatefulWidget { final AppoitmentAllHistoryResultList? appointment; @@ -51,7 +51,7 @@ class _SendFeedbackPageState extends State { MessageType messageType = MessageType.NON; var _currentLocaleId; - // stt.SpeechToText speech = stt.SpeechToText(); + stt.SpeechToText speech = stt.SpeechToText(); var reconizedWord; int selectedStatusIndex = 5; var event = RobotProvider(); @@ -408,8 +408,8 @@ class _SendFeedbackPageState extends State { color: Color(0xff575757), letterSpacing: -0.56, ), - // suffixIconConstraints: BoxConstraints(minWidth: 50), - // suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), + suffixIconConstraints: BoxConstraints(minWidth: 50), + suffixIcon: suffixTap == null ? null : IconButton(icon: Icon(Icons.mic, color: Color(0xff2E303A)), onPressed: suffixTap), contentPadding: EdgeInsets.zero, border: InputBorder.none, focusedBorder: InputBorder.none, @@ -524,38 +524,21 @@ class _SendFeedbackPageState extends State { openSpeechReco() async { new RoboSearch(context: context).showAlertDialog(context); _currentLocaleId = TranslationBase.of(AppGlobal.context).locale.languageCode; - // bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); - // if (available) { - // speech.listen( - // onResult: resultListener, - // listenMode: stt.ListenMode.confirmation, - // localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', - // ); - // } else { - // print("The user has denied the use of speech recognition."); - // } - } - // openSpeechReco() async { - // new RoboSearch(context: context).showAlertDialog(context); - // _currentLocaleId = TranslationBase.of(AppGlobal.context).locale.languageCode; - // bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); - // if (available) { - // speech.listen( - // onResult: resultListener, - // listenMode: stt.ListenMode.confirmation, - // localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', - // ); - // } else { - // print("The user has denied the use of speech recognition."); - // } - // } - // - // void errorListener(SpeechRecognitionError error) { - // event.setValue({"searchText": 'null'}); - // //SpeechToText.closeAlertDialog(context); - // print(error); - // } + bool available = await speech.initialize(); + if(available) { + speech.listen( + onResult: resultListener, + listenFor: Duration(seconds: 10), + localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', + // onSoundLevelChange: soundLevelListener, + // cancelOnError: true, + // partialResults: true, + // onDevice: true, + // listenMode: stt.ListenMode.deviceDefault + ); + } + } void statusListener(String status) { reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; } diff --git a/pubspec.yaml b/pubspec.yaml index ebf51eb9..8e314461 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -103,7 +103,7 @@ dependencies: flutter_svg: ^2.0.8 #Calendar Events - manage_calendar_events: ^2.0.1 + manage_calendar_events: ^2.0.2 #InAppBrowser flutter_inappwebview: ^5.8.0