feat(frontend): improve application feedback messages
This commit is contained in:
@@ -6,6 +6,7 @@ import "../models/materiel_item.dart";
|
||||
import "../services/materiel_service.dart";
|
||||
import "../widgets/ensup_top_bar.dart";
|
||||
import "../widgets/brand_corners.dart";
|
||||
import "../widgets/app_message.dart";
|
||||
import "../widgets/materiel_card.dart";
|
||||
import "detail_screen.dart";
|
||||
|
||||
@@ -65,9 +66,7 @@ class _CatalogueScreenState extends State<CatalogueScreen> {
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _selectionEnCoursId = null);
|
||||
|
||||
@@ -7,6 +7,7 @@ import "../services/emprunt_service.dart";
|
||||
import "../widgets/ensup_top_bar.dart";
|
||||
import "../widgets/brand_corners.dart";
|
||||
import "../widgets/etat_checklist.dart";
|
||||
import "../widgets/app_message.dart";
|
||||
import "confirmation_screen.dart";
|
||||
|
||||
class ChecklistDepartScreen extends StatefulWidget {
|
||||
@@ -77,9 +78,7 @@ class _ChecklistDepartScreenState extends State<ChecklistDepartScreen> {
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _envoiEnCours = false);
|
||||
|
||||
@@ -9,6 +9,7 @@ import "../services/emprunt_service.dart";
|
||||
import "../widgets/ensup_top_bar.dart";
|
||||
import "../widgets/brand_corners.dart";
|
||||
import "../widgets/etat_checklist.dart";
|
||||
import "../widgets/app_message.dart";
|
||||
import "resultat_retour_screen.dart";
|
||||
|
||||
class ChecklistRetourScreen extends StatefulWidget {
|
||||
@@ -114,9 +115,7 @@ class _ChecklistRetourScreenState extends State<ChecklistRetourScreen> {
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _envoiEnCours = false);
|
||||
@@ -142,19 +141,15 @@ class _ChecklistRetourScreenState extends State<ChecklistRetourScreen> {
|
||||
etatDemande: _etatApi(etat),
|
||||
);
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
"Le responsable a été alerté de cette tentative de modification.",
|
||||
),
|
||||
),
|
||||
AppMessage.alerte(
|
||||
context,
|
||||
"Le responsable a été alerté de cette tentative de modification.",
|
||||
titre: "Changement signalé",
|
||||
);
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
setState(() => _alerteEnvoyee = false);
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _alerteEnCours = false);
|
||||
|
||||
@@ -3,6 +3,7 @@ import "package:google_fonts/google_fonts.dart";
|
||||
import "../demo_identity.dart";
|
||||
import "../services/auth_service.dart";
|
||||
import "../theme/ensup_colors.dart";
|
||||
import "../widgets/app_message.dart";
|
||||
import "../widgets/ensup_top_bar.dart";
|
||||
import "../widgets/profile_card.dart";
|
||||
import "../widgets/action_card.dart";
|
||||
@@ -22,9 +23,7 @@ class HomeScreen extends StatelessWidget {
|
||||
}
|
||||
} catch (error) {
|
||||
if (!context.mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import "../demo_identity.dart";
|
||||
import "../services/api_client.dart";
|
||||
import "../services/auth_service.dart";
|
||||
import "../theme/ensup_colors.dart";
|
||||
import "../widgets/app_message.dart";
|
||||
import "../widgets/ensup_top_bar.dart";
|
||||
import "../widgets/identification_option.dart";
|
||||
import "../widgets/brand_corners.dart";
|
||||
@@ -72,10 +73,10 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
}
|
||||
} catch (_) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text("La session Microsoft doit etre renouvelee."),
|
||||
),
|
||||
AppMessage.alerte(
|
||||
context,
|
||||
"La session Microsoft doit être renouvelée.",
|
||||
titre: "Session expirée",
|
||||
);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
@@ -87,12 +88,10 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
Future<void> _identifierParQr() async {
|
||||
if (_connexionEnCours) return;
|
||||
if (AuthService.mode == AuthenticationMode.azure) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
"L'identification QR securisee n'est pas encore configuree.",
|
||||
),
|
||||
),
|
||||
AppMessage.information(
|
||||
context,
|
||||
"L'identification QR sécurisée n'est pas encore configurée.",
|
||||
titre: "QR code indisponible",
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -121,9 +120,7 @@ class _LoginScreenState extends State<LoginScreen> {
|
||||
_ouvrirPourRole(profile.roleCode);
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error, titre: "Connexion impossible");
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _connexionEnCours = false);
|
||||
|
||||
@@ -5,6 +5,7 @@ import "../services/auth_service.dart";
|
||||
import "../services/responsable_service.dart";
|
||||
import "../theme/ensup_colors.dart";
|
||||
import "../utils/file_download.dart";
|
||||
import "../widgets/app_message.dart";
|
||||
|
||||
const _workspaceBackground = Color(0xFFF3F6F9);
|
||||
const _orange = Color(0xFFD97706);
|
||||
@@ -55,9 +56,7 @@ class _ResponsableScreenState extends State<ResponsableScreen> {
|
||||
}
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,12 +72,16 @@ class _ResponsableScreenState extends State<ResponsableScreen> {
|
||||
anomalie["id"] as int,
|
||||
prochain,
|
||||
);
|
||||
if (!mounted) return;
|
||||
AppMessage.succes(
|
||||
context,
|
||||
"L'anomalie est maintenant au statut ${_statusLabel(prochain)}.",
|
||||
titre: "Statut mis à jour",
|
||||
);
|
||||
_rafraichir();
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _transitionEnCours = false);
|
||||
@@ -106,21 +109,17 @@ class _ResponsableScreenState extends State<ResponsableScreen> {
|
||||
statutMateriel: decision.statutMateriel,
|
||||
);
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
decision.decision == "CONFIRMER"
|
||||
? "Le changement a été confirmé et l'anomalie a été créée."
|
||||
: "Le changement a été refusé.",
|
||||
),
|
||||
),
|
||||
AppMessage.succes(
|
||||
context,
|
||||
decision.decision == "CONFIRMER"
|
||||
? "Le changement a été confirmé et l'anomalie a été créée."
|
||||
: "Le changement a été refusé.",
|
||||
titre: "Décision enregistrée",
|
||||
);
|
||||
_rafraichir();
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _decisionEnCours = false);
|
||||
@@ -134,9 +133,7 @@ class _ResponsableScreenState extends State<ResponsableScreen> {
|
||||
_rafraichir();
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,14 +149,14 @@ class _ResponsableScreenState extends State<ResponsableScreen> {
|
||||
contentType: file.contentType,
|
||||
);
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
AppMessage.succes(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text("Export CSV téléchargé.")));
|
||||
"Le fichier d'historique est disponible dans vos téléchargements.",
|
||||
titre: "Export CSV téléchargé",
|
||||
);
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error, titre: "Export impossible");
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _exportEnCours = false);
|
||||
|
||||
@@ -7,6 +7,7 @@ import "../services/emprunt_service.dart";
|
||||
import "../services/materiel_service.dart";
|
||||
import "../widgets/ensup_top_bar.dart";
|
||||
import "../widgets/brand_corners.dart";
|
||||
import "../widgets/app_message.dart";
|
||||
import "checklist_retour_screen.dart";
|
||||
|
||||
/// Sélection de l'emprunt en cours à restituer (RG15 : ses propres emprunts).
|
||||
@@ -50,9 +51,7 @@ class _RestitutionSelectScreenState extends State<RestitutionSelectScreen> {
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(SnackBar(content: Text(error.toString())));
|
||||
AppMessage.erreur(context, error);
|
||||
} finally {
|
||||
if (mounted) {
|
||||
setState(() => _chargementId = null);
|
||||
|
||||
Reference in New Issue
Block a user