SFNotification class

Un widget de notification qui affiche un message important à l'utilisateur.

Cette notification contient une icône, un titre optionnel, un message et un bouton de fermeture. Elle est conçue pour être utilisée dans un contexte d'affichage temporaire d'informations comme des succès, des erreurs, des avertissements ou des informations générales.

Paramètres

  • message - Le texte principal de la notification (obligatoire).
  • iconColor - La couleur de l'icône (obligatoire).
  • title - Un titre optionnel qui apparaît au-dessus du message.
  • icon - L'icône à afficher (par défaut: Icons.check_circle).
  • onClose - Fonction appelée lorsque l'utilisateur ferme la notification.

Exemple d'utilisation

// Notification de succès
SFNotification(
  title: 'Succès',
  message: 'Votre paiement a été traité avec succès.',
  iconColor: Colors.green,
  onClose: () => Navigator.of(context).pop(),
)

// Notification d'erreur
SFNotification(
  title: 'Erreur',
  message: 'Impossible de traiter votre paiement. Veuillez réessayer.',
  icon: Icons.error,
  iconColor: Colors.red,
  onClose: () => Navigator.of(context).pop(),
)

// Notification d'information sans titre
SFNotification(
  message: 'Vos modifications ont été enregistrées.',
  icon: Icons.info,
  iconColor: Colors.blue,
  onClose: () => Navigator.of(context).pop(),
)
Inheritance

Constructors

SFNotification({Key? key, required String message, required Color iconColor, String? title, IconData icon = Icons.check_circle, VoidCallback? onClose})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
icon IconData
final
iconColor Color
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
message String
final
onClose VoidCallback?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
title String?
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited