FossToast class

See the toast documentation ↗ or try it live in the playground ↗.
One transient notification. Enqueue it with showFossToast or a
FossToastController; the surface stays on the popover role for every
variant, which tints only the leading glyph.
Customize globally by passing your own FossThemeData, or per instance
through the widget's style object. There are no per-instance token props:
to change color, radius, or spacing, change the theme.
See also FossToaster, the host that displays toasts, and FossAlert for a persistent inline message.
showFossToast(
context,
const FossToast(variant: FossToastVariant.success, title: Text('Saved')),
);
- Annotations
Constructors
- FossToast({Widget? title, Widget? description, FossToastVariant variant = FossToastVariant.neutral, Widget? icon, Widget? action, Duration? duration, FossToastStyle? style})
-
const
Properties
- action → Widget?
-
An optional trailing action.
final
- description → Widget?
-
The description below the title.
final
- duration → Duration?
-
Overrides the auto-dismiss delay. Ignored for FossToastVariant.loading,
which persists.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → Widget?
-
Overrides the default leading glyph (or the loading spinner). Null hides
the leading slot for FossToastVariant.neutral.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → FossToastStyle?
-
Per-instance visual overrides.
final
- title → Widget?
-
The title line.
final
- variant → FossToastVariant
-
The kind of toast. Defaults to FossToastVariant.neutral.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited