Toast class

Reusable Toast alert / notification banner component for the Alter Design System.

Figma Specifications (Node 342:12219):

  • Variants:
    • status=Neutral (342:12218): Fill baseBlack (#1E2939), Text & Icon textInverse (#FFFFFF)
    • status=Gray (342:12220): Fill baseGray (#F9FAFB), Border 1px stroke200 (#E5E7EB), Text & Icon textPrimary (#000000)
    • status=White (342:12224): Fill baseWhite (#FFFFFF), Border 1px stroke100 (#F3F4F6), Text & Icon textPrimary (#000000)
    • status=Danger (342:12228): Fill colorsRed800 (#9F0712), Text & Icon textInverse (#FFFFFF)
    • status=Warning (342:12232): Fill statusWarning / colorsOrange800 (#8A2C0D), Text & Icon textInverse (#FFFFFF)
    • status=Caution (342:12236): Fill statusCaution / colorsYellow400 (#FDC700), Text & Icon textPrimary (#000000)
    • status=Success (342:12240): Fill colorsGreen800 (#016630), Text & Icon textInverse (#FFFFFF)
  • Dimensions: Width 320px, Padding 10px vertical, 12px horizontal
  • Border Radius: 16px
  • Gap: 4px between icon and feedback text
  • Icon: 16x16px (default Icons.error_outline)
  • Typography: Body/caption -> AlterTypography.caption (Geist 12px, Regular 400, line-height 16px)
Inheritance

Constructors

Toast({Key? key, String label = 'Feedback Text', ToastStatus status = ToastStatus.neutral, bool hasIcon = true, IconData icon = Icons.error_outline, double? width = 320.0})
Creates a Toast alert instance.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
hasIcon → bool
Whether the leading icon should be rendered.
final
icon → IconData
Icon data for the leading status icon.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → String
Message string displayed in the toast.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
status → ToastStatus
Visual status theme variant of the toast.
final
width → double?
Optional fixed width of the toast (defaults to 320.0).
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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

Constants

version → const String
Component version for reference. v1.0.1: Replaced baseBlack token reference with AlterColors.colorsGray800 swatch. v1.0.0: Initial release matching Figma Node 342:12219.