AuiBadge class

A badge overlay widget that displays a count or dot indicator on top of a child widget.

AuiBadge wraps any widget and renders a small circular badge in one of the four corners. It supports three display modes:

  • Count badge: shows a number (or "${maxCount}+" when the count exceeds maxCount).
  • Dot badge: shows a plain filled circle when count is null.
  • Hidden: renders child unwrapped when count is 0 or visible is false.

Example usage:

AuiBadge(
  count: 5,
  child: Icon(Icons.notifications),
)

Use the AuiBadge.dot named constructor for a quick dot badge:

AuiBadge.dot(child: Icon(Icons.circle_notifications))
Inheritance

Constructors

AuiBadge({Key? key, required Widget child, int? count, Color? color, Color textColor = Colors.white, BadgePosition position = BadgePosition.topRight, int maxCount = 99, bool visible = true, double size = 18})
Creates a badge widget with an optional count indicator.
const
AuiBadge.dot({Key? key, required Widget child, Color? color, Color textColor = Colors.white, BadgePosition position = BadgePosition.topRight, bool visible = true, double size = 18})
Creates a dot badge — a small filled circle with no count label.
const

Properties

child Widget
The widget that the badge is overlaid on.
final
color Color?
Background color of the badge circle.
final
count int?
The number displayed inside the badge.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxCount int
The maximum count value displayed verbatim. Counts above this value are rendered as "${maxCount}+".
final
position BadgePosition
Which corner of child the badge is placed at.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size double
Diameter of the badge circle in logical pixels.
final
textColor Color
Color of the count label text.
final
visible bool
Whether the badge is visible. When false, child is returned unwrapped.
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