CherryToast class
Constructors
-
CherryToast({Key? key, Text? title, required IconData icon, required Color themeColor, Color iconColor = Colors.black, Text? action, Color backgroundColor = defaultBackgroundColor, Color shadowColor = defaultShadowColor, Function? actionHandler, Text? description, Widget? iconWidget, Position toastPosition = Position.top, Duration animationDuration = const Duration(milliseconds: 1500), Cubic animationCurve = Curves.ease, AnimationType animationType = AnimationType.fromLeft, bool autoDismiss = true, Duration toastDuration = const Duration(milliseconds: 3000), ToastLayout layout = ToastLayout.ltr, bool displayCloseButton = true, double borderRadius = 20, bool displayIcon = true, bool enableIconAnimation = true, double iconSize = 20, double? height, double? width, BoxConstraints? constraints, bool disableToastAnimation = false, bool inheritThemeColors = false, dynamic onToastClosed()?})
-
-
CherryToast.error({Key? key, Text? title, Text? action, Function? actionHandler, Color backgroundColor = defaultBackgroundColor, Color shadowColor = defaultShadowColor, Text? description, Position toastPosition = Position.top, Duration animationDuration = const Duration(milliseconds: 1500), Cubic animationCurve = Curves.ease, AnimationType animationType = AnimationType.fromLeft, bool autoDismiss = true, Widget? iconWidget, Duration toastDuration = const Duration(milliseconds: 3000), ToastLayout layout = ToastLayout.ltr, bool displayCloseButton = true, double borderRadius = 20, bool displayIcon = true, bool enableIconAnimation = true, double? height, double? width, BoxConstraints? constraints, bool disableToastAnimation = false, bool inheritThemeColors = false, dynamic onToastClosed()?})
-
-
CherryToast.info({Key? key, Text? title, Text? action, Function? actionHandler, Text? description, Color backgroundColor = defaultBackgroundColor, Color shadowColor = defaultShadowColor, Position toastPosition = Position.top, Duration animationDuration = const Duration(milliseconds: 1500), Cubic animationCurve = Curves.ease, AnimationType animationType = AnimationType.fromLeft, bool autoDismiss = true, Duration toastDuration = const Duration(milliseconds: 3000), ToastLayout layout = ToastLayout.ltr, bool displayCloseButton = true, double borderRadius = 20, bool displayIcon = true, bool enableIconAnimation = true, Widget? iconWidget, double? height, double? width, BoxConstraints? constraints, bool disableToastAnimation = false, bool inheritThemeColors = false, dynamic onToastClosed()?})
-
-
CherryToast.success({Key? key, Text? title, Text? action, Function? actionHandler, Text? description, Color backgroundColor = defaultBackgroundColor, Color shadowColor = defaultShadowColor, Position toastPosition = Position.top, Duration animationDuration = const Duration(milliseconds: 1500), Cubic animationCurve = Curves.ease, AnimationType animationType = AnimationType.fromLeft, bool autoDismiss = true, Duration toastDuration = const Duration(milliseconds: 3000), ToastLayout layout = ToastLayout.ltr, bool displayCloseButton = true, double borderRadius = 20, Widget? iconWidget, bool displayIcon = true, bool enableIconAnimation = true, double? height, double? width, BoxConstraints? constraints, bool disableToastAnimation = false, bool inheritThemeColors = false, dynamic onToastClosed()?})
-
-
CherryToast.warning({Key? key, Text? title, Text? action, Function? actionHandler, Text? description, Color backgroundColor = defaultBackgroundColor, Color shadowColor = defaultShadowColor, Position toastPosition = Position.top, Duration animationDuration = const Duration(milliseconds: 1500), Cubic animationCurve = Curves.ease, AnimationType animationType = AnimationType.fromLeft, bool autoDismiss = true, Duration toastDuration = const Duration(milliseconds: 3000), ToastLayout layout = ToastLayout.ltr, bool displayCloseButton = true, double borderRadius = 20, Widget? iconWidget, bool displayIcon = true, bool enableIconAnimation = true, double? height, double? width, BoxConstraints? constraints, bool disableToastAnimation = false, bool inheritThemeColors = false, dynamic onToastClosed()?})
-
Properties
-
action
→ Text?
-
THe action button displayed below description
by default there's no action added
final
-
actionHandler
→ Function?
-
the function invoked when clicking on the action button
final
-
animationCurve
→ Cubic
-
the animation curve by default it's set to
Curves.ease
final
-
animationDuration
→ Duration
-
The duration of the animation by default it's 1.5 seconds
final
-
animationType
→ AnimationType
-
The animation type applied on the toast
final
-
autoDismiss
→ bool
-
indicates whether the toast will be hidden automatically or not
final
-
backgroundColor
→ Color
-
final
-
borderRadius
→ double
-
define the border radius applied on the toast
by default it's 20
final
-
constraints
→ BoxConstraints?
-
Enable taost constraints customization (by default it's null)
final
-
description
→ Text?
-
Text widget displayed as a description in the toast
final
-
disableToastAnimation
→ bool
-
indicate whether the toast animation is enabled or not
by default the toast animation is enabled
final
-
displayCloseButton
→ bool
-
Display / Hide the close button icon
by default it's true
final
-
displayIcon
→ bool
-
Define whether the icon will be rendered or not
final
-
enableIconAnimation
→ bool
-
Define wether the animation on the icon will be rendered or not
final
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
height
→ double?
-
The attribute is declaring a final variable named "height" of type double with a nullable type
modifier.
height attribute define the toast height
final
-
icon
↔ IconData
-
the toast icon, it's required when using the default constructor
getter/setter pair
-
iconColor
↔ Color
-
the Icon color
this parameter is only available on the default constructor
for the built-in themes the color will be set automatically
getter/setter pair
-
iconSize
↔ double
-
the icon size
by default is 20
this parameter is available in default constructor
getter/setter pair
-
iconWidget
→ Widget?
-
final
-
inheritThemeColors
→ bool
-
Indicate toast should inherit theme colors sheme, to apply in background
and shadow color.
final
-
key
→ Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
layout
→ ToastLayout
-
the layout of the toast
final
-
onToastClosed
→ (dynamic Function()?)
-
Callback invoked when toast get dismissed (closed by button or dismissed automtically)
final
-
overlayEntry
↔ OverlayEntry?
-
getter/setter pair
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
-
shadowColor
→ Color
-
final
-
themeColor
↔ Color
-
The color that will be applied on the circle behind the icon
for better rendering the action button must have the same color
getter/setter pair
-
title
→ Text?
-
Text widget displayed as a title in the toast
required parameter for all toast types
final
-
toastDuration
→ Duration
-
the duration of the toast if autoDismiss is true
by default it's 3 seconds
final
-
toastPosition
→ Position
-
the toast display postion, possible values
final
-
width
→ double?
-
The attribute is declaring a final variable named "width" of type double with a nullable value.
width attribute define the toast width
final