Auth réparée
This commit is contained in:
@ -31,68 +31,50 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
print("test");
|
||||
return MaterialApp(
|
||||
title: 'EM2 ERP',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.red,
|
||||
primaryColor: AppColors.noir,
|
||||
colorScheme:
|
||||
ColorScheme.fromSwatch().copyWith(secondary: AppColors.rouge),
|
||||
textTheme: const TextTheme(
|
||||
bodyMedium: TextStyle(color: AppColors.noir),
|
||||
),
|
||||
// Personnalisation de l'InputDecorationTheme pour les text fields
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
// Bordure lorsqu'il est focus
|
||||
borderSide:
|
||||
BorderSide(color: AppColors.noir), // Couleur rouge quand focus
|
||||
title: 'EM2 ERP',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.red,
|
||||
primaryColor: AppColors.noir,
|
||||
colorScheme:
|
||||
ColorScheme.fromSwatch().copyWith(secondary: AppColors.rouge),
|
||||
textTheme: const TextTheme(
|
||||
bodyMedium: TextStyle(color: AppColors.noir),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
// Bordure par défaut (non focus)
|
||||
borderSide:
|
||||
BorderSide(color: AppColors.gris), // Couleur grise par défaut
|
||||
),
|
||||
labelStyle: TextStyle(color: AppColors.noir), // Couleur du label
|
||||
hintStyle: TextStyle(color: AppColors.gris), // Couleur du hint text
|
||||
// Tu peux personnaliser d'autres propriétés ici :
|
||||
// fillColor, filled, iconColor, prefixStyle, suffixStyle, etc.
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor:
|
||||
AppColors.blanc, // Couleur du texte du bouton (ici blanc)
|
||||
backgroundColor: AppColors
|
||||
.noir, // Couleur de fond du bouton (si tu veux aussi changer le fond)
|
||||
// Autres styles possibles pour les boutons :
|
||||
// textStyle, padding, shape, elevation, etc.
|
||||
),
|
||||
),
|
||||
),
|
||||
routes: {
|
||||
'/login': (context) => const LoginPage(),
|
||||
'/calendar': (context) => const CalendarPage(),
|
||||
'/my_account': (context) => const MyAccountPage(),
|
||||
'/user_management': (context) => const UserManagementPage(),
|
||||
},
|
||||
// Conditionally set home based on authentication state
|
||||
home: StreamBuilder<User?>(
|
||||
stream: FirebaseAuth.instance.authStateChanges(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.active) {
|
||||
User? user = snapshot.data;
|
||||
if (user == null) {
|
||||
return const LoginPage(); // User not logged in, show LoginPage
|
||||
}
|
||||
return const CalendarPage(); // User logged in, show CalendarPage
|
||||
}
|
||||
// Checking auth state, show loading indicator
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
// Personnalisation de l'InputDecorationTheme pour les text fields
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
// Bordure lorsqu'il est focus
|
||||
borderSide: BorderSide(
|
||||
color: AppColors.noir), // Couleur rouge quand focus
|
||||
),
|
||||
);
|
||||
enabledBorder: OutlineInputBorder(
|
||||
// Bordure par défaut (non focus)
|
||||
borderSide:
|
||||
BorderSide(color: AppColors.gris), // Couleur grise par défaut
|
||||
),
|
||||
labelStyle: TextStyle(color: AppColors.noir), // Couleur du label
|
||||
hintStyle: TextStyle(color: AppColors.gris), // Couleur du hint text
|
||||
// Tu peux personnaliser d'autres propriétés ici :
|
||||
// fillColor, filled, iconColor, prefixStyle, suffixStyle, etc.
|
||||
),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor:
|
||||
AppColors.blanc, // Couleur du texte du bouton (ici blanc)
|
||||
backgroundColor: AppColors
|
||||
.noir, // Couleur de fond du bouton (si tu veux aussi changer le fond)
|
||||
// Autres styles possibles pour les boutons :
|
||||
// textStyle, padding, shape, elevation, etc.
|
||||
),
|
||||
),
|
||||
),
|
||||
routes: {
|
||||
'/login': (context) => const LoginPage(),
|
||||
'/calendar': (context) => const CalendarPage(),
|
||||
'/my_account': (context) => const MyAccountPage(),
|
||||
'/user_management': (context) => const UserManagementPage(),
|
||||
},
|
||||
),
|
||||
);
|
||||
// Conditionally set home based on authentication state
|
||||
home: LoginPage());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user