Speech to text fix in iOS

merge-update-with-lab-changes
haroon amjad 4 years ago
parent 8e00c59746
commit 94aab4a737

@ -94,6 +94,13 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
this.appointHistory = widget.appointment; this.appointHistory = widget.appointment;
}); });
requestPermissions(); requestPermissions();
event.controller.stream.listen((p) {
if (p['isIOSFeedback'] == 'true') {
if (this.mounted) {
this.titleController.value = p['data'];
}
}
});
super.initState(); super.initState();
} }
@ -538,9 +545,10 @@ class _SendFeedbackPageState extends State<SendFeedbackPage> {
if (result.finalResult == true) { if (result.finalResult == true) {
setState(() { setState(() {
messageController.text += reconizedWord + '\n';
RoboSearch.closeAlertDialog(context); RoboSearch.closeAlertDialog(context);
speech.stop(); speech.stop();
messageController.text = reconizedWord + '\n';
}); });
} }
} }

@ -1,9 +1,8 @@
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:maps_launcher/maps_launcher.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:map_launcher/map_launcher.dart'; import 'package:map_launcher/map_launcher.dart';
import 'package:url_launcher/url_launcher.dart';
class AvailabilityInfo extends StatelessWidget { class AvailabilityInfo extends StatelessWidget {
final ProductDetailViewModel previousModel; final ProductDetailViewModel previousModel;
@ -21,8 +20,8 @@ class AvailabilityInfo extends StatelessWidget {
), ),
) )
: Container( : Container(
margin: EdgeInsets.only(bottom: 40), margin: EdgeInsets.only(bottom: 40),
child: ListView.builder( child: ListView.builder(
physics: ScrollPhysics(), physics: ScrollPhysics(),
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
@ -56,13 +55,14 @@ class AvailabilityInfo extends StatelessWidget {
color: Colors.red, color: Colors.red,
onPressed: () { onPressed: () {
MapLauncher.showMarker( MapLauncher.showMarker(
mapType: MapType.google, mapType: MapType.googleGo,
coords: Coords(double.parse(previousModel.productLocationService[index].latitude), coords: Coords(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude)),
double.parse(previousModel.productLocationService[index].longitude)), title: previousModel.productLocationService[index].locationDescription,
title: previousModel.productLocationService[index].locationDescription,
// description: location.locationName, // description: location.locationName,
); ).then((value) {}).catchError((err) {
// MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription); print(err);
});
// MapLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription);
}, },
), ),
), ),
@ -84,7 +84,7 @@ class AvailabilityInfo extends StatelessWidget {
); );
}, },
), ),
); );
} }
convertCityName(txt) { convertCityName(txt) {

@ -54,9 +54,11 @@ import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart' show TargetPlatform;
import 'package:flutter/material.dart'; 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:permission_handler/permission_handler.dart';
@ -896,17 +898,6 @@ class RoboSearch {
}); });
showAlertDialog(BuildContext context) { showAlertDialog(BuildContext context) {
//AlertDialog alert = AlertDialog
// AlertDialog alert = AlertDialog(content: MyStatefulBuilder(dispose: () {
// print('dispose!!!!!!!!!!!!');
// })
// isClosed = true;
// streamSubscription.cancel();
// }, builder: (BuildContext context, StateSetter setState) {
// //print(streamSubscription);
// }),
// );
// show the dialog // show the dialog
showDialog( showDialog(
context: context, context: context,
@ -918,7 +909,6 @@ class RoboSearch {
); );
}, },
); );
print(dialog);
} }
static closeAlertDialog(BuildContext context) { static closeAlertDialog(BuildContext context) {
@ -946,6 +936,7 @@ class _MyStatefulBuilderState extends State<MyStatefulBuilder> {
var searchText; var searchText;
static StreamSubscription<dynamic> streamSubscription; static StreamSubscription<dynamic> streamSubscription;
static var isClosed = false; static var isClosed = false;
stt.SpeechToText speech = stt.SpeechToText();
@override @override
void initState() { void initState() {
@ -1006,6 +997,21 @@ class _MyStatefulBuilderState extends State<MyStatefulBuilder> {
event.setValue({'startPopUp': 'true'}); event.setValue({'startPopUp': 'true'});
}, },
)) ))
: SizedBox(),
searchText != 'null' && searchText != null && Theme.of(context).platform == TargetPlatform.iOS
? Center(
child: DefaultButton(
TranslationBase.of(context).ok,
() {
RoboSearch.closeAlertDialog(context);
speech.stop();
// event.setValue({"searchText": {
// 'isIOSFeedback':true,
//
// }
// });
},
))
: SizedBox() : SizedBox()
]), ]),
))); )));

Loading…
Cancel
Save