feat: implement authentication flow with AppStartGate, AuthGuard, and calendar page initialization
This commit is contained in:
@@ -4,8 +4,9 @@ import 'package:provider/provider.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import '../views/login_page.dart';
|
||||
import '../utils/colors.dart';
|
||||
|
||||
import '../providers/local_user_provider.dart';
|
||||
import '../views/widgets/common/startup_splash_screen.dart';
|
||||
|
||||
/// Gate de démarrage qui attend la restauration Firebase Auth avant
|
||||
/// d'afficher soit le contenu connecté, soit la page de connexion.
|
||||
@@ -43,14 +44,14 @@ class AppStartGate extends StatelessWidget {
|
||||
stream: safeAuthStream,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const _StartupSplashScreen();
|
||||
return const StartupSplashScreen();
|
||||
}
|
||||
|
||||
if (snapshot.hasError) {
|
||||
// En théorie handleError évite d'arriver ici, mais on garde
|
||||
// une protection supplémentaire.
|
||||
debugPrint('[AppStartGate] snapshot error: ${snapshot.error}');
|
||||
return const _StartupSplashScreen(message: 'Erreur de connexion');
|
||||
return const StartupSplashScreen(message: 'Erreur de connexion');
|
||||
}
|
||||
|
||||
if (snapshot.data != null) {
|
||||
@@ -101,44 +102,9 @@ class _AuthenticatedBootstrapState extends State<_AuthenticatedBootstrap> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const _StartupSplashScreen();
|
||||
return const StartupSplashScreen();
|
||||
}
|
||||
}
|
||||
|
||||
class _StartupSplashScreen extends StatelessWidget {
|
||||
final String message;
|
||||
|
||||
const _StartupSplashScreen({this.message = 'Démarrage...'});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.white,
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/logos/RectangleLogoBlack.png',
|
||||
width: 160,
|
||||
height: 160,
|
||||
fit: BoxFit.contain,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Icon(
|
||||
Icons.event_available,
|
||||
size: 72,
|
||||
color: AppColors.rouge,
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 16),
|
||||
Text(message),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user