From 5fb8e1dcc49ae9a4bcf2d4811e6918c281ecffd5 Mon Sep 17 00:00:00 2001 From: yaso Date: Fri, 27 Sep 2024 12:56:28 +0200 Subject: [PATCH] prescription generator window enhancement --- .../patient_profile/patient_files.dart | 103 +++++---------- .../patient_profile/prescip_input.dart | 117 +++++++----------- 2 files changed, 76 insertions(+), 144 deletions(-) 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 e68979f1..eccdd31a 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 @@ -344,81 +344,34 @@ class _PatientFilesState extends State { showDialog( context: context, barrierDismissible: false, - builder: (context) => Dialog( - child: Stack( - children: [ - Container( - padding: const EdgeInsets.all(10.0), - width: 900.0, - //height: 475.0, - decoration: BoxDecoration( - color: MzanziInnovationHub.of(context)!.theme.primaryColor(), - borderRadius: BorderRadius.circular(25.0), - border: Border.all( - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - width: 5.0), - ), - 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, - ), - ], - ), - ), - ), - Positioned( - top: 5, - right: 5, - width: 50, - height: 50, - child: IconButton( - onPressed: () { - medicineController.clear(); - quantityController.clear(); - dosageController.clear(); - timesDailyController.clear(); - noDaysController.clear(); - noRepeatsController.clear(); - Navigator.pop(context); - }, - icon: Icon( - Icons.close, - color: MzanziInnovationHub.of(context)!.theme.errorColor(), - size: 35, - ), - ), - ), - ], - ), + builder: (context) => MIHWindow( + fullscreen: false, + windowTitle: "Create Prescription", + windowTools: const [], + onWindowTapClose: () { + medicineController.clear(); + quantityController.clear(); + dosageController.clear(); + timesDailyController.clear(); + noDaysController.clear(); + noRepeatsController.clear(); + Navigator.pop(context); + }, + windowBody: [ + 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, + ), + ], ), ); } 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 116e00ed..3da5772b 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,7 +344,7 @@ class _PrescripInputState extends State { Widget displayMedInput() { return Column( children: [ - const SizedBox(height: 25.0), + //const SizedBox(height: 25.0), KeyboardListener( focusNode: _focusNode, @@ -355,17 +355,14 @@ class _PrescripInputState extends State { getMedsPopUp(widget.medicineController); } }, - child: SizedBox( - width: 300, - child: MIHSearchField( - controller: widget.medicineController, - hintText: "Medicine", - required: true, - editable: true, - onTap: () { - getMedsPopUp(widget.medicineController); - }, - ), + child: MIHSearchField( + controller: widget.medicineController, + hintText: "Medicine", + required: true, + editable: true, + onTap: () { + getMedsPopUp(widget.medicineController); + }, ), ), const SizedBox(height: 10.0), @@ -380,50 +377,38 @@ class _PrescripInputState extends State { // ), // ), // const SizedBox(height: 10.0), - SizedBox( - width: 300, - child: MIHDropdownField( - controller: widget.dosageController, - hintText: "Dosage", - dropdownOptions: numberOptions, - required: true, - editable: true, - ), + MIHDropdownField( + controller: widget.dosageController, + hintText: "Dosage", + dropdownOptions: numberOptions, + required: true, + editable: true, ), const SizedBox(height: 10.0), - SizedBox( - width: 300, - child: MIHDropdownField( - controller: widget.timesDailyController, - hintText: "Times Daily", - dropdownOptions: numberOptions, - required: true, - editable: true, - ), + MIHDropdownField( + controller: widget.timesDailyController, + hintText: "Times Daily", + dropdownOptions: numberOptions, + required: true, + editable: true, ), const SizedBox(height: 10.0), - SizedBox( - width: 300, - child: MIHDropdownField( - controller: widget.noDaysController, - hintText: "No. Days", - dropdownOptions: numberOptions, - required: true, - editable: true, - ), + MIHDropdownField( + controller: widget.noDaysController, + hintText: "No. Days", + dropdownOptions: numberOptions, + required: true, + editable: true, ), const SizedBox(height: 10.0), - SizedBox( - width: 300, - child: MIHDropdownField( - controller: widget.noRepeatsController, - hintText: "No. Repeats", - dropdownOptions: numberOptions, - required: true, - editable: true, - ), + MIHDropdownField( + controller: widget.noRepeatsController, + hintText: "No. Repeats", + dropdownOptions: numberOptions, + required: true, + editable: true, ), - const SizedBox(height: 30.0), + const SizedBox(height: 15.0), SizedBox( width: 300, height: 50, @@ -470,7 +455,7 @@ class _PrescripInputState extends State { children: [ Container( width: 550, - height: 350, + height: 325, decoration: BoxDecoration( color: MzanziInnovationHub.of(context)!.theme.primaryColor(), borderRadius: BorderRadius.circular(25.0), @@ -520,7 +505,7 @@ class _PrescripInputState extends State { }, ), ), - const SizedBox(height: 30.0), + const SizedBox(height: 15.0), SizedBox( width: 300, height: 50, @@ -567,24 +552,18 @@ class _PrescripInputState extends State { width = size.width; height = size.height; }); - return Container( - //width: , - height: (height / 3) * 1.5, - child: SingleChildScrollView( - child: Wrap( - direction: Axis.horizontal, - alignment: WrapAlignment.center, - spacing: 10, - runSpacing: 10, - // mainAxisAlignment: MainAxisAlignment.center, - // mainAxisSize: MainAxisSize.max, - // crossAxisAlignment: CrossAxisAlignment.center, - children: [ - displayMedInput(), - displayPerscList(), - ], - ), - ), + return Wrap( + direction: Axis.horizontal, + alignment: WrapAlignment.center, + spacing: 10, + runSpacing: 10, + // mainAxisAlignment: MainAxisAlignment.center, + // mainAxisSize: MainAxisSize.max, + // crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(width: 500, child: displayMedInput()), + displayPerscList(), + ], ); } }