ErrorDisplayWidget class

A reusable widget for displaying error states with consistent styling.

This widget provides a standard way to display errors across the app, including an error icon, message, and optional retry button.

Usage examples:

// Full-size error widget for main content areas
ErrorDisplayWidget(
  message: 'Failed to load data',
  onRetry: () => refreshData(),
)

// Compact error widget for smaller spaces like horizontal lists
ErrorDisplayWidget.compact(
  message: 'Failed to load movies',
  onRetry: () => retryLoad(),
)

// Error widget without retry button
ErrorDisplayWidget(
  message: 'No internet connection',
)
Inheritance

Constructors

ErrorDisplayWidget.new({Key? key, required String message, VoidCallback? onRetry, double iconSize = 48, double textSize = 16, bool isCompact = false})
Creates a new ErrorDisplayWidget.
const
ErrorDisplayWidget.compact({Key? key, required String message, VoidCallback? onRetry})
Creates a compact version of the error widget for smaller spaces.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
iconSize double
Size of the error icon. Defaults to 48.
final
isCompact bool
Whether to show the widget in compact mode (smaller sizes).
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
message String
The error message to display.
final
onRetry VoidCallback?
Optional callback for retry functionality.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textSize double
Size of the error message text. Defaults to 16.
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