fix pat profile padding

This commit is contained in:
2025-06-06 13:39:54 +02:00
parent 52bf4ed1b6
commit 0cfe408bce
5 changed files with 1093 additions and 1103 deletions

View File

@@ -82,292 +82,301 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
);
}
Widget getWindowBody() {
return Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
MIHDropdownField(
controller: _docTypeController,
hintText: "Document Type",
dropdownOptions: const ["Claim", "Statement"],
required: true,
editable: true,
enableSearch: false,
),
const SizedBox(height: 10),
Center(
child: Text(
"Service Details",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
Widget getWindowBody(double width) {
return Padding(
padding: MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: const EdgeInsets.symmetric(horizontal: 0),
child: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
MIHDropdownField(
controller: _docTypeController,
hintText: "Document Type",
dropdownOptions: const ["Claim", "Statement"],
required: true,
editable: true,
enableSearch: false,
),
),
Divider(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
const SizedBox(height: 10),
MIHDateField(
controller: _serviceDateController,
lableText: "Date of Service",
required: true,
),
const SizedBox(height: 10),
MIHDropdownField(
controller: _serviceDescController,
hintText: "Service Decription",
dropdownOptions: const [
"Consultation",
"Procedure",
"Other",
],
required: true,
editable: true,
enableSearch: false,
),
const SizedBox(height: 10),
ValueListenableBuilder(
valueListenable: serviceDesc,
builder: (BuildContext context, String value, Widget? child) {
Widget returnWidget;
switch (value) {
case 'Consultation':
returnWidget = Column(
children: [
SizedBox(
child: MIHDropdownField(
controller: _serviceDescOptionsController,
hintText: "Consultation Type",
dropdownOptions: const [
"General Consultation",
"Follow-Up Consultation",
"Specialist Consultation",
"Emergency Consultation",
],
required: true,
editable: true,
enableSearch: false,
),
),
const SizedBox(height: 10),
],
);
case 'Procedure':
returnWidget = Column(
children: [
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: _prcedureNameController,
multiLineInput: false,
requiredText: true,
hintText: "Procedure Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: _proceedureAdditionalInfoController,
multiLineInput: false,
requiredText: true,
hintText: "Additional Information",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 15),
],
);
case 'Other':
returnWidget = Column(
children: [
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: _serviceDescOptionsController,
multiLineInput: false,
requiredText: true,
hintText: "Service Description Details",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10),
],
);
default:
returnWidget = const SizedBox();
}
return returnWidget;
},
),
Column(
children: [
Align(
alignment: Alignment.centerLeft,
child: Text("ICD-10 Code & Description",
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
)),
),
const SizedBox(height: 4),
MihSearchBar(
controller: _icd10CodeController,
hintText: "ICD-10 Search",
prefixIcon: Icons.search,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
hintColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
onPrefixIconTap: () {
MIHIcd10CodeApis.getIcd10Codes(
_icd10CodeController.text, context)
.then((result) {
icd10SearchWindow(result);
});
},
onClearIconTap: () {
_icd10CodeController.clear();
},
searchFocusNode: _searchFocusNode,
),
],
),
const SizedBox(height: 10),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _amountController,
multiLineInput: false,
requiredText: true,
numberMode: true,
hintText: "Service Cost",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10),
Center(
child: Text(
"Additional Infomation",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
),
Divider(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
const SizedBox(height: 10),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _preauthNoController,
multiLineInput: false,
requiredText: false,
hintText: "Pre-authorisation No.",
),
const SizedBox(height: 20),
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
if (isInputValid()) {
MIHClaimStatementGenerationApi().generateClaimStatement(
ClaimStatementGenerationArguments(
_docTypeController.text,
widget.selectedPatient.app_id,
_fullNameController.text,
_idController.text,
_medAidController.text,
_medAidNoController.text,
_medAidCodeController.text,
_medAidNameController.text,
_medAidSchemeController.text,
widget.business!.Name,
"*To-Be Added*",
widget.business!.contact_no,
widget.business!.bus_email,
_providerNameController.text,
_practiceNoController.text,
_vatNoController.text,
_serviceDateController.text,
_serviceDescController.text,
_serviceDescOptionsController.text,
_prcedureNameController.text,
_proceedureAdditionalInfoController.text,
_icd10CodeController.text,
_amountController.text,
_preauthNoController.text,
widget.business!.logo_path,
widget.businessUser!.sig_path,
),
PatientViewArguments(
widget.signedInUser,
widget.selectedPatient,
widget.businessUser,
widget.business,
"business",
),
widget.env,
context);
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(
errorType: "Input Error");
},
);
}
}
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
const SizedBox(height: 10),
Center(
child: Text(
"Generate",
"Service Details",
textAlign: TextAlign.center,
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontSize: 25,
fontWeight: FontWeight.bold,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
),
),
],
),
],
Divider(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor()),
const SizedBox(height: 10),
MIHDateField(
controller: _serviceDateController,
lableText: "Date of Service",
required: true,
),
const SizedBox(height: 10),
MIHDropdownField(
controller: _serviceDescController,
hintText: "Service Decription",
dropdownOptions: const [
"Consultation",
"Procedure",
"Other",
],
required: true,
editable: true,
enableSearch: false,
),
const SizedBox(height: 10),
ValueListenableBuilder(
valueListenable: serviceDesc,
builder: (BuildContext context, String value, Widget? child) {
Widget returnWidget;
switch (value) {
case 'Consultation':
returnWidget = Column(
children: [
SizedBox(
child: MIHDropdownField(
controller: _serviceDescOptionsController,
hintText: "Consultation Type",
dropdownOptions: const [
"General Consultation",
"Follow-Up Consultation",
"Specialist Consultation",
"Emergency Consultation",
],
required: true,
editable: true,
enableSearch: false,
),
),
const SizedBox(height: 10),
],
);
case 'Procedure':
returnWidget = Column(
children: [
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: _prcedureNameController,
multiLineInput: false,
requiredText: true,
hintText: "Procedure Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: _proceedureAdditionalInfoController,
multiLineInput: false,
requiredText: true,
hintText: "Additional Information",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 15),
],
);
case 'Other':
returnWidget = Column(
children: [
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: _serviceDescOptionsController,
multiLineInput: false,
requiredText: true,
hintText: "Service Description Details",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10),
],
);
default:
returnWidget = const SizedBox();
}
return returnWidget;
},
),
Column(
children: [
Align(
alignment: Alignment.centerLeft,
child: Text("ICD-10 Code & Description",
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
)),
),
const SizedBox(height: 4),
MihSearchBar(
controller: _icd10CodeController,
hintText: "ICD-10 Search",
prefixIcon: Icons.search,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
hintColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
onPrefixIconTap: () {
MIHIcd10CodeApis.getIcd10Codes(
_icd10CodeController.text, context)
.then((result) {
icd10SearchWindow(result);
});
},
onClearIconTap: () {
_icd10CodeController.clear();
},
searchFocusNode: _searchFocusNode,
),
],
),
const SizedBox(height: 10),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _amountController,
multiLineInput: false,
requiredText: true,
numberMode: true,
hintText: "Service Cost",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10),
Center(
child: Text(
"Additional Infomation",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
),
Divider(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor()),
const SizedBox(height: 10),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: _preauthNoController,
multiLineInput: false,
requiredText: false,
hintText: "Pre-authorisation No.",
),
const SizedBox(height: 20),
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
if (isInputValid()) {
MIHClaimStatementGenerationApi().generateClaimStatement(
ClaimStatementGenerationArguments(
_docTypeController.text,
widget.selectedPatient.app_id,
_fullNameController.text,
_idController.text,
_medAidController.text,
_medAidNoController.text,
_medAidCodeController.text,
_medAidNameController.text,
_medAidSchemeController.text,
widget.business!.Name,
"*To-Be Added*",
widget.business!.contact_no,
widget.business!.bus_email,
_providerNameController.text,
_practiceNoController.text,
_vatNoController.text,
_serviceDateController.text,
_serviceDescController.text,
_serviceDescOptionsController.text,
_prcedureNameController.text,
_proceedureAdditionalInfoController.text,
_icd10CodeController.text,
_amountController.text,
_preauthNoController.text,
widget.business!.logo_path,
widget.businessUser!.sig_path,
),
PatientViewArguments(
widget.signedInUser,
widget.selectedPatient,
widget.businessUser,
widget.business,
"business",
),
widget.env,
context);
} else {
showDialog(
context: context,
builder: (context) {
return const MIHErrorMessage(
errorType: "Input Error");
},
);
}
}
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Generate",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
],
),
);
}
@@ -459,19 +468,14 @@ class _ClaimStatementWindowState extends State<ClaimStatementWindow> {
@override
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageWindow(
fullscreen: false,
windowTitle: "Generate Claim/ Statement Document",
onWindowTapClose: () {
// medicineController.clear();
// quantityController.clear();
// dosageController.clear();
// timesDailyController.clear();
// noDaysController.clear();
// noRepeatsController.clear();
Navigator.pop(context);
},
windowBody: getWindowBody(),
windowBody: getWindowBody(screenWidth),
);
}
}

