81 lines
3.0 KiB
Dart
81 lines
3.0 KiB
Dart
import 'package:em2rp/views/calendar_page.dart';
|
|
import 'package:em2rp/views/login_page.dart';
|
|
import 'package:firebase_auth/firebase_auth.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:firebase_core/firebase_core.dart';
|
|
import 'firebase_options.dart';
|
|
import 'utils/colors.dart';
|
|
import 'views/my_account_page.dart';
|
|
import 'views/user_management_page.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'providers/user_provider.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await Firebase.initializeApp(
|
|
options: DefaultFirebaseOptions.currentPlatform,
|
|
);
|
|
runApp(
|
|
ChangeNotifierProvider(
|
|
// Wrap MyApp with ChangeNotifierProvider
|
|
create: (context) => UserProvider(), // Create UserProvider instance
|
|
child: const MyApp(),
|
|
),
|
|
);
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
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
|
|
),
|
|
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());
|
|
}
|
|
}
|