finish the operation Reports from our side

merge-requests/862/head
Elham Rababh 4 years ago
parent 231614e914
commit a44a207116

@ -348,7 +348,7 @@ const GET_EPISODE_FOR_INPATIENT =
const GET_OPERATION_REPORT = const GET_OPERATION_REPORT =
"/Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails"; "/Services/DoctorApplication.svc/REST/DoctorApp_GetReservationDetails";
const UPDATE_OPERATION_REPORT = const UPDATE_OPERATION_REPORT =
"/Services/DoctorApplication.svc/REST/DoctorApp_CreateUpdateOperationReport"; "Services/DoctorApplication.svc/REST/DoctorApp_CreateUpdateOperationReport";
var selectedPatientType = 1; var selectedPatientType = 1;

@ -709,5 +709,6 @@ const Map<String, Map<String, String>> localizedValues = {
"en":"Request Type", "en":"Request Type",
"ar":"نوع الطلب"}, "ar":"نوع الطلب"},
"special": {"en": "Special", "ar": "خاص"}, "special": {"en": "Special", "ar": "خاص"},
"allClinic": {"en": "All Clinics", "ar": "جميع العيادات"} "allClinic": {"en": "All Clinics", "ar": "جميع العيادات"} ,
"operationReports": {"en": "Operation Reports", "ar": "تقارير العملية"}
}; };

@ -2,6 +2,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/service/operation_report_servive.dart'; import 'package:doctor_app_flutter/core/service/operation_report_servive.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/locator.dart'; import 'package:doctor_app_flutter/locator.dart';
import 'package:doctor_app_flutter/models/operation_report/create_update_operation_report_request_model.dart';
class OperationReportViewModel extends BaseViewModel { class OperationReportViewModel extends BaseViewModel {
bool hasError = false; bool hasError = false;
@ -28,6 +29,7 @@ class OperationReportViewModel extends BaseViewModel {
CreateUpdateOperationReportRequestModel CreateUpdateOperationReportRequestModel
createUpdateOperationReport) async { createUpdateOperationReport) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _operationReportService.updateOperationReport(createUpdateOperationReport);
if (_operationReportService.hasError) { if (_operationReportService.hasError) {
error = _operationReportService.error; error = _operationReportService.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);

@ -90,15 +90,11 @@ class _ProgressNoteState extends State<OperationReportScreen> {
patient, patient,
isInpatient: true, isInpatient: true,
), ),
body: model.operationReportList == null || body:
model.operationReportList.length == 0 Container(
? DrAppEmbeddedError(
error: TranslationBase.of(context).errorNoProgressNote)
: Container(
color: Colors.grey[200], color: Colors.grey[200],
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
if (!isDischargedPatient)
AddNewOrder( AddNewOrder(
onTap: () async { onTap: () async {
await locator<AnalyticsService>().logEvent( await locator<AnalyticsService>().logEvent(
@ -108,8 +104,8 @@ class _ProgressNoteState extends State<OperationReportScreen> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => UpdateOperatiomReport( builder: (context) => UpdateOperationReport(
patientModel: model, operationReportViewModel: model,
patient: patient, patient: patient,
visitType: widget.visitType, visitType: widget.visitType,
isUpdate: false, isUpdate: false,
@ -118,11 +114,12 @@ class _ProgressNoteState extends State<OperationReportScreen> {
), ),
); );
}, },
label: widget.visitType == 3 label: TranslationBase.of(context).operationReports,
? TranslationBase.of(context).addNewOrderSheet
: TranslationBase.of(context).addProgressNote,
), ),
Expanded( model.operationReportList == null ||
model.operationReportList.length == 0
? DrAppEmbeddedError(
error: TranslationBase.of(context).errorNoProgressNote):Expanded(
child: Container( child: Container(
child: ListView.builder( child: ListView.builder(
itemCount: model.operationReportList.length, itemCount: model.operationReportList.length,
@ -558,97 +555,4 @@ class _ProgressNoteState extends State<OperationReportScreen> {
), ),
); );
} }
showMyDialog({BuildContext context, Function confirmFun, String actionName}) {
showDialog(
context: context,
builder: (ctx) => Center(
child: Container(
width: MediaQuery.of(context).size.width * 0.8,
height: 200,
child: AppScaffold(
isShowAppBar: false,
body: Container(
color: Colors.white,
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
// SizedBox(height: 20,),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
TranslationBase.of(context).noteConfirm,
fontWeight: FontWeight.w600,
color: Colors.black,
fontSize: 16,
),
],
),
SizedBox(
height: 10,
),
DividerWithSpacesAround(),
SizedBox(
height: 12,
),
Container(
padding: EdgeInsets.all(20),
color: Colors.white,
child: AppText(
projectViewModel.isArabic
? "هل أنت متأكد أنك تريد تنفيذ $actionName هذا الأمر؟"
: 'Are you sure you want $actionName this order?',
fontSize: 15,
textAlign: TextAlign.center,
),
),
SizedBox(
height: 8,
),
DividerWithSpacesAround(),
FractionallySizedBox(
widthFactor: 0.75,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
FlatButton(
child: AppText(
TranslationBase.of(context).cancel,
fontWeight: FontWeight.w600,
color: Colors.black,
fontSize: 16,
), //Text("Cancel"),
onPressed: () {
Navigator.of(context).pop();
}),
FlatButton(
child: AppText(
TranslationBase.of(context).noteConfirm,
fontWeight: FontWeight.w600,
color: Colors.red.shade700,
fontSize: 16,
), //Text("Confirm", ),
onPressed: () async {
await confirmFun();
Navigator.of(context).pop();
})
],
),
)
],
),
),
),
),
),
));
}
} }

