From 4ed438a44bf974ee8cfb7902139b6c4c6267fee4 Mon Sep 17 00:00:00 2001 From: yaso-meth Date: Tue, 27 Aug 2024 11:47:10 +0200 Subject: [PATCH] fix box alainments for all screen sizes --- .../components/builders/buildFilesList.dart | 11 ++-- .../components/builders/buildNotesList.dart | 11 ++-- .../lib/components/patientDetails.dart | 63 +++++++++++-------- .../lib/pages/patientManager.dart | 4 +- 4 files changed, 54 insertions(+), 35 deletions(-) diff --git a/Frontend/patient_manager/lib/components/builders/buildFilesList.dart b/Frontend/patient_manager/lib/components/builders/buildFilesList.dart index a2ca2947..d77ce10a 100644 --- a/Frontend/patient_manager/lib/components/builders/buildFilesList.dart +++ b/Frontend/patient_manager/lib/components/builders/buildFilesList.dart @@ -302,9 +302,12 @@ class _BuildFilesListState extends State { @override Widget build(BuildContext context) { + final Size size = MediaQuery.sizeOf(context); + //double width = size.width; + double height = size.height; if (widget.files.isNotEmpty) { return SizedBox( - height: 500.0, + height: height - 250, child: ListView.separated( shrinkWrap: true, separatorBuilder: (BuildContext context, int index) { @@ -353,9 +356,9 @@ class _BuildFilesListState extends State { ), ); } else { - return const SizedBox( - height: 500.0, - child: Center( + return SizedBox( + height: height - 250, + child: const Center( child: Text( "No Documents Available", style: TextStyle(fontSize: 25, color: Colors.grey), diff --git a/Frontend/patient_manager/lib/components/builders/buildNotesList.dart b/Frontend/patient_manager/lib/components/builders/buildNotesList.dart index 496968db..86b80338 100644 --- a/Frontend/patient_manager/lib/components/builders/buildNotesList.dart +++ b/Frontend/patient_manager/lib/components/builders/buildNotesList.dart @@ -263,9 +263,12 @@ class _BuildNotesListState extends State { @override Widget build(BuildContext context) { + final Size size = MediaQuery.sizeOf(context); + //double width = size.width; + double height = size.height; if (widget.notes.isNotEmpty) { return SizedBox( - height: 500.0, + height: height - 250, child: ListView.separated( shrinkWrap: true, separatorBuilder: (BuildContext context, int index) { @@ -306,9 +309,9 @@ class _BuildNotesListState extends State { ), ); } else { - return const SizedBox( - height: 500.0, - child: Center( + return SizedBox( + height: height - 250, + child: const Center( child: Text( "No Notes Available", style: TextStyle(fontSize: 25, color: Colors.grey), diff --git a/Frontend/patient_manager/lib/components/patientDetails.dart b/Frontend/patient_manager/lib/components/patientDetails.dart index dde3c10a..2bf2e6b9 100644 --- a/Frontend/patient_manager/lib/components/patientDetails.dart +++ b/Frontend/patient_manager/lib/components/patientDetails.dart @@ -264,7 +264,12 @@ class _PatientDetailsState extends State { @override Widget build(BuildContext context) { + final Size size = MediaQuery.sizeOf(context); + //double width = size.width; + double height = size.height; return Container( + alignment: Alignment.topCenter, + height: height - 177, padding: const EdgeInsets.only(left: 10, right: 10, bottom: 10), decoration: BoxDecoration( color: MzanziInnovationHub.of(context)!.theme.primaryColor(), @@ -275,32 +280,40 @@ class _PatientDetailsState extends State { ), //constraints: const BoxConstraints.expand(height: 250.0), child: SelectionArea( - child: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - //crossAxisAlignment: , - children: setIcons(), - ), - Divider( - color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), - const SizedBox(height: 10), - getPatientDetailsField(), - const SizedBox(height: 10), - Text( - "Medical Aid Details", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + //crossAxisAlignment: , + children: setIcons(), ), - ), - Divider( - color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), - const SizedBox(height: 10), - getMedAidDetailsFields(), - ], + Divider( + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor()), + const SizedBox(height: 10), + getPatientDetailsField(), + const SizedBox(height: 10), + Text( + "Medical Aid Details", + 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), + getMedAidDetailsFields(), + ], + ), ), ), ); diff --git a/Frontend/patient_manager/lib/pages/patientManager.dart b/Frontend/patient_manager/lib/pages/patientManager.dart index db63188f..39370c37 100644 --- a/Frontend/patient_manager/lib/pages/patientManager.dart +++ b/Frontend/patient_manager/lib/pages/patientManager.dart @@ -172,7 +172,7 @@ class _PatientManagerState extends State { }, child: SizedBox( width: w, - height: 600, + height: h - 157, child: Column(mainAxisSize: MainAxisSize.max, children: [ const SizedBox(height: 5), const Text( @@ -302,7 +302,7 @@ class _PatientManagerState extends State { Widget patientQueue(double w, double h) { return SizedBox( width: w, - height: 600, + height: h - 157, child: Column(mainAxisSize: MainAxisSize.max, children: [ //const SizedBox(height: 15), Row(