Add launch configuration, update API keys, and refactor UI components for better structure and performance
This commit is contained in:
@@ -62,31 +62,39 @@ class _LoginPageState extends State<LoginPage> {
|
||||
_passwordController.text,
|
||||
);
|
||||
|
||||
if (user != null) {
|
||||
// Naviguer vers la page d'accueil
|
||||
Provider.of<UserProvider>(context, listen: false).setCurrentUser(user);
|
||||
Navigator.pushReplacementNamed(context, '/home');
|
||||
} else {
|
||||
// Échec de la connexion
|
||||
_showErrorMessage('Email ou mot de passe incorrect');
|
||||
if (mounted) {
|
||||
if (user != null) {
|
||||
// Naviguer vers la page d'accueil
|
||||
Provider.of<UserProvider>(context, listen: false).setCurrentUser(user);
|
||||
Navigator.pushReplacementNamed(context, '/home');
|
||||
} else {
|
||||
// Échec de la connexion
|
||||
_showErrorMessage('Email ou mot de passe incorrect');
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
_showErrorMessage('Erreur lors de la connexion: ${e.toString()}');
|
||||
if (mounted) {
|
||||
_showErrorMessage('Erreur lors de la connexion: ${e.toString()}');
|
||||
}
|
||||
} finally {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _showErrorMessage(String message) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: Colors.red,
|
||||
duration: Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
backgroundColor: Colors.red,
|
||||
duration: const Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user