Avatar class
A compact user/entity avatar component for the Alter Design System.
Figma Specifications (Node 655:11313 - Avatar):
- Variants:
type=Image(655:11312): 32x32px, 12px border radius, fills image with cover fit.type=Placeholder(655:11314): 32x32px, 12px border radius,#FFFFFFbackground, centered 24x24faceicon.
- Dimensions: Default 32x32px,
BorderRadius.circular(12). - Children:
faceicon (Icons.face_5_outlined) or custom widget/image/initials.
- Inheritance
Constructors
-
Avatar({Key? key, AvatarType type = AvatarType.placeholder, ImageProvider<
Object> ? image, String? imageUrl, String? initials, IconData? icon = Icons.face_5_outlined, Widget? iconWidget, double size = 32.0, BorderRadius? borderRadius, Color? backgroundColor, Color? foregroundColor, Color? borderColor, double borderWidth = 1.0, VoidCallback? onTap, String? semanticLabel}) -
Creates an Avatar instance.
const
-
Avatar.image({Key? key, required ImageProvider<
Object> ? image, double size = 32.0, BorderRadius? borderRadius, Color? borderColor, double borderWidth = 1.0, VoidCallback? onTap, String? semanticLabel}) -
Factory for an image-based avatar.
const
- Avatar.initials({Key? key, required String? initials, double size = 32.0, BorderRadius? borderRadius, Color? backgroundColor, Color? foregroundColor, Color? borderColor, double borderWidth = 1.0, VoidCallback? onTap, String? semanticLabel})
-
Factory for an initials-based avatar.
const
- Avatar.network({Key? key, required String url, double size = 32.0, BorderRadius? borderRadius, Color? borderColor, double borderWidth = 1.0, VoidCallback? onTap, String? semanticLabel})
-
Factory for a network image avatar.
const
- Avatar.placeholder({Key? key, IconData? icon = Icons.face_5_outlined, Widget? iconWidget, double size = 32.0, BorderRadius? borderRadius, Color? backgroundColor, Color? foregroundColor, Color? borderColor, double borderWidth = 1.0, VoidCallback? onTap, String? semanticLabel})
-
Factory for a placeholder icon avatar.
const
Properties
- backgroundColor → Color?
-
Background color of the avatar.
final
- borderColor → Color?
-
Optional border outline color.
final
- borderRadius → BorderRadius?
-
Corner border radius of the avatar container.
final
- borderWidth → double
-
Optional border stroke width.
final
- foregroundColor → Color?
-
Foreground icon/initials color.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → IconData?
-
Leading icon for AvatarType.placeholder.
final
- iconWidget → Widget?
-
Custom icon/placeholder widget override.
final
-
image
→ ImageProvider<
Object> ? -
Image provider for AvatarType.image.
final
- imageUrl → String?
-
Convenience URL string for network images.
final
- initials → String?
-
Initials text fallback (e.g. 'RC' or 'JD').
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onTap → VoidCallback?
-
Optional tap callback.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
Semantic accessibility label.
final
- size → double
-
Width and height dimension of the avatar.
final
- type → AvatarType
-
Variant type of the avatar.
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