Refactoring - Version OK
This commit is contained in:
@@ -6,16 +6,9 @@ library main;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.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 'app/app.dart';
|
||||
import 'core/storage/dashboard_cache_manager.dart';
|
||||
import 'core/l10n/locale_provider.dart';
|
||||
import 'features/auth/presentation/pages/login_page.dart';
|
||||
import 'core/navigation/main_navigation_layout.dart';
|
||||
import 'core/di/app_di.dart';
|
||||
|
||||
void main() async {
|
||||
@@ -44,90 +37,20 @@ Future<void> _configureApp() async {
|
||||
DeviceOrientation.portraitUp,
|
||||
]);
|
||||
|
||||
// Configuration de la barre de statut
|
||||
// Configuration de la barre de statut - Mode immersif
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
const SystemUiOverlayStyle(
|
||||
statusBarColor: Colors.transparent,
|
||||
statusBarIconBrightness: Brightness.dark,
|
||||
statusBarBrightness: Brightness.light,
|
||||
systemNavigationBarColor: Colors.white,
|
||||
systemNavigationBarIconBrightness: Brightness.dark,
|
||||
statusBarColor: Colors.transparent, // Transparent pour mode immersif
|
||||
statusBarIconBrightness: Brightness.dark, // Icônes sombres sur fond clair
|
||||
statusBarBrightness: Brightness.light, // Pour iOS
|
||||
systemNavigationBarColor: Colors.white, // Barre de navigation blanche
|
||||
systemNavigationBarIconBrightness: Brightness.dark, // Icônes sombres
|
||||
systemNavigationBarDividerColor: Colors.transparent, // Pas de séparateur
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Application principale avec système d'authentification Keycloak
|
||||
class UnionFlowApp extends StatelessWidget {
|
||||
final LocaleProvider localeProvider;
|
||||
|
||||
const UnionFlowApp({super.key, required this.localeProvider});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider.value(value: localeProvider),
|
||||
BlocProvider(
|
||||
create: (context) => AuthBloc()..add(const AuthStatusChecked()),
|
||||
),
|
||||
],
|
||||
child: Consumer<LocaleProvider>(
|
||||
builder: (context, localeProvider, child) {
|
||||
return MaterialApp(
|
||||
title: 'UnionFlow',
|
||||
debugShowCheckedModeBanner: false,
|
||||
|
||||
// Configuration du thème
|
||||
theme: AppThemeSophisticated.lightTheme,
|
||||
// darkTheme: AppThemeSophisticated.darkTheme,
|
||||
// themeMode: ThemeMode.system,
|
||||
|
||||
// Configuration de la localisation
|
||||
locale: localeProvider.locale,
|
||||
supportedLocales: LocaleProvider.supportedLocales,
|
||||
localizationsDelegates: const [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
|
||||
// Configuration des routes
|
||||
routes: {
|
||||
'/': (context) => BlocBuilder<AuthBloc, AuthState>(
|
||||
builder: (context, state) {
|
||||
if (state is AuthLoading) {
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
);
|
||||
} else if (state is AuthAuthenticated) {
|
||||
return const MainNavigationLayout();
|
||||
} else {
|
||||
return const LoginPage();
|
||||
}
|
||||
},
|
||||
),
|
||||
'/dashboard': (context) => const MainNavigationLayout(),
|
||||
'/login': (context) => const LoginPage(),
|
||||
},
|
||||
|
||||
// Page d'accueil par défaut
|
||||
initialRoute: '/',
|
||||
|
||||
// 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(),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
// Activer le mode edge-to-edge (immersif)
|
||||
SystemChrome.setEnabledSystemUIMode(
|
||||
SystemUiMode.edgeToEdge,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user