finish chief complaint design

merge-requests/431/head
Elham Rababah 5 years ago
parent 9559265a2d
commit 8fd318548a

@ -1,10 +1,10 @@
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_medication_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_medication_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
import 'package:doctor_app_flutter/widgets/shared/new_text_Field.dart'; import 'package:doctor_app_flutter/widgets/shared/new_text_Field.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../custom_validation_error.dart';
class UpdateChiefComplaints extends StatelessWidget { class UpdateChiefComplaints extends StatelessWidget {
const UpdateChiefComplaints({ const UpdateChiefComplaints({
@ -13,18 +13,24 @@ class UpdateChiefComplaints extends StatelessWidget {
@required this.complaintsController, @required this.complaintsController,
@required this.illnessController, @required this.illnessController,
@required this.medicationController, @required this.medicationController,
this.complaintsControllerError,
this.illnessControllerError,
this.medicationControllerError,
}) : super(key: key); }) : super(key: key);
final GlobalKey<FormState> formKey; final GlobalKey<FormState> formKey;
final TextEditingController complaintsController; final TextEditingController complaintsController;
final TextEditingController illnessController; final TextEditingController illnessController;
final TextEditingController medicationController; final TextEditingController medicationController;
final String complaintsControllerError;
final String illnessControllerError;
final String medicationControllerError;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Form( return Form(
key: formKey, key: formKey,
child: Column(children: [ child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
SizedBox( SizedBox(
height: 20, height: 20,
), ),
@ -33,9 +39,14 @@ class UpdateChiefComplaints extends StatelessWidget {
hintText: TranslationBase.of(context).addChiefComplaints, hintText: TranslationBase.of(context).addChiefComplaints,
controller: complaintsController, controller: complaintsController,
maxLines: 25, maxLines: 25,
minLines: 13, minLines: 3,
), ),
Container(
child: CustomValidationError(
error: complaintsControllerError,
)),
// Container( // Container(
// margin: // margin:
// EdgeInsets.only(left: 10, right: 10, top: 15), // EdgeInsets.only(left: 10, right: 10, top: 15),
@ -71,35 +82,15 @@ class UpdateChiefComplaints extends StatelessWidget {
), ),
NewTextFields( NewTextFields(
hintText: TranslationBase.of(context).historyOfPresentIllness, hintText: TranslationBase
.of(context)
.historyOfPresentIllness,
controller: illnessController, controller: illnessController,
maxLines: 25, maxLines: 25,
minLines: 13, minLines: 3,
), ),
// Container( Container(
// margin: child: CustomValidationError(error: illnessControllerError,)),
// EdgeInsets.only(left: 10, right: 10, top: 15),
// child: TextFields(
// hasLabelText:
// illnessController.text != '' ? true : false,
// showLabelText: true,
// hintText: TranslationBase
// .of(context)
// .historyOfPresentIllness,
// fontSize: 13.5,
// // hintColor: Colors.black,
// fontWeight: FontWeight.w600,
// maxLines: 25,
// minLines: 13,
// controller: illnessController,
// validator: (value) {
// if (value == null || value == "")
// return TranslationBase.of(context)
// .emptyMessage;
// else
// return null;
// }),
// ),
SizedBox( SizedBox(
height: 20, height: 20,
), ),
@ -112,39 +103,16 @@ class UpdateChiefComplaints extends StatelessWidget {
SizedBox( SizedBox(
height: 10, height: 10,
), ),
// Container(
// margin:
// EdgeInsets.only(left: 10, right: 10, top: 15),
// child: TextFields(
// hasLabelText: medicationController.text != ''
// ? true
// : false,
// showLabelText: true,
// hintText: TranslationBase
// .of(context)
// .currentMedications,
// fontSize: 13.5,
// // hintColor: Colors.black,
// fontWeight: FontWeight.w600,
// maxLines: 23,
// minLines: 10,
// controller: medicationController,
// validator: (value) {
// if (value == null || value == "")
// return TranslationBase
// .of(context)
// .emptyMessage;
// else
// return null;
// }),
// ),
NewTextFields( NewTextFields(
hintText: TranslationBase.of(context).currentMedications, hintText: TranslationBase
.of(context)
.currentMedications,
controller: medicationController, controller: medicationController,
maxLines: 23, maxLines: 25,
minLines: 10, minLines: 3,
), ),
Container(child: CustomValidationError(
error: medicationControllerError,)),
SizedBox( SizedBox(
height: 10, height: 10,
), ),

@ -16,6 +16,7 @@ import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart'; import 'package:doctor_app_flutter/widgets/shared/dialogs/master_key_dailog.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart'; import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../custom_validation_error.dart'; import '../custom_validation_error.dart';
@ -40,17 +41,19 @@ class _UpdateMedicationWidgetState extends State<UpdateMedicationWidget> {
return Column( return Column(
children: [ children: [
Container( Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 15),
child: TextFields( child: TextFields(
hintText: TranslationBase.of(context).addMedication, hintText: TranslationBase.of(context).addMedication,
borderColor: HexColor('#707070'),
borderWidth: 0.30,
fontSize: 13.5, fontSize: 13.5,
borderRadius: 12,
onTapTextFields: () { onTapTextFields: () {
openMedicationList(context); openMedicationList(context);
}, },
readOnly: true, readOnly: true,
// hintColor: Colors.black, // hintColor: Colors.black,
suffixIcon: EvaIcons.plusCircleOutline, suffixIcon: EvaIcons.plusCircleOutline,
suffixIconColor: AppGlobal.appPrimaryColor, suffixIconColor: Color(0xFF2B353E),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
// controller: messageController, // controller: messageController,
validator: (value) { validator: (value) {

@ -19,8 +19,6 @@ import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_Chief_complaints.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_Chief_complaints.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_allergies_widget.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_history_widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_history_widget.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/soap_update/subjective/update_medication_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/TextFields.dart';
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -53,7 +51,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
TextEditingController illnessController = TextEditingController(); TextEditingController illnessController = TextEditingController();
TextEditingController complaintsController = TextEditingController(); TextEditingController complaintsController = TextEditingController();
TextEditingController medicationController = TextEditingController(); TextEditingController medicationController = TextEditingController();
String complaintsControllerError = '';
String medicationControllerError = '';
String illnessControllerError = '';
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
getHistory(SOAPViewModel model) async { getHistory(SOAPViewModel model) async {
@ -235,8 +235,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
height: 30, height: 30,
), ),
ExpandableSOAPWidget( ExpandableSOAPWidget(
headerTitle: TranslationBase headerTitle: TranslationBase.of(context)
.of(context)
.chiefComplaints .chiefComplaints
.toUpperCase(), .toUpperCase(),
onTap: () { onTap: () {
@ -244,7 +243,15 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
isChiefExpand = !isChiefExpand; isChiefExpand = !isChiefExpand;
}); });
}, },
child: UpdateChiefComplaints(formKey: formKey, complaintsController: complaintsController, illnessController: illnessController, medicationController: medicationController), child: UpdateChiefComplaints(
formKey: formKey,
complaintsController: complaintsController,
illnessController: illnessController,
medicationController: medicationController,
complaintsControllerError: complaintsControllerError,
illnessControllerError: illnessControllerError,
medicationControllerError: medicationControllerError,
),
isExpanded: isChiefExpand, isExpanded: isChiefExpand,
), ),
SizedBox( SizedBox(
@ -356,7 +363,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
formKey.currentState.save(); formKey.currentState.save();
formKey.currentState.validate(); formKey.currentState.validate();
complaintsControllerError = '';
medicationControllerError = '';
illnessControllerError = '';
if (complaintsController.text.isNotEmpty && if (complaintsController.text.isNotEmpty &&
illnessController.text.isNotEmpty && illnessController.text.isNotEmpty &&
complaintsController.text.length > 25) { complaintsController.text.length > 25) {
@ -382,6 +391,29 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
widget.changePageViewIndex(1); widget.changePageViewIndex(1);
} else { } else {
setState(() {
if (complaintsController.text.isEmpty) {
complaintsControllerError = TranslationBase
.of(context)
.emptyMessage;
} else if (complaintsController.text.length < 25) {
complaintsControllerError = TranslationBase
.of(context)
.chiefComplaintLength;
}
if (illnessController.text.isEmpty) {
illnessControllerError = TranslationBase
.of(context)
.emptyMessage;
}
if (medicationController.text.isEmpty) {
medicationControllerError = TranslationBase
.of(context)
.emptyMessage;
}
});
helpers.showErrorToast(TranslationBase helpers.showErrorToast(TranslationBase
.of(context) .of(context)
.chiefComplaintErrorMsg); .chiefComplaintErrorMsg);

@ -77,7 +77,7 @@ class TextFields extends StatefulWidget {
this.hasBorder = true, this.hasBorder = true,
this.onTapTextFields, this.onTapTextFields,
this.hasLabelText = false, this.hasLabelText = false,
this.showLabelText = false, this.borderRadius= 8.0}) this.showLabelText = false, this.borderRadius= 8.0, this.borderColor, this.borderWidth = 1, })
: super(key: key); : super(key: key);
final String hintText; final String hintText;
@ -116,8 +116,9 @@ class TextFields extends StatefulWidget {
final Color fillColor; final Color fillColor;
final bool hasBorder; final bool hasBorder;
final bool showLabelText; final bool showLabelText;
Color borderColor;
final double borderRadius; final double borderRadius;
final double borderWidth;
bool hasLabelText; bool hasLabelText;
@override @override
@ -202,6 +203,8 @@ class _TextFieldsState extends State<TextFields> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
widget.borderColor = widget.borderColor?? Colors.grey;
return (AnimatedContainer( return (AnimatedContainer(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
decoration: widget.bare decoration: widget.bare
@ -321,7 +324,7 @@ class _TextFieldsState extends State<TextFields> {
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: Colors.grey, width: 1.0) ? 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)
@ -329,14 +332,14 @@ class _TextFieldsState extends State<TextFields> {
), ),
disabledBorder: OutlineInputBorder( disabledBorder: OutlineInputBorder(
borderSide: widget.hasBorder borderSide: widget.hasBorder
? BorderSide(color: Colors.grey, width: 1.0) ? 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: Colors.grey, width: 1.0) ? 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)

Loading…
Cancel
Save