VAvatar class

A versatile avatar widget that can display an image, an icon, or fallback text. The VAvatar widget is designed to provide a consistent avatar display across the application, with support for different sizes and content types.

The avatar will prioritize displaying an image if provided, then an icon, and finally fallback text if neither an image nor an icon is available.

The size of the avatar can be customized through the size parameter, which defaults to 40 pixels.

Example Usage

// Displaying an avatar with an image
VAvatar(image: NetworkImage('https://example.com/avatar.png'));
// Displaying an avatar with an icon
VAvatar(icon: Icons.person);
// Displaying an avatar with fallback text
VAvatar(text: 'AB');

This widget is built on top of the FAvatar component from the ForUI library, providing additional flexibility for different avatar content types while maintaining a consistent design language throughout the app.

Inheritance

Constructors

VAvatar({Key? key, ImageProvider<Object>? image, IconData? icon, String? text, double size = 40})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
icon IconData?
final
image ImageProvider<Object>?
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size double
final
text String?
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