Compare commits

...

1 Commits

Author SHA1 Message Date
hussam al-habibeh aeb5d12cc3 flutter 2.8 4 years ago

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

@ -41,7 +41,7 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String txtOfMedicalReport; String txtOfMedicalReport;
HtmlEditorController controller = HtmlEditorController();
return BaseView<PatientMedicalReportViewModel>( return BaseView<PatientMedicalReportViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
model.getMedicalReportTemplate(); model.getMedicalReportTemplate();
@ -68,13 +68,25 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
children: [ children: [
if (model.medicalReportTemplate.length > 0) if (model.medicalReportTemplate.length > 0)
HtmlRichEditor( HtmlRichEditor(
initialText: (widget.medicalReport != null initialText: (widget.medicalReport !=
null
? widget.medicalNote ? widget.medicalNote
: widget.model.medicalReportTemplate[0].templateText.length > 0 : widget
? widget.model.medicalReportTemplate[0].templateText .model
.medicalReportTemplate[
0]
.templateText
.length >
0
? widget
.model
.medicalReportTemplate[0]
.templateText
: ""), : ""),
hint: "Write the medical report ", hint: "Write the medical report ",
height: MediaQuery.of(context).size.height * 0.75, height:
MediaQuery.of(context).size.height *
0.75,
), ),
], ],
), ),
@ -100,27 +112,35 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
// disabled: progressNoteController.text.isEmpty, // disabled: progressNoteController.text.isEmpty,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
onPressed: () async { onPressed: () async {
txtOfMedicalReport = await HtmlEditor.getText(); txtOfMedicalReport = await controller.getText();
if (txtOfMedicalReport.isNotEmpty) { if (txtOfMedicalReport.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
widget.medicalReport != null widget.medicalReport != null
?await widget.model.updateMedicalReport( ? await widget.model.updateMedicalReport(
widget.patient, widget.patient,
txtOfMedicalReport, txtOfMedicalReport,
widget.medicalReport != null ? widget.medicalReport.lineItemNo : null, widget.medicalReport != null
widget.medicalReport != null ? widget.medicalReport.invoiceNo : null) ? widget.medicalReport.lineItemNo
: await widget.model.addMedicalReport(widget.patient, txtOfMedicalReport); : null,
widget.medicalReport != null
? widget.medicalReport.invoiceNo
: null)
: await widget.model.addMedicalReport(
widget.patient, txtOfMedicalReport);
//model.getMedicalReportList(patient); //model.getMedicalReportList(patient);
Navigator.pop(context); Navigator.pop(context);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
if (widget.model.state == ViewState.ErrorLocal) { if (widget.model.state ==
DrAppToastMsg.showErrorToast(widget.model.error); ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
widget.model.error);
} }
} else { } else {
DrAppToastMsg.showErrorToast("Please enter medical note"); DrAppToastMsg.showErrorToast(
"Please enter medical note");
} }
}, },
), ),
@ -137,17 +157,21 @@ class _AddVerifyMedicalReportState extends State<AddVerifyMedicalReport> {
color: Color(0xff359846), color: Color(0xff359846),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
onPressed: () async { onPressed: () async {
txtOfMedicalReport = await HtmlEditor.getText(); txtOfMedicalReport = await controller.getText();
if (txtOfMedicalReport.isNotEmpty) { if (txtOfMedicalReport.isNotEmpty) {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await widget.model.verifyMedicalReport(widget.patient, widget.medicalReport); await widget.model.verifyMedicalReport(
widget.patient, widget.medicalReport);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
Navigator.pop(context); Navigator.pop(context);
if (widget.model.state == ViewState.ErrorLocal) { if (widget.model.state ==
DrAppToastMsg.showErrorToast(widget.model.error); ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
widget.model.error);
} }
} else { } else {
DrAppToastMsg.showErrorToast("Please enter medical note"); DrAppToastMsg.showErrorToast(
"Please enter medical note");
} }
}, },
), ),