View File

@@ -69,7 +69,7 @@ class _PatientConsultationState extends State<PatientConsultation> {
}
}
void addNotePopUp() {
void addNotePopUp(double width) {
DateTime now = new DateTime.now();
DateTime date = new DateTime(now.year, now.month, now.day);
var title = "";
@@ -94,128 +94,136 @@ class _PatientConsultationState extends State<PatientConsultation> {
titleController.clear();
noteTextController.clear();
},
windowBody: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: officeController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Office",
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: doctorController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Created By",
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: dateController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Created Date",
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: titleController,
multiLineInput: false,
requiredText: true,
hintText: "Note Title",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
height: 250,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: noteTextController,
multiLineInput: true,
requiredText: true,
hintText: "Note Details",
validator: (value) {
return MihValidationServices().validateLength(value, 512);
},
),
SizedBox(
height: 15,
child: ValueListenableBuilder(
builder: (BuildContext context, int value, Widget? child) {
return Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
"$value",
style: TextStyle(
color: getNoteDetailLimitColor(),
fontWeight: FontWeight.bold,
),
),
const SizedBox(width: 5),
Text(
"/512",
style: TextStyle(
color: getNoteDetailLimitColor(),
fontWeight: FontWeight.bold,
),
),
],
);
},
valueListenable: _counter,
windowBody: Padding(
padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: const EdgeInsets.symmetric(horizontal: 0),
child: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: officeController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Office",
),
),
const SizedBox(height: 15.0),
MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
addPatientNoteAPICall();
Navigator.pop(context);
}
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Add Note",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: doctorController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Created By",
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: dateController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Created Date",
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: titleController,
multiLineInput: false,
requiredText: true,
hintText: "Note Title",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
height: 250,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: noteTextController,
multiLineInput: true,
requiredText: true,
hintText: "Note Details",
validator: (value) {
return MihValidationServices().validateLength(value, 512);
},
),
SizedBox(
height: 15,
child: ValueListenableBuilder(
builder:
(BuildContext context, int value, Widget? child) {
return Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
"$value",
style: TextStyle(
color: getNoteDetailLimitColor(),
fontWeight: FontWeight.bold,
),
),
const SizedBox(width: 5),
Text(
"/512",
style: TextStyle(
color: getNoteDetailLimitColor(),
fontWeight: FontWeight.bold,
),
),
],
);
},
valueListenable: _counter,
),
),
),
],
),
],
const SizedBox(height: 15.0),
MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
addPatientNoteAPICall();
Navigator.pop(context);
}
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Add Note",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
],
),
),
),
);
@@ -271,40 +279,6 @@ class _PatientConsultationState extends State<PatientConsultation> {
}
}
List<Widget> setIcons() {
if (widget.type == "personal") {
return [
Text(
"Consultation Notes",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
),
];
} else {
return [
Text(
"Consultation Notes",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
),
IconButton(
onPressed: () {
// addConsultationNotePopUp();
addNotePopUp();
},
icon: Icon(Icons.add,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
)
];
}
}
void successPopUp(String message) {
showDialog(
context: context,
@@ -349,13 +323,14 @@ class _PatientConsultationState extends State<PatientConsultation> {
@override
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
borderOn: false,
bodyItem: getBody(),
bodyItem: getBody(screenWidth),
);
}
Widget getBody() {
Widget getBody(double width) {
return Stack(
children: [
MihSingleChildScroll(
@@ -413,7 +388,7 @@ class _PatientConsultationState extends State<PatientConsultation> {
MzanziInnovationHub.of(context)!.theme.successColor(),
onTap: () {
// addConsultationNotePopUp();
addNotePopUp();
addNotePopUp(width);
},
)
],

View File

@@ -39,7 +39,7 @@ class _PatientInfoState extends State<PatientInfo> {
final medMainMemController = TextEditingController();
final medAidCodeController = TextEditingController();
final _formKey = GlobalKey<FormState>();
double textFieldWidth = 400.0;
double textFieldWidth = 500;
late String medAid;
Widget getPatientDetailsField() {
@@ -48,69 +48,93 @@ class _PatientInfoState extends State<PatientInfo> {
spacing: 15,
runSpacing: 10,
children: [
MihTextFormField(
SizedBox(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: idController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "ID No.",
// validator: (value) {
// return MihValidationServices().isEmpty(value);
// },
child: MihTextFormField(
// width: textFieldWidth,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: idController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "ID No.",
// validator: (value) {
// return MihValidationServices().isEmpty(value);
// },
),
),
MihTextFormField(
SizedBox(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "First Name",
child: MihTextFormField(
// width: textFieldWidth,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "First Name",
),
),
MihTextFormField(
SizedBox(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
hintText: "Surname",
readOnly: true,
child: MihTextFormField(
// width: textFieldWidth,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
hintText: "Surname",
readOnly: true,
),
),
MihTextFormField(
SizedBox(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: cellController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Cell No.",
child: MihTextFormField(
// width: textFieldWidth,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: cellController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Cell No.",
),
),
MihTextFormField(
SizedBox(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: emailController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Email",
child: MihTextFormField(
// width: textFieldWidth,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: emailController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Email",
),
),
MihTextFormField(
SizedBox(
width: textFieldWidth,
height: 100,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: addressController,
multiLineInput: true,
requiredText: true,
readOnly: true,
hintText: "Address",
child: MihTextFormField(
// width: textFieldWidth,
height: 100,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: addressController,
multiLineInput: true,
requiredText: true,
readOnly: true,
hintText: "Address",
),
),
],
),
@@ -120,15 +144,18 @@ class _PatientInfoState extends State<PatientInfo> {
Widget getMedAidDetailsFields() {
List<Widget> medAidDet = [];
medAidDet.add(
MihTextFormField(
SizedBox(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medAidController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Medical Aid",
child: MihTextFormField(
// width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medAidController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Medical Aid",
),
),
);
bool req;
@@ -140,67 +167,81 @@ class _PatientInfoState extends State<PatientInfo> {
medAidDet.addAll([
Visibility(
visible: req,
child: MihTextFormField(
child: SizedBox(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medMainMemController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Main Member",
child: MihTextFormField(
// width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medMainMemController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Main Member",
),
),
),
Visibility(
visible: req,
child: MihTextFormField(
child: SizedBox(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medNoController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "No.",
child: MihTextFormField(
// width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medNoController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "No.",
),
),
),
Visibility(
visible: req,
child: MihTextFormField(
child: SizedBox(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medAidCodeController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Code",
child: MihTextFormField(
// width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medAidCodeController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Code",
),
),
),
Visibility(
visible: req,
child: MihTextFormField(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medNameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Name",
child: SizedBox(
child: MihTextFormField(
// width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medNameController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Name",
),
),
),
Visibility(
visible: req,
child: MihTextFormField(
child: SizedBox(
width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medSchemeController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Plan",
child: MihTextFormField(
// width: textFieldWidth,
fillColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: medSchemeController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Plan",
),
),
),
]);
@@ -263,14 +304,15 @@ class _PatientInfoState extends State<PatientInfo> {
@override
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
return MihPackageToolBody(
borderOn: false,
innerHorizontalPadding: 10,
bodyItem: getBody(),
bodyItem: getBody(screenWidth),
);
}
Widget getBody() {
Widget getBody(double width) {
return Stack(
children: [
MihSingleChildScroll(

View File

@@ -160,18 +160,127 @@ class _AddPatientState extends State<AddPatient> {
}
}
Widget displayForm() {
Widget displayForm(double width) {
return SingleChildScrollView(
child: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Personal",
child: Padding(
padding: MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.2)
: EdgeInsets.symmetric(horizontal: width * 0.075),
child: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Personal",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25.0,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
],
),
Divider(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: idController,
multiLineInput: false,
requiredText: true,
hintText: "ID No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
hintText: "First Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
hintText: "Surname",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: cellController,
multiLineInput: false,
requiredText: true,
hintText: "Cell No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: emailController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Email",
validator: (value) {
return MihValidationServices().validateEmail(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
height: 100,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: addressController,
multiLineInput: true,
requiredText: true,
hintText: "Address",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 15.0),
Center(
child: Text(
"Medical Aid Details",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
@@ -181,250 +290,150 @@ class _AddPatientState extends State<AddPatient> {
.secondaryColor(),
),
),
],
),
Divider(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor()),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: idController,
multiLineInput: false,
requiredText: true,
hintText: "ID No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
hintText: "First Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
hintText: "Surname",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: cellController,
multiLineInput: false,
requiredText: true,
hintText: "Cell No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: emailController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Email",
validator: (value) {
return MihValidationServices().validateEmail(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
height: 100,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: addressController,
multiLineInput: true,
requiredText: true,
hintText: "Address",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 15.0),
Center(
child: Text(
"Medical Aid Details",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25.0,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
),
Divider(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor()),
const SizedBox(height: 10.0),
MIHDropdownField(
controller: medAidController,
hintText: "Medical Aid",
editable: true,
required: true,
enableSearch: false,
dropdownOptions: const ["Yes", "No"],
),
ValueListenableBuilder(
valueListenable: medRequired,
builder: (BuildContext context, bool value, Widget? child) {
return Visibility(
visible: value,
child: Column(
children: [
const SizedBox(height: 10.0),
MIHDropdownField(
controller: medMainMemController,
hintText: "Main Member",
editable: value,
required: value,
enableSearch: false,
dropdownOptions: const ["Yes", "No"],
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medNoController,
multiLineInput: false,
requiredText: true,
hintText: "No.",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medAidCodeController,
multiLineInput: false,
requiredText: true,
hintText: "Code",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medNameController,
multiLineInput: false,
requiredText: true,
hintText: "Name",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medSchemeController,
multiLineInput: false,
requiredText: true,
hintText: "Plan",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
],
),
);
},
),
const SizedBox(height: 20.0),
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
submitForm();
}
Divider(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
const SizedBox(height: 10.0),
MIHDropdownField(
controller: medAidController,
hintText: "Medical Aid",
editable: true,
required: true,
enableSearch: false,
dropdownOptions: const ["Yes", "No"],
),
ValueListenableBuilder(
valueListenable: medRequired,
builder: (BuildContext context, bool value, Widget? child) {
return Visibility(
visible: value,
child: Column(
children: [
const SizedBox(height: 10.0),
MIHDropdownField(
controller: medMainMemController,
hintText: "Main Member",
editable: value,
required: value,
enableSearch: false,
dropdownOptions: const ["Yes", "No"],
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medNoController,
multiLineInput: false,
requiredText: true,
hintText: "No.",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medAidCodeController,
multiLineInput: false,
requiredText: true,
hintText: "Code",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medNameController,
multiLineInput: false,
requiredText: true,
hintText: "Name",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medSchemeController,
multiLineInput: false,
requiredText: true,
hintText: "Plan",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
],
),
);
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Add",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
const SizedBox(height: 20.0),
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
submitForm();
}
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Add",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
),
const SizedBox(height: 20.0),
],
),
],
const SizedBox(height: 20.0),
],
),
],
),
),
);
}
@@ -458,7 +467,7 @@ class _AddPatientState extends State<AddPatient> {
);
}
MIHBody getBody() {
MIHBody getBody(double width) {
return MIHBody(
borderOn: false,
bodyItems: [
@@ -473,7 +482,7 @@ class _AddPatientState extends State<AddPatient> {
}
}
},
child: displayForm(),
child: displayForm(width),
),
],
);
@@ -513,12 +522,12 @@ class _AddPatientState extends State<AddPatient> {
@override
Widget build(BuildContext context) {
print("Add Patient");
double screenWidth = MediaQuery.of(context).size.width;
return MIHLayoutBuilder(
actionButton: getActionButton(),
header: getHeader(),
secondaryActionButton: null,
body: getBody(),
body: getBody(screenWidth),
actionDrawer: null,
secondaryActionDrawer: null,
bottomNavBar: null,

View File

@@ -374,18 +374,127 @@ class _EditPatientState extends State<EditPatient> {
}
}
Widget displayForm() {
Widget displayForm(double width) {
return SingleChildScrollView(
child: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Personal",
child: Padding(
padding: MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.2)
: EdgeInsets.symmetric(horizontal: width * 0.075),
child: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Personal",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25.0,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
],
),
Divider(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: idController,
multiLineInput: false,
requiredText: true,
hintText: "ID No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
hintText: "First Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
hintText: "Surname",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: cellController,
multiLineInput: false,
requiredText: true,
hintText: "Cell No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: emailController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Email",
validator: (value) {
return MihValidationServices().validateEmail(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
height: 100,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: addressController,
multiLineInput: true,
requiredText: true,
hintText: "Address",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 15.0),
Center(
child: Text(
"Medical Aid Details",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
@@ -395,250 +504,150 @@ class _EditPatientState extends State<EditPatient> {
.secondaryColor(),
),
),
],
),
Divider(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor()),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: idController,
multiLineInput: false,
requiredText: true,
hintText: "ID No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: fnameController,
multiLineInput: false,
requiredText: true,
hintText: "First Name",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: lnameController,
multiLineInput: false,
requiredText: true,
hintText: "Surname",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: cellController,
multiLineInput: false,
requiredText: true,
hintText: "Cell No.",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: emailController,
multiLineInput: false,
requiredText: true,
readOnly: true,
hintText: "Email",
validator: (value) {
return MihValidationServices().validateEmail(value);
},
),
const SizedBox(height: 10.0),
MihTextFormField(
height: 100,
fillColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
inputColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
controller: addressController,
multiLineInput: true,
requiredText: true,
hintText: "Address",
validator: (value) {
return MihValidationServices().isEmpty(value);
},
),
const SizedBox(height: 15.0),
Center(
child: Text(
"Medical Aid Details",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25.0,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
),
Divider(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor()),
const SizedBox(height: 10.0),
MIHDropdownField(
controller: medAidController,
hintText: "Medical Aid",
editable: true,
required: true,
enableSearch: false,
dropdownOptions: const ["Yes", "No"],
),
ValueListenableBuilder(
valueListenable: medRequired,
builder: (BuildContext context, bool value, Widget? child) {
return Visibility(
visible: value,
child: Column(
children: [
const SizedBox(height: 10.0),
MIHDropdownField(
controller: medMainMemController,
hintText: "Main Member",
editable: value,
required: value,
enableSearch: false,
dropdownOptions: const ["Yes", "No"],
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medNoController,
multiLineInput: false,
requiredText: true,
hintText: "No.",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medAidCodeController,
multiLineInput: false,
requiredText: true,
hintText: "Code",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medNameController,
multiLineInput: false,
requiredText: true,
hintText: "Name",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medSchemeController,
multiLineInput: false,
requiredText: true,
hintText: "Plan",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
],
),
);
},
),
const SizedBox(height: 20.0),
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
submitForm();
}
Divider(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
const SizedBox(height: 10.0),
MIHDropdownField(
controller: medAidController,
hintText: "Medical Aid",
editable: true,
required: true,
enableSearch: false,
dropdownOptions: const ["Yes", "No"],
),
ValueListenableBuilder(
valueListenable: medRequired,
builder: (BuildContext context, bool value, Widget? child) {
return Visibility(
visible: value,
child: Column(
children: [
const SizedBox(height: 10.0),
MIHDropdownField(
controller: medMainMemController,
hintText: "Main Member",
editable: value,
required: value,
enableSearch: false,
dropdownOptions: const ["Yes", "No"],
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medNoController,
multiLineInput: false,
requiredText: true,
hintText: "No.",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medAidCodeController,
multiLineInput: false,
requiredText: true,
hintText: "Code",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medNameController,
multiLineInput: false,
requiredText: true,
hintText: "Name",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
MihTextFormField(
fillColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
inputColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
controller: medSchemeController,
multiLineInput: false,
requiredText: true,
hintText: "Plan",
validator: (validationValue) {
if (value) {
return MihValidationServices()
.isEmpty(validationValue);
}
return null;
},
),
const SizedBox(height: 10.0),
],
),
);
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Update",
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
const SizedBox(height: 20.0),
Center(
child: MihButton(
onPressed: () {
if (_formKey.currentState!.validate()) {
submitForm();
}
},
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 300,
child: Text(
"Update",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
),
const SizedBox(height: 20.0),
],
),
],
const SizedBox(height: 20.0),
],
),
],
),
),
);
}
@@ -672,7 +681,7 @@ class _EditPatientState extends State<EditPatient> {
);
}
MIHBody getBody() {
MIHBody getBody(double width) {
return MIHBody(
borderOn: false,
bodyItems: [
@@ -687,7 +696,7 @@ class _EditPatientState extends State<EditPatient> {
}
}
},
child: displayForm(),
child: displayForm(width),
),
],
);
@@ -747,61 +756,12 @@ class _EditPatientState extends State<EditPatient> {
actionButton: getActionButton(),
header: getHeader(),
secondaryActionButton: null,
body: getBody(),
body: getBody(width),
actionDrawer: null,
secondaryActionDrawer: null,
bottomNavBar: null,
pullDownToRefresh: false,
onPullDown: () async {},
);
// return Scaffold(
// // appBar: const MIHAppBar(
// // barTitle: "Edit Patient",
// // propicFile: null,
// // ),
// body: SafeArea(
// child: Stack(
// children: [
// KeyboardListener(
// focusNode: _focusNode,
// autofocus: true,
// onKeyEvent: (event) async {
// if (event is KeyDownEvent &&
// event.logicalKey == LogicalKeyboardKey.enter) {
// submitForm();
// }
// },
// child: displayForm(),
// ),
// Positioned(
// top: 10,
// left: 5,
// width: 50,
// height: 50,
// child: IconButton(
// onPressed: () {
// Navigator.of(context).pop();
// },
// icon: const Icon(Icons.arrow_back),
// ),
// ),
// Positioned(
// top: 10,
// right: 5,
// width: 50,
// height: 50,
// child: IconButton(
// icon: const Icon(Icons.delete),
// color:
// MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// //alignment: Alignment.topRight,
// onPressed: () {
// deletePatientPopUp();
// },
// ))
// ],
// ),
// ),
// );
}
}