Merge branch 'textfield-validation' into 'development'

Textfield validation

See merge request Cloud_Solution/doctor_app_flutter!475
merge-requests/476/merge
Mohammad Aljammal 5 years ago
commit f289ae0c44

@ -44,6 +44,12 @@ class _AdmissionRequestThirdScreenState
bool _isSickLeaveRequired = false;
bool _patientPregnant = false;
String clinicError;
String doctorError;
String sickLeaveCommentError;
String medicalHistoryError;
String surgicalHistoryError;
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
@ -117,6 +123,7 @@ class _AdmissionRequestThirdScreenState
height: screenSize.height * 0.075,
hintText: TranslationBase.of(context).clinic,
isDropDown: true,
validationError: clinicError,
dropDownText: _selectedClinic != null
? projectViewModel.isArabic? _selectedClinic['clinicNameArabic'] : _selectedClinic['clinicNameEnglish']
: null,
@ -170,6 +177,7 @@ class _AdmissionRequestThirdScreenState
? _selectedDoctor['DoctorName']
: null,
enabled: false,
validationError: doctorError,
onClick: _selectedClinic != null
? model.doctorsList != null &&
model.doctorsList.length > 0
@ -263,6 +271,7 @@ class _AdmissionRequestThirdScreenState
controller: _sickLeaveCommentsController,
minLines: 2,
maxLines: 4,
validationError: sickLeaveCommentError,
inputType: TextInputType.multiline,
),
SizedBox(
@ -331,6 +340,7 @@ class _AdmissionRequestThirdScreenState
controller: _postMedicalHistoryController,
minLines: 4,
maxLines: 6,
validationError: medicalHistoryError,
inputType: TextInputType.multiline,
),
SizedBox(
@ -341,6 +351,7 @@ class _AdmissionRequestThirdScreenState
controller: _postSurgicalHistoryController,
minLines: 2,
maxLines: 4,
validationError: surgicalHistoryError,
inputType: TextInputType.multiline,
),
],
@ -401,6 +412,34 @@ class _AdmissionRequestThirdScreenState
} else {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseFill);
setState(() {
if(_selectedClinic == null){
clinicError = TranslationBase.of(context).fieldRequired;
}else {
clinicError = null;
}
if(_selectedDoctor == null){
doctorError = TranslationBase.of(context).fieldRequired;
}else {
doctorError = null;
}
if(_sickLeaveCommentsController.text == ""){
sickLeaveCommentError = TranslationBase.of(context).fieldRequired;
}else {
sickLeaveCommentError = null;
}
if(_postMedicalHistoryController.text == ""){
medicalHistoryError = TranslationBase.of(context).fieldRequired;
}else {
medicalHistoryError = null;
}
if(_postSurgicalHistoryController.text == ""){
surgicalHistoryError = TranslationBase.of(context).fieldRequired;
}else {
surgicalHistoryError = null;
}
});
}
},
),

@ -38,6 +38,10 @@ class _AdmissionRequestThirdScreenState
dynamic _selectedIcd;
dynamic _selectedDiagnosisType;
String diagnosisError;
String icdError;
String diagnosisTypeError;
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
@ -112,6 +116,7 @@ class _AdmissionRequestThirdScreenState
: null,
enabled: false,
isDropDown: true,
validationError: diagnosisError,
onClick: model.diagnosisTypesList != null &&
model.diagnosisTypesList.length > 0
? () {
@ -157,6 +162,7 @@ class _AdmissionRequestThirdScreenState
: null,
enabled: false,
isDropDown: true,
validationError: icdError,
onClick: model.icdCodes != null &&
model.icdCodes.length > 0
? () {
@ -204,6 +210,7 @@ class _AdmissionRequestThirdScreenState
: null,
enabled: false,
isDropDown: true,
validationError: diagnosisTypeError,
onClick: model.listOfDiagnosisSelectionTypes !=
null &&
model.listOfDiagnosisSelectionTypes.length >
@ -312,6 +319,26 @@ class _AdmissionRequestThirdScreenState
} else {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseFill);
setState(() {
if(_selectedDiagnosis == null){
diagnosisError = TranslationBase.of(context).fieldRequired;
}else {
diagnosisError = null;
}
if(_selectedIcd == null){
icdError = TranslationBase.of(context).fieldRequired;
}else {
icdError = null;
}
if(_selectedDiagnosisType == null){
diagnosisTypeError = TranslationBase.of(context).fieldRequired;
}else {
diagnosisTypeError = null;
}
});
}
},
),

