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/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:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../custom_validation_error.dart';
class UpdateChiefComplaints extends StatelessWidget {
const UpdateChiefComplaints({
@ -13,18 +13,24 @@ class UpdateChiefComplaints extends StatelessWidget {
@required this.complaintsController,
@required this.illnessController,
@required this.medicationController,
this.complaintsControllerError,
this.illnessControllerError,
this.medicationControllerError,
}) : super(key: key);
final GlobalKey<FormState> formKey;
final TextEditingController complaintsController;
final TextEditingController illnessController;
final TextEditingController medicationController;
final String complaintsControllerError;
final String illnessControllerError;
final String medicationControllerError;
@override
Widget build(BuildContext context) {
return Form(
key: formKey,
child: Column(children: [
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
SizedBox(
height: 20,
),
@ -33,9 +39,14 @@ class UpdateChiefComplaints extends StatelessWidget {
hintText: TranslationBase.of(context).addChiefComplaints,
controller: complaintsController,
maxLines: 25,
minLines: 13,
minLines: 3,
),
Container(
child: CustomValidationError(
error: complaintsControllerError,
)),
// Container(
// margin:
// EdgeInsets.only(left: 10, right: 10, top: 15),
@ -66,89 +77,46 @@ class UpdateChiefComplaints extends StatelessWidget {
// return null;
// }),
// ),
SizedBox(
height: 20,
),
NewTextFields(
hintText: TranslationBase.of(context).historyOfPresentIllness,
controller: illnessController,
maxLines: 25,
minLines: 13,
),
// Container(
// margin:
// 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(
height: 20,
),
SizedBox(
height: 10,
),
UpdateMedicationWidget(
medicationController: medicationController,
),
SizedBox(
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;
// }),
// ),
SizedBox(
height: 20,
),
NewTextFields(
hintText: TranslationBase.of(context).currentMedications,
controller: medicationController,
maxLines: 23,
minLines: 10,
),
SizedBox(
height: 10,
),
]),
NewTextFields(
hintText: TranslationBase
.of(context)
.historyOfPresentIllness,
controller: illnessController,
maxLines: 25,
minLines: 3,
),
Container(
child: CustomValidationError(error: illnessControllerError,)),
SizedBox(
height: 20,
),
SizedBox(
height: 10,
),
UpdateMedicationWidget(
medicationController: medicationController,
),
SizedBox(
height: 10,
),
NewTextFields(
hintText: TranslationBase
.of(context)
.currentMedications,
controller: medicationController,
maxLines: 25,
minLines: 3,
),
Container(child: CustomValidationError(
error: medicationControllerError,)),
SizedBox(
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:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
import '../custom_validation_error.dart';
@ -40,17 +41,19 @@ class _UpdateMedicationWidgetState extends State<UpdateMedicationWidget> {
return Column(
children: [
Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 15),
child: TextFields(
hintText: TranslationBase.of(context).addMedication,
borderColor: HexColor('#707070'),
borderWidth: 0.30,
fontSize: 13.5,
borderRadius: 12,
onTapTextFields: () {
openMedicationList(context);
},
readOnly: true,
// hintColor: Colors.black,
suffixIcon: EvaIcons.plusCircleOutline,
suffixIconColor: AppGlobal.appPrimaryColor,
suffixIconColor: Color(0xFF2B353E),
fontWeight: FontWeight.w600,
// controller: messageController,
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_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_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_scaffold_widget.dart';
import 'package:flutter/material.dart';
@ -53,7 +51,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
TextEditingController illnessController = TextEditingController();
TextEditingController complaintsController = TextEditingController();
TextEditingController medicationController = TextEditingController();
String complaintsControllerError = '';
String medicationControllerError = '';
String illnessControllerError = '';
final formKey = GlobalKey<FormState>();
getHistory(SOAPViewModel model) async {
@ -235,8 +235,7 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
height: 30,
),
ExpandableSOAPWidget(
headerTitle: TranslationBase
.of(context)
headerTitle: TranslationBase.of(context)
.chiefComplaints
.toUpperCase(),
onTap: () {
@ -244,7 +243,15 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
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,
),
SizedBox(
@ -356,7 +363,9 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
formKey.currentState.save();
formKey.currentState.validate();
complaintsControllerError = '';
medicationControllerError = '';
illnessControllerError = '';
if (complaintsController.text.isNotEmpty &&
illnessController.text.isNotEmpty &&
complaintsController.text.length > 25) {
@ -382,6 +391,29 @@ class _UpdateSubjectivePageState extends State<UpdateSubjectivePage> {
widget.changePageViewIndex(1);
} 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
.of(context)
.chiefComplaintErrorMsg);

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

Loading…
Cancel
Save