@ -39,46 +39,49 @@ class NumberTextInputFormatter extends TextInputFormatter {
final _mobileFormatter = NumberTextInputFormatter(); final _mobileFormatter = NumberTextInputFormatter();
class TextFields extends StatefulWidget { class TextFields extends StatefulWidget {
TextFields( TextFields({
{Key key, Key key,
this.type, this.type,
this.hintText, this.hintText,
this.suffixIcon, this.suffixIcon,
this.autoFocus, this.autoFocus,
this.onChanged, this.onChanged,
this.initialValue, this.initialValue,
this.minLines, this.minLines,
this.maxLines, this.maxLines,
this.inputFormatters, this.inputFormatters,
this.padding, this.padding,
this.focus = false, this.focus = false,
this.maxLengthEnforced = true, this.maxLengthEnforced = true,
this.suffixIconColor, this.suffixIconColor,
this.inputAction = TextInputAction.done, this.inputAction = TextInputAction.done,
this.onSubmit, this.onSubmit,
this.keepPadding = true, this.keepPadding = true,
this.textCapitalization = TextCapitalization.none, this.textCapitalization = TextCapitalization.none,
this.controller, this.controller,
this.keyboardType, this.keyboardType,
this.validator, this.validator,
this.borderOnlyError = false, this.borderOnlyError = false,
this.onSaved, this.onSaved,
this.onSuffixTap, this.onSuffixTap,
this.readOnly: false, this.readOnly: false,
this.maxLength, this.maxLength,
this.prefixIcon, this.prefixIcon,
this.bare = false, this.bare = false,
this.onTap, this.onTap,
this.fontSize = 16.0, this.fontSize = 16.0,
this.fontWeight = FontWeight.w700, this.fontWeight = FontWeight.w700,
this.autoValidate = false, this.autoValidate,
this.fillColor, this.fillColor,
this.hintColor, this.hintColor,
this.hasBorder = true, this.hasBorder = true,
this.onTapTextFields, this.onTapTextFields,
this.hasLabelText = false, this.hasLabelText = false,
this.showLabelText = false, this.borderRadius= 8.0, this.borderColor, this.borderWidth = 1, }) this.showLabelText = false,
: super(key: key); this.borderRadius = 8.0,
this.borderColor,
this.borderWidth = 1,
}) : super(key: key);
final String hintText; final String hintText;
final String initialValue; final String initialValue;
@ -108,7 +111,7 @@ class TextFields extends StatefulWidget {
final bool keepPadding; final bool keepPadding;
final TextCapitalization textCapitalization; final TextCapitalization textCapitalization;
final List<TextInputFormatter> inputFormatters; final List<TextInputFormatter> inputFormatters;
final bool autoValidate; final AutovalidateMode autoValidate;
final EdgeInsets padding; final EdgeInsets padding;
final bool focus; final bool focus;
final bool borderOnlyError; final bool borderOnlyError;
@ -203,8 +206,7 @@ class _TextFieldsState extends State<TextFields> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
widget.borderColor = widget.borderColor ?? Colors.grey;
widget.borderColor = widget.borderColor?? Colors.grey;
return (AnimatedContainer( return (AnimatedContainer(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
decoration: widget.bare decoration: widget.bare
@ -225,7 +227,7 @@ class _TextFieldsState extends State<TextFields> {
onTap: widget.onTapTextFields, onTap: widget.onTapTextFields,
keyboardAppearance: Theme.of(context).brightness, keyboardAppearance: Theme.of(context).brightness,
scrollPhysics: BouncingScrollPhysics(), scrollPhysics: BouncingScrollPhysics(),
autovalidate: widget.autoValidate, autovalidateMode: widget.autoValidate,
textCapitalization: widget.textCapitalization, textCapitalization: widget.textCapitalization,
onFieldSubmitted: widget.inputAction == TextInputAction.next onFieldSubmitted: widget.inputAction == TextInputAction.next
? (widget.onSubmit != null ? (widget.onSubmit != null
@ -266,7 +268,7 @@ class _TextFieldsState extends State<TextFields> {
fontSize: widget.fontSize, fontWeight: widget.fontWeight), fontSize: widget.fontSize, fontWeight: widget.fontWeight),
inputFormatters: widget.keyboardType == TextInputType.phone inputFormatters: widget.keyboardType == TextInputType.phone
? <TextInputFormatter>[ ? <TextInputFormatter>[
WhitelistingTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
_mobileFormatter, _mobileFormatter,
] ]
: widget.inputFormatters, : widget.inputFormatters,
@ -281,7 +283,6 @@ class _TextFieldsState extends State<TextFields> {
hintText: widget.hintText, hintText: widget.hintText,
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: widget.fontSize, fontSize: widget.fontSize,
fontWeight: widget.fontWeight, fontWeight: widget.fontWeight,
color: widget.hintColor ?? Theme.of(context).hintColor, color: widget.hintColor ?? Theme.of(context).hintColor,
), ),
@ -310,7 +311,8 @@ class _TextFieldsState extends State<TextFields> {
width: 1.0) width: 1.0)
: BorderSide(color: Colors.transparent, width: 0), : BorderSide(color: Colors.transparent, width: 0),
borderRadius: widget.hasBorder borderRadius: widget.hasBorder
? BorderRadius.circular(widget.bare ? 0.0 : widget.borderRadius) ? BorderRadius.circular(
widget.bare ? 0.0 : widget.borderRadius)
: BorderRadius.circular(0.0), : BorderRadius.circular(0.0),
), ),
focusedErrorBorder: OutlineInputBorder( focusedErrorBorder: OutlineInputBorder(
@ -321,28 +323,35 @@ class _TextFieldsState extends State<TextFields> {
.withOpacity(widget.bare ? 0.0 : 0.5), .withOpacity(widget.bare ? 0.0 : 0.5),
width: 1.0) width: 1.0)
: BorderSide(color: Colors.transparent, width: 0), : BorderSide(color: Colors.transparent, width: 0),
borderRadius: BorderRadius.circular(widget.bare ? 0.0 : widget.borderRadius)), borderRadius: BorderRadius.circular(
widget.bare ? 0.0 : widget.borderRadius)),
focusedBorder: OutlineInputBorder( focusedBorder: OutlineInputBorder(
borderSide: widget.hasBorder borderSide: widget.hasBorder
? BorderSide(color: widget.borderColor,width: widget.borderWidth) ? BorderSide(
color: widget.borderColor, width: widget.borderWidth)
: BorderSide(color: Colors.transparent, width: 0), : BorderSide(color: Colors.transparent, width: 0),
borderRadius: widget.hasBorder borderRadius: widget.hasBorder
? BorderRadius.circular(widget.bare ? 0.0 : widget.borderRadius) ? BorderRadius.circular(
widget.bare ? 0.0 : widget.borderRadius)
: BorderRadius.circular(0.0), : BorderRadius.circular(0.0),
), ),
disabledBorder: OutlineInputBorder( disabledBorder: OutlineInputBorder(
borderSide: widget.hasBorder borderSide: widget.hasBorder
? BorderSide(color: widget.borderColor,width: widget.borderWidth) ? BorderSide(
color: widget.borderColor, width: widget.borderWidth)
: BorderSide(color: Colors.transparent, width: 0), : BorderSide(color: Colors.transparent, width: 0),
borderRadius: widget.hasBorder borderRadius: widget.hasBorder
? BorderRadius.circular(widget.bare ? 0.0 : widget.borderRadius) ? BorderRadius.circular(
widget.bare ? 0.0 : widget.borderRadius)
: BorderRadius.circular(0.0)), : BorderRadius.circular(0.0)),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderSide: widget.hasBorder borderSide: widget.hasBorder
? BorderSide(color: widget.borderColor,width: widget.borderWidth) ? BorderSide(
color: widget.borderColor, width: widget.borderWidth)
: BorderSide(color: Colors.transparent, width: 0), : BorderSide(color: Colors.transparent, width: 0),
borderRadius: widget.hasBorder borderRadius: widget.hasBorder
? BorderRadius.circular(widget.bare ? 0.0 : widget.borderRadius) ? BorderRadius.circular(
widget.bare ? 0.0 : widget.borderRadius)
: BorderRadius.circular(0.0), : BorderRadius.circular(0.0),
), ),
), ),

@ -13,11 +13,11 @@ class AppTextFormField extends FormField<String> {
GestureTapCallback onTap, GestureTapCallback onTap,
bool obscureText = false, bool obscureText = false,
TextEditingController controller, TextEditingController controller,
bool autovalidate = true, AutovalidateMode autovalidate,
TextInputType textInputType, TextInputType textInputType,
String hintText, String hintText,
FocusNode focusNode, FocusNode focusNode,
TextInputAction textInputAction=TextInputAction.done, TextInputAction textInputAction = TextInputAction.done,
ValueChanged<String> onFieldSubmitted, ValueChanged<String> onFieldSubmitted,
IconButton prefix, IconButton prefix,
String labelText, String labelText,
@ -27,7 +27,7 @@ class AppTextFormField extends FormField<String> {
: super( : super(
onSaved: onSaved, onSaved: onSaved,
validator: validator, validator: validator,
autovalidate: autovalidate, autovalidateMode: autovalidate,
builder: (FormFieldState<String> state) { builder: (FormFieldState<String> state) {
return Column( return Column(
children: <Widget>[ children: <Widget>[

@ -12,7 +12,7 @@ import 'package:speech_to_text/speech_to_text.dart' as stt;
import '../speech-text-popup.dart'; import '../speech-text-popup.dart';
class HtmlRichEditor extends StatefulWidget { class HtmlRichEditor extends StatefulWidget {
HtmlRichEditor({ HtmlRichEditor({
key, key,
this.hint = "Your text here...", this.hint = "Your text here...",
this.initialText, this.initialText,
@ -30,7 +30,6 @@ class HtmlRichEditor extends StatefulWidget {
final bool showBottomToolbar; final bool showBottomToolbar;
final List<Toolbar> toolbar; final List<Toolbar> toolbar;
@override @override
_HtmlRichEditorState createState() => _HtmlRichEditorState(); _HtmlRichEditorState createState() => _HtmlRichEditorState();
} }
@ -38,9 +37,9 @@ class HtmlRichEditor extends StatefulWidget {
class _HtmlRichEditorState extends State<HtmlRichEditor> { class _HtmlRichEditorState extends State<HtmlRichEditor> {
ProjectViewModel projectViewModel; ProjectViewModel projectViewModel;
stt.SpeechToText speech = stt.SpeechToText(); stt.SpeechToText speech = stt.SpeechToText();
HtmlEditorController controller = HtmlEditorController();
var recognizedWord; var recognizedWord;
var event = RobotProvider(); var event = RobotProvider();
@override @override
void initState() { void initState() {
@ -55,8 +54,6 @@ class _HtmlRichEditorState extends State<HtmlRichEditor> {
super.initState(); super.initState();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
projectViewModel = Provider.of(context); projectViewModel = Provider.of(context);
@ -65,18 +62,20 @@ class _HtmlRichEditorState extends State<HtmlRichEditor> {
children: [ children: [
HtmlEditor( HtmlEditor(
hint: widget.hint, hint: widget.hint,
height: widget.height, options: HtmlEditorOptions(
initialText: widget.initialText, showBottomToolbar: widget.showBottomToolbar,
showBottomToolbar: widget.showBottomToolbar, darkMode: widget.darkMode,
darkMode: widget.darkMode, decoration: widget.decoration ??
decoration: widget.decoration ?? BoxDecoration(
BoxDecoration( color: Colors.transparent,
color: Colors.transparent, borderRadius: BorderRadius.all(
borderRadius: BorderRadius.all( Radius.circular(30.0),
Radius.circular(30.0), ),
border: Border.all(color: Colors.grey[200], width: 0.5),
), ),
border: Border.all(color: Colors.grey[200], width: 0.5), height: widget.height,
), ),
initialText: widget.initialText,
toolbar: widget.toolbar ?? toolbar: widget.toolbar ??
const [ const [
// Style(), // Style(),
@ -96,8 +95,7 @@ class _HtmlRichEditorState extends State<HtmlRichEditor> {
], ],
), ),
Positioned( Positioned(
top: top: 50, //MediaQuery.of(context).size.height * 0,
50, //MediaQuery.of(context).size.height * 0,
right: projectViewModel.isArabic right: projectViewModel.isArabic
? MediaQuery.of(context).size.width * 0.75 ? MediaQuery.of(context).size.width * 0.75
: 15, : 15,
@ -107,8 +105,7 @@ class _HtmlRichEditorState extends State<HtmlRichEditor> {
icon: Icon(DoctorApp.speechtotext, icon: Icon(DoctorApp.speechtotext,
color: Colors.black, size: 35), color: Colors.black, size: 35),
onPressed: () { onPressed: () {
initSpeechState() initSpeechState().then((value) => {onVoiceText()});
.then((value) => {onVoiceText()});
}, },
), ),
], ],
@ -117,7 +114,6 @@ class _HtmlRichEditorState extends State<HtmlRichEditor> {
); );
} }
onVoiceText() async { onVoiceText() async {
new SpeechToText(context: context).showAlertDialog(context); new SpeechToText(context: context).showAlertDialog(context);
var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode; var lang = TranslationBase.of(AppGlobal.CONTEX).locale.languageCode;
@ -150,15 +146,15 @@ class _HtmlRichEditorState extends State<HtmlRichEditor> {
].request(); ].request();
} }
void resultListener(result)async { void resultListener(result) async {
recognizedWord = result.recognizedWords; recognizedWord = result.recognizedWords;
event.setValue({"searchText": recognizedWord}); event.setValue({"searchText": recognizedWord});
String txt = await HtmlEditor.getText(); String txt = await controller.getText();
if (result.finalResult == true) { if (result.finalResult == true) {
setState(() { setState(() {
SpeechToText.closeAlertDialog(context); SpeechToText.closeAlertDialog(context);
speech.stop(); speech.stop();
HtmlEditor.setText(txt+recognizedWord); controller.setText(txt + recognizedWord);
}); });
} else { } else {
print(result.finalResult); print(result.finalResult);

@ -72,7 +72,7 @@ class NewTextFields extends StatefulWidget {
this.onTap, this.onTap,
this.fontSize = 15.0, this.fontSize = 15.0,
this.fontWeight = FontWeight.w500, this.fontWeight = FontWeight.w500,
this.autoValidate = false, this.autoValidate,
this.hintColor, this.hintColor,
this.isEnabled = true}) this.isEnabled = true})
: super(key: key); : super(key: key);
@ -106,7 +106,7 @@ class NewTextFields extends StatefulWidget {
final bool keepPadding; final bool keepPadding;
final TextCapitalization textCapitalization; final TextCapitalization textCapitalization;
final List<TextInputFormatter> inputFormatters; final List<TextInputFormatter> inputFormatters;
final bool autoValidate; final AutovalidateMode autoValidate;
final EdgeInsets padding; final EdgeInsets padding;
final bool focus; final bool focus;
final bool borderOnlyError; final bool borderOnlyError;
@ -172,7 +172,7 @@ class _NewTextFieldsState extends State<NewTextFields> {
initialValue: widget.initialValue, initialValue: widget.initialValue,
keyboardAppearance: Theme.of(context).brightness, keyboardAppearance: Theme.of(context).brightness,
scrollPhysics: BouncingScrollPhysics(), scrollPhysics: BouncingScrollPhysics(),
autovalidate: widget.autoValidate, autovalidateMode: widget.autoValidate,
textCapitalization: widget.textCapitalization, textCapitalization: widget.textCapitalization,
onFieldSubmitted: widget.inputAction == TextInputAction.next onFieldSubmitted: widget.inputAction == TextInputAction.next
? (widget.onSubmit != null ? (widget.onSubmit != null
@ -195,11 +195,11 @@ class _NewTextFieldsState extends State<NewTextFields> {
autofocus: widget.autoFocus ?? false, autofocus: widget.autoFocus ?? false,
validator: widget.validator, validator: widget.validator,
onSaved: widget.onSaved, onSaved: widget.onSaved,
style: Theme.of(context).textTheme.body2.copyWith( style: Theme.of(context).textTheme.bodyText2.copyWith(
fontSize: widget.fontSize, fontWeight: widget.fontWeight, color: Color(0xFF575757), fontFamily: 'Poppins'), fontSize: widget.fontSize, fontWeight: widget.fontWeight, color: Color(0xFF575757), fontFamily: 'Poppins'),
inputFormatters: widget.keyboardType == TextInputType.phone inputFormatters: widget.keyboardType == TextInputType.phone
? <TextInputFormatter>[ ? <TextInputFormatter>[
WhitelistingTextInputFormatter.digitsOnly, FilteringTextInputFormatter.digitsOnly,
_mobileFormatter, _mobileFormatter,
] ]
: widget.inputFormatters, : widget.inputFormatters,

File diff suppressed because it is too large Load Diff

@ -17,8 +17,8 @@ environment:
sdk: ">=2.8.0 <3.0.0" sdk: ">=2.8.0 <3.0.0"
#dependency_overrides: dependency_overrides:
# intl: 0.17.0-nullsafety.2 intl: 0.17.0-nullsafety.2
dependencies: dependencies:
@ -94,7 +94,7 @@ dependencies:
quiver: ^2.1.5 quiver: ^2.1.5
# Html Editor Enhanced # Html Editor Enhanced
html_editor_enhanced: ^1.3.0 html_editor_enhanced: ^1.5.0
#Network Image #Network Image
cached_network_image: ^2.5.0 cached_network_image: ^2.5.0

Loading…
Cancel
Save