Badge class

A short, bold, filled tag that labels the state of something near it.

A badge is passive: it never takes focus and has no callback. It exists so status colors come from one place instead of being spelled out at each call site.

Badge(label: 'STAGED', variant: BadgeVariant.success)
Inheritance

Constructors

Badge({required String label, Key? key, BadgeVariant variant = BadgeVariant.neutral, Color? color, Color? textColor})
Configures a badge showing label colored by variant.
const

Properties

color Color?
Fill painted behind the label, overriding the variant color.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how this widget replaces another of the same type.
finalinherited
label String
Text rendered inside the badge.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textColor Color?
Color of the label. Falls back to ThemeData.accentForeground, which stays legible on every variant fill.
final
variant BadgeVariant
Meaning the badge carries, which chooses its default fill.
final

Methods

build(BuildContext context) Widget
Describes the part of the UI represented by this widget.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited