From 7111ad36004198d13d9b84fa4f3cef1d6a329ea4 Mon Sep 17 00:00:00 2001 From: yaso Date: Thu, 19 Sep 2024 10:56:57 +0200 Subject: [PATCH] Fix pop up windows with input. make more dynamic --- .../lib/mih_components/med_cert_input.dart | 2 +- .../lib/mih_components/medicine_search.dart | 100 +++++----- .../mih_components/mih_layout/mih_body.dart | 28 ++- .../mih_layout/mih_layout_builder.dart | 28 +-- .../builder/build_employee_list.dart | 2 +- .../builder/build_user_list.dart | 2 +- .../builder/build_patient_list.dart | 2 +- .../patient_profile/patient_files.dart | 159 ++++++++-------- .../patient_profile/patient_notes.dart | 176 +++++++++--------- .../patient_profile/prescip_input.dart | 2 + 10 files changed, 271 insertions(+), 230 deletions(-) diff --git a/Frontend/patient_manager/lib/mih_components/med_cert_input.dart b/Frontend/patient_manager/lib/mih_components/med_cert_input.dart index c9394359..1d9a16e9 100644 --- a/Frontend/patient_manager/lib/mih_components/med_cert_input.dart +++ b/Frontend/patient_manager/lib/mih_components/med_cert_input.dart @@ -28,7 +28,7 @@ class _MedcertinputState extends State { //height: 325, child: Column( children: [ - const SizedBox(height: 50.0), + //const SizedBox(height: 50.0), SizedBox( width: 700, child: MIHDateField( diff --git a/Frontend/patient_manager/lib/mih_components/medicine_search.dart b/Frontend/patient_manager/lib/mih_components/medicine_search.dart index 75dade56..e1f41c1c 100644 --- a/Frontend/patient_manager/lib/mih_components/medicine_search.dart +++ b/Frontend/patient_manager/lib/mih_components/medicine_search.dart @@ -80,55 +80,61 @@ class _MedicineSearchState extends State { MzanziInnovationHub.of(context)!.theme.secondaryColor(), width: 5.0), ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - "Select Medicine", - textAlign: TextAlign.center, - style: TextStyle( - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - fontSize: 35.0, - fontWeight: FontWeight.bold, + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "Select Medicine", + textAlign: TextAlign.center, + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + fontSize: 35.0, + fontWeight: FontWeight.bold, + ), ), - ), - const SizedBox(height: 25.0), - FutureBuilder( - future: futueMeds, - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const SizedBox( - height: 400, - child: Mihloadingcircle(), - ); - } else if (snapshot.hasData && snapshot.data!.isNotEmpty) { - final medsList = snapshot.data!; - return SizedBox( - height: 400, - child: BuildMedicinesList( - contoller: widget.searchVlaue, - medicines: medsList, - //searchString: searchString, - ), - ); - } else { - return const SizedBox( - height: 400, - child: Center( - child: Text( - "No Match Found\nPlease close and manually capture medicine", - style: TextStyle(fontSize: 25, color: Colors.grey), - textAlign: TextAlign.center, + const SizedBox(height: 25.0), + FutureBuilder( + future: futueMeds, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const SizedBox( + height: 400, + child: Mihloadingcircle(), + ); + } else if (snapshot.hasData && + snapshot.data!.isNotEmpty) { + final medsList = snapshot.data!; + return SizedBox( + height: 400, + child: BuildMedicinesList( + contoller: widget.searchVlaue, + medicines: medsList, + //searchString: searchString, ), - ), - ); - } - }, - ), - ], + ); + } else { + return const SizedBox( + height: 400, + child: Center( + child: Text( + "No Match Found\nPlease close and manually capture medicine", + style: + TextStyle(fontSize: 25, color: Colors.grey), + textAlign: TextAlign.center, + ), + ), + ); + } + }, + ), + ], + ), ), ), Positioned( diff --git a/Frontend/patient_manager/lib/mih_components/mih_layout/mih_body.dart b/Frontend/patient_manager/lib/mih_components/mih_layout/mih_body.dart index 80f0fe68..4dede04a 100644 --- a/Frontend/patient_manager/lib/mih_components/mih_layout/mih_body.dart +++ b/Frontend/patient_manager/lib/mih_components/mih_layout/mih_body.dart @@ -17,7 +17,25 @@ class MIHBody extends StatefulWidget { class _MIHBodyState extends State { //double paddingSize = 10; - double getPaddingSize() { + double getHorizontalPaddingSize(Size screenSize) { + if (MzanziInnovationHub.of(context)!.theme.screenType == "desktop") { + if (widget.borderOn) { + return 10; + } else { + return 0; + } + } else { + // mobile + if (widget.borderOn) { + return 10; + } else { + return 0; + } + } + } + + double getVerticalPaddingSize(Size screenSize) { + // mobile if (widget.borderOn) { return 10; } else { @@ -54,9 +72,9 @@ class _MIHBodyState extends State { Size screenSize = MediaQuery.sizeOf(context); return Padding( padding: EdgeInsets.only( - left: getPaddingSize(), - right: getPaddingSize(), - bottom: getPaddingSize(), + left: getHorizontalPaddingSize(screenSize), + right: getHorizontalPaddingSize(screenSize), + bottom: getVerticalPaddingSize(screenSize), top: 0, ), child: Container( @@ -64,7 +82,7 @@ class _MIHBodyState extends State { left: 10, right: 10, bottom: 10, - top: getPaddingSize(), + top: getVerticalPaddingSize(screenSize), ), width: screenSize.width, height: screenSize.height, diff --git a/Frontend/patient_manager/lib/mih_components/mih_layout/mih_layout_builder.dart b/Frontend/patient_manager/lib/mih_components/mih_layout/mih_layout_builder.dart index 372e9b4e..7e1a471a 100644 --- a/Frontend/patient_manager/lib/mih_components/mih_layout/mih_layout_builder.dart +++ b/Frontend/patient_manager/lib/mih_components/mih_layout/mih_layout_builder.dart @@ -40,19 +40,21 @@ class _MIHLayoutBuilderState extends State { Widget build(BuildContext context) { Size screenSize = MediaQuery.sizeOf(context); return Scaffold( - body: SizedBox( - width: screenSize.width, - height: screenSize.height, - child: Stack( - children: [ - widget.actionButton, - Column( - children: [ - widget.header, - Expanded(child: widget.body), - ], - ), - ], + body: SafeArea( + child: SizedBox( + width: screenSize.width, + height: screenSize.height, + child: Stack( + children: [ + widget.actionButton, + Column( + children: [ + widget.header, + Expanded(child: widget.body), + ], + ), + ], + ), ), ), ); diff --git a/Frontend/patient_manager/lib/mih_packages/manage_business/builder/build_employee_list.dart b/Frontend/patient_manager/lib/mih_packages/manage_business/builder/build_employee_list.dart index 495ff4ff..32ba5bc4 100644 --- a/Frontend/patient_manager/lib/mih_packages/manage_business/builder/build_employee_list.dart +++ b/Frontend/patient_manager/lib/mih_packages/manage_business/builder/build_employee_list.dart @@ -155,7 +155,7 @@ class _BuildEmployeeListState extends State { MzanziInnovationHub.of(context)!.theme.secondaryColor(), width: 5.0), ), - child: Padding( + child: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( mainAxisSize: MainAxisSize.min, diff --git a/Frontend/patient_manager/lib/mih_packages/manage_business/builder/build_user_list.dart b/Frontend/patient_manager/lib/mih_packages/manage_business/builder/build_user_list.dart index cf615505..e0ce3a32 100644 --- a/Frontend/patient_manager/lib/mih_packages/manage_business/builder/build_user_list.dart +++ b/Frontend/patient_manager/lib/mih_packages/manage_business/builder/build_user_list.dart @@ -130,7 +130,7 @@ class _BuildUserListState extends State { MzanziInnovationHub.of(context)!.theme.secondaryColor(), width: 5.0), ), - child: Padding( + child: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( mainAxisSize: MainAxisSize.min, diff --git a/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_patient_list.dart b/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_patient_list.dart index 78e5a96c..e618f88c 100644 --- a/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_patient_list.dart +++ b/Frontend/patient_manager/lib/mih_packages/patient_profile/builder/build_patient_list.dart @@ -144,7 +144,7 @@ class _BuildPatientsListState extends State { MzanziInnovationHub.of(context)!.theme.secondaryColor(), width: 5.0), ), - child: Padding( + child: SingleChildScrollView( padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( mainAxisSize: MainAxisSize.min, diff --git a/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_files.dart b/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_files.dart index 76af2032..a7550e2e 100644 --- a/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_files.dart +++ b/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_files.dart @@ -263,54 +263,58 @@ class _PatientFilesState extends State { MzanziInnovationHub.of(context)!.theme.secondaryColor(), width: 5.0), ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - "Create Medical Certificate", - textAlign: TextAlign.center, - style: TextStyle( - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - fontSize: 35.0, - fontWeight: FontWeight.bold, + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "Create Medical Certificate", + textAlign: TextAlign.center, + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + fontSize: 35.0, + fontWeight: FontWeight.bold, + ), ), - ), - const SizedBox(height: 25.0), - Medcertinput( - startDateController: startDateController, - endDateTextController: endDateTextController, - retDateTextController: retDateTextController, - ), - const SizedBox(height: 30.0), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - buttonText: "Generate", - buttonColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () async { - if (isMedCertFieldsFilled()) { - await generateMedCert(); - //Navigator.pop(context); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage( - errorType: "Input Error"); - }, - ); - } - }, + const SizedBox(height: 25.0), + Medcertinput( + startDateController: startDateController, + endDateTextController: endDateTextController, + retDateTextController: retDateTextController, ), - ) - ], + const SizedBox(height: 30.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + buttonText: "Generate", + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + onTap: () async { + if (isMedCertFieldsFilled()) { + await generateMedCert(); + //Navigator.pop(context); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage( + errorType: "Input Error"); + }, + ); + } + }, + ), + ) + ], + ), ), ), Positioned( @@ -354,37 +358,40 @@ class _PatientFilesState extends State { MzanziInnovationHub.of(context)!.theme.secondaryColor(), width: 5.0), ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - "Create Perscription", - textAlign: TextAlign.center, - style: TextStyle( - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - fontSize: 35.0, - fontWeight: FontWeight.bold, + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "Create Perscription", + textAlign: TextAlign.center, + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + fontSize: 35.0, + fontWeight: FontWeight.bold, + ), ), - ), - const SizedBox(height: 25.0), - PrescripInput( - medicineController: medicineController, - quantityController: quantityController, - dosageController: dosageController, - timesDailyController: timesDailyController, - noDaysController: noDaysController, - noRepeatsController: noRepeatsController, - outputController: outputController, - selectedPatient: widget.selectedPatient, - signedInUser: widget.signedInUser, - business: widget.business, - businessUser: widget.businessUser, - ), - ], + //const SizedBox(height: 25.0), + PrescripInput( + medicineController: medicineController, + quantityController: quantityController, + dosageController: dosageController, + timesDailyController: timesDailyController, + noDaysController: noDaysController, + noRepeatsController: noRepeatsController, + outputController: outputController, + selectedPatient: widget.selectedPatient, + signedInUser: widget.signedInUser, + business: widget.business, + businessUser: widget.businessUser, + ), + ], + ), ), ), Positioned( diff --git a/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_notes.dart b/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_notes.dart index c3d00adf..f676eb0c 100644 --- a/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_notes.dart +++ b/Frontend/patient_manager/lib/mih_packages/patient_profile/patient_notes.dart @@ -158,97 +158,103 @@ class _PatientNotesState extends State { MzanziInnovationHub.of(context)!.theme.secondaryColor(), width: 5.0), ), - child: Column( - //mainAxisSize: MainAxisSize.max, - children: [ - Text( - "Add Note", - textAlign: TextAlign.center, - style: TextStyle( - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - fontSize: 35.0, - fontWeight: FontWeight.bold, + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "Add Note", + textAlign: TextAlign.center, + style: TextStyle( + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + fontSize: 35.0, + fontWeight: FontWeight.bold, + ), ), - ), - const SizedBox(height: 25.0), - SizedBox( - width: 700, - child: MIHTextField( - controller: officeController, - hintText: "Office", - editable: false, - required: true, + const SizedBox(height: 25.0), + SizedBox( + width: 700, + child: MIHTextField( + controller: officeController, + hintText: "Office", + editable: false, + required: true, + ), ), - ), - const SizedBox(height: 10.0), - SizedBox( - width: 700, - child: MIHTextField( - controller: doctorController, - hintText: "Created By", - editable: false, - required: true, + const SizedBox(height: 10.0), + SizedBox( + width: 700, + child: MIHTextField( + controller: doctorController, + hintText: "Created By", + editable: false, + required: true, + ), ), - ), - const SizedBox(height: 10.0), - SizedBox( - width: 700, - child: MIHTextField( - controller: dateController, - hintText: "Created Date", - editable: false, - required: true, + const SizedBox(height: 10.0), + SizedBox( + width: 700, + child: MIHTextField( + controller: dateController, + hintText: "Created Date", + editable: false, + required: true, + ), ), - ), - const SizedBox(height: 10.0), - SizedBox( - width: 700, - child: MIHTextField( - controller: titleController, - hintText: "Note Title", - editable: true, - required: true, + const SizedBox(height: 10.0), + SizedBox( + width: 700, + child: MIHTextField( + controller: titleController, + hintText: "Note Title", + editable: true, + required: true, + ), ), - ), - const SizedBox(height: 10.0), - Expanded( - child: MIHMLTextField( - controller: noteTextController, - hintText: "Note Details", - editable: true, - required: true, + const SizedBox(height: 10.0), + SizedBox( + width: 700, + height: 250, + child: MIHMLTextField( + controller: noteTextController, + hintText: "Note Details", + editable: true, + required: true, + ), ), - ), - const SizedBox(height: 30.0), - SizedBox( - width: 300, - height: 50, - child: MIHButton( - onTap: () { - if (isFieldsFilled()) { - addPatientNoteAPICall(); - Navigator.pop(context); - } else { - showDialog( - context: context, - builder: (context) { - return const MIHErrorMessage( - errorType: "Input Error"); - }, - ); - } - }, - buttonText: "Add Note", - buttonColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - ), - ) - ], + const SizedBox(height: 30.0), + SizedBox( + width: 300, + height: 50, + child: MIHButton( + onTap: () { + if (isFieldsFilled()) { + addPatientNoteAPICall(); + Navigator.pop(context); + } else { + showDialog( + context: context, + builder: (context) { + return const MIHErrorMessage( + errorType: "Input Error"); + }, + ); + } + }, + buttonText: "Add Note", + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + ), + ) + ], + ), ), ), Positioned( diff --git a/Frontend/patient_manager/lib/mih_packages/patient_profile/prescip_input.dart b/Frontend/patient_manager/lib/mih_packages/patient_profile/prescip_input.dart index 651d98ab..116e00ed 100644 --- a/Frontend/patient_manager/lib/mih_packages/patient_profile/prescip_input.dart +++ b/Frontend/patient_manager/lib/mih_packages/patient_profile/prescip_input.dart @@ -344,6 +344,8 @@ class _PrescripInputState extends State { Widget displayMedInput() { return Column( children: [ + const SizedBox(height: 25.0), + KeyboardListener( focusNode: _focusNode, autofocus: true,