MotionToast class
Render the motion toast widget
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MotionToast
Constructors
- MotionToast({Key? key, required Widget description, required Color primaryColor, IconData? icon, Widget? title, double? width, double? height, BoxConstraints? constraints, double iconSize = 40, bool enableAnimation = true, ToastOrientation layoutOrientation = ToastOrientation.ltr, AnimationType animationType = AnimationType.fromBottom, Duration animationDuration = const Duration(milliseconds: 1500), Duration toastDuration = const Duration(seconds: 3), Curve animationCurve = Curves.ease, MotionToastPosition position = MotionToastPosition.bottom, double borderRadius = 20, Function? onClose, bool dismissable = true, Color? secondaryColor, BackgroundType backgroundType = BackgroundType.lighter, Color barrierColor = Colors.transparent, EdgeInsets margin = EdgeInsets.zero, bool displayBorder = false, bool displaySideBar = true, EdgeInsets contentPadding = EdgeInsets.zero})
- Used to create a custom motion toast with given icon, description and primaryColor
- MotionToast.delete({Key? key, required Widget description, Widget? title, IconType? iconType = IconType.materialDesign, double? width = 350, double? height = 80, BoxConstraints? constraints, double iconSize = 40, bool enableAnimation = true, ToastOrientation layoutOrientation = ToastOrientation.ltr, AnimationType animationType = AnimationType.fromBottom, Duration animationDuration = const Duration(milliseconds: 1500), Duration toastDuration = const Duration(seconds: 3), Curve animationCurve = Curves.ease, MotionToastPosition position = MotionToastPosition.bottom, double borderRadius = 20, Function? onClose, bool dismissable = true, Color barrierColor = Colors.transparent, EdgeInsets margin = EdgeInsets.zero, bool displayBorder = false, bool displaySideBar = true, EdgeInsets contentPadding = EdgeInsets.zero})
-
Render delete motion toast
primaryColor is set to deleteColor
icon is set to
MOTION_TOAST_ICONS_MD[MOTION_TOAST_TYPE.DELETE]
orMOTION_TOAST_ICONS_CUPERTINO[MOTION_TOAST_TYPE.DELETE]
description is required - MotionToast.error({Key? key, required Widget description, Widget? title, IconType? iconType = IconType.materialDesign, double? width = 350, double? height = 80, BoxConstraints? constraints, double iconSize = 40, bool enableAnimation = true, ToastOrientation layoutOrientation = ToastOrientation.ltr, AnimationType animationType = AnimationType.fromBottom, Duration animationDuration = const Duration(milliseconds: 1500), Duration toastDuration = const Duration(seconds: 3), Curve animationCurve = Curves.ease, MotionToastPosition position = MotionToastPosition.bottom, double borderRadius = 20, Function? onClose, bool dismissable = true, Color barrierColor = Colors.transparent, EdgeInsets margin = EdgeInsets.zero, bool displayBorder = false, bool displaySideBar = true, EdgeInsets contentPadding = EdgeInsets.zero})
-
Render an error motion toast
primaryColor is set to errorColor
icon is set to
MOTION_TOAST_ICONS_MD[MOTION_TOAST_TYPE.ERROR]
orMOTION_TOAST_ICONS_CUPERTINO[MOTION_TOAST_TYPE.ERROR]
description is required - MotionToast.info({Key? key, required Widget description, Widget? title, IconType? iconType = IconType.materialDesign, double? width = 350, double? height = 80, BoxConstraints? constraints, double iconSize = 40, bool enableAnimation = true, ToastOrientation layoutOrientation = ToastOrientation.ltr, AnimationType animationType = AnimationType.fromBottom, Duration animationDuration = const Duration(milliseconds: 1500), Duration toastDuration = const Duration(seconds: 3), Curve animationCurve = Curves.ease, MotionToastPosition position = MotionToastPosition.bottom, double borderRadius = 20, Function? onClose, bool dismissable = true, Color barrierColor = Colors.transparent, EdgeInsets margin = EdgeInsets.zero, bool displayBorder = false, bool displaySideBar = true, EdgeInsets contentPadding = EdgeInsets.zero})
-
Render Info motion toast
primaryColor is set to infoColor
icon is set to
MOTION_TOAST_ICONS_MD[MOTION_TOAST_TYPE.INFO]
orMOTION_TOAST_ICONS_CUPERTINO[MOTION_TOAST_TYPE.INFO]
description is required - MotionToast.success({Key? key, required Widget description, Widget? title, IconType? iconType = IconType.materialDesign, double? width, double? height, BoxConstraints? constraints, double iconSize = 40, bool enableAnimation = true, ToastOrientation layoutOrientation = ToastOrientation.ltr, AnimationType animationType = AnimationType.fromBottom, Duration animationDuration = const Duration(milliseconds: 1500), Duration toastDuration = const Duration(seconds: 3), Curve animationCurve = Curves.ease, MotionToastPosition position = MotionToastPosition.bottom, double borderRadius = 20, Function? onClose, bool dismissable = true, Color barrierColor = Colors.transparent, EdgeInsets margin = EdgeInsets.zero, bool displayBorder = false, bool displaySideBar = true, EdgeInsets contentPadding = EdgeInsets.zero})
-
Render a success motion toast
primaryColor is set to successColor
icon is set to
MOTION_TOAST_ICONS_MD[MOTION_TOAST_TYPE.SUCCESS]
orMOTION_TOAST_ICONS_CUPERTINO[MOTION_TOAST_TYPE.SUCCESS]
description is required - MotionToast.warning({Key? key, required Widget description, Widget? title, IconType? iconType = IconType.materialDesign, double? width = 350, double? height = 80, BoxConstraints? constraints, double iconSize = 40, bool enableAnimation = true, ToastOrientation layoutOrientation = ToastOrientation.ltr, AnimationType animationType = AnimationType.fromBottom, Duration animationDuration = const Duration(milliseconds: 1500), Duration toastDuration = const Duration(seconds: 3), Curve animationCurve = Curves.ease, MotionToastPosition position = MotionToastPosition.bottom, double borderRadius = 20, Function? onClose, bool dismissable = true, Color barrierColor = Colors.transparent, EdgeInsets margin = EdgeInsets.zero, bool displayBorder = false, bool displaySideBar = true, EdgeInsets contentPadding = EdgeInsets.zero})
-
Render a warning motion toast
primaryColor is set to warningColor
icon is set to
MOTION_TOAST_ICONS_MD[MOTION_TOAST_TYPE.WARNING]
orMOTION_TOAST_ICONS_CUPERTINO[MOTION_TOAST_TYPE.WARNING]
description is required
Properties
- animationCurve → Curve
-
The toast animation curve
by default it's
Curves.ease
final - animationDuration → Duration
-
the Duration of the toast animation
by default it's 1.5 seconds
final
- animationType ↔ AnimationType
-
The type of animation, by default it's AnimationType.fromBottom
getter/setter pair
- backgroundType ↔ BackgroundType
-
the type of the background that will be applied on the motion toast content
available values:
latefinal
- barrierColor → Color
-
The barrier color applied to the dialog display
by default the barrier is transparent Colors.transparent
final
- borderRadius → double
-
Define the border radius of the toast
by default it's 20
final
- constraints → BoxConstraints?
-
The constraint of the motion toast to size itself to the content
for responsive design
If it's
null
, then width and height will be used as it is.final - contentPadding → EdgeInsets
-
padding added under the main widget
by default the padding is set to 0
final
-
currentWidgetState
↔ State<
MotionToast> -
getter/setter pair
- description → Widget
-
the text widget used for description message
final
- dismissable → bool
-
define whether the motion toast can be dismissed or not
applied on bottom motion toast
final
- displayBorder → bool
-
define whether the borders are rendered or not
by default
= false
final - displaySideBar → bool
-
define whether the side bar is displayed or not
default
= true
final - enableAnimation → bool
-
disable or enable the heartbeat animation on the icon
by default the animation is enabled
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double?
-
define the height of the motion toast
final
- icon ↔ IconData?
-
The motion toast icon, for types other than custom
the icon will get the default type icon
latefinal
- iconSize → double
-
the motion toast icon size
by default it's 40
final
- iconType ↔ IconType?
-
The design type icon (Material design or Cupertino)
if motionToastType set to
MOTION_TOAST_TYPE.CUSTOM
iconType will not be used possible valueslatefinal - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- layoutOrientation → ToastOrientation
-
The layout ToastOrientation (from right to left or from left to right)
final
- margin → EdgeInsets
-
padding added to the main widget motion taost
by default the padding is set to 0
final
- motionToastType ↔ MotionToastType
-
The motion toast type possible values:
latefinal
- onClose → Function?
-
Function invoked when the toast is closed
final
- overlayEntry ↔ OverlayEntry?
-
getter/setter pair
- position → MotionToastPosition
-
The position where the motion toast will be displayed
possible values
final
- primaryColor ↔ Color
-
The motion toast background color
if
motionToastType == MOTION_TOAST_TYPE.CUSTOM
color parameter is required else the color will get the default type color from motionToastColorslatefinal - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- secondaryColor ↔ Color?
-
Color applied on the motion toast side widget (sidebar) and the icon
if it's null secondary color will be the primary color
can be customized when using the default constructor
latefinal
- title → Widget?
-
The title of the motion toast
if it's null it will not be rendered in the widget
final
- toastDuration → Duration
-
How long the toast will be shown
by default it's 3 seconds.
final
- width → double?
-
The motion toast width by default it's set to 250
final
Methods
-
closeOverlay(
) → void -
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< MotionToast> -
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
show(
BuildContext context) → void -
Display the created motion toast based on the position attribute
context
: the actual 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
Static Methods
-
of(
BuildContext context) → _MotionToastState?