From 12b51cbddc7cb2c90e9536d13d79edd89cbe3d7f Mon Sep 17 00:00:00 2001 From: yaso-meth Date: Thu, 29 Aug 2024 12:16:21 +0200 Subject: [PATCH] update UI to remove app bar --- .../lib/pages/patientAccessReview.dart | 103 +++-- .../patient_manager/lib/pages/patientAdd.dart | 49 ++- .../lib/pages/patientEdit.dart | 93 +++-- .../lib/pages/patientManager.dart | 133 +++---- .../lib/pages/patientView.dart | 113 +++--- .../lib/pages/profileBusinessAdd.dart | 348 +++++++++-------- .../lib/pages/profileBusinessUpdate.dart | 362 +++++++++--------- .../lib/pages/profileUserUpdate.dart | 325 ++++++++-------- 8 files changed, 816 insertions(+), 710 deletions(-) diff --git a/Frontend/patient_manager/lib/pages/patientAccessReview.dart b/Frontend/patient_manager/lib/pages/patientAccessReview.dart index 6fb5fb85..7190f970 100644 --- a/Frontend/patient_manager/lib/pages/patientAccessReview.dart +++ b/Frontend/patient_manager/lib/pages/patientAccessReview.dart @@ -3,8 +3,6 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:patient_manager/components/builders/buildAccessRequestList.dart'; import 'package:patient_manager/components/inputsAndButtons/mihDropdownInput.dart'; -import 'package:patient_manager/components/mihAppBar.dart'; -//import 'package:patient_manager/components/mihAppDrawer.dart'; import 'package:patient_manager/components/popUpMessages/mihLoadingCircle.dart'; import 'package:patient_manager/env/env.dart'; import 'package:patient_manager/main.dart'; @@ -103,7 +101,7 @@ class _PatientAccessRequestState extends State { ); } return Container( - //height: 500, + height: 500, decoration: BoxDecoration( color: MzanziInnovationHub.of(context)!.theme.primaryColor(), borderRadius: BorderRadius.circular(25.0), @@ -131,28 +129,14 @@ class _PatientAccessRequestState extends State { height: 600, child: Column(mainAxisSize: MainAxisSize.max, children: [ //const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - //const SizedBox(height: 25), - const Text( - "Access Request", - style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), - ), - IconButton( - onPressed: () { - setState(() { - forceRefresh = true; - }); - refreshList(); - }, - icon: const Icon( - Icons.refresh, - )) - ], + const Text( + "Access Request", + style: TextStyle( + fontSize: 25, + fontWeight: FontWeight.bold, + ), ), - const SizedBox(height: 10), + const SizedBox(height: 25), SizedBox( width: 500, child: MIHDropdownField( @@ -169,19 +153,21 @@ class _PatientAccessRequestState extends State { builder: (context, snapshot) { //print("patient Queue List ${snapshot.hasData}"); if (snapshot.connectionState == ConnectionState.waiting) { - return Container( - //height: 500, - decoration: BoxDecoration( - color: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - borderRadius: BorderRadius.circular(25.0), - border: Border.all( - color: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - width: 3.0), + return Expanded( + child: Container( + //height: 500, + decoration: BoxDecoration( + color: + MzanziInnovationHub.of(context)!.theme.primaryColor(), + borderRadius: BorderRadius.circular(25.0), + border: Border.all( + color: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + width: 3.0), + ), + child: const Mihloadingcircle(), ), - child: const Mihloadingcircle(), ); } else if (snapshot.connectionState == ConnectionState.done) { List accessRequestList; @@ -267,12 +253,47 @@ class _PatientAccessRequestState extends State { final screenWidth = MediaQuery.of(context).size.width; final screenHeight = MediaQuery.of(context).size.height; return Scaffold( - appBar: const MIHAppBar( - barTitle: "Access Reviews", - propicFile: null, - ), + // appBar: const MIHAppBar( + // barTitle: "Access Reviews", + // propicFile: null, + // ), //drawer: MIHAppDrawer(signedInUser: widget.signedInUser), - body: SafeArea(child: viewAccessRequest(screenWidth, screenHeight)), + body: SafeArea( + child: Stack( + children: [ + viewAccessRequest(screenWidth, screenHeight), + Positioned( + top: 10, + left: 5, + width: 50, + height: 50, + child: IconButton( + onPressed: () { + Navigator.of(context).pop(); + }, + icon: const Icon(Icons.arrow_back), + ), + ), + Positioned( + top: 10, + right: 5, + width: 50, + height: 50, + child: IconButton( + onPressed: () { + setState(() { + forceRefresh = true; + }); + refreshList(); + }, + icon: const Icon( + Icons.refresh, + ), + ), + ) + ], + ), + ), ); } } diff --git a/Frontend/patient_manager/lib/pages/patientAdd.dart b/Frontend/patient_manager/lib/pages/patientAdd.dart index 55db5588..1406de4a 100644 --- a/Frontend/patient_manager/lib/pages/patientAdd.dart +++ b/Frontend/patient_manager/lib/pages/patientAdd.dart @@ -12,7 +12,6 @@ import 'package:patient_manager/env/env.dart'; import 'package:patient_manager/main.dart'; import 'package:patient_manager/objects/appUser.dart'; import 'package:patient_manager/objects/arguments.dart'; -import '../components/mihAppBar.dart'; import 'package:supertokens_flutter/http.dart' as http; class AddPatient extends StatefulWidget { @@ -160,7 +159,7 @@ class _AddPatientState extends State { Widget displayForm() { return SingleChildScrollView( - padding: const EdgeInsets.all(25.0), + padding: const EdgeInsets.all(15.0), child: Column( children: [ Text( @@ -172,7 +171,7 @@ class _AddPatientState extends State { color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), ), ), - const SizedBox(height: 10.0), + const SizedBox(height: 25.0), MIHTextField( controller: idController, hintText: "13 digit ID Number or Passport", @@ -343,22 +342,38 @@ class _AddPatientState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: const MIHAppBar( - barTitle: "Add Patient", - propicFile: null, - ), + // appBar: const MIHAppBar( + // barTitle: "Add Patient", + // propicFile: null, + // ), //drawer: MIHAppDrawer(signedInUser: widget.signedInUser), body: SafeArea( - child: KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - submitForm(); - } - }, - child: displayForm(), + child: Stack( + children: [ + KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { + submitForm(); + } + }, + child: displayForm(), + ), + Positioned( + top: 10, + left: 5, + width: 50, + height: 50, + child: IconButton( + onPressed: () { + Navigator.of(context).pop(); + }, + icon: const Icon(Icons.arrow_back), + ), + ) + ], ), ), ); diff --git a/Frontend/patient_manager/lib/pages/patientEdit.dart b/Frontend/patient_manager/lib/pages/patientEdit.dart index 249f215a..303b22bb 100644 --- a/Frontend/patient_manager/lib/pages/patientEdit.dart +++ b/Frontend/patient_manager/lib/pages/patientEdit.dart @@ -2,7 +2,6 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:patient_manager/components/mihAppBar.dart'; import 'package:patient_manager/components/inputsAndButtons/mihDropdownInput.dart'; import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart'; import 'package:patient_manager/components/popUpMessages/mihSuccessMessage.dart'; @@ -367,33 +366,19 @@ class _EditPatientState extends State { Widget displayForm() { return SingleChildScrollView( - padding: const EdgeInsets.all(25.0), + padding: const EdgeInsets.all(15.0), child: Column( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Personal Details", - textAlign: TextAlign.center, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25.0, - color: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - ), - ), - IconButton( - icon: const Icon(Icons.delete), - color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), - alignment: Alignment.topRight, - onPressed: () { - deletePatientPopUp(); - }, - ) - ], + Text( + "Personal Details", + textAlign: TextAlign.center, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25.0, + color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), + ), ), - const SizedBox(height: 10.0), + const SizedBox(height: 25.0), MIHTextField( controller: idController, hintText: "13 digit ID Number or Passport", @@ -608,21 +593,51 @@ class _EditPatientState extends State { }); return Scaffold( - appBar: const MIHAppBar( - barTitle: "Edit Patient", - propicFile: null, - ), + // appBar: const MIHAppBar( + // barTitle: "Edit Patient", + // propicFile: null, + // ), body: SafeArea( - child: KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - submitForm(); - } - }, - child: displayForm(), + child: Stack( + children: [ + KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { + submitForm(); + } + }, + child: displayForm(), + ), + Positioned( + top: 10, + left: 5, + width: 50, + height: 50, + child: IconButton( + onPressed: () { + Navigator.of(context).pop(); + }, + icon: const Icon(Icons.arrow_back), + ), + ), + Positioned( + top: 10, + right: 5, + width: 50, + height: 50, + child: IconButton( + icon: const Icon(Icons.delete), + color: + MzanziInnovationHub.of(context)!.theme.secondaryColor(), + //alignment: Alignment.topRight, + onPressed: () { + deletePatientPopUp(); + }, + )) + ], ), ), ); diff --git a/Frontend/patient_manager/lib/pages/patientManager.dart b/Frontend/patient_manager/lib/pages/patientManager.dart index d507e145..a7d298c3 100644 --- a/Frontend/patient_manager/lib/pages/patientManager.dart +++ b/Frontend/patient_manager/lib/pages/patientManager.dart @@ -6,8 +6,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:patient_manager/components/builders/buildPatientList.dart'; import 'package:patient_manager/components/builders/buildPatientQueueList.dart'; -import 'package:patient_manager/components/mihAppBar.dart'; -//import 'package:patient_manager/components/mihAppDrawer.dart'; import 'package:patient_manager/components/popUpMessages/mihLoadingCircle.dart'; import 'package:patient_manager/components/inputsAndButtons/mihDateInput.dart'; import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart'; @@ -309,22 +307,9 @@ class _PatientManagerState extends State { height: h - 157, child: Column(mainAxisSize: MainAxisSize.max, children: [ //const SizedBox(height: 15), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const Text( - "Waiting Room", - style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), - ), - IconButton( - onPressed: () { - refreshQueue(); - }, - icon: const Icon( - Icons.refresh, - )) - ], + const Text( + "Waiting Room", + style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), ), const SizedBox(height: 10), MIHDateField( @@ -478,66 +463,72 @@ class _PatientManagerState extends State { final screenWidth = MediaQuery.of(context).size.width; final screenHeight = MediaQuery.of(context).size.height; return Scaffold( - appBar: const MIHAppBar( - barTitle: "Patient Manager", - propicFile: null, - ), - //drawer: MIHAppDrawer(signedInUser: widget.arguments.signedInUser), - //floatingActionButtonLocation: FloatingActionButtonLocation., - // floatingActionButton: FloatingActionButton.extended( - // label: Text( - // "Add Patient", - // style: TextStyle( - // fontWeight: FontWeight.bold, - // color: MzanziInnovationHub.of(context)!.theme.primaryColor(), - // ), - // ), - // //backgroundColor: Colors.blueAccent, - // onPressed: () { - // Navigator.of(context).pushNamed('/patient-manager/add', - // arguments: widget.signedInUser.email); - // }, - // icon: Icon( - // Icons.add, - // color: MzanziInnovationHub.of(context)!.theme.primaryColor(), - // ), + // appBar: const MIHAppBar( + // barTitle: "Patient Manager", + // propicFile: null, // ), - body: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, + body: Stack( children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.end, + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - IconButton( - onPressed: () { - setState(() { - _selectedIndex = 0; - }); - }, - icon: const Icon( - Icons.people, - size: 35, - ), + const SizedBox(height: 5), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + mainAxisAlignment: MainAxisAlignment.end, + children: [ + IconButton( + onPressed: () { + setState(() { + _selectedIndex = 0; + }); + }, + icon: const Icon( + Icons.people, + size: 35, + ), + ), + IconButton( + onPressed: () { + setState(() { + _selectedIndex = 1; + }); + }, + icon: const Icon( + Icons.search, + size: 35, + ), + ), + IconButton( + onPressed: () { + refreshQueue(); + }, + icon: const Icon( + Icons.refresh, + size: 35, + ), + ), + ], ), - IconButton( - onPressed: () { - setState(() { - _selectedIndex = 1; - }); - }, - icon: const Icon( - Icons.search, - size: 35, - ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 15), + child: showSelection(_selectedIndex, screenWidth, screenHeight), ), ], ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 15), - child: showSelection(_selectedIndex, screenWidth, screenHeight), - ), + Positioned( + top: 5, + left: 5, + width: 50, + height: 50, + child: IconButton( + onPressed: () { + Navigator.of(context).pop(); + }, + icon: const Icon(Icons.arrow_back), + ), + ) ], ), ); diff --git a/Frontend/patient_manager/lib/pages/patientView.dart b/Frontend/patient_manager/lib/pages/patientView.dart index 351371a7..db4e7d2b 100644 --- a/Frontend/patient_manager/lib/pages/patientView.dart +++ b/Frontend/patient_manager/lib/pages/patientView.dart @@ -3,7 +3,6 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:patient_manager/components/mihAppDrawer.dart'; import 'package:patient_manager/components/patientDetails.dart'; -import 'package:patient_manager/components/mihAppBar.dart'; import 'package:patient_manager/components/patientFiles.dart'; import 'package:patient_manager/components/patientNotes.dart'; import 'package:patient_manager/env/env.dart'; @@ -96,63 +95,79 @@ class _PatientViewState extends State { // loadImage(); // var logo = MzanziInnovationHub.of(context)!.theme.logoImage(); return Scaffold( - appBar: const MIHAppBar( - barTitle: "Patient Profile", - propicFile: null, - ), + // appBar: const MIHAppBar( + // barTitle: "Patient Profile", + // propicFile: null, + // ), //drawer: showDrawer(), body: SafeArea( child: SingleChildScrollView( - child: Padding( - padding: - const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), - child: Column( - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.end, - mainAxisAlignment: MainAxisAlignment.end, + child: Stack( + children: [ + Padding( + padding: const EdgeInsets.symmetric( + vertical: 10.0, horizontal: 15.0), + child: Column( children: [ - IconButton( - onPressed: () { - setState(() { - _selectedIndex = 0; - }); - }, - icon: const Icon( - Icons.perm_identity, - size: 35, - ), + 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.article_outlined, + size: 35, + ), + ), + IconButton( + onPressed: () { + setState(() { + _selectedIndex = 2; + }); + }, + icon: const Icon( + Icons.file_present, + size: 35, + ), + ), + ], ), - IconButton( - onPressed: () { - setState(() { - _selectedIndex = 1; - }); - }, - icon: const Icon( - Icons.article_outlined, - size: 35, - ), - ), - IconButton( - onPressed: () { - setState(() { - _selectedIndex = 2; - }); - }, - icon: const Icon( - Icons.file_present, - size: 35, - ), + const SizedBox( + height: 25.0, ), + showSelection(_selectedIndex), ], ), - const SizedBox( - height: 10.0, + ), + Positioned( + top: 10, + left: 5, + width: 50, + height: 50, + child: IconButton( + onPressed: () { + Navigator.of(context).pop(); + }, + icon: const Icon(Icons.arrow_back), ), - showSelection(_selectedIndex), - ], - ), + ) + ], ), ), ), diff --git a/Frontend/patient_manager/lib/pages/profileBusinessAdd.dart b/Frontend/patient_manager/lib/pages/profileBusinessAdd.dart index ca696b48..dfaf393c 100644 --- a/Frontend/patient_manager/lib/pages/profileBusinessAdd.dart +++ b/Frontend/patient_manager/lib/pages/profileBusinessAdd.dart @@ -2,8 +2,6 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:patient_manager/components/mihAppBar.dart'; -//import 'package:patient_manager/components/mihAppDrawer.dart'; import 'package:patient_manager/components/popUpMessages/mihLoadingCircle.dart'; import 'package:patient_manager/components/inputsAndButtons/mihDropdownInput.dart'; import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart'; @@ -229,173 +227,193 @@ class _ProfileBusinessAddState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: const MIHAppBar( - barTitle: "Add Business", - propicFile: null, - ), + // appBar: const MIHAppBar( + // barTitle: "Add Business", + // propicFile: null, + // ), //drawer: MIHAppDrawer(signedInUser: widget.signedInUser), body: SafeArea( - child: KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - submitForm(); - } - }, - child: SingleChildScrollView( - padding: EdgeInsets.all(25), - child: Column( - children: [ - const Text( - "Add Business Profile:", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), + child: Stack( + children: [ + KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { + submitForm(); + } + }, + child: SingleChildScrollView( + padding: const EdgeInsets.all(15), + child: Column( + children: [ + //const SizedBox(height: 15), + const Text( + "Add Business Profile", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + const SizedBox(height: 25.0), + MIHTextField( + controller: regController, + hintText: "Registration No.", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: nameController, + hintText: "Business Name", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHDropdownField( + controller: typeController, + hintText: "Business Type", + dropdownOptions: const ["Doctors Office", "Other"], + required: true, + editable: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: contactController, + hintText: "Contact Number", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: emailController, + hintText: "Email", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHFileField( + controller: logonameController, + hintText: "Logo", + editable: false, + required: true, + onPressed: () async { + FilePickerResult? result = + await FilePicker.platform.pickFiles( + type: FileType.custom, + allowedExtensions: ['jpg', 'png', 'pdf'], + ); + if (result == null) return; + final selectedFile = result.files.first; + setState(() { + selectedLogo = selectedFile; + }); + setState(() { + logonameController.text = selectedFile.name; + }); + }, + ), + const SizedBox(height: 15.0), + Divider( + color: MzanziInnovationHub.of(context) + ?.theme + .secondaryColor(), + ), + //const SizedBox(height: 15.0), + const Text( + "My Business User:", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + const SizedBox(height: 25.0), + MIHDropdownField( + controller: titleController, + hintText: "Title", + dropdownOptions: const ["Doctor", "Assistant"], + required: true, + editable: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "Name", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Surname", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHFileField( + controller: signtureController, + hintText: "Signature", + editable: false, + required: true, + onPressed: () async { + FilePickerResult? result = + await FilePicker.platform.pickFiles( + type: FileType.custom, + allowedExtensions: ['jpg', 'png', 'pdf'], + ); + if (result == null) return; + final selectedFile = result.files.first; + setState(() { + selectedSignature = selectedFile; + }); + setState(() { + signtureController.text = selectedFile.name; + }); + }, + ), + const SizedBox(height: 15.0), + MIHDropdownField( + controller: accessController, + hintText: "Access", + dropdownOptions: const ["Full", "Partial"], + required: true, + editable: false, + ), + const SizedBox(height: 30.0), + SizedBox( + width: 500.0, + height: 50.0, + child: MIHButton( + buttonText: "Add", + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + onTap: () { + submitForm(); + }, + ), + ), + ], ), - const SizedBox(height: 15.0), - MIHTextField( - controller: regController, - hintText: "Registration No.", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: nameController, - hintText: "Business Name", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: typeController, - hintText: "Business Type", - dropdownOptions: const ["Doctors Office", "Other"], - required: true, - editable: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: contactController, - hintText: "Contact Number", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: emailController, - hintText: "Email", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHFileField( - controller: logonameController, - hintText: "Logo", - editable: false, - required: true, - onPressed: () async { - FilePickerResult? result = - await FilePicker.platform.pickFiles( - type: FileType.custom, - allowedExtensions: ['jpg', 'png', 'pdf'], - ); - if (result == null) return; - final selectedFile = result.files.first; - setState(() { - selectedLogo = selectedFile; - }); - setState(() { - logonameController.text = selectedFile.name; - }); - }, - ), - const SizedBox(height: 15.0), - Divider( - color: - MzanziInnovationHub.of(context)?.theme.secondaryColor(), - ), - const SizedBox(height: 15.0), - const Text( - "My Business User:", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), - ), - const SizedBox(height: 15.0), - MIHDropdownField( - controller: titleController, - hintText: "Title", - dropdownOptions: const ["Doctor", "Assistant"], - required: true, - editable: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: fnameController, - hintText: "Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Surname", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHFileField( - controller: signtureController, - hintText: "Signature", - editable: false, - required: true, - onPressed: () async { - FilePickerResult? result = - await FilePicker.platform.pickFiles( - type: FileType.custom, - allowedExtensions: ['jpg', 'png', 'pdf'], - ); - if (result == null) return; - final selectedFile = result.files.first; - setState(() { - selectedSignature = selectedFile; - }); - setState(() { - signtureController.text = selectedFile.name; - }); - }, - ), - const SizedBox(height: 15.0), - MIHDropdownField( - controller: accessController, - hintText: "Access", - dropdownOptions: const ["Full", "Partial"], - required: true, - editable: false, - ), - const SizedBox(height: 30.0), - SizedBox( - width: 500.0, - height: 50.0, - child: MIHButton( - buttonText: "Add", - buttonColor: - MzanziInnovationHub.of(context)!.theme.secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - submitForm(); - }, - ), - ), - ], + ), ), - ), + Positioned( + top: 10, + left: 5, + width: 50, + height: 50, + child: IconButton( + onPressed: () { + Navigator.of(context).pop(); + }, + icon: const Icon(Icons.arrow_back), + ), + ) + ], ), ), ); diff --git a/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart b/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart index 234c5f40..895841ac 100644 --- a/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart +++ b/Frontend/patient_manager/lib/pages/profileBusinessUpdate.dart @@ -3,8 +3,6 @@ import 'dart:convert'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:patient_manager/components/mihAppBar.dart'; -//import 'package:patient_manager/components/mihAppDrawer.dart'; import 'package:patient_manager/components/popUpMessages/mihLoadingCircle.dart'; import 'package:patient_manager/components/inputsAndButtons/mihDropdownInput.dart'; import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart'; @@ -312,186 +310,202 @@ class _ProfileBusinessUpdateState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: const MIHAppBar( - barTitle: "Business Profile", - propicFile: null, - ), + // appBar: const MIHAppBar( + // barTitle: "Business Profile", + // propicFile: null, + // ), //drawer: MIHAppDrawer(signedInUser: widget.arguments.signedInUser), body: SafeArea( - child: KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - //print(business_id); - submitForm(business_id); - } - }, - child: SingleChildScrollView( - padding: EdgeInsets.all(25), - child: Column( - children: [ - Column( + child: Stack( + children: [ + KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { + //print(business_id); + submitForm(business_id); + } + }, + child: SingleChildScrollView( + padding: const EdgeInsets.all(15), + child: Column( children: [ - const Text( - "Update Business Profile:", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), + Column( + children: [ + const Text( + "Business Profile", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + const SizedBox(height: 25.0), + MIHTextField( + controller: regController, + hintText: "Registration No.", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: nameController, + hintText: "Business Name", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHDropdownField( + controller: typeController, + hintText: "Business Type", + dropdownOptions: const ["Doctors Office", "Other"], + required: true, + editable: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: contactController, + hintText: "Contact Number", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: emailController, + hintText: "Email", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHFileField( + controller: logonameController, + hintText: "Logo", + editable: false, + required: true, + onPressed: () async { + FilePickerResult? result = + await FilePicker.platform.pickFiles( + type: FileType.custom, + allowedExtensions: ['jpg', 'png', 'pdf'], + ); + if (result == null) return; + final selectedFile = result.files.first; + setState(() { + selectedLogo = selectedFile; + }); + setState(() { + logonameController.text = selectedFile.name; + }); + }, + ), + const SizedBox(height: 15.0), + Divider( + color: MzanziInnovationHub.of(context) + ?.theme + .secondaryColor(), + ), + ], ), - const SizedBox(height: 15.0), - MIHTextField( - controller: regController, - hintText: "Registration No.", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: nameController, - hintText: "Business Name", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHDropdownField( - controller: typeController, - hintText: "Business Type", - dropdownOptions: const ["Doctors Office", "Other"], - required: true, - editable: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: contactController, - hintText: "Contact Number", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: emailController, - hintText: "Email", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHFileField( - controller: logonameController, - hintText: "Logo", - editable: false, - required: true, - onPressed: () async { - FilePickerResult? result = - await FilePicker.platform.pickFiles( - type: FileType.custom, - allowedExtensions: ['jpg', 'png', 'pdf'], - ); - if (result == null) return; - final selectedFile = result.files.first; - setState(() { - selectedLogo = selectedFile; - }); - setState(() { - logonameController.text = selectedFile.name; - }); - }, - ), - const SizedBox(height: 15.0), - Divider( - color: MzanziInnovationHub.of(context) - ?.theme - .secondaryColor(), + Column( + children: [ + //const SizedBox(height: 15.0), + const Text( + "My Business User", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + ), + const SizedBox(height: 25.0), + MIHDropdownField( + controller: titleController, + hintText: "Title", + dropdownOptions: const ["Doctor", "Assistant"], + required: true, + editable: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "Name", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Surname", + editable: false, + required: true, + ), + const SizedBox(height: 10.0), + MIHFileField( + controller: signtureController, + hintText: "Signature", + editable: false, + required: true, + onPressed: () async { + FilePickerResult? result = + await FilePicker.platform.pickFiles( + type: FileType.custom, + allowedExtensions: ['jpg', 'png', 'pdf'], + ); + if (result == null) return; + final selectedFile = result.files.first; + setState(() { + selectedSignature = selectedFile; + }); + setState(() { + signtureController.text = selectedFile.name; + }); + }, + ), + const SizedBox(height: 15.0), + MIHDropdownField( + controller: accessController, + hintText: "Access", + dropdownOptions: const ["Full", "Partial"], + required: true, + editable: false, + ), + const SizedBox(height: 30.0), + SizedBox( + width: 500.0, + height: 50.0, + child: MIHButton( + buttonText: "Update", + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + onTap: () { + //print(business_id); + submitForm(business_id); + }, + ), + ), + ], ), ], ), - Column( - children: [ - const SizedBox(height: 15.0), - const Text( - "My Business User:", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), - ), - const SizedBox(height: 15.0), - MIHDropdownField( - controller: titleController, - hintText: "Title", - dropdownOptions: const ["Doctor", "Assistant"], - required: true, - editable: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: fnameController, - hintText: "Name", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Surname", - editable: false, - required: true, - ), - const SizedBox(height: 10.0), - MIHFileField( - controller: signtureController, - hintText: "Signature", - editable: false, - required: true, - onPressed: () async { - FilePickerResult? result = - await FilePicker.platform.pickFiles( - type: FileType.custom, - allowedExtensions: ['jpg', 'png', 'pdf'], - ); - if (result == null) return; - final selectedFile = result.files.first; - setState(() { - selectedSignature = selectedFile; - }); - setState(() { - signtureController.text = selectedFile.name; - }); - }, - ), - const SizedBox(height: 15.0), - MIHDropdownField( - controller: accessController, - hintText: "Access", - dropdownOptions: const ["Full", "Partial"], - required: true, - editable: false, - ), - const SizedBox(height: 30.0), - SizedBox( - width: 500.0, - height: 50.0, - child: MIHButton( - buttonText: "Update", - buttonColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - textColor: MzanziInnovationHub.of(context)! - .theme - .primaryColor(), - onTap: () { - //print(business_id); - submitForm(business_id); - }, - ), - ), - ], - ), - ], + ), ), - ), + Positioned( + top: 10, + left: 5, + width: 50, + height: 50, + child: IconButton( + onPressed: () { + Navigator.of(context).pop(); + }, + icon: const Icon(Icons.arrow_back), + ), + ) + ], ), ), ); diff --git a/Frontend/patient_manager/lib/pages/profileUserUpdate.dart b/Frontend/patient_manager/lib/pages/profileUserUpdate.dart index 84157389..0cdc47e8 100644 --- a/Frontend/patient_manager/lib/pages/profileUserUpdate.dart +++ b/Frontend/patient_manager/lib/pages/profileUserUpdate.dart @@ -4,7 +4,6 @@ import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:patient_manager/components/inputsAndButtons/mihFileInput.dart'; -import 'package:patient_manager/components/mihAppBar.dart'; import 'package:patient_manager/components/popUpMessages/mihLoadingCircle.dart'; import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart'; import 'package:patient_manager/components/popUpMessages/mihSuccessMessage.dart'; @@ -258,166 +257,184 @@ class _ProfileUserUpdateState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: const MIHAppBar( - barTitle: "Update Profile", - propicFile: null, - ), + // appBar: const MIHAppBar( + // barTitle: "Update Profile", + // propicFile: null, + // ), //drawer: MIHAppDrawer(signedInUser: widget.signedInUser), body: SafeArea( - child: Padding( - padding: const EdgeInsets.all(15.0), - child: Center( - child: KeyboardListener( - focusNode: _focusNode, - autofocus: true, - onKeyEvent: (event) async { - if (event is KeyDownEvent && - event.logicalKey == LogicalKeyboardKey.enter) { - submitForm(); - } - }, - child: Column( - children: [ - const Text( - "Mzansi Profile:", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 25, - ), - ), - const SizedBox(height: 25.0), - FutureBuilder( - future: proPicUrl, - builder: (BuildContext context, snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.hasData && snapshot.data != "") { - return Stack( - alignment: Alignment.center, - fit: StackFit.loose, - children: [ - CircleAvatar( - //backgroundColor: Colors.green, - backgroundImage: - NetworkImage(snapshot.requireData), - //'https://media.licdn.com/dms/image/D4D03AQGd1-QhjtWWpA/profile-displayphoto-shrink_400_400/0/1671698053061?e=2147483647&v=beta&t=a3dJI5yxs5-KeXjj10LcNCFuC9IOfa8nNn3k_Qyr0CA'), - radius: 50, - ), - SizedBox( - width: 110, - child: Image( - image: MzanziInnovationHub.of(context)! - .theme - .altLogoFrame()), - ) - ], - ); - } else { - return SizedBox( - width: 110, - child: Image( - image: MzanziInnovationHub.of(context)! - .theme - .altLogoFrame())); - } - } else { - return Center( - child: Text( - '${snapshot.error} occurred', - style: const TextStyle(fontSize: 18), - ), - ); + child: Stack( + children: [ + Padding( + padding: const EdgeInsets.all(15.0), + child: Center( + child: KeyboardListener( + focusNode: _focusNode, + autofocus: true, + onKeyEvent: (event) async { + if (event is KeyDownEvent && + event.logicalKey == LogicalKeyboardKey.enter) { + submitForm(); } }, - ), - const SizedBox(height: 10.0), - MIHFileField( - controller: proPicController, - hintText: "Profile Picture", - editable: false, - required: false, - onPressed: () async { - FilePickerResult? result = - await FilePicker.platform.pickFiles( - type: FileType.custom, - allowedExtensions: ['jpg', 'png', 'pdf'], - ); - if (result == null) return; - final selectedFile = result.files.first; - setState(() { - proPic = selectedFile; - }); - - setState(() { - proPicController.text = selectedFile.name; - }); - }, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: usernameController, - hintText: "Username", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: fnameController, - hintText: "First Name", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - MIHTextField( - controller: lnameController, - hintText: "Last Name", - editable: true, - required: true, - ), - const SizedBox(height: 10.0), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const Text( - "Activate Business Account", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20, + child: Column( + children: [ + const Text( + "Mzansi Profile", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), ), - ), - const SizedBox( - width: 10, - ), - Switch( - value: businessUser, - onChanged: (bool value) { - setState(() { - businessUser = value; - }); - }, - ), - ], - ), - const SizedBox(height: 30.0), - SizedBox( - width: 500.0, - height: 50.0, - child: MIHButton( - buttonText: "Update", - buttonColor: MzanziInnovationHub.of(context)! - .theme - .secondaryColor(), - textColor: - MzanziInnovationHub.of(context)!.theme.primaryColor(), - onTap: () { - submitForm(); - }, - ), - ), - ], + const SizedBox(height: 25.0), + FutureBuilder( + future: proPicUrl, + builder: (BuildContext context, snapshot) { + if (snapshot.connectionState == + ConnectionState.done) { + if (snapshot.hasData && snapshot.data != "") { + return Stack( + alignment: Alignment.center, + fit: StackFit.loose, + children: [ + CircleAvatar( + //backgroundColor: Colors.green, + backgroundImage: + NetworkImage(snapshot.requireData), + //'https://media.licdn.com/dms/image/D4D03AQGd1-QhjtWWpA/profile-displayphoto-shrink_400_400/0/1671698053061?e=2147483647&v=beta&t=a3dJI5yxs5-KeXjj10LcNCFuC9IOfa8nNn3k_Qyr0CA'), + radius: 50, + ), + SizedBox( + width: 110, + child: Image( + image: + MzanziInnovationHub.of(context)! + .theme + .altLogoFrame()), + ) + ], + ); + } else { + return SizedBox( + width: 110, + child: Image( + image: MzanziInnovationHub.of(context)! + .theme + .altLogoFrame())); + } + } else { + return Center( + child: Text( + '${snapshot.error} occurred', + style: const TextStyle(fontSize: 18), + ), + ); + } + }, + ), + const SizedBox(height: 25.0), + MIHFileField( + controller: proPicController, + hintText: "Profile Picture", + editable: false, + required: false, + onPressed: () async { + FilePickerResult? result = + await FilePicker.platform.pickFiles( + type: FileType.custom, + allowedExtensions: ['jpg', 'png', 'pdf'], + ); + if (result == null) return; + final selectedFile = result.files.first; + setState(() { + proPic = selectedFile; + }); + + setState(() { + proPicController.text = selectedFile.name; + }); + }, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: usernameController, + hintText: "Username", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: fnameController, + hintText: "First Name", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + MIHTextField( + controller: lnameController, + hintText: "Last Name", + editable: true, + required: true, + ), + const SizedBox(height: 10.0), + Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Text( + "Activate Business Account", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 20, + ), + ), + const SizedBox( + width: 10, + ), + Switch( + value: businessUser, + onChanged: (bool value) { + setState(() { + businessUser = value; + }); + }, + ), + ], + ), + const SizedBox(height: 30.0), + SizedBox( + width: 500.0, + height: 50.0, + child: MIHButton( + buttonText: "Update", + buttonColor: MzanziInnovationHub.of(context)! + .theme + .secondaryColor(), + textColor: MzanziInnovationHub.of(context)! + .theme + .primaryColor(), + onTap: () { + submitForm(); + }, + ), + ), + ], + )), ), ), - ), + Positioned( + top: 10, + left: 5, + width: 50, + height: 50, + child: IconButton( + onPressed: () { + Navigator.of(context).pop(); + }, + icon: const Icon(Icons.arrow_back), + ), + ) + ], ), ), );