UiBadge class

Compact label surface for statuses and counts.

Shares its colour recipe with UiButton via UiIntentPalette so the destructive/primary/secondary/etc. variants read as the same family — the badge is just a smaller, non-interactive pill. Padding is intentionally tighter than the button (shadcn sizes badges at text-xs px-2 py-0.5 rather than the button's h-9 px-4) so rows of badges don't visually drown their surroundings.

Set outlined to render a transparent fill with a 1pt border in the intent colour — useful for status chips on busy surfaces.

Inheritance

Constructors

UiBadge({Key? key, required String label, UiIntent intent = UiIntent.defaultIntent, UiSize size = UiSize.sm, bool outlined = false, Color? color, Color? backgroundColor, Color? foregroundColor, Color? borderColor, BorderRadius? borderRadius, Widget? leading, Widget? trailing})
const

Properties

backgroundColor Color?
Explicit background override. Use this when a design system needs a badge on a custom surface instead of the intent/status-color recipes.
final
borderColor Color?
final
borderRadius BorderRadius?
Optional shape override for design systems that use less-rounded badges.
final
color Color?
Optional custom status color. When supplied, this overrides intent and renders a soft tinted badge by default.
final
foregroundColor Color?
final
hashCode int
The hash code for this object.
no setterinherited
intent UiIntent
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String
final
leading Widget?
final
outlined bool
Transparent fill + intent-colored border.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size UiSize
final
trailing Widget?
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