AvatarWidget class
A customizable avatar widget that adapts to different content types.
Supports network images, local image providers, text initials, and icons. Can be displayed in circle or square shapes with multiple size options.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- AvatarWidget
- Available extensions
Constructors
-
AvatarWidget({String? imageUrl, ImageProvider<
Object> ? imageProvider, String? text, IconData? icon, AvatarSize size = AvatarSize.medium, AvatarShape shape = AvatarShape.circle, Color? backgroundColor, Color? foregroundColor, VoidCallback? onTap, Key? key}) -
Creates an AvatarWidget.
const
Properties
- backgroundColor → Color?
-
The background color of the avatar.
final
- foregroundColor → Color?
-
The color of the text or icon.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- icon → IconData?
-
The icon to display if no image or text is provided.
final
-
imageProvider
→ ImageProvider<
Object> ? -
The image provider for the avatar image.
final
- imageUrl → String?
-
The URL of the network image to display.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onTap → VoidCallback?
-
Optional callback when the avatar is tapped.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shape → AvatarShape
-
The shape of the avatar (circle or square).
final
- size → AvatarSize
-
The size of the avatar.
final
- text → String?
-
The text to display as initials if no image is provided.
final
Methods
-
absorbPointer(
[bool absorbing = true]) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with AbsorbPointer -
align(
{AlignmentGeometry alignment = Alignment.center, double? widthFactor, double? heightFactor}) → Widget -
Available on Widget, provided by the WidgetLayoutExtensions extension
Wraps widget with Align -
animatedColor(
{required Color color, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut, BlendMode blendMode = BlendMode.srcATop}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with an animated color overlay. -
animatedRotate(
{double turns = 0.0, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut, Alignment alignment = Alignment.center}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with an animated rotation. -
animatedScale(
{double scale = 1.0, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut, Alignment alignment = Alignment.center}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with an animated scale. -
animatedSize(
{Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut, Alignment alignment = Alignment.center, Clip clipBehavior = Clip.hardEdge}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with an animated size. -
aspectRatio(
double aspectRatio) → Widget -
Available on Widget, provided by the WidgetLayoutExtensions extension
Wraps widget with AspectRatio -
blurIn(
{Duration duration = const Duration(milliseconds: 400), Duration delay = Duration.zero, double beginBlur = 10.0, Curve curve = Curves.easeOut}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with an animated blur effect. -
bounce(
{Duration duration = const Duration(milliseconds: 800), double height = 10.0}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a continuous bounce animation. -
bounceIn(
{Duration duration = const Duration(milliseconds: 600), Duration delay = Duration.zero, Alignment alignment = Alignment.center}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a bounce-in animation. -
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
card(
{Color? color, double? elevation, ShapeBorder? shape, EdgeInsetsGeometry? margin}) → Widget -
Available on Widget, provided by the WidgetMaterialExtensions extension
Wraps widget with Card -
center(
) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with center alignment -
clipOval(
) → Widget -
Available on Widget, provided by the WidgetClipExtensions extension
Wraps widget with ClipOval -
clipRect(
{Clip clipBehavior = Clip.hardEdge}) → Widget -
Available on Widget, provided by the WidgetClipExtensions extension
Wraps widget with ClipRect -
clipRRect(
{double? borderRadius, BorderRadius? border}) → Widget -
Available on Widget, provided by the WidgetClipExtensions extension
Wraps widget with ClipRRect -
constrained(
{double? minWidth, double? maxWidth, double? minHeight, double? maxHeight}) → Widget -
Available on Widget, provided by the WidgetLayoutExtensions extension
Wraps widget with ConstrainedBox -
container(
{Key? key, AlignmentGeometry? alignment, EdgeInsetsGeometry? padding, Color? color, Decoration? decoration, Decoration? foregroundDecoration, double? width, double? height, BoxConstraints? constraints, EdgeInsetsGeometry? margin, Matrix4? transform, AlignmentGeometry? transformAlignment, Widget? child, Clip clipBehavior = Clip.none}) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with container -
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
crossFade(
{required Key key, Duration duration = const Duration(milliseconds: 300), Curve switchInCurve = Curves.easeIn, Curve switchOutCurve = Curves.easeOut}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget for animated switching with cross-fade. -
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
-
decoratedBox(
{Color? color, DecorationImage? image, BoxBorder? border, BorderRadius? borderRadius, List< BoxShadow> ? boxShadow, Gradient? gradient}) → Widget -
Available on Widget, provided by the WidgetLayoutExtensions extension
Wraps widget with DecoratedBox -
elasticIn(
{Duration duration = const Duration(milliseconds: 800), Duration delay = Duration.zero}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with an elastic scale-in animation. -
expanded(
[int flex = 1]) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with expanded -
fade(
{double opacity = 1.0, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a controllable fade animation. -
fadeIn(
{Duration duration = const Duration(milliseconds: 300), Duration delay = Duration.zero, Curve curve = Curves.easeIn}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a fade-in animation. -
fadeOut(
{Duration duration = const Duration(milliseconds: 300), Duration delay = Duration.zero, Curve curve = Curves.easeOut}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a fade-out animation. -
fittedBox(
{BoxFit fit = BoxFit.contain, AlignmentGeometry alignment = Alignment.center}) → Widget -
Available on Widget, provided by the WidgetLayoutExtensions extension
Wraps widget with FittedBox -
flexible(
[int flex = 1]) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with flexible -
flipHorizontal(
{bool isFlipped = false, Duration duration = const Duration(milliseconds: 500), Curve curve = Curves.easeInOut, Widget? backWidget}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a horizontal flip animation. -
flipIn(
{Duration duration = const Duration(milliseconds: 500), Duration delay = Duration.zero, Curve curve = Curves.easeOutCubic, Axis axis = Axis.vertical}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a flip-in animation. -
flipVertical(
{bool isFlipped = false, Duration duration = const Duration(milliseconds: 500), Curve curve = Curves.easeInOut, Widget? backWidget}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a vertical flip animation. -
float(
{Duration duration = const Duration(seconds: 2), double distance = 10.0}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a floating animation effect. -
fractionallySizedBox(
{double? widthFactor, double? heightFactor, AlignmentGeometry alignment = Alignment.center}) → Widget -
Available on Widget, provided by the WidgetSizingExtensions extension
Wraps widget with FractionallySizedBox -
glow(
{Color color = Colors.blue, Duration duration = const Duration(seconds: 1), double minRadius = 0.0, double maxRadius = 10.0}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a glowing animation effect. -
heartbeat(
{Duration duration = const Duration(milliseconds: 1200)}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a heartbeat animation. -
hero(
Object tag) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps widget with Hero animation. -
ignorePointer(
[bool ignoring = true]) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with IgnorePointer -
inkWell(
{VoidCallback? onTap, VoidCallback? onLongPress, VoidCallback? onDoubleTap, BorderRadius? borderRadius}) → Widget -
Available on Widget, provided by the WidgetGestureExtensions extension
Wraps widget with InkWell for material tap effect -
intrinsicHeight(
) → Widget -
Available on Widget, provided by the WidgetSizingExtensions extension
Wraps widget with IntrinsicHeight -
intrinsicWidth(
) → Widget -
Available on Widget, provided by the WidgetSizingExtensions extension
Wraps widget with IntrinsicWidth -
jello(
{Duration duration = const Duration(milliseconds: 1000), Duration delay = Duration.zero}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a jello animation effect. -
limitedBox(
{double maxWidth = double.infinity, double maxHeight = double.infinity}) → Widget -
Available on Widget, provided by the WidgetSizingExtensions extension
Wraps widget with LimitedBox -
margin(
{double? all, double? horizontal, double? vertical, double? top, double? bottom, double? left, double? right}) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with margin -
material(
{Color? color, double elevation = 0, Color? shadowColor, ShapeBorder? shape, BorderRadius? borderRadius}) → Widget -
Available on Widget, provided by the WidgetMaterialExtensions extension
Wraps widget with Material -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDoubleTap(
VoidCallback? onDoubleTap) → Widget -
Available on Widget, provided by the WidgetGestureExtensions extension
Wraps widget with double tap gesture -
onLongPress(
VoidCallback? onLongPress) → Widget -
Available on Widget, provided by the WidgetGestureExtensions extension
Wraps widget with long press gesture -
onTap(
VoidCallback? onTap) → Widget -
Available on Widget, provided by the WidgetGestureExtensions extension
Wraps widget with gesture detector -
opacity(
double opacity) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with opacity -
overflowBox(
{AlignmentGeometry alignment = Alignment.center, double? minWidth, double? maxWidth, double? minHeight, double? maxHeight}) → Widget -
Available on Widget, provided by the WidgetSizingExtensions extension
Wraps widget with OverflowBox -
padding(
{double? all, double? horizontal, double? vertical, double? top, double? bottom, double? left, double? right}) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with padding -
positioned(
{double? top, double? bottom, double? left, double? right, double? width, double? height}) → Widget -
Available on Widget, provided by the WidgetLayoutExtensions extension
Wraps widget with Positioned (for Stack) -
pulse(
{Duration duration = const Duration(milliseconds: 1000), double minScale = 0.95, double maxScale = 1.05}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a pulse animation. -
repaintBoundary(
) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with RepaintBoundary -
rotate(
double angle) → Widget -
Available on Widget, provided by the WidgetTransformExtensions extension
Wraps widget with rotation transform -
rubberBand(
{Duration duration = const Duration(milliseconds: 800), Duration delay = Duration.zero}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a rubber band animation effect. -
safeArea(
{bool top = true, bool bottom = true, bool left = true, bool right = true}) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with SafeArea -
scale(
double scale, {Offset? origin}) → Widget -
Available on Widget, provided by the WidgetTransformExtensions extension
Wraps widget with scale transform -
scaleIn(
{Duration duration = const Duration(milliseconds: 300), Duration delay = Duration.zero, Curve curve = Curves.easeOutBack, double beginScale = 0.0, Alignment alignment = Alignment.center}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a scale-in animation. -
scaleOut(
{Duration duration = const Duration(milliseconds: 300), Duration delay = Duration.zero, Curve curve = Curves.easeInBack, double endScale = 0.0, Alignment alignment = Alignment.center}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a scale-out animation. -
scrollable(
{ScrollPhysics? physics, bool reverse = false, ScrollController? controller, Axis scrollDirection = Axis.vertical}) → Widget -
Available on Widget, provided by the WidgetScrollExtensions extension
Wraps widget with SingleChildScrollView -
semantics(
{String? label, String? hint, bool? button, bool? header, bool excludeSemantics = false}) → Widget -
Available on Widget, provided by the WidgetSemanticsExtensions extension
Wraps widget with Semantics (simplified version) -
shake(
{Duration duration = const Duration(milliseconds: 500), Duration delay = Duration.zero, double intensity = 10.0, int shakes = 4}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a shake animation. -
shakeHorizontal(
{Duration duration = const Duration(milliseconds: 500), double intensity = 10.0}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a horizontal shake animation. -
shakeVertical(
{Duration duration = const Duration(milliseconds: 500), double intensity = 10.0}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a vertical shake animation. -
shimmer(
{Duration duration = const Duration(milliseconds: 1500), Color baseColor = const Color(0xFFE0E0E0), Color highlightColor = const Color(0xFFF5F5F5), ShimmerDirection direction = ShimmerDirection.leftToRight}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a shimmer effect. -
sizedBox(
{double? width, double? height}) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with sized box -
slide(
{Offset offset = Offset.zero, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeInOut}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a slide animation. -
slideInFromBottom(
{Duration duration = const Duration(milliseconds: 300), Duration delay = Duration.zero, Curve curve = Curves.easeOutCubic, double offset = 1.0}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a slide-in animation from the bottom. -
slideInFromLeft(
{Duration duration = const Duration(milliseconds: 300), Duration delay = Duration.zero, Curve curve = Curves.easeOutCubic, double offset = 1.0}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a slide-in animation from the left. -
slideInFromRight(
{Duration duration = const Duration(milliseconds: 300), Duration delay = Duration.zero, Curve curve = Curves.easeOutCubic, double offset = 1.0}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a slide-in animation from the right. -
slideInFromTop(
{Duration duration = const Duration(milliseconds: 300), Duration delay = Duration.zero, Curve curve = Curves.easeOutCubic, double offset = 1.0}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a slide-in animation from the top. -
spin(
{Duration duration = const Duration(seconds: 1), bool clockwise = true, Alignment alignment = Alignment.center}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a continuous spinning animation. -
spinIn(
{Duration duration = const Duration(milliseconds: 500), Duration delay = Duration.zero, Curve curve = Curves.easeOutCubic, double turns = 1.0, Alignment alignment = Alignment.center}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a spin-in animation. -
swing(
{Duration duration = const Duration(milliseconds: 1000), double angle = 0.15, Alignment alignment = Alignment.topCenter}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a swing animation. -
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
tooltip(
String message, {Duration? waitDuration}) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with Tooltip -
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
-
transform(
{required Matrix4 transform, Offset? origin, AlignmentGeometry? alignment, bool transformHitTests = true}) → Widget -
Available on Widget, provided by the WidgetTransformExtensions extension
Wraps widget with Transform -
translate(
{double? x, double? y}) → Widget -
Available on Widget, provided by the WidgetTransformExtensions extension
Wraps widget with translate transform -
typing(
{required String text, Duration duration = const Duration(seconds: 2), TextStyle? style, bool loop = false}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a typing animation effect. Best used with Text widgets. -
unconstrained(
{TextDirection? textDirection, AlignmentGeometry alignment = Alignment.center, Axis? constrainedAxis}) → Widget -
Available on Widget, provided by the WidgetSizingExtensions extension
Wraps widget with UnconstrainedBox -
visible(
bool visible) → Widget -
Available on Widget, provided by the WidgetCoreExtensions extension
Wraps widget with visibility -
wobble(
{Duration duration = const Duration(milliseconds: 1000), double angle = 0.1}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a wobble animation. -
zoomIn(
{Duration duration = const Duration(milliseconds: 400), Duration delay = Duration.zero, Curve curve = Curves.easeOutCubic, double beginScale = 0.5}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a zoom-in animation. -
zoomOut(
{Duration duration = const Duration(milliseconds: 400), Duration delay = Duration.zero, Curve curve = Curves.easeInCubic, double endScale = 0.5}) → Widget -
Available on Widget, provided by the AnimatedWidgetEffectsExtensions extension
Wraps the widget with a zoom-out animation.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited