69 lines
1.7 KiB
Dart
69 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../../shared/theme/app_theme.dart';
|
|
import 'welcome_screen.dart';
|
|
|
|
class AuthWrapper extends StatefulWidget {
|
|
const AuthWrapper({super.key});
|
|
|
|
@override
|
|
State<AuthWrapper> createState() => _AuthWrapperState();
|
|
}
|
|
|
|
class _AuthWrapperState extends State<AuthWrapper> {
|
|
bool _isLoading = true;
|
|
bool _isAuthenticated = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_checkAuthenticationStatus();
|
|
}
|
|
|
|
Future<void> _checkAuthenticationStatus() async {
|
|
// Simulation de vérification d'authentification
|
|
// En production : vérifier le token JWT, SharedPreferences, etc.
|
|
await Future.delayed(const Duration(milliseconds: 500));
|
|
|
|
setState(() {
|
|
_isLoading = false;
|
|
// Pour le moment, toujours false (pas d'utilisateur connecté)
|
|
_isAuthenticated = false;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (_isLoading) {
|
|
return _buildLoadingScreen();
|
|
}
|
|
|
|
if (_isAuthenticated) {
|
|
// TODO: Retourner vers la navigation principale
|
|
return _buildLoadingScreen(); // Temporaire
|
|
} else {
|
|
return const WelcomeScreen();
|
|
}
|
|
}
|
|
|
|
Widget _buildLoadingScreen() {
|
|
return Scaffold(
|
|
body: Container(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
AppTheme.primaryColor,
|
|
AppTheme.primaryDark,
|
|
],
|
|
),
|
|
),
|
|
child: const Center(
|
|
child: CircularProgressIndicator(
|
|
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |