|
|
|
|
@ -22,7 +22,7 @@ import 'package:speech_to_text/speech_to_text.dart' as stt;
|
|
|
|
|
class AddReplayOnReferralPatient extends StatefulWidget {
|
|
|
|
|
final PatientReferralViewModel patientReferralViewModel;
|
|
|
|
|
final MyReferralPatientModel myReferralInPatientModel;
|
|
|
|
|
//TODO Jammal
|
|
|
|
|
|
|
|
|
|
const AddReplayOnReferralPatient(
|
|
|
|
|
{Key key, this.patientReferralViewModel, this.myReferralInPatientModel})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
@ -38,7 +38,7 @@ class _AddReplayOnReferralPatientState
|
|
|
|
|
stt.SpeechToText speech = stt.SpeechToText();
|
|
|
|
|
var reconizedWord;
|
|
|
|
|
var event = RobotProvider();
|
|
|
|
|
TextEditingController progressNoteController = TextEditingController();
|
|
|
|
|
TextEditingController replayOnReferralController = TextEditingController();
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
requestPermissions();
|
|
|
|
|
@ -71,12 +71,12 @@ class _AddReplayOnReferralPatientState
|
|
|
|
|
children: [
|
|
|
|
|
AppTextFieldCustom(
|
|
|
|
|
hintText: 'Replay your responses here',
|
|
|
|
|
controller: progressNoteController,
|
|
|
|
|
controller: replayOnReferralController,
|
|
|
|
|
maxLines: 35,
|
|
|
|
|
minLines: 25,
|
|
|
|
|
hasBorder: true,
|
|
|
|
|
validationError:
|
|
|
|
|
progressNoteController.text.isEmpty &&
|
|
|
|
|
replayOnReferralController.text.isEmpty &&
|
|
|
|
|
isSubmitted
|
|
|
|
|
? TranslationBase.of(context).emptyMessage
|
|
|
|
|
: null,
|
|
|
|
|
@ -107,11 +107,11 @@ class _AddReplayOnReferralPatientState
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
height: replayOnReferralController.text.isNotEmpty? 130:70,
|
|
|
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
|
|
|
child: Wrap(
|
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
progressNoteController.text.isEmpty
|
|
|
|
|
replayOnReferralController.text.isEmpty
|
|
|
|
|
? SizedBox()
|
|
|
|
|
: Container(
|
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
|
@ -120,7 +120,7 @@ class _AddReplayOnReferralPatientState
|
|
|
|
|
title: TranslationBase.of(context).clearText,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
progressNoteController.text = '';
|
|
|
|
|
replayOnReferralController.text = '';
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
)),
|
|
|
|
|
@ -135,10 +135,10 @@ class _AddReplayOnReferralPatientState
|
|
|
|
|
setState(() {
|
|
|
|
|
isSubmitted = true;
|
|
|
|
|
});
|
|
|
|
|
if (progressNoteController.text.isNotEmpty) {
|
|
|
|
|
if (replayOnReferralController.text.isNotEmpty) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
await widget.patientReferralViewModel.replay(
|
|
|
|
|
progressNoteController.text.trim(),
|
|
|
|
|
replayOnReferralController.text.trim(),
|
|
|
|
|
widget.myReferralInPatientModel);
|
|
|
|
|
if (widget.patientReferralViewModel.state ==
|
|
|
|
|
ViewState.ErrorLocal) {
|
|
|
|
|
@ -199,7 +199,7 @@ class _AddReplayOnReferralPatientState
|
|
|
|
|
if (result.finalResult == true) {
|
|
|
|
|
setState(() {
|
|
|
|
|
SpeechToText.closeAlertDialog(context);
|
|
|
|
|
progressNoteController.text += reconizedWord + '\n';
|
|
|
|
|
replayOnReferralController.text += reconizedWord + '\n';
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|