ZdsNetworkAvatar class
A circular container used to display a user's profile picture fetched from the internet.
This widget will prioritize showing the image fetched from url. If an image can't be loaded, the avatar will show a circle with a plain background using backgroundColor and the user's initials.
The image fetched from url is not loaded again every time, but is rather cached to reduce network usage.
See also:
- ZdsAvatar, an avatar used to display an image that is stored locally, or just the initials.
- CachedNetworkImage, which this avatar uses to not have to download the image every time.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ZdsNetworkAvatar
- Implemented types
- Available Extensions
Constructors
-
ZdsNetworkAvatar({required String initials, String url = '', VoidCallback? onTap, double? size, TextStyle? textStyle, Color? backgroundColor, String? semanticLabelAvatarDescription, String? imgCacheKey, Map<
String, String> ? headers, BoxFit? fit, Key? key}) -
An avatar that gets its image from an URL.
const
Properties
- backgroundColor → Color?
-
The background color of this avatar if the initials are shown.
final
- fit → BoxFit?
-
How to inscribe the image into the space allocated during layout.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
headers
→ Map<
String, String> ? -
Optional headers for the http request of the image url.
final
- imgCacheKey → String?
-
It the key which will be used in the CachedNetworkImage as cachekey for refreshing image.
final
- initials → String
-
Fallback text shown while the image is loading, or if the image couldn't be loaded.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onTap → VoidCallback?
-
A function called whenever the user taps on this 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
- semanticLabelAvatarDescription → String?
-
Semantic label for description of image
final
- size → double?
-
The avatar's size.
final
- textStyle → TextStyle?
-
The textStyle used for the initials, if shown.
final
- url → String
-
The URL from which to fetch the image.
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