@ -50,6 +50,18 @@ class _AdmissionRequestSecondScreenState
dynamic _selectedRoomCategory;
dynamic _selectedAdmissionType;
String costError;
String plansError;
String otherInterventionsError;
String expectedDaysError;
String expectedDatesError;
String floorError;
String roomError;
String treatmentsError;
String complicationsError;
String proceduresError;
String admissionTypeError;
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
@ -125,6 +137,7 @@ class _AdmissionRequestSecondScreenState
hintText:
TranslationBase.of(context).estimatedCost,
controller: _estimatedCostController,
validationError: costError,
inputType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(
@ -138,6 +151,7 @@ class _AdmissionRequestSecondScreenState
hintText: TranslationBase.of(context).postPlans,
controller: _postPlansEstimatedCostController,
inputType: TextInputType.multiline,
validationError: plansError,
minLines: 4,
maxLines: 6,
),
@ -150,6 +164,7 @@ class _AdmissionRequestSecondScreenState
controller:
_otherDepartmentsInterventionsController,
inputType: TextInputType.multiline,
validationError: otherInterventionsError,
minLines: 2,
maxLines: 4,
),
@ -170,6 +185,7 @@ class _AdmissionRequestSecondScreenState
hintText:
TranslationBase.of(context).expectedDays,
controller: _expectedDaysController,
validationError: expectedDaysError,
inputType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter.allow(
@ -188,6 +204,7 @@ class _AdmissionRequestSecondScreenState
: null,
enabled: false,
isDropDown: true,
validationError: expectedDatesError,
suffixIcon: Icon(
Icons.calendar_today,
color: Colors.black,
@ -215,6 +232,7 @@ class _AdmissionRequestSecondScreenState
: null,
enabled: false,
isDropDown: true,
validationError: floorError,
onClick: model.floorList != null &&
model.floorList.length > 0
? () {
@ -314,6 +332,7 @@ class _AdmissionRequestSecondScreenState
: null,
enabled: false,
isDropDown: true,
validationError: roomError,
onClick: model.roomCategoryList != null &&
model.roomCategoryList.length > 0
? () {
@ -365,6 +384,7 @@ class _AdmissionRequestSecondScreenState
TranslationBase.of(context).treatmentLine,
controller: _treatmentLineController,
inputType: TextInputType.multiline,
validationError: treatmentsError,
minLines: 3,
maxLines: 5,
),
@ -376,6 +396,7 @@ class _AdmissionRequestSecondScreenState
TranslationBase.of(context).complications,
controller: _complicationsController,
inputType: TextInputType.multiline,
validationError: complicationsError,
minLines: 3,
maxLines: 5,
),
@ -387,6 +408,7 @@ class _AdmissionRequestSecondScreenState
TranslationBase.of(context).otherProcedure,
controller: _otherProceduresController,
inputType: TextInputType.multiline,
validationError: proceduresError,
minLines: 3,
maxLines: 5,
),
@ -402,6 +424,7 @@ class _AdmissionRequestSecondScreenState
: null,
enabled: false,
isDropDown: true,
validationError: admissionTypeError,
onClick: model.admissionTypeList != null &&
model.admissionTypeList.length > 0
? () {
@ -533,6 +556,75 @@ class _AdmissionRequestSecondScreenState
} else {
DrAppToastMsg.showErrorToast(
TranslationBase.of(context).pleaseFill);
setState(() {
if (_estimatedCostController.text == "") {
costError = TranslationBase.of(context).fieldRequired;
} else {
costError = null;
}
if (_postPlansEstimatedCostController.text == "") {
plansError = TranslationBase.of(context).fieldRequired;
} else {
plansError = null;
}
if (_expectedDaysController.text == "") {
expectedDaysError = TranslationBase.of(context).fieldRequired;
} else {
expectedDaysError = null;
}
if (_expectedAdmissionDate == null) {
expectedDatesError = TranslationBase.of(context).fieldRequired;
} else {
expectedDatesError = null;
}
if (_otherDepartmentsInterventionsController.text == "") {
otherInterventionsError = TranslationBase.of(context).fieldRequired;
} else {
otherInterventionsError = null;
}
if (_selectedFloor == null) {
floorError = TranslationBase.of(context).fieldRequired;
} else {
floorError = null;
}
if (_selectedRoomCategory == null) {
roomError = TranslationBase.of(context).fieldRequired;
} else {
roomError = null;
}
if (_treatmentLineController.text == "") {
treatmentsError = TranslationBase.of(context).fieldRequired;
} else {
treatmentsError = null;
}
if (_complicationsController.text == "") {
complicationsError = TranslationBase.of(context).fieldRequired;
} else {
complicationsError = null;
}
if (_otherProceduresController.text == "") {
proceduresError = TranslationBase.of(context).fieldRequired;
} else {
proceduresError = null;
}
if (_selectedAdmissionType == null) {
admissionTypeError = TranslationBase.of(context).fieldRequired;
} else {
admissionTypeError = null;
}
});
}
},
),

Loading…
Cancel
Save