From f8b195e368e787a4db77d835439a11d1e49cc38e Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Fri, 1 Jan 2021 17:03:59 +0200 Subject: [PATCH] parseHtmlString now working :) --- lib/util/helpers.dart | 8 ++++++++ .../subjective/update_subjective_page.dart | 8 +++++--- .../profile/soap_update/update_plan_page.dart | 4 ++-- pubspec.lock | 14 ++++++++++++++ pubspec.yaml | 3 +++ 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/lib/util/helpers.dart b/lib/util/helpers.dart index c1d70cef..4725ca9f 100644 --- a/lib/util/helpers.dart +++ b/lib/util/helpers.dart @@ -5,6 +5,7 @@ import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:doctor_app_flutter/config/config.dart'; +import 'package:html/parser.dart'; import '../config/size_config.dart'; import '../util/dr_app_toast_msg.dart'; @@ -352,4 +353,11 @@ class Helpers { // TODO Fix it // Navigator.of(AppGlobal.CONTEX).popUntil((ModalRoute.withName(LOGIN))); } + + String parseHtmlString(String htmlString) { + final document = parse(htmlString); + final String parsedString = parse(document.body.text).documentElement.text; + + return parsedString; + } } diff --git a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart index 2236098a..84c0734a 100644 --- a/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart +++ b/lib/widgets/patients/profile/soap_update/subjective/update_subjective_page.dart @@ -24,6 +24,7 @@ import 'package:doctor_app_flutter/widgets/shared/expandable-widget-header-body. import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:html/parser.dart'; class UpdateSubjectivePage extends StatefulWidget { final Function changePageViewIndex; @@ -96,7 +97,8 @@ class _UpdateSubjectivePageState extends State { } @override Widget build(BuildContext context) { - return BaseView( + + return BaseView( onModelReady: (model) async { GeneralGetReqForSOAP generalGetReqForSOAP = GeneralGetReqForSOAP( patientMRN: widget.patientInfo.patientMRN, @@ -110,8 +112,8 @@ class _UpdateSubjectivePageState extends State { episodeID: widget.patientInfo.episodeNo); await model.getPatientChiefComplaint(getChiefComplaintReqModel); if (model.patientChiefComplaintList.isNotEmpty) { - complaintsController.text = - model.patientChiefComplaintList[0].chiefComplaint; + complaintsController.text = helpers.parseHtmlString(model.patientChiefComplaintList[0].chiefComplaint) + ; illnessController.text = model.patientChiefComplaintList[0].hopi; } await model.getPatientAllergy(generalGetReqForSOAP); diff --git a/lib/widgets/patients/profile/soap_update/update_plan_page.dart b/lib/widgets/patients/profile/soap_update/update_plan_page.dart index 506ff103..d5ad12e9 100644 --- a/lib/widgets/patients/profile/soap_update/update_plan_page.dart +++ b/lib/widgets/patients/profile/soap_update/update_plan_page.dart @@ -63,8 +63,8 @@ class _UpdatePlanPageState extends State { await model.getPatientProgressNote(getGetProgressNoteReqModel); if (model.patientProgressNoteList.isNotEmpty) { - progressNoteController.text = - model.patientProgressNoteList[0].planNote; + progressNoteController.text = helpers + .parseHtmlString(model.patientProgressNoteList[0].planNote); } }, builder: (_, model, w) => AppScaffold( diff --git a/pubspec.lock b/pubspec.lock index c6829dad..61cc667f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -239,6 +239,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.5" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.2" cupertino_icons: dependency: "direct main" description: @@ -385,6 +392,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.6" + html: + dependency: "direct main" + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.0+4" http: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index e15a7182..91283a89 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -63,6 +63,9 @@ dependencies: #Autocomplete TextField autocomplete_textfield: ^1.7.3 + # Html + html: ^0.14.0+4 + #speech to text