update UI to remove app bar

This commit is contained in:
2024-08-29 12:16:21 +02:00
parent aba7bbce27
commit 12b51cbddc
8 changed files with 816 additions and 710 deletions

View File

@@ -3,8 +3,6 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:patient_manager/components/builders/buildAccessRequestList.dart'; import 'package:patient_manager/components/builders/buildAccessRequestList.dart';
import 'package:patient_manager/components/inputsAndButtons/mihDropdownInput.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/components/popUpMessages/mihLoadingCircle.dart';
import 'package:patient_manager/env/env.dart'; import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/main.dart'; import 'package:patient_manager/main.dart';
@@ -103,7 +101,7 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
); );
} }
return Container( return Container(
//height: 500, height: 500,
decoration: BoxDecoration( decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.primaryColor(), color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0), borderRadius: BorderRadius.circular(25.0),
@@ -131,28 +129,14 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
height: 600, height: 600,
child: Column(mainAxisSize: MainAxisSize.max, children: [ child: Column(mainAxisSize: MainAxisSize.max, children: [
//const SizedBox(height: 15), //const SizedBox(height: 15),
Row( const Text(
mainAxisAlignment: MainAxisAlignment.center, "Access Request",
crossAxisAlignment: CrossAxisAlignment.center, style: TextStyle(
children: [ fontSize: 25,
//const SizedBox(height: 25), fontWeight: FontWeight.bold,
const Text( ),
"Access Request",
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
),
IconButton(
onPressed: () {
setState(() {
forceRefresh = true;
});
refreshList();
},
icon: const Icon(
Icons.refresh,
))
],
), ),
const SizedBox(height: 10), const SizedBox(height: 25),
SizedBox( SizedBox(
width: 500, width: 500,
child: MIHDropdownField( child: MIHDropdownField(
@@ -169,19 +153,21 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
builder: (context, snapshot) { builder: (context, snapshot) {
//print("patient Queue List ${snapshot.hasData}"); //print("patient Queue List ${snapshot.hasData}");
if (snapshot.connectionState == ConnectionState.waiting) { if (snapshot.connectionState == ConnectionState.waiting) {
return Container( return Expanded(
//height: 500, child: Container(
decoration: BoxDecoration( //height: 500,
color: decoration: BoxDecoration(
MzanziInnovationHub.of(context)!.theme.primaryColor(), color:
borderRadius: BorderRadius.circular(25.0), MzanziInnovationHub.of(context)!.theme.primaryColor(),
border: Border.all( borderRadius: BorderRadius.circular(25.0),
color: MzanziInnovationHub.of(context)! border: Border.all(
.theme color: MzanziInnovationHub.of(context)!
.secondaryColor(), .theme
width: 3.0), .secondaryColor(),
width: 3.0),
),
child: const Mihloadingcircle(),
), ),
child: const Mihloadingcircle(),
); );
} else if (snapshot.connectionState == ConnectionState.done) { } else if (snapshot.connectionState == ConnectionState.done) {
List<AccessRequest> accessRequestList; List<AccessRequest> accessRequestList;
@@ -267,12 +253,47 @@ class _PatientAccessRequestState extends State<PatientAccessRequest> {
final screenWidth = MediaQuery.of(context).size.width; final screenWidth = MediaQuery.of(context).size.width;
final screenHeight = MediaQuery.of(context).size.height; final screenHeight = MediaQuery.of(context).size.height;
return Scaffold( return Scaffold(
appBar: const MIHAppBar( // appBar: const MIHAppBar(
barTitle: "Access Reviews", // barTitle: "Access Reviews",
propicFile: null, // propicFile: null,
), // ),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser), //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,
),
),
)
],
),
),
); );
} }
} }

View File

@@ -12,7 +12,6 @@ import 'package:patient_manager/env/env.dart';
import 'package:patient_manager/main.dart'; import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart'; import 'package:patient_manager/objects/appUser.dart';
import 'package:patient_manager/objects/arguments.dart'; import 'package:patient_manager/objects/arguments.dart';
import '../components/mihAppBar.dart';
import 'package:supertokens_flutter/http.dart' as http; import 'package:supertokens_flutter/http.dart' as http;
class AddPatient extends StatefulWidget { class AddPatient extends StatefulWidget {
@@ -160,7 +159,7 @@ class _AddPatientState extends State<AddPatient> {
Widget displayForm() { Widget displayForm() {
return SingleChildScrollView( return SingleChildScrollView(
padding: const EdgeInsets.all(25.0), padding: const EdgeInsets.all(15.0),
child: Column( child: Column(
children: [ children: [
Text( Text(
@@ -172,7 +171,7 @@ class _AddPatientState extends State<AddPatient> {
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
), ),
), ),
const SizedBox(height: 10.0), const SizedBox(height: 25.0),
MIHTextField( MIHTextField(
controller: idController, controller: idController,
hintText: "13 digit ID Number or Passport", hintText: "13 digit ID Number or Passport",
@@ -343,22 +342,38 @@ class _AddPatientState extends State<AddPatient> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: const MIHAppBar( // appBar: const MIHAppBar(
barTitle: "Add Patient", // barTitle: "Add Patient",
propicFile: null, // propicFile: null,
), // ),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser), //drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: SafeArea( body: SafeArea(
child: KeyboardListener( child: Stack(
focusNode: _focusNode, children: [
autofocus: true, KeyboardListener(
onKeyEvent: (event) async { focusNode: _focusNode,
if (event is KeyDownEvent && autofocus: true,
event.logicalKey == LogicalKeyboardKey.enter) { onKeyEvent: (event) async {
submitForm(); if (event is KeyDownEvent &&
} event.logicalKey == LogicalKeyboardKey.enter) {
}, submitForm();
child: displayForm(), }
},
child: displayForm(),
),
Positioned(
top: 10,
left: 5,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: const Icon(Icons.arrow_back),
),
)
],
), ),
), ),
); );

View File

@@ -2,7 +2,6 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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/inputsAndButtons/mihDropdownInput.dart';
import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart'; import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart';
import 'package:patient_manager/components/popUpMessages/mihSuccessMessage.dart'; import 'package:patient_manager/components/popUpMessages/mihSuccessMessage.dart';
@@ -367,33 +366,19 @@ class _EditPatientState extends State<EditPatient> {
Widget displayForm() { Widget displayForm() {
return SingleChildScrollView( return SingleChildScrollView(
padding: const EdgeInsets.all(25.0), padding: const EdgeInsets.all(15.0),
child: Column( child: Column(
children: [ children: [
Row( Text(
mainAxisAlignment: MainAxisAlignment.center, "Personal Details",
children: [ textAlign: TextAlign.center,
Text( style: TextStyle(
"Personal Details", fontWeight: FontWeight.bold,
textAlign: TextAlign.center, fontSize: 25.0,
style: TextStyle( color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
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();
},
)
],
), ),
const SizedBox(height: 10.0), const SizedBox(height: 25.0),
MIHTextField( MIHTextField(
controller: idController, controller: idController,
hintText: "13 digit ID Number or Passport", hintText: "13 digit ID Number or Passport",
@@ -608,21 +593,51 @@ class _EditPatientState extends State<EditPatient> {
}); });
return Scaffold( return Scaffold(
appBar: const MIHAppBar( // appBar: const MIHAppBar(
barTitle: "Edit Patient", // barTitle: "Edit Patient",
propicFile: null, // propicFile: null,
), // ),
body: SafeArea( body: SafeArea(
child: KeyboardListener( child: Stack(
focusNode: _focusNode, children: [
autofocus: true, KeyboardListener(
onKeyEvent: (event) async { focusNode: _focusNode,
if (event is KeyDownEvent && autofocus: true,
event.logicalKey == LogicalKeyboardKey.enter) { onKeyEvent: (event) async {
submitForm(); if (event is KeyDownEvent &&
} event.logicalKey == LogicalKeyboardKey.enter) {
}, submitForm();
child: displayForm(), }
},
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();
},
))
],
), ),
), ),
); );

View File

@@ -6,8 +6,6 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:patient_manager/components/builders/buildPatientList.dart'; import 'package:patient_manager/components/builders/buildPatientList.dart';
import 'package:patient_manager/components/builders/buildPatientQueueList.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/popUpMessages/mihLoadingCircle.dart';
import 'package:patient_manager/components/inputsAndButtons/mihDateInput.dart'; import 'package:patient_manager/components/inputsAndButtons/mihDateInput.dart';
import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart'; import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart';
@@ -309,22 +307,9 @@ class _PatientManagerState extends State<PatientManager> {
height: h - 157, height: h - 157,
child: Column(mainAxisSize: MainAxisSize.max, children: [ child: Column(mainAxisSize: MainAxisSize.max, children: [
//const SizedBox(height: 15), //const SizedBox(height: 15),
Row( const Text(
mainAxisAlignment: MainAxisAlignment.center, "Waiting Room",
crossAxisAlignment: CrossAxisAlignment.center, style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
children: [
const Text(
"Waiting Room",
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
),
IconButton(
onPressed: () {
refreshQueue();
},
icon: const Icon(
Icons.refresh,
))
],
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
MIHDateField( MIHDateField(
@@ -478,66 +463,72 @@ class _PatientManagerState extends State<PatientManager> {
final screenWidth = MediaQuery.of(context).size.width; final screenWidth = MediaQuery.of(context).size.width;
final screenHeight = MediaQuery.of(context).size.height; final screenHeight = MediaQuery.of(context).size.height;
return Scaffold( return Scaffold(
appBar: const MIHAppBar( // appBar: const MIHAppBar(
barTitle: "Patient Manager", // barTitle: "Patient Manager",
propicFile: null, // 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(),
// ),
// ), // ),
body: Column( body: Stack(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Row( Column(
crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
IconButton( const SizedBox(height: 5),
onPressed: () { Row(
setState(() { crossAxisAlignment: CrossAxisAlignment.end,
_selectedIndex = 0; mainAxisAlignment: MainAxisAlignment.end,
}); children: [
}, IconButton(
icon: const Icon( onPressed: () {
Icons.people, setState(() {
size: 35, _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( Padding(
onPressed: () { padding: EdgeInsets.symmetric(horizontal: 15),
setState(() { child: showSelection(_selectedIndex, screenWidth, screenHeight),
_selectedIndex = 1;
});
},
icon: const Icon(
Icons.search,
size: 35,
),
), ),
], ],
), ),
Padding( Positioned(
padding: EdgeInsets.symmetric(horizontal: 15), top: 5,
child: showSelection(_selectedIndex, screenWidth, screenHeight), left: 5,
), width: 50,
height: 50,
child: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: const Icon(Icons.arrow_back),
),
)
], ],
), ),
); );

View File

@@ -3,7 +3,6 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:patient_manager/components/mihAppDrawer.dart'; import 'package:patient_manager/components/mihAppDrawer.dart';
import 'package:patient_manager/components/patientDetails.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/patientFiles.dart';
import 'package:patient_manager/components/patientNotes.dart'; import 'package:patient_manager/components/patientNotes.dart';
import 'package:patient_manager/env/env.dart'; import 'package:patient_manager/env/env.dart';
@@ -96,63 +95,79 @@ class _PatientViewState extends State<PatientView> {
// loadImage(); // loadImage();
// var logo = MzanziInnovationHub.of(context)!.theme.logoImage(); // var logo = MzanziInnovationHub.of(context)!.theme.logoImage();
return Scaffold( return Scaffold(
appBar: const MIHAppBar( // appBar: const MIHAppBar(
barTitle: "Patient Profile", // barTitle: "Patient Profile",
propicFile: null, // propicFile: null,
), // ),
//drawer: showDrawer(), //drawer: showDrawer(),
body: SafeArea( body: SafeArea(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding( child: Stack(
padding: children: [
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0), Padding(
child: Column( padding: const EdgeInsets.symmetric(
children: [ vertical: 10.0, horizontal: 15.0),
Row( child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
IconButton( Row(
onPressed: () { crossAxisAlignment: CrossAxisAlignment.end,
setState(() { mainAxisAlignment: MainAxisAlignment.end,
_selectedIndex = 0; children: [
}); IconButton(
}, onPressed: () {
icon: const Icon( setState(() {
Icons.perm_identity, _selectedIndex = 0;
size: 35, });
), },
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( const SizedBox(
onPressed: () { height: 25.0,
setState(() {
_selectedIndex = 1;
});
},
icon: const Icon(
Icons.article_outlined,
size: 35,
),
),
IconButton(
onPressed: () {
setState(() {
_selectedIndex = 2;
});
},
icon: const Icon(
Icons.file_present,
size: 35,
),
), ),
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), )
], ],
),
), ),
), ),
), ),

View File

@@ -2,8 +2,6 @@ import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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/popUpMessages/mihLoadingCircle.dart';
import 'package:patient_manager/components/inputsAndButtons/mihDropdownInput.dart'; import 'package:patient_manager/components/inputsAndButtons/mihDropdownInput.dart';
import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart'; import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart';
@@ -229,173 +227,193 @@ class _ProfileBusinessAddState extends State<ProfileBusinessAdd> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: const MIHAppBar( // appBar: const MIHAppBar(
barTitle: "Add Business", // barTitle: "Add Business",
propicFile: null, // propicFile: null,
), // ),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser), //drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: SafeArea( body: SafeArea(
child: KeyboardListener( child: Stack(
focusNode: _focusNode, children: [
autofocus: true, KeyboardListener(
onKeyEvent: (event) async { focusNode: _focusNode,
if (event is KeyDownEvent && autofocus: true,
event.logicalKey == LogicalKeyboardKey.enter) { onKeyEvent: (event) async {
submitForm(); if (event is KeyDownEvent &&
} event.logicalKey == LogicalKeyboardKey.enter) {
}, submitForm();
child: SingleChildScrollView( }
padding: EdgeInsets.all(25), },
child: Column( child: SingleChildScrollView(
children: [ padding: const EdgeInsets.all(15),
const Text( child: Column(
"Add Business Profile:", children: [
style: TextStyle( //const SizedBox(height: 15),
fontWeight: FontWeight.bold, const Text(
fontSize: 25, "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),
),
)
],
), ),
), ),
); );

View File

@@ -3,8 +3,6 @@ import 'dart:convert';
import 'package:file_picker/file_picker.dart'; import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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/popUpMessages/mihLoadingCircle.dart';
import 'package:patient_manager/components/inputsAndButtons/mihDropdownInput.dart'; import 'package:patient_manager/components/inputsAndButtons/mihDropdownInput.dart';
import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart'; import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart';
@@ -312,186 +310,202 @@ class _ProfileBusinessUpdateState extends State<ProfileBusinessUpdate> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: const MIHAppBar( // appBar: const MIHAppBar(
barTitle: "Business Profile", // barTitle: "Business Profile",
propicFile: null, // propicFile: null,
), // ),
//drawer: MIHAppDrawer(signedInUser: widget.arguments.signedInUser), //drawer: MIHAppDrawer(signedInUser: widget.arguments.signedInUser),
body: SafeArea( body: SafeArea(
child: KeyboardListener( child: Stack(
focusNode: _focusNode, children: [
autofocus: true, KeyboardListener(
onKeyEvent: (event) async { focusNode: _focusNode,
if (event is KeyDownEvent && autofocus: true,
event.logicalKey == LogicalKeyboardKey.enter) { onKeyEvent: (event) async {
//print(business_id); if (event is KeyDownEvent &&
submitForm(business_id); event.logicalKey == LogicalKeyboardKey.enter) {
} //print(business_id);
}, submitForm(business_id);
child: SingleChildScrollView( }
padding: EdgeInsets.all(25), },
child: Column( child: SingleChildScrollView(
children: [ padding: const EdgeInsets.all(15),
Column( child: Column(
children: [ children: [
const Text( Column(
"Update Business Profile:", children: [
style: TextStyle( const Text(
fontWeight: FontWeight.bold, "Business Profile",
fontSize: 25, 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), Column(
MIHTextField( children: [
controller: regController, //const SizedBox(height: 15.0),
hintText: "Registration No.", const Text(
editable: true, "My Business User",
required: true, style: TextStyle(
), fontWeight: FontWeight.bold,
const SizedBox(height: 10.0), fontSize: 25,
MIHTextField( ),
controller: nameController, ),
hintText: "Business Name", const SizedBox(height: 25.0),
editable: true, MIHDropdownField(
required: true, controller: titleController,
), hintText: "Title",
const SizedBox(height: 10.0), dropdownOptions: const ["Doctor", "Assistant"],
MIHDropdownField( required: true,
controller: typeController, editable: true,
hintText: "Business Type", ),
dropdownOptions: const ["Doctors Office", "Other"], const SizedBox(height: 10.0),
required: true, MIHTextField(
editable: true, controller: fnameController,
), hintText: "Name",
const SizedBox(height: 10.0), editable: false,
MIHTextField( required: true,
controller: contactController, ),
hintText: "Contact Number", const SizedBox(height: 10.0),
editable: true, MIHTextField(
required: true, controller: lnameController,
), hintText: "Surname",
const SizedBox(height: 10.0), editable: false,
MIHTextField( required: true,
controller: emailController, ),
hintText: "Email", const SizedBox(height: 10.0),
editable: true, MIHFileField(
required: true, controller: signtureController,
), hintText: "Signature",
const SizedBox(height: 10.0), editable: false,
MIHFileField( required: true,
controller: logonameController, onPressed: () async {
hintText: "Logo", FilePickerResult? result =
editable: false, await FilePicker.platform.pickFiles(
required: true, type: FileType.custom,
onPressed: () async { allowedExtensions: ['jpg', 'png', 'pdf'],
FilePickerResult? result = );
await FilePicker.platform.pickFiles( if (result == null) return;
type: FileType.custom, final selectedFile = result.files.first;
allowedExtensions: ['jpg', 'png', 'pdf'], setState(() {
); selectedSignature = selectedFile;
if (result == null) return; });
final selectedFile = result.files.first; setState(() {
setState(() { signtureController.text = selectedFile.name;
selectedLogo = selectedFile; });
}); },
setState(() { ),
logonameController.text = selectedFile.name; const SizedBox(height: 15.0),
}); MIHDropdownField(
}, controller: accessController,
), hintText: "Access",
const SizedBox(height: 15.0), dropdownOptions: const ["Full", "Partial"],
Divider( required: true,
color: MzanziInnovationHub.of(context) editable: false,
?.theme ),
.secondaryColor(), 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),
),
)
],
), ),
), ),
); );

View File

@@ -4,7 +4,6 @@ import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:patient_manager/components/inputsAndButtons/mihFileInput.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/mihLoadingCircle.dart';
import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart'; import 'package:patient_manager/components/popUpMessages/mihErrorMessage.dart';
import 'package:patient_manager/components/popUpMessages/mihSuccessMessage.dart'; import 'package:patient_manager/components/popUpMessages/mihSuccessMessage.dart';
@@ -258,166 +257,184 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: const MIHAppBar( // appBar: const MIHAppBar(
barTitle: "Update Profile", // barTitle: "Update Profile",
propicFile: null, // propicFile: null,
), // ),
//drawer: MIHAppDrawer(signedInUser: widget.signedInUser), //drawer: MIHAppDrawer(signedInUser: widget.signedInUser),
body: SafeArea( body: SafeArea(
child: Padding( child: Stack(
padding: const EdgeInsets.all(15.0), children: [
child: Center( Padding(
child: KeyboardListener( padding: const EdgeInsets.all(15.0),
focusNode: _focusNode, child: Center(
autofocus: true, child: KeyboardListener(
onKeyEvent: (event) async { focusNode: _focusNode,
if (event is KeyDownEvent && autofocus: true,
event.logicalKey == LogicalKeyboardKey.enter) { onKeyEvent: (event) async {
submitForm(); 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: Column(
const SizedBox(height: 10.0), children: [
MIHFileField( const Text(
controller: proPicController, "Mzansi Profile",
hintText: "Profile Picture", style: TextStyle(
editable: false, fontWeight: FontWeight.bold,
required: false, fontSize: 25,
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(height: 25.0),
const SizedBox( FutureBuilder(
width: 10, future: proPicUrl,
), builder: (BuildContext context, snapshot) {
Switch( if (snapshot.connectionState ==
value: businessUser, ConnectionState.done) {
onChanged: (bool value) { if (snapshot.hasData && snapshot.data != "") {
setState(() { return Stack(
businessUser = value; alignment: Alignment.center,
}); fit: StackFit.loose,
}, children: [
), CircleAvatar(
], //backgroundColor: Colors.green,
), backgroundImage:
const SizedBox(height: 30.0), NetworkImage(snapshot.requireData),
SizedBox( //'https://media.licdn.com/dms/image/D4D03AQGd1-QhjtWWpA/profile-displayphoto-shrink_400_400/0/1671698053061?e=2147483647&v=beta&t=a3dJI5yxs5-KeXjj10LcNCFuC9IOfa8nNn3k_Qyr0CA'),
width: 500.0, radius: 50,
height: 50.0, ),
child: MIHButton( SizedBox(
buttonText: "Update", width: 110,
buttonColor: MzanziInnovationHub.of(context)! child: Image(
.theme image:
.secondaryColor(), MzanziInnovationHub.of(context)!
textColor: .theme
MzanziInnovationHub.of(context)!.theme.primaryColor(), .altLogoFrame()),
onTap: () { )
submitForm(); ],
}, );
), } 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),
),
)
],
), ),
), ),
); );