ElegantNotification class

Inheritance

Constructors

ElegantNotification({Key? key, Widget? title, required Widget description, required Widget? icon, Color shadowColor = Colors.grey, Color background = Colors.white, double radius = 5.0, bool enableShadow = true, bool showProgressIndicator = true, Widget closeButton(void dismissNotification())?, Color progressIndicatorColor = Colors.blue, Duration toastDuration = const Duration(milliseconds: 3000), bool displayCloseButton = true, void onCloseButtonPressed()?, void onProgressFinished()?, Alignment position = Alignment.topRight, AnimationType animation = AnimationType.fromRight, Duration animationDuration = const Duration(milliseconds: 600), double iconSize = defaultIconSize, Widget? action, dynamic onActionPressed()?, bool autoDismiss = true, double? height, double? width, double? progressBarHeight, double? progressBarWidth, EdgeInsetsGeometry? progressBarPadding, dynamic onDismiss()?, bool isDismissible = true, DismissDirection dismissDirection = DismissDirection.horizontal, Color progressIndicatorBackground = greyColor, void onNotificationPressed()?})
ElegantNotification.error({Key? key, Widget? title, required Widget description, Color background = Colors.white, Widget closeButton(void dismissNotification())?, Duration toastDuration = const Duration(milliseconds: 3000), bool displayCloseButton = true, void onCloseButtonPressed()?, void onProgressFinished()?, double iconSize = defaultIconSize, Alignment position = Alignment.topRight, AnimationType animation = AnimationType.fromRight, Duration animationDuration = const Duration(milliseconds: 600), bool showProgressIndicator = true, Widget? action, dynamic onActionPressed()?, bool autoDismiss = true, double? height, double? width, double? progressBarHeight, double? progressBarWidth, EdgeInsetsGeometry? progressBarPadding, dynamic onDismiss()?, bool isDismissible = true, DismissDirection dismissDirection = DismissDirection.horizontal, Color progressIndicatorBackground = greyColor, void onNotificationPressed()?})
ElegantNotification.info({Key? key, Widget? title, required Widget description, Color background = Colors.white, Widget closeButton(void dismissNotification())?, Duration toastDuration = const Duration(milliseconds: 3000), bool displayCloseButton = true, void onCloseButtonPressed()?, void onProgressFinished()?, double iconSize = defaultIconSize, Alignment position = Alignment.topRight, AnimationType animation = AnimationType.fromRight, Duration animationDuration = const Duration(milliseconds: 600), bool showProgressIndicator = true, Widget? action, dynamic onActionPressed()?, bool autoDismiss = true, double? height, double? width, double? progressBarHeight, double? progressBarWidth, EdgeInsetsGeometry? progressBarPadding, dynamic onDismiss()?, bool isDismissible = true, DismissDirection dismissDirection = DismissDirection.horizontal, Color progressIndicatorBackground = greyColor, void onNotificationPressed()?})
ElegantNotification.success({Key? key, Widget? title, required Widget description, Color background = Colors.white, Widget closeButton(void dismissNotification())?, Duration toastDuration = const Duration(milliseconds: 3000), bool displayCloseButton = true, void onCloseButtonPressed()?, void onProgressFinished()?, double iconSize = defaultIconSize, Alignment position = Alignment.topRight, AnimationType animation = AnimationType.fromRight, Duration animationDuration = const Duration(milliseconds: 600), bool showProgressIndicator = true, Widget? action, dynamic onActionPressed()?, bool autoDismiss = true, double? height, double? width, double? progressBarHeight, double? progressBarWidth, EdgeInsetsGeometry? progressBarPadding, dynamic onDismiss()?, bool isDismissible = true, DismissDirection dismissDirection = DismissDirection.horizontal, Color progressIndicatorBackground = greyColor, void onNotificationPressed()?})

Properties

action Widget?
Action widget rendered with clickable inkwell by default action == null
final
animation AnimationType
The type of the animation set on the notification possible values
final
animationDuration Duration
The duration of the animation Default value Duration(milliseconds: 600)
final
autoDismiss bool
define whether the notification will be dismissed automatically or not by default autoDimiss == false
final
background Color
the background color of the notification by default it's set to white for types constructors (Success, Info, Delete) this parameter is unchangeable
getter/setter pair
closeButton → (Widget Function(void dismissNotification())?)
Close widget rendered as the close function by default the close button is displayed, if you don't want it set closeButton to null for types constructors (Success, Info, Delete) this parameter is unchangeable
final
description Widget
The toast description widget
final
dismissDirection DismissDirection
The direction of the dismissible widget by default it's DismissDirection.horizontal
final
displayCloseButton bool
Display or hide the close button by default the close button is displayed for types constructors (Success, Info, Delete) this parameter is unchangeable
final
enableShadow bool
enable or disable the shadow rendering by default it's true for types constructors (Success, Info, Delete) this parameter is unchangeable
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
height double?
the height of the notification widget
final
icon Widget?
The toast icon, required only if using the default constructor for other toast types (Success, Info, error) the icon is not changeable
getter/setter pair
iconSize double
The size of the icon, by default it's 20px
final
isDismissible bool
If the notification is dismissible or not by default it's true
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
notificationType NotificationType
The type of the notification, will be set automatically on every constructor possible values
getter/setter pair
onActionPressed → (dynamic Function()?)
Function invoked when pressing action widget must be not null when action != null
final
onCloseButtonPressed → (void Function()?)
Function invoked when user press on the close button
final
onDismiss → (dynamic Function()?)
Function invoked when tapping outside the notification Or when pressing the back button of the phone or when tapping on the screen
final
onNotificationPressed → (void Function()?)
Function invoked when the user taps on the notification
final
onProgressFinished → (void Function()?)
Function invoked when the notification is closed after the finish of the progress indicator
final
overlayEntry OverlayEntry?
getter/setter pair
position Alignment
The notification position in the screen by default the position is set to Alignment.topRight
final
progressBarHeight double?
progress bar indicator height, by default it's null so it takes the widget's height
final
progressBarPadding EdgeInsetsGeometry?
progress bar indicator padding constraints
final
progressBarWidth double?
progress bar indicator width, by default it's null so it takes the widget's width
final
progressIndicatorBackground Color
The progress indicator background color by default it's grey
final
progressIndicatorColor Color
The color of the progress by default it's blue for types constructors (Success, Info, Delete) this parameter is unchangeable
getter/setter pair
radius double
the border radius of the notification widget this parameter it's only set if you are using the default constructor for types constructors (Success, Info, Delete) this parameter is unchangeable
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shadowColor Color
The shadow color applied on the notification widget by defualt it's Colors.grey for types constructors (Success, Info, Delete) this parameter is unchangeable
getter/setter pair
showProgressIndicator bool
enable or disable the progress indicator rendering by default the indicator is displayed for types constructors (Success, Info, Delete) this parameter is unchangeable
getter/setter pair
title Widget?
The toast title widget
final
toastDuration Duration
How much the notification will take time, by default the duration is 3000 milliseconds
final
width double?
the width of the notification widget
final

Methods

checkAssertions() → void
Checks assertions for various constructors of this package
closeOverlay() → void
createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() ElegantNotificationState
Creates the mutable state for this widget at a given location in the tree.
override
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
dismiss() Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
show(BuildContext context) → void
display the notification on the screen context the context of the application
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}) 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