ShadAlert class
A customizable alert widget that displays a message with optional icon and styling.
The ShadAlert widget can be used to show informational or warning messages to users. It supports two variants: primary (default) and destructive, which can be styled through the ShadTheme. Use the named constructors ShadAlert.destructive or ShadAlert.raw for specific configurations.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ShadAlert
- Available extensions
Constructors
- ShadAlert({Key? key, Widget? icon, Widget? title, Widget? description, TextDirection? textDirection, ShadDecoration? decoration, EdgeInsetsGeometry? iconPadding, Color? iconColor, double? iconSize, TextStyle? titleStyle, TextStyle? descriptionStyle, MainAxisAlignment? mainAxisAlignment, CrossAxisAlignment? crossAxisAlignment, Widget? leading, Widget? trailing, Widget? top, Widget? bottom})
-
Creates a primary variant alert widget.
const
- ShadAlert.destructive({Key? key, Widget? icon, Widget? title, Widget? description, TextDirection? textDirection, ShadDecoration? decoration, EdgeInsetsGeometry? iconPadding, Color? iconColor, double? iconSize, TextStyle? titleStyle, TextStyle? descriptionStyle, MainAxisAlignment? mainAxisAlignment, CrossAxisAlignment? crossAxisAlignment, Widget? leading, Widget? trailing, Widget? top, Widget? bottom})
-
Creates a destructive variant alert widget, typically used for error or
warning messages.
const
- ShadAlert.raw({Key? key, required ShadAlertVariant variant, Widget? icon, Widget? title, Widget? description, TextDirection? textDirection, ShadDecoration? decoration, EdgeInsetsGeometry? iconPadding, Color? iconColor, double? iconSize, TextStyle? titleStyle, TextStyle? descriptionStyle, MainAxisAlignment? mainAxisAlignment, CrossAxisAlignment? crossAxisAlignment, Widget? leading, Widget? trailing, Widget? top, Widget? bottom})
-
Creates a raw alert widget with a specified
variant, allowing full control over configuration.const
Properties
- bottom → Widget?
-
An optional widget to display at the bottom of the alert, below the main
content. This can be used to add additional information or controls.
final
- crossAxisAlignment → CrossAxisAlignment?
-
Cross axis alignment for the alert's content, defaults to start if not
specified. Controls vertical alignment of icon and text content within the
Row.
final
- decoration → ShadDecoration?
-
Custom decoration for the alert, merged with theme defaults if provided.
Allows customization of border, padding, and other visual properties.
final
- description → Widget?
-
The description widget of the alert, typically a Text widget providing
additional details.
Displayed with the style defined by descriptionStyle or theme defaults.
final
- descriptionStyle → TextStyle?
-
Style for the description text, overrides theme default if provided.
Controls font size, weight, color, and other text properties of the
description.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → Widget?
-
A custom widget to use as the alert's icon.
final
- iconColor → Color?
-
Color of the icon, overrides theme default if provided.
Applied to the IconTheme if icon is not null.
final
- iconPadding → EdgeInsetsGeometry?
-
Padding around the icon, defaults to right padding of 12 if not specified.
Controls the spacing between the icon and adjacent content.
final
- iconSize → double?
-
Size of the icon, overrides theme default if provided.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leading → Widget?
-
An optional widget to display at the leading edge of the alert, before the
main content. This can be used to add additional information or controls.
final
- mainAxisAlignment → MainAxisAlignment?
-
Main axis alignment for the alert's content, defaults to start if not
specified. Controls horizontal arrangement of icon and text content within
the Row.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- textDirection → TextDirection?
-
The text direction for the alert's content, overrides the default
direction if specified. Can be set to TextDirection.ltr or
TextDirection.rtl.
final
- title → Widget?
-
The title widget of the alert, typically a Text widget.
Displayed with the style defined by titleStyle or theme defaults.
final
- titleStyle → TextStyle?
-
Style for the title text, overrides theme default if provided.
Controls font size, weight, color, and other text properties of the
title.
final
- top → Widget?
-
An optional widget to display at the top of the alert, above the main
content. This can be used to add additional information or controls.
final
- trailing → Widget?
-
An optional widget to display at the trailing edge of the alert, after the
main content. This can be used to add additional information or controls.
final
- variant → ShadAlertVariant
-
The variant of the alert, either ShadAlertVariant.primary or
ShadAlertVariant.destructive.
Determines the visual style applied through the ShadTheme.
final
Methods
-
animate(
{Key? key, List< Effect> ? effects, AnimateCallback? onInit, AnimateCallback? onPlay, AnimateCallback? onComplete, bool? autoPlay, Duration? delay, AnimationController? controller, Adapter? adapter, double? target, double? value}) → Animate -
Available on Widget, provided by the AnimateWidgetExtensions extension
Wraps the target Widget in an Animate instance, and returns the instance for chaining calls. Ex.myWidget.animate()is equivalent toAnimate(child: myWidget). -
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
-
positionedWith(
ShadPosition position) → Widget -
Available on Widget, provided by the PositionedExt extension
-
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