voice command

merge-requests/140/head
Sultan Khan 6 years ago
parent ce7a64e86e
commit 7742313923

@ -50,6 +50,7 @@ import 'core/service/medical/reports_monthly_service.dart';
import 'core/service/medical/vital_sign_service.dart'; import 'core/service/medical/vital_sign_service.dart';
import 'core/service/parmacyModule/order-preview-service.dart'; import 'core/service/parmacyModule/order-preview-service.dart';
import 'core/service/notifications_service.dart'; import 'core/service/notifications_service.dart';
import 'core/service/privilege_service.dart';
import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart'; import 'core/viewModels/AlHabibMedicalService/cmc_view_model.dart';
import 'core/service/parmacyModule/parmacy_module_service.dart'; import 'core/service/parmacyModule/parmacy_module_service.dart';
@ -153,6 +154,7 @@ void setupLocator() {
locator.registerLazySingleton(() => OrderPreviewService()); locator.registerLazySingleton(() => OrderPreviewService());
locator.registerLazySingleton(() => CustomerAddressesService()); locator.registerLazySingleton(() => CustomerAddressesService());
// locator.registerLazySingleton(() => TermsConditionService()); // locator.registerLazySingleton(() => TermsConditionService());
locator.registerLazySingleton(() => PrivilegeService());
/// View Model /// View Model
locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => HospitalViewModel());

@ -94,37 +94,37 @@ class AppScaffold extends StatelessWidget {
appBar = preferredSize == 0 appBar = preferredSize == 0
? appBarWidget ? appBarWidget
: PreferredSize( : PreferredSize(
child: appBarWidget, child: appBarWidget,
preferredSize: Size.fromHeight(preferredSize)); preferredSize: Size.fromHeight(preferredSize));
} else { } else {
appBar = this.appBarWidget; appBar = this.appBarWidget;
} }
return Scaffold( return Scaffold(
backgroundColor: backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: appBar, appBar: appBar,
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
isShowDecPage) isShowDecPage)
? NotAutPage( ? NotAutPage(
title: appBarTitle, title: appBarTitle,
description: description, description: description,
infoList: infoList, infoList: infoList,
imagesInfo: imagesInfo, imagesInfo: imagesInfo,
) )
: baseViewModel != null : baseViewModel != null
? NetworkBaseView( ? NetworkBaseView(
child: buildBodyWidget(context), child: buildBodyWidget(context),
baseViewModel: baseViewModel, baseViewModel: baseViewModel,
) )
: buildBodyWidget(context), : buildBodyWidget(context),
bottomSheet: bottomSheet bottomSheet: bottomSheet
//floatingActionButton: floatingActionButton ?? floatingActionButton, //floatingActionButton: floatingActionButton ?? floatingActionButton,
// bottomNavigationBar: // bottomNavigationBar:
// this.isBottomBar == true ? BottomBarSearch() : SizedBox() // this.isBottomBar == true ? BottomBarSearch() : SizedBox()
//floatingActionButton: FloatingSearchButton(), //floatingActionButton: FloatingSearchButton(),
); );
} }
buildAppLoaderWidget(bool isLoading) { buildAppLoaderWidget(bool isLoading) {
@ -133,10 +133,9 @@ class AppScaffold extends StatelessWidget {
buildBodyWidget(context) { buildBodyWidget(context) {
// return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]); // return body; //Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)]);
return Stack(children: <Widget>[ //&& Provider.of<ProjectViewModel>(context, listen: false).havePrivilege(77) need to added
body, return Stack(
isHelp==true && Provider.of<ProjectViewModel>(context, listen: false).havePrivilege(77) ? RobotIcon() : Container() children: <Widget>[body, isHelp == true ? RobotIcon() : Container()]);
]);
} }
} }

@ -217,11 +217,11 @@ class _FloatingSearchButton extends State<FloatingSearchButton>
void resultListener(SpeechRecognitionResult result) { void resultListener(SpeechRecognitionResult result) {
// lastWords = "${result.recognizedWords} - ${result.finalResult}"; // lastWords = "${result.recognizedWords} - ${result.finalResult}";
print(result);
reconizedWord = result.recognizedWords; reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord}); event.setValue({"searchText": reconizedWord});
if (result.finalResult == true) { if (result.finalResult == true) {
RoboSearch.closeAlertDialog(context);
// setState(() { // setState(() {
@ -230,6 +230,7 @@ class _FloatingSearchButton extends State<FloatingSearchButton>
// }); // });
Future.delayed(const Duration(seconds: 1), () { Future.delayed(const Duration(seconds: 1), () {
_speak(reconizedWord); _speak(reconizedWord);
RoboSearch.closeAlertDialog(context);
}); });
} }
//}); //});
@ -942,9 +943,14 @@ class RoboSearch {
Expanded( Expanded(
flex: 1, flex: 1,
child: Center( child: Center(
child: Text(searchText != null child: Text(searchText != null && searchText != 'null'
? searchText ? searchText
: 'Try saying something'))) : 'Try saying something'))),
// searchText == 'null' ? Center(child:RaisedButton(child: Text('Retry'), onPressed: (){
// //RoboSearch.closeAlertDialog(context);
// new FloatingSearchButton().createState().startVoiceSearch();
// }, )) :SizedBox()
]), ]),
)); ));
}), }),

Loading…
Cancel
Save