BadgeVariant class abstract

Defines the visual appearance of a Badge.

Extend this class to create custom badge styles:

class PremiumBadgeVariant extends BadgeVariant {
  const PremiumBadgeVariant();

  @override
  BadgeVariantStyle resolve(ColorScheme cs) => BadgeVariantStyle(
    backgroundColor: const Color(0xFFFFF7E6),
    foregroundColor: const Color(0xFFB45309),
    dotColor: const Color(0xFFD97706),
  );
}

Built-in variants: BadgeVariant.neutral, BadgeVariant.info, BadgeVariant.success, BadgeVariant.warning, BadgeVariant.danger, BadgeVariant.brand.

Annotations

Constructors

BadgeVariant()
Const constructor for subclasses.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(ColorScheme colorScheme) BadgeVariantStyle
Resolves the visual style for this variant against colorScheme.
toString() String
A string representation of this object.
inherited

Operators

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

Constants

brand → const BadgeVariant
Brand-coloured fill — primary emphasis label.
danger → const BadgeVariant
Red tint — error or destructive label.
info → const BadgeVariant
Blue tint — informational label.
neutral → const BadgeVariant
Grey — non-semantic label.
success → const BadgeVariant
Green tint — positive or success label.
warning → const BadgeVariant
Amber tint — cautionary label.