feat: implement event creation flow and management widgets with preparation tracking buttons
This commit is contained in:
+18
-4
@@ -262,11 +262,18 @@ class _EventPreparationButtonsState extends State<EventPreparationButtons> {
|
||||
);
|
||||
|
||||
if (confirm == true && context.mounted) {
|
||||
// Utiliser le rootNavigator pour s'assurer qu'on gère la bonne pile de navigation
|
||||
final navigator = Navigator.of(context, rootNavigator: true);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
useRootNavigator: true,
|
||||
builder: (BuildContext dialogContext) {
|
||||
return const PopScope(
|
||||
canPop: false,
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -277,15 +284,21 @@ class _EventPreparationButtonsState extends State<EventPreparationButtons> {
|
||||
'targetStep': selectedStep,
|
||||
});
|
||||
|
||||
// Attendre un tout petit peu pour s'assurer que le showDialog a eu le temps
|
||||
// de faire son animation d'entrée si l'API a répondu trop vite.
|
||||
await Future.delayed(const Duration(milliseconds: 200));
|
||||
|
||||
if (context.mounted) {
|
||||
final eventProvider = Provider.of<EventProvider>(context, listen: false);
|
||||
final userProvider = Provider.of<LocalUserProvider>(context, listen: false);
|
||||
if (userProvider.currentUser != null) {
|
||||
await eventProvider.refreshEvents(userProvider.currentUser!.uid);
|
||||
}
|
||||
}
|
||||
|
||||
Navigator.of(context).pop(); // Fermer le loader
|
||||
navigator.pop(); // Fermer le loader
|
||||
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Retour en arrière effectué avec succès'),
|
||||
@@ -294,8 +307,9 @@ class _EventPreparationButtonsState extends State<EventPreparationButtons> {
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
navigator.pop(); // Fermer le loader
|
||||
|
||||
if (context.mounted) {
|
||||
Navigator.of(context).pop(); // Fermer le loader
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Erreur : $e'),
|
||||
|
||||
Reference in New Issue
Block a user