Authentification stable - WIP
This commit is contained in:
@@ -1,27 +1,28 @@
|
||||
/// UnionFlow - Application Mobile Révolutionnaire
|
||||
///
|
||||
/// Point d'entrée principal avec système d'authentification adaptatif
|
||||
/// Architecture ultra-sophistiquée avec dashboard morphique basé sur les rôles
|
||||
library main;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:intl/date_symbol_data_local.dart';
|
||||
|
||||
|
||||
import 'core/auth/presentation/auth_wrapper.dart';
|
||||
import 'core/di/injection.dart';
|
||||
import 'shared/theme/app_theme.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'core/design_system/theme/app_theme_sophisticated.dart';
|
||||
import 'core/auth/bloc/auth_bloc.dart';
|
||||
import 'core/cache/dashboard_cache_manager.dart';
|
||||
import 'features/auth/presentation/pages/login_page.dart';
|
||||
import 'features/dashboard/presentation/pages/adaptive_dashboard_page.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// Initialisation des données de localisation
|
||||
await initializeDateFormatting('fr_FR', null);
|
||||
|
||||
// Configuration de l'injection de dépendances
|
||||
await configureDependencies();
|
||||
|
||||
// Le service d'authentification WebView s'initialise automatiquement
|
||||
|
||||
// Configuration du système
|
||||
await _configureApp();
|
||||
|
||||
// Lancement de l'application
|
||||
// Initialisation du cache
|
||||
await DashboardCacheManager.initialize();
|
||||
|
||||
runApp(const UnionFlowApp());
|
||||
}
|
||||
|
||||
@@ -44,36 +45,62 @@ Future<void> _configureApp() async {
|
||||
);
|
||||
}
|
||||
|
||||
/// Application principale
|
||||
/// Application principale avec système d'authentification Keycloak
|
||||
class UnionFlowApp extends StatelessWidget {
|
||||
const UnionFlowApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'UnionFlow',
|
||||
debugShowCheckedModeBanner: false,
|
||||
return BlocProvider(
|
||||
create: (context) => AuthBloc()..add(const AuthStatusChecked()),
|
||||
child: MaterialApp(
|
||||
title: 'UnionFlow',
|
||||
debugShowCheckedModeBanner: false,
|
||||
|
||||
// Configuration du thème
|
||||
theme: AppTheme.lightTheme,
|
||||
darkTheme: AppTheme.darkTheme,
|
||||
themeMode: ThemeMode.system,
|
||||
// Configuration du thème
|
||||
theme: AppThemeSophisticated.lightTheme,
|
||||
// darkTheme: AppThemeSophisticated.darkTheme,
|
||||
// themeMode: ThemeMode.system,
|
||||
|
||||
// Configuration de la localisation
|
||||
locale: const Locale('fr', 'FR'),
|
||||
// Configuration de la localisation
|
||||
locale: const Locale('fr', 'FR'),
|
||||
supportedLocales: const [
|
||||
Locale('fr', 'FR'), // Français
|
||||
Locale('en', 'US'), // Anglais
|
||||
],
|
||||
localizationsDelegates: const [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
|
||||
// Application principale
|
||||
home: const AuthWrapper(),
|
||||
// Page d'accueil avec authentification
|
||||
home: BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, state) {
|
||||
if (state is AuthLoading) {
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
} else if (state is AuthAuthenticated) {
|
||||
return const AdaptiveDashboardPage();
|
||||
} else {
|
||||
return const LoginPage();
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
// Builder global pour gérer les erreurs
|
||||
builder: (context, child) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaler: const TextScaler.linear(1.0),
|
||||
),
|
||||
child: child ?? const SizedBox(),
|
||||
);
|
||||
},
|
||||
// Builder global pour gérer les erreurs
|
||||
builder: (context, child) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
textScaler: const TextScaler.linear(1.0),
|
||||
),
|
||||
child: child ?? const SizedBox(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user