From d188dd205fec1d0f8a29c02e1a56f994ee10f550 Mon Sep 17 00:00:00 2001 From: yaso-meth Date: Fri, 5 Jul 2024 19:13:45 +0200 Subject: [PATCH] UI Update --- .../lib/components/buildFilesList.dart | 57 +++++---- .../lib/components/buildNotesList.dart | 82 ++++++------- .../lib/components/patientFiles.dart | 113 +++++++++--------- .../lib/components/patientNotes.dart | 75 ++++++------ .../lib/pages/patientView.dart | 3 + 5 files changed, 166 insertions(+), 164 deletions(-) diff --git a/Frontend/patient_manager/lib/components/buildFilesList.dart b/Frontend/patient_manager/lib/components/buildFilesList.dart index 6b46d83a..d0602b63 100644 --- a/Frontend/patient_manager/lib/components/buildFilesList.dart +++ b/Frontend/patient_manager/lib/components/buildFilesList.dart @@ -90,27 +90,40 @@ class _BuildFilesListState extends State { @override Widget build(BuildContext context) { - return SizedBox( - height: 290.0, - child: ListView.separated( - shrinkWrap: true, - separatorBuilder: (BuildContext context, int index) { - return const Divider(); - }, - itemCount: widget.files.length, - itemBuilder: (context, index) { - return ListTile( - title: Text( - widget.files[index].file_name, - ), - subtitle: Text(widget.files[index].insert_date), - trailing: const Icon(Icons.arrow_forward), - onTap: () { - viewFilePopUp(widget.files[index].file_name); - }, - ); - }, - ), - ); + if (widget.files.isNotEmpty) { + return SizedBox( + height: 290.0, + child: ListView.separated( + shrinkWrap: true, + separatorBuilder: (BuildContext context, int index) { + return const Divider(); + }, + itemCount: widget.files.length, + itemBuilder: (context, index) { + return ListTile( + title: Text( + widget.files[index].file_name, + ), + subtitle: Text(widget.files[index].insert_date), + trailing: const Icon(Icons.arrow_forward), + onTap: () { + viewFilePopUp(widget.files[index].file_name); + }, + ); + }, + ), + ); + } else { + return const SizedBox( + height: 290.0, + child: Center( + child: Text( + "No Files Available", + style: TextStyle(fontSize: 25, color: Colors.grey), + textAlign: TextAlign.center, + ), + ), + ); + } } } diff --git a/Frontend/patient_manager/lib/components/buildNotesList.dart b/Frontend/patient_manager/lib/components/buildNotesList.dart index 622b5385..2910bef9 100644 --- a/Frontend/patient_manager/lib/components/buildNotesList.dart +++ b/Frontend/patient_manager/lib/components/buildNotesList.dart @@ -97,50 +97,42 @@ class _BuildNotesListState extends State { @override Widget build(BuildContext context) { - return SizedBox( - height: 290.0, - child: ListView.separated( - shrinkWrap: true, - separatorBuilder: (BuildContext context, int index) { - return const Divider(); - }, - itemCount: widget.notes.length, - itemBuilder: (context, index) { - return ListTile( - title: Text( - widget.notes[index].note_name, - ), - subtitle: Text( - "${widget.notes[index].insert_date}:\n${widget.notes[index].note_text}"), //Text(widget.notes[index].note_text), - trailing: const Icon(Icons.arrow_forward), - onTap: () { - viewNotePopUp(widget.notes[index].note_name, - "${widget.notes[index].insert_date}:\n${widget.notes[index].note_text}"); - // showDialog( - // context: context, - // builder: (context) => AlertDialog( - // title: Center(child: Text(widget.notes[index].note_name)), - // content: SizedBox( - // width: 700, - // height: 250, - // child: Text( - // "${widget.notes[index].insert_date}:\n${widget.notes[index].note_text}", - // style: TextStyle(fontSize: 16), - // ), - // ), - // actions: [ - // TextButton( - // onPressed: () { - // Navigator.pop(context); - // }, - // child: const Text("Close")) - // ], - // ), - // ); - }, - ); - }, - ), - ); + if (widget.notes.isNotEmpty) { + return SizedBox( + height: 290.0, + child: ListView.separated( + shrinkWrap: true, + separatorBuilder: (BuildContext context, int index) { + return const Divider(); + }, + itemCount: widget.notes.length, + itemBuilder: (context, index) { + return ListTile( + title: Text( + widget.notes[index].note_name, + ), + subtitle: Text( + "${widget.notes[index].insert_date}:\n${widget.notes[index].note_text}"), //Text(widget.notes[index].note_text), + trailing: const Icon(Icons.arrow_forward), + onTap: () { + viewNotePopUp(widget.notes[index].note_name, + "${widget.notes[index].insert_date}:\n${widget.notes[index].note_text}"); + }, + ); + }, + ), + ); + } else { + return const SizedBox( + height: 290.0, + child: Center( + child: Text( + "No Notes Available", + style: TextStyle(fontSize: 25, color: Colors.grey), + textAlign: TextAlign.center, + ), + ), + ); + } } } diff --git a/Frontend/patient_manager/lib/components/patientFiles.dart b/Frontend/patient_manager/lib/components/patientFiles.dart index 30b6a909..e9f7dfb5 100644 --- a/Frontend/patient_manager/lib/components/patientFiles.dart +++ b/Frontend/patient_manager/lib/components/patientFiles.dart @@ -534,67 +534,64 @@ class _PatientFilesState extends State { final filesList = snapshot.data!; return Flexible( flex: 1, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Container( - //height: 300.0, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(25.0), - border: Border.all(color: Colors.blueAccent, width: 3.0), - ), - child: Padding( - padding: const EdgeInsets.only(top: 5.0), - child: Column(children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - "Files", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: Colors.blueAccent, - ), + child: Container( + //height: 300.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(25.0), + border: Border.all(color: Colors.blueAccent, width: 3.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Column(children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + "Files", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: Colors.blueAccent, ), - IconButton( - onPressed: () { - medCertPopUp(); - }, - icon: const Icon( - Icons.sick_outlined, - color: Colors.blueAccent, - ), + ), + IconButton( + onPressed: () { + medCertPopUp(); + }, + icon: const Icon( + Icons.sick_outlined, + color: Colors.blueAccent, ), - IconButton( - onPressed: () { - prescritionPopUp(); - }, - icon: const Icon( - Icons.medication_outlined, - color: Colors.blueAccent, - ), + ), + IconButton( + onPressed: () { + prescritionPopUp(); + }, + icon: const Icon( + Icons.medication_outlined, + color: Colors.blueAccent, ), - IconButton( - onPressed: () { - uploudFilePopUp(); - }, - icon: const Icon( - Icons.add, - color: Colors.blueAccent, - ), - ) - ], - ), - const Padding( - padding: EdgeInsets.symmetric(horizontal: 20.0), - child: Divider(color: Colors.blueAccent), - ), - const SizedBox(height: 10), - BuildFilesList(files: filesList), - ]), - ), + ), + IconButton( + onPressed: () { + uploudFilePopUp(); + }, + icon: const Icon( + Icons.add, + color: Colors.blueAccent, + ), + ) + ], + ), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0), + child: Divider(color: Colors.blueAccent), + ), + const SizedBox(height: 10), + BuildFilesList(files: filesList), + ]), ), ), ); diff --git a/Frontend/patient_manager/lib/components/patientNotes.dart b/Frontend/patient_manager/lib/components/patientNotes.dart index 8808642b..abdb0bd5 100644 --- a/Frontend/patient_manager/lib/components/patientNotes.dart +++ b/Frontend/patient_manager/lib/components/patientNotes.dart @@ -219,45 +219,42 @@ class _PatientNotesState extends State { final notesList = snapshot.data!; return Flexible( flex: 1, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Container( - //height: 300.0, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(25.0), - border: Border.all(color: Colors.blueAccent, width: 3.0), - ), - child: Padding( - padding: const EdgeInsets.only(top: 5.0), - child: Column(children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - "Notes", - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 25, - fontWeight: FontWeight.bold, - color: Colors.blueAccent), - ), - IconButton( - onPressed: () { - addNotePopUp(); - }, - icon: const Icon(Icons.add, color: Colors.blueAccent), - ) - ], - ), - const Padding( - padding: EdgeInsets.symmetric(horizontal: 20.0), - child: Divider(color: Colors.blueAccent), - ), - const SizedBox(height: 10), - BuildNotesList(notes: notesList), - ]), - ), + child: Container( + //height: 300.0, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(25.0), + border: Border.all(color: Colors.blueAccent, width: 3.0), + ), + child: Padding( + padding: const EdgeInsets.only(top: 5.0), + child: Column(children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + "Notes", + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + color: Colors.blueAccent), + ), + IconButton( + onPressed: () { + addNotePopUp(); + }, + icon: const Icon(Icons.add, color: Colors.blueAccent), + ) + ], + ), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0), + child: Divider(color: Colors.blueAccent), + ), + const SizedBox(height: 10), + BuildNotesList(notes: notesList), + ]), ), ), ); diff --git a/Frontend/patient_manager/lib/pages/patientView.dart b/Frontend/patient_manager/lib/pages/patientView.dart index 7f1117dc..5e637bff 100644 --- a/Frontend/patient_manager/lib/pages/patientView.dart +++ b/Frontend/patient_manager/lib/pages/patientView.dart @@ -32,6 +32,9 @@ class _PatientViewState extends State { PatientNotes( patientIndex: widget.selectedPatient.idpatients, ), + SizedBox( + width: 10, + ), PatientFiles( patientIndex: widget.selectedPatient.idpatients, selectedPatient: widget.selectedPatient,