diff --git a/assets/images/habib-logo.png b/assets/images/habib-logo.png new file mode 100644 index 00000000..bcb6a42b Binary files /dev/null and b/assets/images/habib-logo.png differ diff --git a/assets/images/soundWaveAnimation.gif b/assets/images/soundWaveAnimation.gif new file mode 100644 index 00000000..730e27eb Binary files /dev/null and b/assets/images/soundWaveAnimation.gif differ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 878a1850..2f4607e0 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -322,4 +322,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.10.1 +COCOAPODS: 1.10.0.rc.1 diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 68206226..12286b64 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -859,6 +859,7 @@ const Map> localizedValues = { "noOfDays": {"en": "No of days", "ar": "عدد الأيام"}, "numOfDays": {"en": "Number of Days", "ar": "عدد الأيام"}, "replayBefore": {"en": "Replay Before", "ar": "رد قبل"}, + "try-saying": {"en": "Try saying something", "ar": 'حاول قول شيء ما'}, "refClinic": {"en": "Ref Clinic", "ar": "Ref Clinic"}, "acknowledged": {"en": "Acknowledged", "ar": "إقرار"}, }; diff --git a/lib/core/provider/robot_provider.dart b/lib/core/provider/robot_provider.dart new file mode 100644 index 00000000..a01b1318 --- /dev/null +++ b/lib/core/provider/robot_provider.dart @@ -0,0 +1,25 @@ +import 'dart:async'; + +class RobotProvider { + static final RobotProvider _singleton = RobotProvider._internal(); + var value; + StreamController controller = StreamController.broadcast(); + + getData() { + // return data; + } + intStream() { + controller.add({}); + } + + setValue(Map data) { + value = data; + controller.add(value); + } + + factory RobotProvider() { + return _singleton; + } + + RobotProvider._internal(); +} diff --git a/lib/main.dart b/lib/main.dart index b5e8414d..41441d78 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/livecare_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; @@ -42,6 +43,10 @@ class MyApp extends StatelessWidget { ChangeNotifierProvider( create: (context) => LiveCareViewModel(), ), + StreamProvider.value( + value: RobotProvider().intStream(), + initialData: RobotProvider().setValue({}), + ) ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( diff --git a/lib/screens/doctor/doctor_repaly_chat.dart b/lib/screens/doctor/doctor_repaly_chat.dart index b5576e69..2c614b29 100644 --- a/lib/screens/doctor/doctor_repaly_chat.dart +++ b/lib/screens/doctor/doctor_repaly_chat.dart @@ -20,6 +20,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:url_launcher/url_launcher.dart'; class DoctorReplayChat extends StatelessWidget { @@ -107,7 +108,7 @@ class DoctorReplayChat extends StatelessWidget { SizedBox(height: 30,), Container( // color: Color(0xFF2B353E), - width: MediaQuery.of(context).size.width * 0.8, + width: MediaQuery.of(context).size.width * 0.9, padding: EdgeInsets.all(10), decoration: BoxDecoration( color: Color(0xFF2B353E), @@ -135,7 +136,7 @@ class DoctorReplayChat extends StatelessWidget { width: 60, height: 60, child: Image.asset( - 1 == 1 + reply.gender == 1 ? 'assets/images/male_avatar.png' : 'assets/images/female_avatar.png', fit: BoxFit.cover, @@ -144,7 +145,7 @@ class DoctorReplayChat extends StatelessWidget { Divider(), SizedBox(width: 10,), Container( - width: MediaQuery.of(context).size.width * 0.30, + width: MediaQuery.of(context).size.width * 0.35, child: AppText( reply.patientName .toString(), @@ -154,7 +155,19 @@ class DoctorReplayChat extends StatelessWidget { fontWeight: FontWeight.bold, // fontSize: 18 ), - ) + ), + Container( + margin: EdgeInsets.symmetric(horizontal: 4), + child: InkWell( + onTap: () { + launch("tel://" +reply.mobileNumber); + }, + child: Icon( + Icons.phone, + color: Colors.white, + ), + ), + ), ], ), Column( @@ -218,61 +231,61 @@ class DoctorReplayChat extends StatelessWidget { ), ), - Positioned( - bottom: 0, - child: Container( - width:MediaQuery.of(context).size.width * 1, - // height: MediaQuery.of(context).size.height * 0.12, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - FractionallySizedBox( - child: Container( - - child: TextFields( - borderRadius: 0, - hintText: TranslationBase - .of(context) - .typeHereToReply, - fontSize: 13.5, - - suffixIcon: FontAwesomeIcons.arrowRight, - suffixIconColor: Colors.green, - onSuffixTap: ()async { - GifLoaderDialogUtils.showMyDialog(context); - await model.replay(msgController.text, reply); - if(model.state == ViewState.ErrorLocal) { - Helpers.showErrorToast("An error happened while you are replaying"); - } else { - DrAppToastMsg.showSuccesToast("Thank you for your replay "); - await previousModel.getDoctorReply(); - Navigator.pop(context); - } - GifLoaderDialogUtils.hideDialog(context); - - - - - }, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 50, - minLines: 3, - controller: msgController, - validator: (value) { - if (value == null || value == "") - return TranslationBase.of(context) - .emptyMessage; - else - return null; - }), - - ), - ), - ], - ), - ), - ) + // Positioned( + // bottom: 0, + // child: Container( + // width:MediaQuery.of(context).size.width * 1, + // // height: MediaQuery.of(context).size.height * 0.12, + // child: Column( + // mainAxisSize: MainAxisSize.min, + // children: [ + // FractionallySizedBox( + // child: Container( + // + // child: TextFields( + // borderRadius: 0, + // hintText: TranslationBase + // .of(context) + // .typeHereToReply, + // fontSize: 13.5, + // + // suffixIcon: FontAwesomeIcons.arrowRight, + // suffixIconColor: Colors.green, + // onSuffixTap: ()async { + // GifLoaderDialogUtils.showMyDialog(context); + // await model.replay(msgController.text, reply); + // if(model.state == ViewState.ErrorLocal) { + // Helpers.showErrorToast("An error happened while you are replaying"); + // } else { + // DrAppToastMsg.showSuccesToast("Thank you for your replay "); + // await previousModel.getDoctorReply(); + // Navigator.pop(context); + // } + // GifLoaderDialogUtils.hideDialog(context); + // + // + // + // + // }, + // // hintColor: Colors.black, + // fontWeight: FontWeight.w600, + // maxLines: 50, + // minLines: 3, + // controller: msgController, + // validator: (value) { + // if (value == null || value == "") + // return TranslationBase.of(context) + // .emptyMessage; + // else + // return null; + // }), + // + // ), + // ), + // ], + // ), + // ), + // ) ], diff --git a/lib/screens/doctor/doctor_reply_screen.dart b/lib/screens/doctor/doctor_reply_screen.dart index 283ce7cd..f522561f 100644 --- a/lib/screens/doctor/doctor_reply_screen.dart +++ b/lib/screens/doctor/doctor_reply_screen.dart @@ -48,9 +48,7 @@ class DoctorReplyScreen extends StatelessWidget { children: model.listDoctorWorkingHoursTable.map((reply) { return InkWell( - onTap: reply.status != 2 - ? null - : () { + onTap: () { Navigator.push( context, MaterialPageRoute( diff --git a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart index 8adf55cd..c59bcc5b 100644 --- a/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart +++ b/lib/screens/patients/profile/admission-request/admission-request_second-screen.dart @@ -205,10 +205,11 @@ class _AdmissionRequestSecondScreenState enabled: false, isTextFieldHasSuffix: true, validationError: expectedDatesError, - suffixIcon: Icon( + suffixIcon: IconButton( + icon: Icon( Icons.calendar_today, color: Colors.black, - ), + )), onClick: () { if (_expectedAdmissionDate == null) { _expectedAdmissionDate = DateTime.now(); @@ -559,72 +560,85 @@ class _AdmissionRequestSecondScreenState setState(() { if (_estimatedCostController.text == "") { - costError = TranslationBase.of(context).fieldRequired; + costError = + TranslationBase.of(context).fieldRequired; } else { costError = null; } - if (_postPlansEstimatedCostController.text == "") { - plansError = TranslationBase.of(context).fieldRequired; + if (_postPlansEstimatedCostController.text == + "") { + plansError = + TranslationBase.of(context).fieldRequired; } else { plansError = null; } if (_expectedDaysController.text == "") { - expectedDaysError = TranslationBase.of(context).fieldRequired; + expectedDaysError = + TranslationBase.of(context).fieldRequired; } else { expectedDaysError = null; } if (_expectedAdmissionDate == null) { - expectedDatesError = TranslationBase.of(context).fieldRequired; + expectedDatesError = + TranslationBase.of(context).fieldRequired; } else { expectedDatesError = null; } - if (_otherDepartmentsInterventionsController.text == "") { - otherInterventionsError = TranslationBase.of(context).fieldRequired; + if (_otherDepartmentsInterventionsController + .text == + "") { + otherInterventionsError = + TranslationBase.of(context).fieldRequired; } else { otherInterventionsError = null; } if (_selectedFloor == null) { - floorError = TranslationBase.of(context).fieldRequired; + floorError = + TranslationBase.of(context).fieldRequired; } else { floorError = null; } if (_selectedRoomCategory == null) { - roomError = TranslationBase.of(context).fieldRequired; + roomError = + TranslationBase.of(context).fieldRequired; } else { roomError = null; } if (_treatmentLineController.text == "") { - treatmentsError = TranslationBase.of(context).fieldRequired; + treatmentsError = + TranslationBase.of(context).fieldRequired; } else { treatmentsError = null; } if (_complicationsController.text == "") { - complicationsError = TranslationBase.of(context).fieldRequired; + complicationsError = + TranslationBase.of(context).fieldRequired; } else { complicationsError = null; } if (_otherProceduresController.text == "") { - proceduresError = TranslationBase.of(context).fieldRequired; + proceduresError = + TranslationBase.of(context).fieldRequired; } else { proceduresError = null; } if (_selectedAdmissionType == null) { - admissionTypeError = TranslationBase.of(context).fieldRequired; + admissionTypeError = + TranslationBase.of(context).fieldRequired; } else { admissionTypeError = null; } }); - } }, ), diff --git a/lib/screens/patients/profile/note/progress_note_screen.dart b/lib/screens/patients/profile/note/progress_note_screen.dart index 5b806d4e..b6b9c195 100644 --- a/lib/screens/patients/profile/note/progress_note_screen.dart +++ b/lib/screens/patients/profile/note/progress_note_screen.dart @@ -9,6 +9,7 @@ import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/add-order/addNewOrder.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; +import 'package:doctor_app_flutter/widgets/shared/divider_with_spaces_around.dart'; import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:flutter/material.dart'; @@ -70,7 +71,7 @@ class _ProgressNoteState extends State { // appBarTitle: TranslationBase.of(context).progressNote, appBar: PatientProfileHeaderNewDesignAppBar( patient, patient.patientType.toString() ?? '0', arrivalType), - body: notesList == null || notesList.length == 0 + body: model.patientProgressNoteList == null || model.patientProgressNoteList.length == 0 ? DrAppEmbeddedError( error: TranslationBase.of(context).errorNoProgressNote) : Container( @@ -93,7 +94,7 @@ class _ProgressNoteState extends State { child: Container( child: ListView.builder( - itemCount: notesList.length, + itemCount: model.patientProgressNoteList.length, itemBuilder: (BuildContext ctxt, int index) { return Column( children: [ @@ -111,8 +112,8 @@ class _ProgressNoteState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ - if (notesList[index].status != 2 && - notesList[index].status != 4) + if (model.patientProgressNoteList[index].status != 2 && + model.patientProgressNoteList[index].status != 4) Row( crossAxisAlignment: CrossAxisAlignment.start, @@ -124,7 +125,7 @@ class _ProgressNoteState extends State { MaterialPageRoute( builder: (context) => UpdateNoteOrder( - note: notesList[ + note: model.patientProgressNoteList[ index], patientModel: model, @@ -171,6 +172,7 @@ class _ProgressNoteState extends State { onTap: () async { showMyDialog( context: context, + actionName: "cancel", confirmFun: () async { GifLoaderDialogUtils .showMyDialog( @@ -184,13 +186,13 @@ class _ProgressNoteState extends State { .admissionNo), cancelledNote: true, lineItemNo: - notesList[index] + model.patientProgressNoteList[index] .lineItemNo, createdBy: - notesList[index] + model.patientProgressNoteList[index] .createdBy, notes: - notesList[index] + model.patientProgressNoteList[index] .notes, verifiedNote: false, patientTypeID: patient @@ -241,7 +243,7 @@ class _ProgressNoteState extends State { ), InkWell( onTap: () async { - showMyDialog(context: context, confirmFun: () async{ + showMyDialog(context: context, actionName: "verify",confirmFun: () async{ GifLoaderDialogUtils .showMyDialog(context); UpdateNoteReqModel reqModel = @@ -249,12 +251,12 @@ class _ProgressNoteState extends State { admissionNo: int.parse( patient.admissionNo), cancelledNote: false, - lineItemNo: notesList[index] + lineItemNo: model.patientProgressNoteList[index] .lineItemNo, - createdBy: notesList[index] + createdBy: model.patientProgressNoteList[index] .createdBy, notes: - notesList[index].notes, + model.patientProgressNoteList[index].notes, verifiedNote: true, patientTypeID: patient.patientType, @@ -332,14 +334,14 @@ class _ProgressNoteState extends State { ), Expanded( child: AppText( - notesList[index].doctorName??'',fontWeight: FontWeight.w600,fontSize: 12,), + model.patientProgressNoteList[index].doctorName??'',fontWeight: FontWeight.w600,fontSize: 12,), ), ], ), - if(notesList[index].status == 4) + if(model.patientProgressNoteList[index].status == 4) AppText( 'Canceled',fontWeight: FontWeight.w600, color: Colors.red.shade700,fontSize: 12,), - if(notesList[index].status == 2) + if(model.patientProgressNoteList[index].status == 2) AppText( 'verified',fontWeight: FontWeight.w600, color: Colors.grey.shade700,fontSize: 12,), ], @@ -348,12 +350,12 @@ class _ProgressNoteState extends State { Column( children: [ AppText( - notesList[index] + model.patientProgressNoteList[index] .createdOn != null ? DateUtils .getDayMonthYearDateFormatted( - DateUtils.getDateTimeFromServerFormat(notesList[index].createdOn)) + DateUtils.getDateTimeFromServerFormat(model.patientProgressNoteList[index].createdOn)) : DateUtils .getDayMonthYearDateFormatted( DateTime.now()), @@ -361,12 +363,12 @@ class _ProgressNoteState extends State { fontSize: 14, ), AppText( - notesList[index] + model.patientProgressNoteList[index] .createdOn != null ? DateUtils .getHour( - DateUtils.getDateTimeFromServerFormat(notesList[index].createdOn )) + DateUtils.getDateTimeFromServerFormat(model.patientProgressNoteList[index].createdOn )) : DateUtils .getHour( DateTime.now()), @@ -374,13 +376,25 @@ class _ProgressNoteState extends State { fontSize: 14, ), ], - crossAxisAlignment: CrossAxisAlignment.end, + crossAxisAlignment: + CrossAxisAlignment.end, ) ], ), SizedBox( height: 8, ), + Row( + mainAxisAlignment: + MainAxisAlignment.start, + children: [ + Expanded( + child: AppText( + model.patientProgressNoteList[index].notes, + fontSize: 10, + ), + ), + ]) ], ), ), @@ -400,7 +414,7 @@ class _ProgressNoteState extends State { ); } - showMyDialog({BuildContext context, Function confirmFun, isCancel = true}) { + showMyDialog({BuildContext context, Function confirmFun, String actionName}) { showDialog( context: context, child: Center( @@ -409,10 +423,7 @@ class _ProgressNoteState extends State { .of(context) .size .width * 0.8, - height: MediaQuery - .of(context) - .size - .height * 0.5, + height: 200, child: AppScaffold( isShowAppBar: false, body: Container( @@ -424,43 +435,57 @@ class _ProgressNoteState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ // SizedBox(height: 20,), + SizedBox(height: 10,), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppText( + "Confirm", fontWeight: FontWeight.w600, + color: Colors.black, + fontSize: 16,), + ], + ), + SizedBox(height: 10,), + DividerWithSpacesAround(), + SizedBox(height: 12,), + Container( padding: EdgeInsets.all(20), color: Colors.white, - child: Expanded( - child: AppText( - 'Are you sure you want to do this action?', - fontSize: 15, - textAlign: TextAlign.center, - ), + child: AppText( + 'Are you sure you want $actionName this order?', + fontSize: 15, + textAlign: TextAlign.center, ), ), - SizedBox(height: MediaQuery - .of(context) - .size - .height * 0.2,), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - FlatButton( - child: AppText( - "Cancel", fontWeight: FontWeight.w600, - color: Colors.black, - fontSize: 16,),//Text("Cancel"), - onPressed: () { - Navigator.of(context).pop(); - }), - FlatButton( - child: AppText( - "Confirm", fontWeight: FontWeight.w600, - color: Colors.red.shade700, - fontSize: 16,), //Text("Confirm", ), - onPressed: () async { - await confirmFun(); - Navigator.of(context).pop(); - }) - ], + SizedBox(height: 8,), + DividerWithSpacesAround(), + FractionallySizedBox( + widthFactor: 0.75, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + FlatButton( + child: AppText( + "Cancel", fontWeight: FontWeight.w600, + color: Colors.black, + fontSize: 16,),//Text("Cancel"), + onPressed: () { + Navigator.of(context).pop(); + }), + FlatButton( + child: AppText( + "Confirm", fontWeight: FontWeight.w600, + color: Colors.red.shade700, + fontSize: 16,), //Text("Confirm", ), + onPressed: () async { + await confirmFun(); + Navigator.of(context).pop(); + }) + + ], + ), ) ], ), diff --git a/lib/screens/patients/profile/note/update_note.dart b/lib/screens/patients/profile/note/update_note.dart index 90b94ab3..b8f6a174 100644 --- a/lib/screens/patients/profile/note/update_note.dart +++ b/lib/screens/patients/profile/note/update_note.dart @@ -1,21 +1,27 @@ +import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/model/note/CreateNoteModel.dart'; import 'package:doctor_app_flutter/core/model/note/note_model.dart'; import 'package:doctor_app_flutter/core/model/note/update_note_model.dart'; +import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/progress_note_request.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart'; +import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; +import 'package:doctor_app_flutter/widgets/shared/speech-text-popup.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; class UpdateNoteOrder extends StatefulWidget { final NoteModel note; @@ -25,18 +31,24 @@ class UpdateNoteOrder extends StatefulWidget { final bool isUpdate; const UpdateNoteOrder( - {Key key, this.note, this.patientModel, this.patient, this.visitType, this.isUpdate}) + {Key key, + this.note, + this.patientModel, + this.patient, + this.visitType, + this.isUpdate}) : super(key: key); @override - _UpdateNoteOrderState createState() => - _UpdateNoteOrderState(); + _UpdateNoteOrderState createState() => _UpdateNoteOrderState(); } class _UpdateNoteOrderState extends State { int selectedType; bool isSubmitted = false; - + stt.SpeechToText speech = stt.SpeechToText(); + var reconizedWord; + var event = RobotProvider(); TextEditingController progressNoteController = TextEditingController(); setSelectedType(int val) { @@ -53,27 +65,23 @@ class _UpdateNoteOrderState extends State { return AppScaffold( isShowAppBar: false, - backgroundColor: Theme - .of(context) - .scaffoldBackgroundColor, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, body: SingleChildScrollView( child: Container( - height: MediaQuery - .of(context) - .size - .height * 1.0, + height: MediaQuery.of(context).size.height * 1.0, child: Padding( padding: EdgeInsets.all(0.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - BottomSheetTitle(title: widget.visitType == 3 - ? (widget.isUpdate?'Update':'Add')+' Order Sheet' - : (widget.isUpdate?'Update':'Add')+' Progress Note',), + BottomSheetTitle( + title: widget.visitType == 3 + ? (widget.isUpdate ? 'Update' : 'Add') + ' Order Sheet' + : (widget.isUpdate ? 'Update' : 'Add') + ' Progress Note', + ), SizedBox( height: 10.0, ), - Center( child: FractionallySizedBox( widthFactor: 0.9, @@ -81,21 +89,35 @@ class _UpdateNoteOrderState extends State { children: [ AppTextFieldCustom( hintText: widget.visitType == 3 - ? (widget.isUpdate?'Update':'Add')+' Order Sheet' - : (widget.isUpdate?'Update':'Add')+' Progress Note', + ? (widget.isUpdate ? 'Update' : 'Add') + + ' Order Sheet' + : (widget.isUpdate ? 'Update' : 'Add') + + ' Progress Note', //TranslationBase.of(context).addProgressNote, controller: progressNoteController, maxLines: 35, minLines: 25, hasBorder: true, - validationError:progressNoteController.text.isEmpty&&isSubmitted?TranslationBase.of(context).emptyMessage:null , - + suffixIcon: IconButton( + icon: Icon( + Icons.mic, + color: Colors.black, + ), + onPressed: () { + onVoiceText(); + }, + ), + + isTextFieldHasSuffix: true, + validationError: + progressNoteController.text.isEmpty && isSubmitted + ? TranslationBase.of(context).emptyMessage + : null, ), ], ), ), ), - ], ), ), @@ -108,8 +130,8 @@ class _UpdateNoteOrderState extends State { children: [ AppButton( title: widget.visitType == 3 - ? (widget.isUpdate?'Update':'Add')+' Order Sheet' - : (widget.isUpdate?'Update':'Add')+' Progress Note', + ? (widget.isUpdate ? 'Update' : 'Add') + ' Order Sheet' + : (widget.isUpdate ? 'Update' : 'Add') + ' Progress Note', color: Color(0xff359846), // disabled: progressNoteController.text.isEmpty, fontWeight: FontWeight.w700, @@ -117,65 +139,62 @@ class _UpdateNoteOrderState extends State { setState(() { isSubmitted = true; }); - if (progressNoteController.text.isNotEmpty) { + if (progressNoteController.text.trim().isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - DoctorProfileModel doctorProfile = DoctorProfileModel - .fromJson(profile); - + DoctorProfileModel doctorProfile = + DoctorProfileModel.fromJson(profile); if (widget.isUpdate) { UpdateNoteReqModel reqModel = UpdateNoteReqModel( - admissionNo: int.parse(widget.patient - .admissionNo), + admissionNo: int.parse(widget.patient.admissionNo), cancelledNote: false, lineItemNo: widget.note.lineItemNo, createdBy: widget.note.createdBy, notes: progressNoteController.text, - verifiedNote: false, - patientTypeID: widget.patient.patientType, patientOutSA: false, ); - await widget.patientModel.updatePatientProgressNote(reqModel); + await widget.patientModel + .updatePatientProgressNote(reqModel); } else { CreateNoteModel reqModel = CreateNoteModel( - admissionNo: int.parse(widget.patient - .admissionNo), + admissionNo: int.parse(widget.patient.admissionNo), createdBy: doctorProfile.doctorID, visitType: widget.visitType, patientID: widget.patient.patientId, nursingRemarks: ' ', patientTypeID: widget.patient.patientType, patientOutSA: false, + notes: progressNoteController.text); - notes: progressNoteController.text - ); - - await widget.patientModel.createPatientProgressNote(reqModel); + await widget.patientModel + .createPatientProgressNote(reqModel); } if (widget.patientModel.state == ViewState.ErrorLocal) { - Helpers.showErrorToast( - Helpers.generateContactAdminMsg()); + Helpers.showErrorToast(widget.patientModel.error); } else { ProgressNoteRequest progressNoteRequest = - ProgressNoteRequest( - visitType: widget.visitType, - // if equal 5 then this will return progress note - admissionNo: int.parse(widget.patient - .admissionNo), - projectID: widget.patient.projectId, - patientTypeID: widget.patient.patientType, - languageID: 2); - await widget.patientModel.getPatientProgressNote( - progressNoteRequest.toJson()); + ProgressNoteRequest( + visitType: widget.visitType, + // if equal 5 then this will return progress note + admissionNo: + int.parse(widget.patient.admissionNo), + projectID: widget.patient.projectId, + patientTypeID: widget.patient.patientType, + languageID: 2); + await widget.patientModel + .getPatientProgressNote(progressNoteRequest.toJson()); } - GifLoaderDialogUtils.hideDialog(context); + DrAppToastMsg.showSuccesToast( + "Your Order added Successfully"); Navigator.of(context).pop(); + } else { + Helpers.showErrorToast("You cant add only spaces"); } }), ], @@ -184,5 +203,37 @@ class _UpdateNoteOrderState extends State { ); } + onVoiceText() async { + new SpeechToText(context: context).showAlertDialog(context); + var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; + bool available = await speech.initialize( + onStatus: statusListener, onError: errorListener); + if (available) { + speech.listen( + onResult: resultListener, + // listenMode: ListenMode.confirmation, + localeId: lang == 'en' ? 'en-US' : 'ar-SA', + ); + } else { + print("The user has denied the use of speech recognition."); + } + } + + void errorListener(SpeechRecognitionError error) {} + void statusListener(String status) { + reconizedWord = status == 'listening' ? 'Lisening...' : 'Sorry....'; + } + + void resultListener(result) { + reconizedWord = result.recognizedWords; + event.setValue({"searchText": reconizedWord}); + + if (result.finalResult == true) { + setState(() { + SpeechToText.closeAlertDialog(context); + progressNoteController.text = reconizedWord; + }); + } + } } diff --git a/lib/screens/patients/profile/referral/refer-patient-screen.dart b/lib/screens/patients/profile/referral/refer-patient-screen.dart index 80264bc5..687d5ac1 100644 --- a/lib/screens/patients/profile/referral/refer-patient-screen.dart +++ b/lib/screens/patients/profile/referral/refer-patient-screen.dart @@ -438,10 +438,11 @@ class _PatientMakeReferralScreenState extends State { : null, enabled: false, isTextFieldHasSuffix: true, - suffixIcon: Icon( + suffixIcon: IconButton( + icon: Icon( Icons.calendar_today, color: Colors.black, - ), + )), onClick: () { _selectDate(context, model); }, diff --git a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart index a005f399..d5297fc5 100644 --- a/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart +++ b/lib/screens/patients/profile/soap_update/assessment/add_assessment_details.dart @@ -33,16 +33,16 @@ class AddAssessmentDetails extends StatefulWidget { final MySelectedAssessment mySelectedAssessment; final List mySelectedAssessmentList; final Function(MySelectedAssessment mySelectedAssessment, bool isUpdate) - addSelectedAssessment; + addSelectedAssessment; final PatiantInformtion patientInfo; final bool isUpdate; AddAssessmentDetails( {Key key, - this.mySelectedAssessment, - this.addSelectedAssessment, - this.patientInfo, - this.isUpdate = false, - this.mySelectedAssessmentList}); + this.mySelectedAssessment, + this.addSelectedAssessment, + this.patientInfo, + this.isUpdate = false, + this.mySelectedAssessmentList}); @override _AddAssessmentDetailsState createState() => _AddAssessmentDetailsState(); @@ -78,29 +78,33 @@ class _AddAssessmentDetailsState extends State { icdNameController.text = widget.mySelectedAssessment.selectedICD.code; } InputDecoration textFieldSelectorDecoration( - String hintText, String selectedText, bool isDropDown , - - {IconData icon, String validationError}) { + String hintText, String selectedText, bool isDropDown, + {IconData icon, String validationError}) { return new InputDecoration( fillColor: Colors.white, - contentPadding: EdgeInsets.symmetric(vertical: 15, horizontal: 10), focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: (validationError != null + borderSide: BorderSide( + color: (validationError != null ? Colors.red.shade700 - :Color(0xFFEFEFEF)) , width: 2.5), + : Color(0xFFEFEFEF)), + width: 2.5), borderRadius: BorderRadius.circular(8), ), enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: (validationError != null - ? Colors.red.shade700 - : Color(0xFFEFEFEF)), width: 2.5), + borderSide: BorderSide( + color: (validationError != null + ? Colors.red.shade700 + : Color(0xFFEFEFEF)), + width: 2.5), borderRadius: BorderRadius.circular(8), ), disabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: (validationError != null - ? Colors.red.shade700 - : Color(0xFFEFEFEF)), width: 2.5), + borderSide: BorderSide( + color: (validationError != null + ? Colors.red.shade700 + : Color(0xFFEFEFEF)), + width: 2.5), borderRadius: BorderRadius.circular(8), ), hintText: selectedText != null ? selectedText : hintText, @@ -143,213 +147,224 @@ class _AddAssessmentDetailsState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 16, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: AppTextFieldCustom( - // height: 55.0, - hintText: + SizedBox( + height: 16, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: AppTextFieldCustom( + // height: 55.0, + hintText: TranslationBase.of(context).appointmentNumber, - isTextFieldHasSuffix: false, - enabled: false, - controller: appointmentIdController, - ), - ), - SizedBox( - height: 10, - ), - Container( - child: InkWell( - onTap: model.listOfICD10 != null - ? () { - setState(() { - widget.mySelectedAssessment - .selectedICD = null; - icdNameController.text = null; - }); - } - : null, - child: widget - .mySelectedAssessment.selectedICD == - null - ? CustomAutoCompleteTextField( - isShowError: isFormSubmitted && - widget.mySelectedAssessment.selectedICD == null, - child:AutoCompleteTextField( - - decoration: TextFieldsUtils.textFieldSelectorDecoration( - TranslationBase.of(context) - .nameOrICD, null, true, suffixIcon: Icons.search), - - itemSubmitted: (item) => setState(() { - widget.mySelectedAssessment - .selectedICD = item; - icdNameController.text = '${item.code.trim()}/${item.description}'; - }), - key: key, - suggestions: model.listOfICD10, - itemBuilder: (context, suggestion) => - new Padding( - child: AppText(suggestion - .description + - " / " + - suggestion.code.toString()), - padding: EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, input) => - suggestion.description - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.description - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.code - .toLowerCase() - .startsWith( - input.toLowerCase()), - ), - ) - : AppTextFieldCustom( - onClick: model.listOfICD10 != null - ? () { + isTextFieldHasSuffix: false, + enabled: false, + controller: appointmentIdController, + ), + ), + SizedBox( + height: 10, + ), + Container( + child: InkWell( + onTap: model.listOfICD10 != null + ? () { setState(() { widget.mySelectedAssessment .selectedICD = null; icdNameController.text = null; }); } - : null, - hintText: TranslationBase.of(context) - .nameOrICD, - maxLines: 2, - minLines: 1, - controller: icdNameController, - enabled: true, - isTextFieldHasSuffix: true, - suffixIcon: Icon(Icons.search,color: Colors.grey.shade600,), - ) - ), - ), - SizedBox( - height: 7, - ), - AppTextFieldCustom( - onClick: model.listOfDiagnosisCondition != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisCondition, - okText: TranslationBase.of(context).ok, - okFunction: - (MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment - .selectedDiagnosisCondition = - selectedValue; - conditionController - .text = projectViewModel - .isArabic - ? widget - .mySelectedAssessment - .selectedDiagnosisCondition - .nameAr - : widget - .mySelectedAssessment - .selectedDiagnosisCondition - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } : null, - hintText: TranslationBase.of(context).condition, - maxLines: 2, - minLines: 1, - controller: conditionController, - isTextFieldHasSuffix: true, - enabled: false, - hasBorder: true, - validationError: isFormSubmitted && + child: widget + .mySelectedAssessment.selectedICD == + null + ? CustomAutoCompleteTextField( + isShowError: isFormSubmitted && + widget.mySelectedAssessment + .selectedICD == + null, + child: AutoCompleteTextField< + MasterKeyModel>( + decoration: TextFieldsUtils + .textFieldSelectorDecoration( + TranslationBase.of(context) + .nameOrICD, + null, + true, + suffixIcon: Icons.search), + itemSubmitted: (item) => setState(() { + widget.mySelectedAssessment + .selectedICD = item; + icdNameController.text = + '${item.code.trim()}/${item.description}'; + }), + key: key, + suggestions: model.listOfICD10, + itemBuilder: (context, suggestion) => + new Padding( + child: AppText( + suggestion.description + + " / " + + suggestion.code + .toString()), + padding: EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.description + .toLowerCase() + .startsWith( + input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith( + input.toLowerCase()) || + suggestion.code + .toLowerCase() + .startsWith( + input.toLowerCase()), + ), + ) + : AppTextFieldCustom( + onClick: model.listOfICD10 != null + ? () { + setState(() { + widget.mySelectedAssessment + .selectedICD = null; + icdNameController.text = null; + }); + } + : null, + hintText: TranslationBase.of(context) + .nameOrICD, + maxLines: 2, + minLines: 1, + controller: icdNameController, + enabled: true, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.grey.shade600, + )), + )), + ), + SizedBox( + height: 7, + ), + AppTextFieldCustom( + onClick: model.listOfDiagnosisCondition != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisCondition, + okText: TranslationBase.of(context).ok, + okFunction: + (MasterKeyModel selectedValue) { + setState(() { + widget.mySelectedAssessment + .selectedDiagnosisCondition = + selectedValue; + conditionController + .text = projectViewModel + .isArabic + ? widget + .mySelectedAssessment + .selectedDiagnosisCondition + .nameAr + : widget + .mySelectedAssessment + .selectedDiagnosisCondition + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: TranslationBase.of(context).condition, + maxLines: 2, + minLines: 1, + controller: conditionController, + isTextFieldHasSuffix: true, + enabled: false, + hasBorder: true, + validationError: isFormSubmitted && widget.mySelectedAssessment - .selectedDiagnosisCondition == null?TranslationBase - .of(context) - .emptyMessage:null, - ), - - SizedBox( - height: 10, - ), - AppTextFieldCustom( - onClick: model.listOfDiagnosisType != null - ? () { - MasterKeyDailog dialog = MasterKeyDailog( - list: model.listOfDiagnosisType, - okText: TranslationBase.of(context).ok, - okFunction: - (MasterKeyModel selectedValue) { - setState(() { - widget.mySelectedAssessment - .selectedDiagnosisType = - selectedValue; - typeController.text = - projectViewModel.isArabic - ? selectedValue.nameAr - : selectedValue.nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: TranslationBase.of(context).dType, - maxLines: 2, - minLines: 1, - enabled: false, - isTextFieldHasSuffix: true, - controller: typeController, - hasBorder: true, - validationError: isFormSubmitted && + .selectedDiagnosisCondition == + null + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 10, + ), + AppTextFieldCustom( + onClick: model.listOfDiagnosisType != null + ? () { + MasterKeyDailog dialog = MasterKeyDailog( + list: model.listOfDiagnosisType, + okText: TranslationBase.of(context).ok, + okFunction: + (MasterKeyModel selectedValue) { + setState(() { + widget.mySelectedAssessment + .selectedDiagnosisType = + selectedValue; + typeController.text = + projectViewModel.isArabic + ? selectedValue.nameAr + : selectedValue.nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: TranslationBase.of(context).dType, + maxLines: 2, + minLines: 1, + enabled: false, + isTextFieldHasSuffix: true, + controller: typeController, + hasBorder: true, + validationError: isFormSubmitted && widget.mySelectedAssessment - .selectedDiagnosisType == null?TranslationBase - .of(context) - .emptyMessage:null, - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only(left: 0, right: 0, top: 15), - child: AppTextFieldCustom( - hintText: TranslationBase.of(context).remarks, - maxLines: 18, - minLines: 5, - controller: remarkController, - onChanged: (value) { - widget.mySelectedAssessment.remark = - remarkController.text; - }, - ), - ), - SizedBox( - height: 10, - ), - ])), + .selectedDiagnosisType == + null + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only(left: 0, right: 0, top: 15), + child: AppTextFieldCustom( + hintText: TranslationBase.of(context).remarks, + maxLines: 18, + minLines: 5, + controller: remarkController, + onChanged: (value) { + widget.mySelectedAssessment.remark = + remarkController.text; + }, + ), + ), + SizedBox( + height: 10, + ), + ])), ), ], ), @@ -390,17 +405,17 @@ class _AddAssessmentDetailsState extends State { widget.mySelectedAssessment.appointmentId = int.parse(appointmentIdController.text); if (widget.mySelectedAssessment - .selectedDiagnosisCondition != - null && + .selectedDiagnosisCondition != + null && widget.mySelectedAssessment - .selectedDiagnosisType != + .selectedDiagnosisType != null && widget.mySelectedAssessment.selectedICD != null) { await submitAssessment( isUpdate: widget.isUpdate, model: model, mySelectedAssessment: - widget.mySelectedAssessment); + widget.mySelectedAssessment); } }, ), @@ -420,8 +435,8 @@ class _AddAssessmentDetailsState extends State { submitAssessment( {SOAPViewModel model, - MySelectedAssessment mySelectedAssessment, - bool isUpdate = false}) async { + MySelectedAssessment mySelectedAssessment, + bool isUpdate = false}) async { if (isUpdate) { PatchAssessmentReqModel patchAssessmentReqModel = PatchAssessmentReqModel( patientMRN: widget.patientInfo.patientMRN, @@ -437,11 +452,11 @@ class _AddAssessmentDetailsState extends State { await model.patchAssessment(patchAssessmentReqModel); } else { PostAssessmentRequestModel postAssessmentRequestModel = - new PostAssessmentRequestModel( - patientMRN: widget.patientInfo.patientMRN, - episodeId: widget.patientInfo.episodeNo, - appointmentNo: widget.patientInfo.appointmentNo, - icdCodeDetails: [ + new PostAssessmentRequestModel( + patientMRN: widget.patientInfo.patientMRN, + episodeId: widget.patientInfo.episodeNo, + appointmentNo: widget.patientInfo.appointmentNo, + icdCodeDetails: [ new IcdCodeDetails( remarks: mySelectedAssessment.remark, complexDiagnosis: true, @@ -468,4 +483,4 @@ class _AddAssessmentDetailsState extends State { Navigator.of(context).pop(); } } -} \ No newline at end of file +} diff --git a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart index 33deb8db..6e9521dc 100644 --- a/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart +++ b/lib/screens/patients/profile/soap_update/objective/examinations_list_search_widget.dart @@ -49,10 +49,11 @@ class _ExaminationsListSearchWidgetState onChanged: (value) { filterSearchResults(value); }, - suffixIcon: Icon( + suffixIcon: IconButton( + icon: Icon( Icons.search, color: Colors.black, - ), + )), ), DividerWithSpacesAround( height: 2, diff --git a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart index b7239158..a58f7248 100644 --- a/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart +++ b/lib/screens/patients/profile/soap_update/subjective/medication/add_medication.dart @@ -58,7 +58,9 @@ class _AddMedicationState extends State { child: BaseView( onModelReady: (model) async { if (model.medicationStrengthList.length == 0) { - await model.getMasterLookup(MasterKeysService.MedicationStrength,); + await model.getMasterLookup( + MasterKeysService.MedicationStrength, + ); } if (model.medicationFrequencyList.length == 0) { await model.getMasterLookup(MasterKeysService.MedicationFrequency); @@ -72,372 +74,366 @@ class _AddMedicationState extends State { if (model.allMedicationList.length == 0) await model.getMedicationList(); }, - builder: (_, model, w) => - AppScaffold( - baseViewModel: model, - isShowAppBar: false, - body: Center( - child: Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - - BottomSheetTitle( - title: TranslationBase.of(context).addMedication, - ), - SizedBox( - height: 10, - ), - SizedBox( - height: 16, - ), - Expanded( - child: Center( - child: FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - SizedBox( - height: 16, - ), - SizedBox( - height: 16, - ), - Container( - // height: screenSize.height * 0.070, - child: InkWell( - onTap: model.allMedicationList != null - ? () { - setState(() { - _selectedMedication = null; - }); - } - : null, - child: _selectedMedication == null - ? - - - CustomAutoCompleteTextField( - isShowError: isFormSubmitted && - _selectedMedication ==null, - child: AutoCompleteTextField< - GetMedicationResponseModel>( - - decoration: - TextFieldsUtils.textFieldSelectorDecoration( - TranslationBase.of(context) - .searchMedicineNameHere, null, true, suffixIcon: Icons.search), - - itemSubmitted: (item) => - setState( - () => - _selectedMedication = - item), - key: key, - suggestions: - model.allMedicationList, - itemBuilder: (context, - suggestion) => - new Padding( - child: AppText(suggestion - .description + - '/' + - suggestion - .genericName), - padding: - EdgeInsets.all(8.0)), - itemSorter: (a, b) => 1, - itemFilter: (suggestion, - input) => - suggestion.genericName - .toLowerCase() - .startsWith( - input.toLowerCase()) || - suggestion.description - .toLowerCase() - .startsWith( - input - .toLowerCase()) || - suggestion.keywords - .toLowerCase() - .startsWith( - input.toLowerCase()), - ), - ) - : AppTextFieldCustom( - hintText: _selectedMedication != null - ? _selectedMedication - .description + - (' (${_selectedMedication.genericName} )') - : TranslationBase.of(context) - .searchMedicineNameHere, - minLines: 2, - maxLines: 2, - isTextFieldHasSuffix: true, - suffixIcon: Icon(Icons.search,color: Colors.grey.shade600,), - enabled: false, - ), - ), - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - enabled: false, - onClick: model.medicationDoseTimeList != null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model.medicationDoseTimeList, - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { + builder: (_, model, w) => AppScaffold( + baseViewModel: model, + isShowAppBar: false, + body: Center( + child: Container( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + BottomSheetTitle( + title: TranslationBase.of(context).addMedication, + ), + SizedBox( + height: 10, + ), + SizedBox( + height: 16, + ), + Expanded( + child: Center( + child: FractionallySizedBox( + widthFactor: 0.9, + child: Column( + children: [ + SizedBox( + height: 16, + ), + SizedBox( + height: 16, + ), + Container( + // height: screenSize.height * 0.070, + child: InkWell( + onTap: model.allMedicationList != null + ? () { setState(() { - _selectedMedicationDose = - selectedValue; - - doseController - .text = projectViewModel - .isArabic - ? _selectedMedicationDose - .nameAr - : _selectedMedicationDose - .nameEn; + _selectedMedication = null; }); - }, + } + : null, + child: _selectedMedication == null + ? CustomAutoCompleteTextField( + isShowError: isFormSubmitted && + _selectedMedication == null, + child: AutoCompleteTextField< + GetMedicationResponseModel>( + decoration: TextFieldsUtils + .textFieldSelectorDecoration( + TranslationBase.of( + context) + .searchMedicineNameHere, + null, + true, + suffixIcon: Icons.search), + itemSubmitted: (item) => setState( + () => _selectedMedication = + item), + key: key, + suggestions: + model.allMedicationList, + itemBuilder: (context, + suggestion) => + new Padding( + child: AppText(suggestion + .description + + '/' + + suggestion + .genericName), + padding: + EdgeInsets.all(8.0)), + itemSorter: (a, b) => 1, + itemFilter: (suggestion, input) => + suggestion.genericName.toLowerCase().startsWith( + input.toLowerCase()) || + suggestion.description + .toLowerCase() + .startsWith(input + .toLowerCase()) || + suggestion.keywords + .toLowerCase() + .startsWith( + input.toLowerCase()), + ), + ) + : AppTextFieldCustom( + hintText: _selectedMedication != + null + ? _selectedMedication + .description + + (' (${_selectedMedication.genericName} )') + : TranslationBase.of(context) + .searchMedicineNameHere, + minLines: 2, + maxLines: 2, + isTextFieldHasSuffix: true, + suffixIcon: IconButton( + icon: Icon( + Icons.search, + color: Colors.grey.shade600, + )), + enabled: false, + ), + ), + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + enabled: false, + onClick: model.medicationDoseTimeList != null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model.medicationDoseTimeList, + okText: + TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationDose = + selectedValue; - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: + doseController + .text = projectViewModel + .isArabic + ? _selectedMedicationDose + .nameAr + : _selectedMedicationDose + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: TranslationBase.of(context).doseTime, - maxLines: 2, - minLines: 2, - isTextFieldHasSuffix: true, - controller: doseController, - validationError:isFormSubmitted && - _selectedMedicationDose == null?TranslationBase - .of(context) - .emptyMessage:null, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - enabled: false, - isTextFieldHasSuffix: true, - onClick: model.medicationStrengthList != null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model.medicationStrengthList, - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationStrength = - selectedValue; + maxLines: 2, + minLines: 2, + isTextFieldHasSuffix: true, + controller: doseController, + validationError: isFormSubmitted && + _selectedMedicationDose == null + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + enabled: false, + isTextFieldHasSuffix: true, + onClick: model.medicationStrengthList != null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model.medicationStrengthList, + okText: + TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationStrength = + selectedValue; - strengthController - .text = projectViewModel - .isArabic - ? _selectedMedicationStrength - .nameAr - : _selectedMedicationStrength - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: + strengthController + .text = projectViewModel + .isArabic + ? _selectedMedicationStrength + .nameAr + : _selectedMedicationStrength + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: TranslationBase.of(context).strength, - maxLines: 2, - minLines: 2, - controller: strengthController, - validationError:isFormSubmitted && - _selectedMedicationStrength == null?TranslationBase - .of(context) - .emptyMessage:null, - ), - SizedBox( - height: 5, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - enabled: false, - isTextFieldHasSuffix: true, - onClick: model.medicationRouteList != null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model.medicationRouteList, - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationRoute = - selectedValue; + maxLines: 2, + minLines: 2, + controller: strengthController, + validationError: isFormSubmitted && + _selectedMedicationStrength == null + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 5, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + enabled: false, + isTextFieldHasSuffix: true, + onClick: model.medicationRouteList != null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model.medicationRouteList, + okText: + TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationRoute = + selectedValue; - routeController - .text = projectViewModel - .isArabic - ? _selectedMedicationRoute - .nameAr - : _selectedMedicationRoute - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: TranslationBase.of(context).route, - maxLines: 2, - minLines: 2, - controller: routeController, - validationError:isFormSubmitted && - _selectedMedicationRoute == null?TranslationBase - .of(context) - .emptyMessage:null, - ), - SizedBox( - height: 5, - ), - SizedBox( - height: 5, - ), - AppTextFieldCustom( - onClick: model.medicationFrequencyList != null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: model.medicationFrequencyList, - okText: - TranslationBase.of(context).ok, - okFunction: (selectedValue) { - setState(() { - _selectedMedicationFrequency = - selectedValue; + routeController + .text = projectViewModel + .isArabic + ? _selectedMedicationRoute + .nameAr + : _selectedMedicationRoute + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: TranslationBase.of(context).route, + maxLines: 2, + minLines: 2, + controller: routeController, + validationError: isFormSubmitted && + _selectedMedicationRoute == null + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 5, + ), + SizedBox( + height: 5, + ), + AppTextFieldCustom( + onClick: model.medicationFrequencyList != null + ? () { + MasterKeyDailog dialog = + MasterKeyDailog( + list: model.medicationFrequencyList, + okText: + TranslationBase.of(context).ok, + okFunction: (selectedValue) { + setState(() { + _selectedMedicationFrequency = + selectedValue; - frequencyController - .text = projectViewModel - .isArabic - ? _selectedMedicationFrequency - .nameAr - : _selectedMedicationFrequency - .nameEn; - }); - }, - ); - showDialog( - barrierDismissible: false, - context: context, - builder: (BuildContext context) { - return dialog; - }, - ); - } - : null, - hintText: + frequencyController + .text = projectViewModel + .isArabic + ? _selectedMedicationFrequency + .nameAr + : _selectedMedicationFrequency + .nameEn; + }); + }, + ); + showDialog( + barrierDismissible: false, + context: context, + builder: (BuildContext context) { + return dialog; + }, + ); + } + : null, + hintText: TranslationBase.of(context).frequency, - enabled: false, - maxLines: 2, - minLines: 2, - isTextFieldHasSuffix: true, - controller: frequencyController, - validationError:isFormSubmitted && - _selectedMedicationFrequency == null?TranslationBase - .of(context) - .emptyMessage:null, - ), - SizedBox( - height: 5, - ), - SizedBox( - height: 30, - ), - ], - )), - ), - ), - ]), - ), + enabled: false, + maxLines: 2, + minLines: 2, + isTextFieldHasSuffix: true, + controller: frequencyController, + validationError: isFormSubmitted && + _selectedMedicationFrequency == null + ? TranslationBase.of(context).emptyMessage + : null, + ), + SizedBox( + height: 5, + ), + SizedBox( + height: 30, + ), + ], + )), + ), + ), + ]), + ), + ), + bottomSheet: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), ), - bottomSheet: Container( - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all( - Radius.circular(10.0), - ), - border: Border.all(color: HexColor('#707070'), width: 0.30), + border: Border.all(color: HexColor('#707070'), width: 0.30), + ), + height: MediaQuery.of(context).size.height * 0.1, + width: double.infinity, + child: Column( + children: [ + SizedBox( + height: 10, ), - height: MediaQuery.of(context).size.height * 0.1, - width: double.infinity, - child: Column( - children: [ - SizedBox( - height: 10, - ), - Container( - child: FractionallySizedBox( - widthFactor: .80, - child: Center( - child: AppButton( - title: TranslationBase.of(context).addMedication.toUpperCase(), - color: Color(0xFF359846), - onPressed: () { - setState(() { - isFormSubmitted = true; - }); - if (_selectedMedication != null && - _selectedMedicationDose != null && - _selectedMedicationStrength != null && - _selectedMedicationRoute != null && - _selectedMedicationFrequency != null) { - widget.medicationController.text = widget + Container( + child: FractionallySizedBox( + widthFactor: .80, + child: Center( + child: AppButton( + title: TranslationBase.of(context) + .addMedication + .toUpperCase(), + color: Color(0xFF359846), + onPressed: () { + setState(() { + isFormSubmitted = true; + }); + if (_selectedMedication != null && + _selectedMedicationDose != null && + _selectedMedicationStrength != null && + _selectedMedicationRoute != null && + _selectedMedicationFrequency != null) { + widget.medicationController.text = widget .medicationController.text + - '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; - Navigator.of(context).pop(); - } - }, - ), - ), + '${_selectedMedication.description} (${TranslationBase.of(context).doseTime} ) ${doseController.text} (${TranslationBase.of(context).strength}) ${strengthController.text} (${TranslationBase.of(context).route}) ${routeController.text} (${TranslationBase.of(context).frequency}) ${frequencyController.text} \n \n'; + Navigator.of(context).pop(); + } + }, ), ), - SizedBox( - height: 5, - ), - ], + ), ), - ), + SizedBox( + height: 5, + ), + ], ), + ), + ), ), ); } } - - - diff --git a/lib/util/translations_delegate_base.dart b/lib/util/translations_delegate_base.dart index c5343ade..505fc351 100644 --- a/lib/util/translations_delegate_base.dart +++ b/lib/util/translations_delegate_base.dart @@ -1236,7 +1236,9 @@ class TranslationBase { localizedValues['admission-date'][locale.languageCode]; String get noOfDays => localizedValues['noOfDays'][locale.languageCode]; String get numOfDays => localizedValues['numOfDays'][locale.languageCode]; - String get replayBefore => localizedValues['replayBefore'][locale.languageCode]; + String get replayBefore => + localizedValues['replayBefore'][locale.languageCode]; + String get trySaying => localizedValues["try-saying"][locale.languageCode]; String get acknowledged => localizedValues['acknowledged'][locale.languageCode]; } diff --git a/lib/widgets/doctor/doctor_reply_widget.dart b/lib/widgets/doctor/doctor_reply_widget.dart index 5e8fb8cf..8ad3a071 100644 --- a/lib/widgets/doctor/doctor_reply_widget.dart +++ b/lib/widgets/doctor/doctor_reply_widget.dart @@ -11,6 +11,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; class DoctorReplyWidget extends StatefulWidget { final ListGtMyPatientsQuestions reply; @@ -104,6 +105,7 @@ class _DoctorReplyWidgetState extends State { ], ), Row( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Expanded( child: AppText( @@ -113,6 +115,18 @@ class _DoctorReplyWidgetState extends State { fontFamily: 'Poppins', ), ), + Container( + margin: EdgeInsets.symmetric(horizontal: 4), + child: InkWell( + onTap: () { + launch("tel://" +widget.reply.mobileNumber); + }, + child: Icon( + Icons.phone, + color: Colors.black87, + ), + ), + ), SizedBox( width: 4, ), @@ -220,7 +234,7 @@ class _DoctorReplyWidgetState extends State { Container( width: MediaQuery.of(context).size.width * 0.5, child: RichText( - maxLines: 2, + maxLines: 3, overflow: TextOverflow.ellipsis, text: new TextSpan( style: new TextStyle( @@ -228,7 +242,7 @@ class _DoctorReplyWidgetState extends State { color: Colors.black), children: [ new TextSpan( - text: TranslationBase.of(context).doctorResponse + " : ", + text:"Patient Question :" ,//TranslationBase.of(context).doctorResponse + " : ", style: TextStyle(fontSize: 14, fontFamily: 'Poppins', color: Color(0xFF575757),fontWeight: FontWeight.bold)), new TextSpan( @@ -244,10 +258,10 @@ class _DoctorReplyWidgetState extends State { ],) ], ), - Container( - alignment: projectViewModel.isArabic?Alignment.centerLeft:Alignment.centerRight, - child: Icon(FontAwesomeIcons.arrowRight, - size: 20, color: Colors.black),) + // Container( + // alignment: projectViewModel.isArabic?Alignment.centerLeft:Alignment.centerRight, + // child: Icon(FontAwesomeIcons.arrowRight, + // size: 20, color: Colors.black),) ], ), // onTap: onTap, diff --git a/lib/widgets/patients/PatientCard.dart b/lib/widgets/patients/PatientCard.dart index c5e07c77..3c24f2d0 100644 --- a/lib/widgets/patients/PatientCard.dart +++ b/lib/widgets/patients/PatientCard.dart @@ -267,6 +267,19 @@ class PatientCard extends StatelessWidget { fontWeight: FontWeight.w700, fontSize: 15)), ]))), + + Row( + children: [ + AppText( + "${TranslationBase.of(context).numOfDays}: ", + fontSize: 15, + ), + AppText( + "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patientInfo.admissionDate)).inDays + 1}", + fontSize: 15, + fontWeight: FontWeight.w700), + ], + ), // Container( // child: Row( // crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart b/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart index a71431c8..d675dd15 100644 --- a/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart +++ b/lib/widgets/patients/profile/patient-profile-header-new-design_in_patient.dart @@ -186,7 +186,7 @@ class PatientProfileHeaderNewDesignInPatient extends StatelessWidget { fontSize: 1.2 * SizeConfig.textMultiplier, ), AppText( - "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays}", + "${DateTime.now().difference(DateUtils.getDateTimeFromServerFormat(patient.admissionDate)).inDays + 1}", fontSize: 1.4 * SizeConfig.textMultiplier, fontWeight: FontWeight.w700), ], diff --git a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart b/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart index b4854afc..eff7f5f1 100644 --- a/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_allergies_widget.dart @@ -19,7 +19,7 @@ import 'expandable-widget-header-body.dart'; class MasterKeyCheckboxSearchAllergiesWidget extends StatefulWidget { final SOAPViewModel model; - final Function () addSelectedAllergy; + final Function() addSelectedAllergy; final Function(MasterKeyModel) removeAllergy; final Function(MySelectedAllergy mySelectedAllergy) addAllergy; final bool Function(MasterKeyModel) isServiceSelected; @@ -77,18 +77,21 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState child: Column( children: [ AppTextFieldCustom( - height: MediaQuery.of(context).size.height * 0.070, - hintText: TranslationBase.of(context).selectAllergy, + height: + MediaQuery.of(context).size.height * 0.070, + hintText: + TranslationBase.of(context).selectAllergy, isTextFieldHasSuffix: true, hasBorder: false, // controller: filteredSearchController, onChanged: (value) { filterSearchResults(value); }, - suffixIcon: Icon( + suffixIcon: IconButton( + icon: Icon( Icons.search, color: Colors.black, - ), + )), ), DividerWithSpacesAround(), SizedBox( @@ -98,12 +101,13 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState child: FractionallySizedBox( widthFactor: 0.9, child: Container( - height: MediaQuery.of(context).size.height * 0.60, + height: + MediaQuery.of(context).size.height * 0.60, child: ListView.builder( itemCount: items.length, itemBuilder: (context, index) { - bool isSelected = - widget.isServiceSelected(items[index]); + bool isSelected = widget + .isServiceSelected(items[index]); MySelectedAllergy mySelectedAllergy; if (isSelected) { mySelectedAllergy = @@ -121,7 +125,8 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState ? mySelectedAllergy .selectedAllergySeverity != null - ? projectViewModel.isArabic + ? projectViewModel + .isArabic ? mySelectedAllergy .selectedAllergySeverity .nameAr @@ -138,28 +143,32 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState Row( children: [ Checkbox( - value: - widget.isServiceSelected( + value: widget + .isServiceSelected( items[index]), - activeColor: Colors.red[800], + activeColor: + Colors.red[800], onChanged: (bool newValue) { setState(() { if (widget .isServiceSelected( - items[index])) { + items[index])) { widget.removeAllergy( items[index]); } else { MySelectedAllergy - mySelectedAllergy = - new MySelectedAllergy( - selectedAllergy: - items[index], - selectedAllergySeverity: - _selectedAllergySeverity, - remark: null, - isChecked: true, - isExpanded: true); + mySelectedAllergy = + new MySelectedAllergy( + selectedAllergy: + items[ + index], + selectedAllergySeverity: + _selectedAllergySeverity, + remark: null, + isChecked: + true, + isExpanded: + true); widget.addAllergy( mySelectedAllergy); } @@ -176,16 +185,17 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState } else { // TODO add Allergy - MySelectedAllergy - mySelectedAllergy = + MySelectedAllergy mySelectedAllergy = new MySelectedAllergy( selectedAllergy: - items[index], + items[ + index], selectedAllergySeverity: _selectedAllergySeverity, remark: null, isChecked: true, - isExpanded: true); + isExpanded: + true); widget.addAllergy( mySelectedAllergy); } @@ -197,9 +207,9 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState horizontal: 10, vertical: 0), child: Container( - child: AppText( - projectViewModel.isArabic + projectViewModel + .isArabic ? items[index] .nameAr != "" @@ -207,13 +217,19 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState .nameAr : items[index] .nameEn - : items[index].nameEn, - color: Color(0xFF575757), + : items[index] + .nameEn, + color: + Color(0xFF575757), fontSize: 16, fontWeight: FontWeight.w600, ), - width: MediaQuery.of(context).size.width * 0.55, + width: + MediaQuery.of(context) + .size + .width * + 0.55, ), ), ), @@ -221,7 +237,8 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState ), InkWell( onTap: () { - if (mySelectedAllergy != null) { + if (mySelectedAllergy != + null) { setState(() { mySelectedAllergy .isExpanded = @@ -250,103 +267,113 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState child: Column( children: [ AppTextFieldCustom( - onClick: widget.model - .allergySeverityList != - null - ? () { - MasterKeyDailog dialog = - MasterKeyDailog( - list: widget.model - .allergySeverityList, - okText: - TranslationBase.of( - context) - .ok, - okFunction: - (selectedValue) { - setState(() { - mySelectedAllergy - .selectedAllergySeverity = - selectedValue; - }); - }, - ); - showDialog( - barrierDismissible: - false, - context: context, - builder: (BuildContext - context) { - return dialog; - }, - ); - } + onClick: widget.model + .allergySeverityList != + null + ? () { + MasterKeyDailog + dialog = + MasterKeyDailog( + list: widget.model + .allergySeverityList, + okText: + TranslationBase.of( + context) + .ok, + okFunction: + (selectedValue) { + setState(() { + mySelectedAllergy + .selectedAllergySeverity = + selectedValue; + }); + }, + ); + showDialog( + barrierDismissible: + false, + context: context, + builder: + (BuildContext + context) { + return dialog; + }, + ); + } : null, isTextFieldHasSuffix: true, hintText: - TranslationBase - .of(context) - .selectSeverity, + TranslationBase.of( + context) + .selectSeverity, enabled: false, maxLines: 2, minLines: 2, - controller: severityController,), - SizedBox( - height: 5, - ), - if(isSubmitted && mySelectedAllergy !=null && - mySelectedAllergy - .selectedAllergySeverity == null) - Row( - - children: [ - CustomValidationError(), - ], - mainAxisAlignment: MainAxisAlignment.start, + controller: + severityController, ), + SizedBox( + height: 5, + ), + if (isSubmitted && + mySelectedAllergy != + null && + mySelectedAllergy + .selectedAllergySeverity == + null) + Row( + children: [ + CustomValidationError(), + ], + mainAxisAlignment: + MainAxisAlignment + .start, + ), + SizedBox( + height: 10, + ), + Container( + margin: EdgeInsets.only( + left: 0, + right: 0, + top: 15), + child: NewTextFields( + hintText: + TranslationBase.of( + context) + .remarks, + fontSize: 13.5, + // hintColor: Colors.black, + fontWeight: + FontWeight.w600, + maxLines: 25, + minLines: 3, + initialValue: isSelected + ? mySelectedAllergy + .remark + : '', + // controller: remarkControlle - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.only( - left: 0, right: 0, top: 15), - child: NewTextFields( - hintText: TranslationBase - .of( - context) - .remarks, - fontSize: 13.5, - // hintColor: Colors.black, - fontWeight: FontWeight.w600, - maxLines: 25, - minLines: 3, - initialValue: isSelected - ? mySelectedAllergy - .remark : '', - // controller: remarkControlle - - onChanged: (value) { - if (isSelected) { - mySelectedAllergy - .remark = value; - } - }, - - validator: (value) { - if (value == null) - return TranslationBase - .of( - context) - .emptyMessage; - else - return null; - }), - ), - SizedBox( - height: 10, - ), - ],), + onChanged: (value) { + if (isSelected) { + mySelectedAllergy + .remark = value; + } + }, + validator: (value) { + if (value == null) + return TranslationBase + .of(context) + .emptyMessage; + else + return null; + }), + ), + SizedBox( + height: 10, + ), + ], + ), ), ), ), @@ -360,8 +387,7 @@ class _MasterKeyCheckboxSearchAllergiesWidgetState ), ), ], - ) - )), + ))), ), ), SizedBox( diff --git a/lib/widgets/shared/master_key_checkbox_search_widget.dart b/lib/widgets/shared/master_key_checkbox_search_widget.dart index 8e29f03b..5b0d1387 100644 --- a/lib/widgets/shared/master_key_checkbox_search_widget.dart +++ b/lib/widgets/shared/master_key_checkbox_search_widget.dart @@ -31,14 +31,18 @@ class MasterKeyCheckboxSearchWidget extends StatefulWidget { this.removeHistory, this.masterList, this.addHistory, - this.isServiceSelected, this.buttonName, this.hintSearchText}) + this.isServiceSelected, + this.buttonName, + this.hintSearchText}) : super(key: key); @override - _MasterKeyCheckboxSearchWidgetState createState() => _MasterKeyCheckboxSearchWidgetState(); + _MasterKeyCheckboxSearchWidgetState createState() => + _MasterKeyCheckboxSearchWidgetState(); } -class _MasterKeyCheckboxSearchWidgetState extends State { +class _MasterKeyCheckboxSearchWidgetState + extends State { List items = List(); @override @@ -67,88 +71,89 @@ class _MasterKeyCheckboxSearchWidgetState extends State _MyStatefulBuilderState(); +} + +class _MyStatefulBuilderState extends State { + var event = RobotProvider(); + var searchText; + static StreamSubscription streamSubscription; + static var isClosed = false; + @override + void initState() { + streamSubscription = event.controller.stream.listen((p) { + if ((p['searchText'] != 'null' && + p['searchText'] != null && + p['searchText'] != "" && + isClosed == false) && + mounted) { + setState(() { + searchText = p['searchText']; + }); + } + }); + super.initState(); + } + + @override + Widget build(BuildContext context) => AlertDialog( + content: Container( + color: Colors.white, + height: SizeConfig.realScreenHeight * 0.5, + width: SizeConfig.realScreenWidth * 0.8, + child: Container( + child: Column(children: [ + Expanded( + flex: 1, + child: Center( + child: Image.asset( + 'assets/images/habib-logo.png', + height: 75, + width: 75, + ))), + Expanded( + flex: 3, + child: Center( + child: Container( + margin: EdgeInsets.all(20), + padding: EdgeInsets.all(10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + border: Border.all(width: 2, color: Colors.red)), + child: Icon( + Icons.mic, + color: Colors.blue, + size: 48, + ), + ))), + Expanded( + flex: 1, + child: Center( + child: Image.asset( + 'assets/images/soundWaveAnimation.gif', + height: 75, + ))), + Expanded( + flex: 1, + child: Center( + child: AppText(searchText != null && searchText != 'null' + ? searchText + : TranslationBase.of(context).trySaying))), + searchText == 'null' + ? Center( + child: RaisedButton( + child: AppText('Retry'), + onPressed: () { + SpeechToText.closeAlertDialog(context); + event.setValue({'startPopUp': 'true'}); + }, + )) + : SizedBox() + ]), + ))); + + @override + void dispose() { + super.dispose(); + widget.dispose(); + } +} diff --git a/lib/widgets/shared/text_fields/app-textfield-custom.dart b/lib/widgets/shared/text_fields/app-textfield-custom.dart index 8d1e7ca8..88b95936 100644 --- a/lib/widgets/shared/text_fields/app-textfield-custom.dart +++ b/lib/widgets/shared/text_fields/app-textfield-custom.dart @@ -14,7 +14,7 @@ class AppTextFieldCustom extends StatefulWidget { final bool isTextFieldHasSuffix; final bool hasBorder; final String dropDownText; - final Icon suffixIcon; + final IconButton suffixIcon; final Color dropDownColor; final bool enabled; final TextInputType inputType; @@ -89,8 +89,9 @@ class _AppTextFieldCustomState extends State { widget.dropDownText == null ? TextField( textAlign: TextAlign.left, - decoration: TextFieldsUtils.textFieldSelectorDecoration( - widget.hintText, null, true), + decoration: + TextFieldsUtils.textFieldSelectorDecoration( + widget.hintText, null, true), style: TextStyle( fontSize: SizeConfig.textMultiplier * 1.7, fontFamily: 'Poppins', @@ -124,11 +125,13 @@ class _AppTextFieldCustomState extends State { widget.isTextFieldHasSuffix ? widget.suffixIcon != null ? widget.suffixIcon - : Icon( - Icons.keyboard_arrow_down, - color: widget.dropDownColor != null - ? widget.dropDownColor - : Colors.black, + : InkWell( + child: Icon( + Icons.keyboard_arrow_down, + color: widget.dropDownColor != null + ? widget.dropDownColor + : Colors.black, + ), ) : Container(), ], @@ -141,4 +144,3 @@ class _AppTextFieldCustomState extends State { ); } } - diff --git a/pubspec.lock b/pubspec.lock index d338a618..9d52ce65 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -566,7 +566,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3-nullsafety.1" + version: "0.6.2" json_annotation: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 1dd7ae8b..347b7a62 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -80,7 +80,6 @@ dependencies: flutter_html: 1.0.2 sticky_headers: "^0.1.8" - #speech to text speech_to_text: path: speech_to_text