Alert class
A status banner — constant bg-surface with a status-colored indicator and
Title. Mirrors (no solid/soft/outline variants; the status color
only tints the indicator + title via *-soft-foreground).
The action renders inline under the description on touch devices and as a trailing row sibling on desktop; onClose appends a close button.
Alert(
color: ColorRoleToken.danger,
leading: const CloseIcon(),
title: const Text('Upload failed'),
description: const Text('Check your connection and retry.'),
action: Button(child: const Text('Retry'), onPressed: retry),
)
- Inheritance
Constructors
- Alert({Key? key, required Widget title, Widget? description, Widget? leading, Widget? action, VoidCallback? onClose, ColorRoleToken color = ColorRoleToken.default_, RadiusToken? radius})
-
Creates an alert.
const
Properties
- action → Widget?
-
Trailing action slot — the demo's action buttons render as a flex-row
sibling of the content on desktop, and inline below the description on
Touch (
sm:hidden/sm:blockresponsive split in the demo).final - color → ColorRoleToken
-
Color role that tints the title and the leading widget.
final
- description → Widget?
-
Muted secondary line.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leading → Widget?
-
Status icon before the text (16px, status-colored).
final
- onClose → VoidCallback?
-
Called when the close button is tapped. The close button is only shown when this is set.
final
- radius → RadiusToken?
-
Corner radius token. Defaults to
SurfaceDefaults.radius, then RadiusToken.r2xl.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- title → Widget
-
Primary message, tinted by the status color.
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