SlideOutToast class
A widget that displays a custom toast message with a sliding animation.
The toast slides in from either the top, bottom, left, or right of the screen, depending on the provided ToastPosition and ToastAlignment, and slides out after a specified duration.
The appearance of the toast can be customized using the style, textStyle, textAlign, and type properties. Optionally, you can pass a callback onClose that is invoked when the toast is dismissed.
This widget uses an AnimationController and a CurvedAnimation to handle the sliding animation.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SlideOutToast
Constructors
- SlideOutToast({Key? key, required String message, int duration = 2, required ToastPosition position, required ToastAlignment alignment, required ToastType type, required ToastStyle style, required Curve animationCurve, TextStyle? textStyle, TextAlign? textAlign, VoidCallback? onClose})
-
Creates a SlideOutToast widget.
const
Properties
- alignment → ToastAlignment
-
The alignment where the toast will appear horizontally (left, right, or center).
final
- animationCurve → Curve
-
The animation curve used for the slide transition effect.
final
- duration → int
-
The duration (in seconds) for which the toast will be displayed before sliding out.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- message → String
-
The message to be displayed in the toast.
final
- onClose → VoidCallback?
-
An optional callback that is triggered when the toast is dismissed.
final
- position → ToastPosition
-
The position where the toast will appear on the screen (top or bottom).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → ToastStyle
-
The style of the toast (flat, filled, etc.), which affects the background color.
final
- textAlign → TextAlign?
-
The alignment of the text within the toast.
final
- textStyle → TextStyle?
-
Optional text style for customizing the appearance of the message text.
final
- type → ToastType
-
The type of the toast (success, error, warning, info), which affects its icon and theme.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< SlideOutToast> -
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
-
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