Update app top cater for env variables

This commit is contained in:
2024-07-11 15:58:55 +02:00
parent 1c7db86571
commit 4923f0f426
15 changed files with 42 additions and 50 deletions

View File

@@ -4,29 +4,17 @@ import 'package:patient_manager/router/routeGenerator.dart';
import 'package:patient_manager/theme/mihTheme.dart';
import 'package:supabase_flutter/supabase_flutter.dart';
// void main() async {
// WidgetsFlutterBinding.ensureInitialized();
// await Supabase.initialize(
// url: "https://stzluvsyhbwtfbztarmu.supabase.co",
// anonKey:
// "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InN0emx1dnN5aGJ3dGZienRhcm11Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTIwNzUyMTMsImV4cCI6MjAyNzY1MTIxM30.a7VHlk63JJcAotvsqtoqiKwjNK4EbnNgKilAqt1iRio",
// );
// runApp(const MzanziInnovationHub());
// }
final client = Supabase.instance.client;
class MzanziInnovationHub extends StatefulWidget {
//final AppEnviroment appEnv;
const MzanziInnovationHub({
super.key,
//required this.appEnv,
});
@override
State<MzanziInnovationHub> createState() => _MzanziInnovationHubState();
// ignore: library_private_types_in_public_api
static _MzanziInnovationHubState? of(BuildContext context) =>
context.findAncestorStateOfType<_MzanziInnovationHubState>();
}
@@ -39,20 +27,25 @@ class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
return theme.primaryColor();
}
String getTitle() {
if (AppEnviroment.getEnv() == "Dev") {
return "Mzansi Innovation Hub - Dev";
} else {
return "Mzansi Innovation Hub";
}
}
void changeTheme(ThemeMode themeMode) {
setState(() {
_themeMode = themeMode;
//print(_themeMode);
if (_themeMode == ThemeMode.light) {
setState(() {
theme.mode = "Light";
});
//print(theme.mode);
} else {
setState(() {
theme.mode = "Dark";
});
//print(theme.mode);
}
});
}
@@ -68,7 +61,7 @@ class _MzanziInnovationHubState extends State<MzanziInnovationHub> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Mzansi Innovation Hub - ${AppEnviroment.getEnv()}',
title: getTitle(),
themeMode: _themeMode,
theme: theme.darkMode(),
darkTheme: theme.lightMode(),