From 1cfa141efb6feecb84573bc01cc32e418e9c474b Mon Sep 17 00:00:00 2001 From: yaso-meth Date: Sat, 24 Aug 2024 05:51:38 +0200 Subject: [PATCH] add category switcher --- .../lib/pages/patientView.dart | 101 ++++++++++++------ 1 file changed, 67 insertions(+), 34 deletions(-) diff --git a/Frontend/patient_manager/lib/pages/patientView.dart b/Frontend/patient_manager/lib/pages/patientView.dart index 9b9e0120..8c294575 100644 --- a/Frontend/patient_manager/lib/pages/patientView.dart +++ b/Frontend/patient_manager/lib/pages/patientView.dart @@ -24,6 +24,7 @@ class PatientView extends StatefulWidget { } class _PatientViewState extends State { + int _selectedIndex = 0; Future fetchPatient() async { //print("Patien manager page: $endpoint"); var patientAppId = widget.arguments.selectedPatient!.app_id; @@ -56,6 +57,33 @@ class _PatientViewState extends State { } } + Widget showSelection(int index) { + if (index == 0) { + return PatientDetails( + selectedPatient: widget.arguments.selectedPatient!, + type: widget.arguments.type, + ); + } else if (index == 1) { + return PatientNotes( + patientAppId: widget.arguments.selectedPatient!.app_id, + selectedPatient: widget.arguments.selectedPatient!, + signedInUser: widget.arguments.signedInUser, + business: widget.arguments.business, + businessUser: widget.arguments.businessUser, + type: widget.arguments.type, + ); + } else { + return PatientFiles( + patientIndex: widget.arguments.selectedPatient!.idpatients, + selectedPatient: widget.arguments.selectedPatient!, + signedInUser: widget.arguments.signedInUser, + business: widget.arguments.business, + businessUser: widget.arguments.businessUser, + type: widget.arguments.type, + ); + } + } + @override void dispose() { // TODO: implement dispose @@ -74,44 +102,49 @@ class _PatientViewState extends State { padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), child: Column( children: [ - PatientDetails( - selectedPatient: widget.arguments.selectedPatient!, - type: widget.arguments.type, + Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + IconButton( + onPressed: () { + setState(() { + _selectedIndex = 0; + }); + }, + icon: const Icon( + Icons.perm_identity, + size: 35, + ), + ), + IconButton( + onPressed: () { + setState(() { + _selectedIndex = 1; + }); + }, + icon: const Icon( + Icons.text_fields, + size: 35, + ), + ), + IconButton( + onPressed: () { + setState(() { + _selectedIndex = 2; + }); + }, + icon: const Icon( + Icons.edit_document, + size: 35, + ), + ), + ], ), const SizedBox( height: 10.0, ), - Wrap( - spacing: 10.0, - runSpacing: 10.0, - direction: Axis.horizontal, - alignment: WrapAlignment.center, - children: [ - SizedBox( - width: 660, - child: PatientNotes( - patientAppId: widget.arguments.selectedPatient!.app_id, - selectedPatient: widget.arguments.selectedPatient!, - signedInUser: widget.arguments.signedInUser, - business: widget.arguments.business, - businessUser: widget.arguments.businessUser, - type: widget.arguments.type, - ), - ), - SizedBox( - width: 660, - child: PatientFiles( - patientIndex: - widget.arguments.selectedPatient!.idpatients, - selectedPatient: widget.arguments.selectedPatient!, - signedInUser: widget.arguments.signedInUser, - business: widget.arguments.business, - businessUser: widget.arguments.businessUser, - type: widget.arguments.type, - ), - ) - ], - ) + showSelection(_selectedIndex) ], ), ),