AvatarBadge constructor

const AvatarBadge({
  1. Key? key,
  2. Widget? child,
  3. double? size,
  4. double? borderRadius,
  5. Color? color,
})

Creates an AvatarBadge.

The badge can display either custom content via child or function as a simple colored indicator.

Parameters:

  • child (Widget?, optional): Content to display inside the badge. If null, shows as a solid colored circle.
  • size (double?, optional): Badge dimensions in logical pixels. Defaults to theme.scaling * 12.
  • borderRadius (double?, optional): Corner radius in logical pixels. Defaults to theme.radius * size for circular appearance.
  • color (Color?, optional): Background color. Defaults to theme primary.

Example:

AvatarBadge(
  color: Colors.red,
  child: Text('5', style: TextStyle(color: Colors.white, fontSize: 8)),
);

Implementation

const AvatarBadge({
  super.key,
  this.child,
  this.size,
  this.borderRadius,
  this.color,
});