diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/add_or_view_patient.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/add_or_view_patient.dart index 456b7418..d5167df1 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/add_or_view_patient.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/add_or_view_patient.dart @@ -26,6 +26,7 @@ class _AddOrViewPatientState extends State { late double width; late double height; late Widget loading; + late Future patient; Future fetchPatient() async { //print("Patien manager page: $endpoint"); @@ -55,15 +56,23 @@ class _AddOrViewPatientState extends State { super.dispose(); } + @override + void initState() { + // TODO: implement initState + super.initState(); + patient = fetchPatient(); + } + @override Widget build(BuildContext context) { + print("AddOrViewPatient"); var size = MediaQuery.of(context).size; setState(() { width = size.width; height = size.height; }); return FutureBuilder( - future: fetchPatient(), + future: patient, builder: (ctx, snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { diff --git a/Frontend/lib/mih_packages/patient_profile/pat_profile/patient_add.dart b/Frontend/lib/mih_packages/patient_profile/pat_profile/patient_add.dart index 73f5ad58..7bd55032 100644 --- a/Frontend/lib/mih_packages/patient_profile/pat_profile/patient_add.dart +++ b/Frontend/lib/mih_packages/patient_profile/pat_profile/patient_add.dart @@ -8,6 +8,7 @@ import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_action.dart' import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_body.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_header.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_layout_builder.dart'; +import 'package:Mzansi_Innovation_Hub/mih_components/mih_layout/mih_single_child_scroll.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_error_message.dart'; import 'package:Mzansi_Innovation_Hub/mih_components/mih_pop_up_messages/mih_success_message.dart'; import 'package:Mzansi_Innovation_Hub/mih_env/env.dart'; @@ -158,147 +159,151 @@ class _AddPatientState extends State { } Widget displayForm() { - return Column( - children: [ - Text( - "Personal Details", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 22.0, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + return MihSingleChildScroll( + child: Column( + children: [ + Text( + "Personal Details", + textAlign: TextAlign.center, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 22.0, + color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + ), ), - ), - Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), - const SizedBox(height: 10.0), - MIHTextField( - controller: idController, - hintText: "13 digit ID Number or Passport", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: fnameController, - hintText: "First Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Last Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: cellController, - hintText: "Cell Number", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: emailController, - hintText: "Email", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: addressController, - hintText: "Address", - editable: true, - required: true, - ), - const SizedBox(height: 15.0), - Text( - "Medical Aid Details", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 22.0, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + Divider( + color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), + const SizedBox(height: 10.0), + MIHTextField( + controller: idController, + hintText: "13 digit ID Number or Passport", + editable: true, + required: true, ), - ), - Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: medAidController, - hintText: "Medical Aid", - editable: true, - enableSearch: false, - // onSelect: (_) { - // isRequired(); - // }, - required: true, - 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), - MIHTextField( - controller: medNoController, - hintText: "Medical Aid No.", - editable: value, - required: value, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: medAidCodeController, - hintText: "Medical Aid Code", - editable: value, - required: value, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: medNameController, - hintText: "Medical Aid Name", - editable: value, - required: value, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: medSchemeController, - hintText: "Medical Aid Plan", - editable: value, - required: value, - ), - ], - ), - ); - }, - ), - const SizedBox(height: 30.0), - SizedBox( - width: 450.0, - height: 50.0, - child: MIHButton( - onTap: () { - submitForm(); + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "First Name", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Last Name", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: cellController, + hintText: "Cell Number", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: emailController, + hintText: "Email", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: addressController, + hintText: "Address", + editable: true, + required: true, + ), + const SizedBox(height: 15.0), + Text( + "Medical Aid Details", + textAlign: TextAlign.center, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 22.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, + enableSearch: false, + // onSelect: (_) { + // isRequired(); + // }, + required: true, + 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), + MIHTextField( + controller: medNoController, + hintText: "Medical Aid No.", + editable: value, + required: value, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: medAidCodeController, + hintText: "Medical Aid Code", + editable: value, + required: value, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: medNameController, + hintText: "Medical Aid Name", + editable: value, + required: value, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: medSchemeController, + hintText: "Medical Aid Plan", + editable: value, + required: value, + ), + ], + ), + ); }, - buttonText: "Add", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), ), - ), - ], + const SizedBox(height: 30.0), + SizedBox( + width: 450.0, + height: 50.0, + child: MIHButton( + onTap: () { + submitForm(); + }, + buttonText: "Add", + buttonColor: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + textColor: MzanziInnovationHub.of(context)!.theme.primaryColor(), + ), + ), + ], + ), ); } @@ -393,6 +398,7 @@ class _AddPatientState extends State { @override Widget build(BuildContext context) { + print("Add Patient"); return MIHLayoutBuilder( actionButton: getActionButton(), header: getHeader(),