Theme Switcher added to drawers all files updated

This commit is contained in:
2024-07-10 15:58:37 +02:00
parent c1493012c9
commit f227af0d81
31 changed files with 1127 additions and 722 deletions

View File

@@ -1,14 +1,15 @@
import 'package:flutter/material.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/components/homeTileGrid.dart';
import 'package:patient_manager/components/myAppBar.dart';
import 'package:patient_manager/components/homeAppDrawer.dart';
//import 'package:patient_manager/components/myErrorMessage.dart';
//import 'package:patient_manager/components/mySuccessMessage.dart';
import 'package:patient_manager/main.dart';
//import 'package:patient_manager/theme/mihTheme.dart';
bool darkm = false;
class Home extends StatefulWidget {
//final String userEmail;
const Home({
super.key,
});
@@ -49,28 +50,38 @@ class _HomeState extends State<Home> {
// floatingActionButton: Padding(
// padding: const EdgeInsets.only(top: 65, right: 5),
// child: FloatingActionButton.extended(
// label: Text(
// "Add Patient",
// label: const Text(
// "Test Pop Up",
// style: TextStyle(
// fontWeight: FontWeight.bold,
// color: MyTheme().primaryColor(),
// ),
// ),
// //backgroundColor: Colors.blueAccent,
// onPressed: () {
// showDatePicker(
// context: context,
// initialDate: DateTime.now(),
// firstDate: DateTime(2000),
// lastDate: DateTime(2100),
// );
// setState(() {
// if (darkm) {
// darkm = !darkm;
// MzanziInnovationHub.of(context)!
// .changeTheme(ThemeMode.light);
// //print("Dark Mode: $darkm");
// } else {
// darkm = !darkm;
// MzanziInnovationHub.of(context)!
// .changeTheme(ThemeMode.dark);
// //print("Dark Mode: $darkm");
// }
// });
// // showDialog(
// // context: context,
// // builder: (context) =>
// // const MyErrorMessage(errorType: "Input Error"),
// // );
// },
// icon: Icon(
// Icons.add,
// color: MyTheme().primaryColor(),
// icon: const Icon(
// Icons.warning,
// //color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
// ),
// ),
// ),
);
} else {
return const Center(child: CircularProgressIndicator());

View File

@@ -6,8 +6,8 @@ import 'package:patient_manager/components/myErrorMessage.dart';
import 'package:patient_manager/components/mySuccessMessage.dart';
import 'package:patient_manager/components/myTextInput.dart';
import 'package:patient_manager/components/mybutton.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart';
import 'package:patient_manager/theme/mihTheme.dart';
import '../components/myAppBar.dart';
import 'package:http/http.dart' as http;
@@ -183,7 +183,7 @@ class _AddPatientState extends State<AddPatient> {
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25.0,
color: MyTheme().secondaryColor(),
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
Row(
@@ -270,7 +270,7 @@ class _AddPatientState extends State<AddPatient> {
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25.0,
color: MyTheme().secondaryColor(),
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
const SizedBox(height: 10.0),
@@ -361,7 +361,7 @@ class _AddPatientState extends State<AddPatient> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 500.0,
width: 400.0,
height: 100.0,
child: MyButton(
onTap: () {
@@ -378,8 +378,10 @@ class _AddPatientState extends State<AddPatient> {
}
},
buttonText: "Add",
buttonColor: MyTheme().secondaryColor(),
textColor: MyTheme().primaryColor(),
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
),
],

View File

@@ -6,8 +6,8 @@ import 'package:patient_manager/components/myErrorMessage.dart';
import 'package:patient_manager/components/mySuccessMessage.dart';
import 'package:patient_manager/components/myTextInput.dart';
import 'package:patient_manager/components/mybutton.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart';
import 'package:patient_manager/theme/mihTheme.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
import '../components/myAppBar.dart';
import 'package:http/http.dart' as http;
@@ -46,6 +46,9 @@ class _EditPatientState extends State<EditPatient> {
late String userEmail;
late bool medRequired;
late double width;
late double height;
Future getOfficeIdByUser(String endpoint) async {
final response = await http.get(Uri.parse(endpoint));
if (response.statusCode == 200) {
@@ -169,82 +172,100 @@ class _EditPatientState extends State<EditPatient> {
children: [
Container(
padding: const EdgeInsets.all(10.0),
width: 500.0,
height: 475.0,
width: width / 3,
height: height / 2,
decoration: BoxDecoration(
color: MyTheme().primaryColor(),
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border:
Border.all(color: MyTheme().secondaryColor(), width: 5.0),
border: Border.all(
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 5.0),
),
child: Column(
//mainAxisSize: MainAxisSize.max,
children: [
Icon(
Icons.warning_amber_rounded,
size: 100,
color: MyTheme().secondaryColor(),
),
const SizedBox(height: 15),
Text(
"Are you sure you want to delete this?",
textAlign: TextAlign.center,
style: TextStyle(
color: MyTheme().secondaryColor(),
fontSize: 25.0,
fontWeight: FontWeight.bold,
child: SingleChildScrollView(
child: Column(
//mainAxisSize: MainAxisSize.max,
children: [
Icon(
Icons.warning_amber_rounded,
size: 100,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Text(
"This action is permanent! Deleting ${fnameController.text} ${lnameController.text} will remove him\\her from your account. You won't be able to recover it once it's gone.",
const SizedBox(height: 15),
Text(
"Are you sure you want to delete this?",
textAlign: TextAlign.center,
style: TextStyle(
color: MyTheme().secondaryColor(),
fontSize: 15.0,
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 15),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Text(
"Here's what you'll be deleting:",
style: TextStyle(
color: MyTheme().secondaryColor(),
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: SizedBox(
width: 450,
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Text(
"1) Patient Profile Information.\n2) Patient Notes\n3) Patient Files.",
textAlign: TextAlign.left,
"This action is permanent! Deleting ${fnameController.text} ${lnameController.text} will remove him\\her from your account. You won't be able to recover it once it's gone.",
style: TextStyle(
color: MyTheme().secondaryColor(),
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
),
SizedBox(
width: 300,
height: 100,
child: MyButton(
onTap: deletePatientApiCall,
buttonText: "Delete",
buttonColor: MyTheme().secondaryColor(),
textColor: MyTheme().primaryColor(),
))
],
const SizedBox(height: 15),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Text(
"Here's what you'll be deleting:",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: SizedBox(
width: 450,
child: Text(
"1) Patient Profile Information.\n2) Patient Notes\n3) Patient Files.",
textAlign: TextAlign.left,
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
),
),
SizedBox(
width: 300,
height: 100,
child: MyButton(
onTap: deletePatientApiCall,
buttonText: "Delete",
buttonColor: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
textColor: MzanziInnovationHub.of(context)!
.theme
.primaryColor(),
))
],
),
),
),
Positioned(
@@ -258,7 +279,7 @@ class _EditPatientState extends State<EditPatient> {
},
icon: Icon(
Icons.close,
color: MyTheme().errorColor(),
color: MzanziInnovationHub.of(context)!.theme.errorColor(),
size: 35,
),
),
@@ -342,12 +363,14 @@ class _EditPatientState extends State<EditPatient> {
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25.0,
color: MyTheme().secondaryColor(),
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
IconButton(
icon: const Icon(Icons.delete),
color: MyTheme().secondaryColor(),
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
alignment: Alignment.topRight,
onPressed: () {
deletePatientPopUp();
@@ -439,7 +462,7 @@ class _EditPatientState extends State<EditPatient> {
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 25.0,
color: MyTheme().secondaryColor(),
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
const SizedBox(height: 10.0),
@@ -530,7 +553,7 @@ class _EditPatientState extends State<EditPatient> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 500.0,
width: 400.0,
height: 100.0,
child: MyButton(
onTap: () {
@@ -547,8 +570,10 @@ class _EditPatientState extends State<EditPatient> {
}
},
buttonText: "Update",
buttonColor: MyTheme().secondaryColor(),
textColor: MyTheme().primaryColor(),
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
),
],
@@ -594,6 +619,12 @@ class _EditPatientState extends State<EditPatient> {
@override
Widget build(BuildContext context) {
var size = MediaQuery.of(context).size;
setState(() {
width = size.width;
height = size.height;
});
return Scaffold(
appBar: const MyAppBar(barTitle: "Edit Patient"),
body: displayForm(),

View File

@@ -7,8 +7,8 @@ import 'package:patient_manager/components/myAppBar.dart';
import 'package:http/http.dart' as http;
import 'package:patient_manager/components/mySearchInput.dart';
import 'package:patient_manager/components/patManAppDrawer.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/patients.dart';
import 'package:patient_manager/theme/mihTheme.dart';
class PatientManager extends StatefulWidget {
final String userEmail;
@@ -73,10 +73,10 @@ class _PatientManagerState extends State<PatientManager> {
child: Container(
height: 500,
decoration: BoxDecoration(
color: MyTheme().primaryColor(),
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(
color: MyTheme().secondaryColor(),
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 3.0,
),
),
@@ -96,14 +96,19 @@ class _PatientManagerState extends State<PatientManager> {
child: Container(
height: 500,
decoration: BoxDecoration(
color: MyTheme().primaryColor(),
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
borderRadius: BorderRadius.circular(25.0),
border: Border.all(color: MyTheme().secondaryColor(), width: 3.0),
border: Border.all(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
width: 3.0),
),
child: Center(
child: Text(
"Enter ID or Medical Aid No. of Patient",
style: TextStyle(fontSize: 25, color: MyTheme().messageTextColor()),
style: TextStyle(
fontSize: 25,
color:
MzanziInnovationHub.of(context)!.theme.messageTextColor()),
textAlign: TextAlign.center,
),
),
@@ -181,7 +186,7 @@ class _PatientManagerState extends State<PatientManager> {
"Add Patient",
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyTheme().primaryColor(),
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
),
//backgroundColor: Colors.blueAccent,
@@ -191,7 +196,7 @@ class _PatientManagerState extends State<PatientManager> {
},
icon: Icon(
Icons.add,
color: MyTheme().primaryColor(),
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
),
),

View File

@@ -3,6 +3,7 @@ import 'package:google_nav_bar/google_nav_bar.dart';
import 'package:patient_manager/components/myAppBar.dart';
import 'package:patient_manager/components/profileOfficeUpdate.dart';
import 'package:patient_manager/components/profileUserUpdate.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/objects/appUser.dart';
class ProfileUpdate extends StatefulWidget {
@@ -43,32 +44,31 @@ class _ProfileUpdateState extends State<ProfileUpdate> {
body: Center(
child: _widgetOptions.elementAt(_selectedIndex),
),
bottomNavigationBar: Padding(
padding: const EdgeInsets.symmetric(horizontal: 150.0, vertical: 5.0),
child: GNav(
//hoverColor: Colors.lightBlueAccent,
iconSize: 35.0,
activeColor: Colors.white,
tabBackgroundColor: Colors.blueAccent,
gap: 20,
//padding: EdgeInsets.all(15),
tabs: const [
GButton(
icon: Icons.perm_identity,
text: "User Profile",
),
GButton(
icon: Icons.business,
text: "Office Profile",
),
],
selectedIndex: _selectedIndex,
onTabChange: (index) {
setState(() {
_selectedIndex = index;
});
},
),
bottomNavigationBar: GNav(
//hoverColor: Colors.lightBlueAccent,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
iconSize: 35.0,
activeColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
tabBackgroundColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
//gap: 20,
//padding: EdgeInsets.all(15),
tabs: const [
GButton(
icon: Icons.perm_identity,
text: "User Profile",
),
GButton(
icon: Icons.business,
text: "Office Profile",
),
],
selectedIndex: _selectedIndex,
onTabChange: (index) {
setState(() {
_selectedIndex = index;
});
},
),
);
}

View File

@@ -3,7 +3,6 @@ import 'package:patient_manager/components/myPassInput.dart';
import 'package:patient_manager/components/myTextInput.dart';
import 'package:patient_manager/components/mybutton.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/theme/mihTheme.dart';
import 'package:supabase_auth_ui/supabase_auth_ui.dart';
class Register extends StatefulWidget {
@@ -75,7 +74,8 @@ class _RegisterState extends State<Register> {
Icon(
Icons.lock,
size: 100,
color: MyTheme().secondaryColor(),
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
//spacer
const SizedBox(height: 10),
@@ -85,7 +85,8 @@ class _RegisterState extends State<Register> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MyTheme().secondaryColor(),
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
//spacer
@@ -143,8 +144,10 @@ class _RegisterState extends State<Register> {
child: MyButton(
onTap: () {},
buttonText: "Sign Up",
buttonColor: MyTheme().secondaryColor(),
textColor: MyTheme().primaryColor(),
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
),
),
//register text
@@ -167,7 +170,9 @@ class _RegisterState extends State<Register> {
'Sign In',
style: TextStyle(
fontSize: 18,
color: MyTheme().secondaryColor(),
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontWeight: FontWeight.bold,
),
),

View File

@@ -4,7 +4,6 @@ import 'package:patient_manager/components/myPassInput.dart';
import 'package:patient_manager/components/myTextInput.dart';
import 'package:patient_manager/components/mybutton.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/theme/mihTheme.dart';
import 'package:supabase_auth_ui/supabase_auth_ui.dart';
class SignIn extends StatefulWidget {
@@ -65,7 +64,8 @@ class _SignInState extends State<SignIn> {
Icon(
Icons.lock,
size: 100,
color: MyTheme().secondaryColor(),
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
//spacer
const SizedBox(height: 10),
@@ -75,7 +75,8 @@ class _SignInState extends State<SignIn> {
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: MyTheme().secondaryColor(),
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
),
//spacer
@@ -109,8 +110,10 @@ class _SignInState extends State<SignIn> {
height: 100.0,
child: MyButton(
buttonText: "Sign In",
buttonColor: MyTheme().secondaryColor(),
textColor: MyTheme().primaryColor(),
buttonColor:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
textColor:
MzanziInnovationHub.of(context)!.theme.primaryColor(),
onTap: () {
if (emailController.text.isEmpty ||
passwordController.text.isEmpty) {
@@ -155,7 +158,9 @@ class _SignInState extends State<SignIn> {
'Register Now',
style: TextStyle(
fontSize: 18,
color: MyTheme().secondaryColor(),
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor(),
fontWeight: FontWeight.bold,
),
),