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,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:patient_manager/main.dart';
import 'package:patient_manager/theme/mihTheme.dart';
class HomeAppDrawer extends StatefulWidget {
final String userEmail;
@@ -15,41 +13,76 @@ class HomeAppDrawer extends StatefulWidget {
class _HomeAppDrawerState extends State<HomeAppDrawer> {
@override
Widget build(BuildContext context) {
//print(MzanziInnovationHub.of(context)?.theme.mode);
return Drawer(
backgroundColor: MyTheme().primaryColor(),
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: BoxDecoration(
color: MyTheme().secondaryColor(),
//backgroundColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
child: Stack(children: [
ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: BoxDecoration(
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
child: Text(
widget.userEmail,
style: TextStyle(
color:
MzanziInnovationHub.of(context)!.theme.primaryColor()),
),
),
child: Text(
widget.userEmail,
style: TextStyle(color: MyTheme().primaryColor()),
ListTile(
title: Row(
children: [
Icon(
Icons.logout,
color:
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
),
SizedBox(width: 25.0),
Text(
"Sign Out",
style: TextStyle(
color: MzanziInnovationHub.of(context)!
.theme
.secondaryColor()),
),
],
),
onTap: () {
client.auth.signOut();
Navigator.of(context).pushNamed('/');
},
)
],
),
Positioned(
top: 1,
right: 1,
width: 50,
height: 50,
child: IconButton(
onPressed: () {
setState(() {
if (MzanziInnovationHub.of(context)?.theme.mode == "Dark") {
//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");
}
});
},
icon: Icon(
Icons.light_mode,
color: MzanziInnovationHub.of(context)!.theme.primaryColor(),
size: 35,
),
),
ListTile(
title: Row(
children: [
Icon(
Icons.logout,
color: MyTheme().secondaryColor(),
),
SizedBox(width: 25.0),
Text(
"Sign Out",
style: TextStyle(color: MyTheme().secondaryColor()),
),
],
),
onTap: () {
client.auth.signOut();
Navigator.of(context).pushNamed('/');
},
)
],
),
),
]),
);
}
}