diff --git a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart index a350544b..4c51e3d7 100644 --- a/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart +++ b/lib/screens/patients/profile/medical_report/AddVerifyMedicalReport.dart @@ -3,7 +3,7 @@ import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/viewModel/PatientMedicalReportViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; -import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; @@ -12,13 +12,13 @@ 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:doctor_app_flutter/widgets/shared/text_fields/html_rich_editor.dart'; import 'package:flutter/material.dart'; +import 'package:html_editor_enhanced/html_editor.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_to_text.dart' as stt; -import 'package:doctor_app_flutter/models/patient/MedicalReport/MeidcalReportModel.dart'; class AddVerifyMedicalReport extends StatefulWidget { @override @@ -72,8 +72,6 @@ class _AddVerifyMedicalReportState extends State { ? routeArgs['medicalReport'] : null; - // model.medicalReportTemplate[0].templateTextHtml - return BaseView( onModelReady: (model) => model.getMedicalReportTemplate(), builder: (_, model, w) => AppScaffold( @@ -96,117 +94,9 @@ class _AddVerifyMedicalReportState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Stack( - children: [ - AppTextFieldCustom( - hintText: TranslationBase.of(context) - .historyPhysicalFinding, - controller: historyFindingController, - maxLines: 15, - minLines: 10, - hasBorder: true, - validationError: commentsError, - ), - Positioned( - top: -2, - //MediaQuery.of(context).size.height * 0, - right: projectViewModel.isArabic - ? MediaQuery.of(context) - .size - .width * - 0.75 - : 15, - child: Column( - children: [ - IconButton( - icon: Icon( - DoctorApp.speechtotext, - color: Colors.black, - size: 35), - onPressed: () { - initSpeechState().then( - (value) => - {onVoiceText()}); - }, - ), - ], - )), - ], - ), - Stack( - children: [ - AppTextFieldCustom( - hintText: TranslationBase.of(context) - .laboratoryPhysicalData, - controller: laboratoryDataController, - maxLines: 15, - minLines: 10, - hasBorder: true, - validationError: comments2Error, - ), - Positioned( - top: -2, - //MediaQuery.of(context).size.height * 0, - right: projectViewModel.isArabic - ? MediaQuery.of(context) - .size - .width * - 0.75 - : 15, - child: Column( - children: [ - IconButton( - icon: Icon( - DoctorApp.speechtotext, - color: Colors.black, - size: 35), - onPressed: () { - initSpeechState2().then( - (value) => - {onVoiceText2()}); - }, - ), - ], - )), - ], - ), - Stack( - children: [ - AppTextFieldCustom( - hintText: TranslationBase.of(context) - .impressionRecommendation, - controller: recommendationController, - maxLines: 15, - minLines: 10, - hasBorder: true, - validationError: comments3Error, - ), - Positioned( - top: -2, - //MediaQuery.of(context).size.height * 0, - right: projectViewModel.isArabic - ? MediaQuery.of(context) - .size - .width * - 0.75 - : 15, - child: Column( - children: [ - IconButton( - icon: Icon( - DoctorApp.speechtotext, - color: Colors.black, - size: 35), - onPressed: () { - initSpeechState3().then( - (value) => - {onVoiceText3()}); - }, - ), - ], - )), - ], - ), + HtmlRichEditor(initialText: model + .medicalReportTemplate[0] + .templateTextHtml, height: MediaQuery.of(context).size.height * 0.75,), ], ), ), @@ -231,32 +121,13 @@ class _AddVerifyMedicalReportState extends State { // disabled: progressNoteController.text.isEmpty, fontWeight: FontWeight.w700, onPressed: () async { - setState(() { - if (historyFindingController.text == "") { - commentsError = - TranslationBase.of(context).fieldRequired; - } else { - commentsError = null; - } - if (laboratoryDataController.text == "") { - comments2Error = - TranslationBase.of(context).fieldRequired; - } else { - comments2Error = null; - } - if (recommendationController.text == "") { - comments3Error = - TranslationBase.of(context).fieldRequired; - } else { - comments3Error = null; - } - }); - if (historyFindingController.text != "" && - laboratoryDataController.text != "" && - recommendationController.text != "") { + + String txtOfMedicalReport = await HtmlEditor.getText(); + + if (txtOfMedicalReport.isNotEmpty) { GifLoaderDialogUtils.showMyDialog(context); - model.insertMedicalReport(patient, - "${historyFindingController.text}\n${laboratoryDataController.text}\n${recommendationController.text}"); + model.insertMedicalReport(patient,txtOfMedicalReport + ); GifLoaderDialogUtils.hideDialog(context); if (model.state == ViewState.ErrorLocal) { DrAppToastMsg.showErrorToast(model.error); diff --git a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart index d986500e..4dad827c 100644 --- a/lib/screens/patients/profile/medical_report/MedicalReportPage.dart +++ b/lib/screens/patients/profile/medical_report/MedicalReportPage.dart @@ -36,6 +36,8 @@ class MedicalReportPage extends StatelessWidget { builder: (_, model, w) => AppScaffold( baseViewModel: model, isShowAppBar: true, + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: PatientProfileHeaderNewDesignAppBar( patient, patientType, diff --git a/lib/widgets/shared/text_fields/html_rich_editor.dart b/lib/widgets/shared/text_fields/html_rich_editor.dart index 1d87685b..71359604 100644 --- a/lib/widgets/shared/text_fields/html_rich_editor.dart +++ b/lib/widgets/shared/text_fields/html_rich_editor.dart @@ -82,8 +82,8 @@ class _HtmlRichEditorState extends State { // Style(), Font(buttons: [ FontButtons.bold, + FontButtons.italic, FontButtons.underline, - FontButtons.clear ]), // ColorBar(buttons: [ColorButtons.color]), Paragraph(buttons: [ diff --git a/pubspec.yaml b/pubspec.yaml index a5026871..2e4d7ce8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -92,7 +92,7 @@ dependencies: - #Html Editor Enhanced + # Html Editor Enhanced html_editor_enhanced: ^1.3.0 dev_dependencies: