ZdsAvatar class
A circular container used to display a user's profile picture or initials.
When both image and initials are not null, this widget will prioritize showing the image. If both image and initials are null, the widget will show a circle with a plain background using backgroundColor.
It's possible to pass an onTap function that will be called whenever the user taps on the avatar. This is typically used for accessing the user's profile page, or toggling selection in ZdsSelectableListTile.
See also:
- ZdsNetworkAvatar, an avatar that fetches the image from an URL.
- ZdsSelectableListTile, where ZdsAvatar is used as the ZdsSelectableListTile.leading widget.
- ZdsProfile, where ZdsAvatar can be used for ZdsProfile.avatar.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ZdsAvatar
- Implemented types
- Available Extensions
Constructors
Properties
- backgroundColor → Color?
-
The background color of the avatar if initials are used.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- image → Image?
-
An image that will fill the entire avatar. As the avatar is circular, a square image will not get its corners
shown, but the original image will be intact.
final
- initials → String?
-
The user's initials. Typically up to 3 initials are used, although it can be higher if necessary by changing the
textStyle to use a smaller font size and weight.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onTap → VoidCallback?
-
A function called whenever the user taps on the avatar.
final
- preferredSize → Size
-
The size this widget would prefer if it were otherwise unconstrained.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → double?
-
The avatar's size.
final
- textStyle → TextStyle?
-
The textStyle used for the initials, if shown.
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.
override
-
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}) → 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