AuiAvatar class

A flexible avatar widget that displays a network image, derived initials, or a person-icon fallback — with optional badge, border, and tap handling.

Example:

AuiAvatar(
  imageUrl: 'https://i.pravatar.cc/150?img=3',
  name: 'Jane Doe',
  size: 48,
)
Inheritance

Constructors

AuiAvatar({Key? key, String? imageUrl, String? name, double size = 40.0, Color? backgroundColor, Color? foregroundColor, AvatarShape shape = AvatarShape.circle, Widget? badge, VoidCallback? onTap, Color? borderColor, double borderWidth = 0})
Creates an AuiAvatar.
const
AuiAvatar.large({Key? key, String? imageUrl, String? name, Color? backgroundColor, Color? foregroundColor, AvatarShape shape = AvatarShape.circle, Widget? badge, VoidCallback? onTap, Color? borderColor, double borderWidth = 0})
Creates a large avatar with size 56.
const
AuiAvatar.small({Key? key, String? imageUrl, String? name, Color? backgroundColor, Color? foregroundColor, AvatarShape shape = AvatarShape.circle, Widget? badge, VoidCallback? onTap, Color? borderColor, double borderWidth = 0})
Creates a small avatar with size 28.
const
AuiAvatar.xl({Key? key, String? imageUrl, String? name, Color? backgroundColor, Color? foregroundColor, AvatarShape shape = AvatarShape.circle, Widget? badge, VoidCallback? onTap, Color? borderColor, double borderWidth = 0})
Creates an extra-large avatar with size 80.
const

Properties

backgroundColor Color?
Background fill color. When null, a deterministic color is derived from name (or a neutral grey is used when both are absent).
final
badge Widget?
An optional widget overlaid at the bottom-right of the avatar (e.g. a status dot or a notification badge).
final
borderColor Color?
Color of the border drawn around the avatar. Only visible when borderWidth is greater than zero.
final
borderWidth double
Width of the border in logical pixels. Defaults to 0 (no border).
final
foregroundColor Color?
Color of the initials text or person icon. Defaults to white when null.
final
hashCode int
The hash code for this object.
no setterinherited
imageUrl String?
Optional network image URL. When provided, the image is loaded from the network; if it fails to load, initials (or the person icon) are shown.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
name String?
Optional name used to generate up to two initials when imageUrl is absent or fails. E.g. "John Doe""JD", "Alice""A".
final
onTap VoidCallback?
Called when the user taps the avatar. When null the avatar is not interactive.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape AvatarShape
Whether the avatar is AvatarShape.circle or AvatarShape.square. Defaults to AvatarShape.circle.
final
size double
Diameter of the avatar in logical pixels. Defaults to 40.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