@ -76,8 +76,7 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
TextEditingController circulatingNurseController = TextEditingController(); TextEditingController circulatingNurseController = TextEditingController();
TextEditingController BloodTransfusedDetailController = TextEditingController BloodTransfusedDetailController =
TextEditingController(); TextEditingController();
TextEditingController anasthetistController = TextEditingController anasthetistController = TextEditingController();
TextEditingController();
setSelectedType(int val) { setSelectedType(int val) {
setState(() { setState(() {
@ -87,240 +86,491 @@ class _UpdateOperationReportState extends State<UpdateOperationReport> {
@override @override
void initState() { void initState() {
requestPermissions();
event.controller.stream.listen((p) {
if (p['startPopUp'] == 'true') {
if (this.mounted) {
initSpeechState().then((value) => {onVoiceText()});
}
}
});
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
//TODO Elham* add translation to hints
if (widget.note != null) {
preOpDiagmosisController.text = widget.note.notes;
}
return AppScaffold( return AppScaffold(
isShowAppBar: false, isShowAppBar: true,
backgroundColor: Theme.of(context).scaffoldBackgroundColor, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
appBar: BottomSheetTitle(
title: (widget.isUpdate
? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).operationReports,
),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 1.0, height: MediaQuery.of(context).size.height * 1.0,
child: Padding( child: Padding(
padding: EdgeInsets.all(0.0), padding: EdgeInsets.all(0.0),
child: Column( child: SingleChildScrollView(
crossAxisAlignment: CrossAxisAlignment.start, child: Column(
children: [ crossAxisAlignment: CrossAxisAlignment.start,
BottomSheetTitle( children: [
title: (widget.isUpdate SizedBox(
? TranslationBase.of(context).noteUpdate height: 10.0,
: TranslationBase.of(context).noteAdd) + ),
TranslationBase.of(context).progressNote, SingleChildScrollView(
), child: Center(
SizedBox( child: FractionallySizedBox(
height: 10.0, widthFactor: 0.9,
), child: Column(
Center( children: [
child: FractionallySizedBox( AppTextFieldCustom(
widthFactor: 0.9, hintText: "Pre Op Diagmosis",
child: Column( //TranslationBase.of(context).addoperationReports,
children: [ controller: preOpDiagmosisController,
AppTextFieldCustom( maxLines: 1,
hintText: widget.visitType == 3 minLines: 1,
? (widget.isUpdate hasBorder: true,
? TranslationBase.of(context)
.noteUpdate
: TranslationBase.of(context)
.noteAdd) +
TranslationBase.of(context).orderSheet
: (widget.isUpdate
? TranslationBase.of(context)
.noteUpdate
: TranslationBase.of(context)
.noteAdd) +
TranslationBase.of(context).progressNote,
//TranslationBase.of(context).addProgressNote,
controller: preOpDiagmosisController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
preOpDiagmosisController.text.isEmpty && preOpDiagmosisController.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context).emptyMessage
: null, : null,
), ),
SizedBox(height: 4,), SizedBox(
AppTextFieldCustom( height: 4,
hintText: "Post Op Diagmosis", ),
//TranslationBase.of(context).addProgressNote, AppTextFieldCustom(
controller: postOpDiagmosisNoteController, hintText: "Post Op Diagmosis",
maxLines: 1, //TranslationBase.of(context).addoperationReports,
minLines: 1, controller: postOpDiagmosisNoteController,
hasBorder: true, maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
postOpDiagmosisNoteController.text.isEmpty && postOpDiagmosisNoteController.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context).emptyMessage
: null, : null,
), ),
SizedBox(height: 4,), SizedBox(
AppTextFieldCustom( height: 4,
hintText: "Post Op Diagmosis", ),
//TranslationBase.of(context).addProgressNote, AppTextFieldCustom(
controller: postOpDiagmosisNoteController, hintText: "Surgeon",
maxLines: 1, //TranslationBase.of(context).addoperationReports,
minLines: 1, controller: surgeonController,
hasBorder: true, maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
surgeonController.text.isEmpty && isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "assistant",
//TranslationBase.of(context).addoperationReports,
controller: assistantNoteController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
assistantNoteController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "Operation",
//TranslationBase.of(context).addoperationReports,
controller: operationController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
operationController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "inasion",
//TranslationBase.of(context).addoperationReports,
controller: inasionController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
inasionController.text.isEmpty && isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "finding",
//TranslationBase.of(context).addoperationReports,
controller: findingController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
findingController.text.isEmpty && isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "Surgery Procedure",
//TranslationBase.of(context).addoperationReports,
controller: surgeryProcedureController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
surgeryProcedureController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "Post Op Instruction",
//TranslationBase.of(context).addoperationReports,
controller: postOpInstructionController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
postOpInstructionController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "Complication Details",
//TranslationBase.of(context).addoperationReports,
controller: complicationDetailsController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
complicationDetailsController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "Blood Loss Detail",
//TranslationBase.of(context).addoperationReports,
controller: bloodLossDetailController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
bloodLossDetailController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "histopal the Specimen",
//TranslationBase.of(context).addoperationReports,
controller: histopathSpecimenController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
histopathSpecimenController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "microbiology Specimen ",
//TranslationBase.of(context).addoperationReports,
controller: microbiologySpecimenController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
microbiologySpecimenController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "other Specimen",
//TranslationBase.of(context).addoperationReports,
controller: otherSpecimenController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true, // isTextFieldHasSuffix: true,
validationError: validationError:
postOpDiagmosisNoteController.text.isEmpty && otherSpecimenController.text.isEmpty &&
isSubmitted isSubmitted
? TranslationBase.of(context).emptyMessage ? TranslationBase.of(context).emptyMessage
: null, : null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "scrub Nurse",
//TranslationBase.of(context).addoperationReports,
controller: scrubNurseController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
scrubNurseController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "circulating Nurse",
//TranslationBase.of(context).addoperationReports,
controller: circulatingNurseController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
circulatingNurseController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "Blood Transfused Detail",
//TranslationBase.of(context).addoperationReports,
controller: BloodTransfusedDetailController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError: BloodTransfusedDetailController
.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 4,
),
AppTextFieldCustom(
hintText: "Anasthetist",
//TranslationBase.of(context).addoperationReports,
controller: anasthetistController,
maxLines: 1,
minLines: 1,
hasBorder: true,
// isTextFieldHasSuffix: true,
validationError:
anasthetistController.text.isEmpty &&
isSubmitted
? TranslationBase.of(context).emptyMessage
: null,
),
SizedBox(
height: 250,
),
],
), ),
SizedBox(height: 4,), ),
],
), ),
), ),
), ],
], ),
), ),
), ),
), ),
), ),
bottomSheet: Container( bottomSheet: Container(
height: preOpDiagmosisController.text.isNotEmpty ? 130 : 70, height: 70,
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5), margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: AppButton( child: AppButton(
title: (widget.isUpdate title: (widget.isUpdate
? TranslationBase.of(context).noteUpdate ? TranslationBase.of(context).noteUpdate
: TranslationBase.of(context).noteAdd) + : TranslationBase.of(context).noteAdd) +
TranslationBase.of(context).progressNote, TranslationBase.of(context).operationReports,
color: Color(0xff359846), color: Color(0xff359846),
// disabled: progressNoteController.text.isEmpty, // disabled: operationReportsController.text.isEmpty,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
onPressed: () async { onPressed: () async {
setState(() { setState(() {
isSubmitted = true; isSubmitted = true;
}); });
GifLoaderDialogUtils.showMyDialog(context); if (isFormValid()) {
Map profile = await sharedPref.getObj(DOCTOR_PROFILE); GifLoaderDialogUtils.showMyDialog(context);
if (widget.isUpdate) { await widget.operationReportViewModel.getDoctorProfile();
CreateUpdateOperationReportRequestModel
createUpdateOperationReportRequestModel =
CreateUpdateOperationReportRequestModel(
inasion: inasionController.text,
preOpDiagmosis: preOpDiagmosisController.text,
postOpDiagmosis: postOpDiagmosisNoteController.text,
surgeon: surgeonController.text,
assistant: assistantNoteController.text,
anasthetist:assistantNoteController.text,
operation: operationController.text,
finding: findingController.text,
surgeryProcedure: surgeonController.text,
postOpInstruction: postOpInstructionController.text,
complicationDetails: complicationDetailsController.text,
bloodLossDetail: bloodLossDetailController.text,
histopathSpecimen: histopathSpecimenController.text,
microbiologySpecimen: microbiologySpecimenController.text,
otherSpecimen: otherSpecimenController.text,
scrubNurse: surgeonController.text,
circulatingNurse: circulatingNurseController.text,
bloodTransfusedDetail: bloodLossDetailController.text
);
await widget.operationReportViewModel
.updateOperationReport(createUpdateOperationReportRequestModel);
}
if (widget.operationReportViewModel.state ==
ViewState.ErrorLocal) {
Helpers.showErrorToast(
widget.operationReportViewModel.error);
} else {
// await widget.operationReportViewModel.(
// progressNoteRequest.toJson());
DrAppToastMsg.showSuccesToast( CreateUpdateOperationReportRequestModel
"Your Order added Successfully"); createUpdateOperationReportRequestModel =
Navigator.of(context).pop(); CreateUpdateOperationReportRequestModel(
} inasion: inasionController.text,
GifLoaderDialogUtils.hideDialog(context); /// TODO Elham* Add dynamic reservation
reservationNo: 0,
preOpDiagmosis: preOpDiagmosisController.text,
postOpDiagmosis: postOpDiagmosisNoteController.text,
surgeon: surgeonController.text,
assistant: assistantNoteController.text,
anasthetist: assistantNoteController.text,
operation: operationController.text,
finding: findingController.text,
surgeryProcedure: surgeonController.text,
postOpInstruction: postOpInstructionController.text,
complicationDetails:
complicationDetailsController.text,
bloodLossDetail: bloodLossDetailController.text,
histopathSpecimen: histopathSpecimenController.text,
microbiologySpecimen:
microbiologySpecimenController.text,
otherSpecimen: otherSpecimenController.text,
scrubNurse: surgeonController.text,
circulatingNurse: circulatingNurseController.text,
bloodTransfusedDetail:
bloodLossDetailController.text,
patientID: widget.patient.patientId,
admissionNo: int.parse(widget.patient.admissionNo),
createdBy: widget.operationReportViewModel.doctorProfile.doctorID,
setupID: SETUP_ID);
await widget.operationReportViewModel.updateOperationReport(
createUpdateOperationReportRequestModel);
if (widget.operationReportViewModel.state ==
ViewState.ErrorLocal) {
Helpers.showErrorToast(
widget.operationReportViewModel.error);
} else {
// await widget.operationReportViewModel.(
// operationReportsRequest.toJson());
})), DrAppToastMsg.showSuccesToast(
"Your Order added Successfully");
Navigator.of(context).pop();
}
GifLoaderDialogUtils.hideDialog(context);
}
},
),
),
], ],
), ),
), ),
); );
} }
onVoiceText() async { isFormValid() {
new SpeechToText(context: context).showAlertDialog(context); if (preOpDiagmosisController.text != null &&
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; preOpDiagmosisController.text.isNotEmpty &&
bool available = await speech.initialize( postOpDiagmosisNoteController.text != null &&
onStatus: statusListener, onError: errorListener); postOpDiagmosisNoteController.text.isNotEmpty &&
if (available) { surgeonController.text != null &&
speech.listen( surgeonController.text.isNotEmpty &&
onResult: resultListener, assistantNoteController.text != null &&
listenMode: stt.ListenMode.confirmation, assistantNoteController.text.isNotEmpty &&
localeId: lang == 'en' ? 'en-US' : 'ar-SA', operationController.text != null &&
); operationController.text.isNotEmpty &&
inasionController.text != null &&
inasionController.text.isNotEmpty &&
findingController.text != null &&
findingController.text.isNotEmpty &&
surgeryProcedureController.text != null &&
surgeryProcedureController.text.isNotEmpty &&
postOpInstructionController.text != null &&
postOpInstructionController.text.isNotEmpty &&
complicationDetailsController.text != null &&
complicationDetailsController.text.isNotEmpty &&
bloodLossDetailController.text != null &&
bloodLossDetailController.text.isNotEmpty &&
histopathSpecimenController.text != null &&
histopathSpecimenController.text.isNotEmpty &&
microbiologySpecimenController.text != null &&
microbiologySpecimenController.text.isNotEmpty &&
otherSpecimenController.text != null &&
otherSpecimenController.text.isNotEmpty &&
scrubNurseController.text != null &&
scrubNurseController.text.isNotEmpty &&
circulatingNurseController.text != null &&
circulatingNurseController.text.isNotEmpty &&
BloodTransfusedDetailController.text != null &&
BloodTransfusedDetailController.text.isNotEmpty &&
anasthetistController.text != null &&
anasthetistController.text.isNotEmpty) {
return true;
} else { } else {
print("The user has denied the use of speech recognition."); return false;
} }
} }
void errorListener(SpeechRecognitionError error) {
event.setValue({"searchText": 'null'});
//SpeechToText.closeAlertDialog(context);
print(error);
}
void statusListener(String status) {
reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....';
}
void requestPermissions() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.microphone,
].request();
}
void resultListener(result) {
reconizedWord = result.recognizedWords;
event.setValue({"searchText": reconizedWord});
if (result.finalResult == true) {
setState(() {
SpeechToText.closeAlertDialog(context);
speech.stop();
preOpDiagmosisController.text += reconizedWord + '\n';
});
} else {
print(result.finalResult);
}
}
Future<void> initSpeechState() async {
bool hasSpeech = await speech.initialize(
onError: errorListener, onStatus: statusListener);
print(hasSpeech);
if (!mounted) return;
}
} }

@ -212,6 +212,7 @@ class TranslationBase {
String get replay => localizedValues['replay'][locale.languageCode]; String get replay => localizedValues['replay'][locale.languageCode];
String get progressNote => localizedValues['progressNote'][locale.languageCode]; String get progressNote => localizedValues['progressNote'][locale.languageCode];
String get operationReports => localizedValues['operationReports'][locale.languageCode];
String get progress => localizedValues['progress'][locale.languageCode]; String get progress => localizedValues['progress'][locale.languageCode];

Loading…
Cancel
Save