From beba15afdb02ccc1b2c3f9474adb96e618a3c461 Mon Sep 17 00:00:00 2001 From: yaso-meth Date: Tue, 30 Jul 2024 10:56:42 +0200 Subject: [PATCH] textfields no wrap when screen changes size --- .../lib/components/patientDetails.dart | 203 +++++++++--------- .../lib/pages/patientView.dart | 4 +- 2 files changed, 103 insertions(+), 104 deletions(-) diff --git a/Frontend/patient_manager/lib/components/patientDetails.dart b/Frontend/patient_manager/lib/components/patientDetails.dart index 94cebb30..84cf2e0b 100644 --- a/Frontend/patient_manager/lib/components/patientDetails.dart +++ b/Frontend/patient_manager/lib/components/patientDetails.dart @@ -26,6 +26,7 @@ class _PatientDetailsState extends State { final medAidCodeController = TextEditingController(); double? headingFontSize = 35.0; double? bodyFonstSize = 20.0; + double textFieldWidth = 400.0; @override void initState() { @@ -60,7 +61,7 @@ class _PatientDetailsState extends State { @override Widget build(BuildContext context) { return Container( - padding: const EdgeInsets.only(left: 20, right: 20, bottom: 10), + padding: const EdgeInsets.only(left: 10, right: 10, bottom: 10), decoration: BoxDecoration( color: MzanziInnovationHub.of(context)!.theme.primaryColor(), borderRadius: BorderRadius.circular(25.0), @@ -100,58 +101,57 @@ class _PatientDetailsState extends State { Divider( color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), const SizedBox(height: 10), - Column( + Wrap( + spacing: 15, + runSpacing: 10, children: [ - Row( - children: [ - Expanded( - child: MyTextField( - controller: idController, - hintText: "ID No.", - editable: false, - required: false), - ), - Expanded( - child: MyTextField( - controller: fnameController, - hintText: "Name", - editable: false, - required: false), - ), - Expanded( - child: MyTextField( - controller: lnameController, - hintText: "Surname", - editable: false, - required: false), - ), - ], + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: idController, + hintText: "ID No.", + editable: false, + required: false), ), - const SizedBox(height: 10), - Row( - children: [ - Expanded( - child: MyTextField( - controller: cellController, - hintText: "Cell No.", - editable: false, - required: false), - ), - Expanded( - child: MyTextField( - controller: emailController, - hintText: "Email", - editable: false, - required: false), - ), - Expanded( - child: MyTextField( - controller: addressController, - hintText: "Address", - editable: false, - required: false), - ), - ], + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: fnameController, + hintText: "Name", + editable: false, + required: false), + ), + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: lnameController, + hintText: "Surname", + editable: false, + required: false), + ), + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: cellController, + hintText: "Cell No.", + editable: false, + required: false), + ), + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: emailController, + hintText: "Email", + editable: false, + required: false), + ), + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: addressController, + hintText: "Address", + editable: false, + required: false), ), ], ), @@ -168,61 +168,60 @@ class _PatientDetailsState extends State { Divider( color: MzanziInnovationHub.of(context)!.theme.secondaryColor()), const SizedBox(height: 10), - Column( + Wrap( + spacing: 10, + runSpacing: 10, children: [ - Row( - children: [ - Expanded( - child: MyTextField( - controller: medAidController, - hintText: "Has Medical Aid", - editable: false, - required: false), - ), - Expanded( - child: MyTextField( - controller: medMainMemController, - hintText: "Main Member", - editable: false, - required: false), - ), - Expanded( - child: MyTextField( - controller: medNoController, - hintText: "No.", - editable: false, - required: false), - ), - ], + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: medAidController, + hintText: "Has Medical Aid", + editable: false, + required: false), ), - const SizedBox(height: 10), - Row( - children: [ - Expanded( - child: MyTextField( - controller: medAidCodeController, - hintText: "Code", - editable: false, - required: false), - ), - Expanded( - child: MyTextField( - controller: medNameController, - hintText: "Name", - editable: false, - required: false), - ), - Expanded( - child: MyTextField( - controller: medSchemeController, - hintText: "Scheme", - editable: false, - required: false), - ), - ], + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: medMainMemController, + hintText: "Main Member", + editable: false, + required: false), + ), + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: medNoController, + hintText: "No.", + editable: false, + required: false), + ), + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: medAidCodeController, + hintText: "Code", + editable: false, + required: false), + ), + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: medNameController, + hintText: "Name", + editable: false, + required: false), + ), + SizedBox( + width: textFieldWidth, + child: MyTextField( + controller: medSchemeController, + hintText: "Scheme", + editable: false, + required: false), ), ], - ) + ), ], ), ); diff --git a/Frontend/patient_manager/lib/pages/patientView.dart b/Frontend/patient_manager/lib/pages/patientView.dart index 58f23817..84b9db34 100644 --- a/Frontend/patient_manager/lib/pages/patientView.dart +++ b/Frontend/patient_manager/lib/pages/patientView.dart @@ -91,14 +91,14 @@ class _PatientViewState extends State { alignment: WrapAlignment.center, children: [ SizedBox( - width: 650, + width: 660, child: PatientNotes( patientAppId: snapshot.data!.app_id, signedInUser: widget.signedInUser, ), ), SizedBox( - width: 650, + width: 660, child: PatientFiles( patientIndex: snapshot.data!.idpatients, selectedPatient: snapshot.data!,