Badges Widget

Estimated reading: 4 minutes 27 views

Flutkit provides the CustomBadge widget, a compact UI component used to display short status labels, tags, counters, or contextual metadata. It is highly customizable and supports multiple visual styles such as soft, outlined, rounded, dismissible, and tag-based layouts.

Badges are commonly used in dashboards to indicate status, categories, notifications, or quick descriptors.

Common Use Cases

The CustomBadge widget is commonly used for:

  • Status indicators (e.g., Active, Pending, Draft)
  • Category or tag labels
  • Notification counters
  • Feature flags or labels
  • Metadata indicators in tables, cards, or lists
  • Filter chips or dismissible tags

Constructor

Dart
CustomBadge({
  Key? key,
  required Color kColor,
  required String kText,
  double? kFontSize = kLabelSmall,
  bool isRounded = false,
  bool isSoft = false,
  bool isOutlined = false,
  bool isDismissible = false,
  bool leftBorder = false,
  bool rightBorder = false,
  bool isTagStyle = false,
})

Parameters

kColor (required)

Dart
required Color kColor,

Defines the primary color of the badge.

This color is used for:

  • Background color
  • Border color
  • Text color (depending on style)

kText (required)

Dart
required String kText,

Text content displayed inside the badge.

Keep the text short and concise for optimal visual clarity.

kFontSize

Dart
double? kFontSize = kLabelSmall,

Controls the font size of the badge text.

Defaults to kLabelSmall, making it suitable for compact UI layouts.

isRounded

Dart
bool isRounded = false,

Applies fully rounded corners to the badge.

Commonly used for:

  • Status pills
  • Count indicators
  • Modern UI designs

isSoft

Dart
bool isSoft = false,

Displays the badge with a soft (light) background color.

This style reduces visual weight and is suitable for:

  • Secondary information
  • Subtle status indicators

isOutlined

Dart
bool isOutlined = false,

Renders the badge with a transparent background and colored border.

Useful when you want minimal visual emphasis while maintaining context.

isDismissible

Dart
bool isDismissible = false,

Allows the badge to be dismissed by the user.

Typically used for:

  • Removable filters
  • Editable tags
  • Temporary labels

leftBorder

Dart
bool leftBorder = false,

Adds a colored border on the left side of the badge.

Often used to:

  • Indicate priority
  • Add visual hierarchy in lists or tables

rightBorder

Dart
bool rightBorder = false,

Adds a colored border on the right side of the badge.

Can be used for symmetrical or stylistic purposes.

isTagStyle

Dart
bool isTagStyle = false,

Enables a tag-like appearance for the badge.

This style is ideal for:

  • Keywords
  • Labels
  • Taxonomy-based UI elements

Usage Example

Basic usage example

Dart
CustomBadge(
  kColor: kPrimaryColor,
  kText: 'Active',
),

Soft Rounded Status Badge

Dart
CustomBadge(
  kColor: kSuccessColor,
  kText: 'Completed',
  isSoft: true,
  isRounded: true,
),

Outlined Badge

Dart
CustomBadge(
  kColor: kInfoColor,
  kText: 'Info',
  isOutlined: true,
),

Dismissible Tag Badge

Dart
CustomBadge(
  kColor: kSecondaryColor,
  kText: 'Flutter',
  isTagStyle: true,
  isDismissible: true,
),

Badge with Left Border

Dart
CustomBadge(
  kColor: kWarningColor,
  kText: 'Pending',
  leftBorder: true,
),

To explore more usage examples, visit the Badges section in the FlutKit demo under

Dart
Base UIBadges.

Best Practices

  • Keep badge text short (1–2 words)
  • Use consistent colors to represent consistent meanings
  • Prefer soft or outlined styles for secondary information
  • Use rounded badges for status indicators
  • Avoid enabling conflicting styles simultaneously (e.g., isSoft and isOutlined)
  • Use dismissible badges sparingly to avoid UI clutter

Summary

The CustomBadge widget is a versatile and lightweight component for displaying contextual labels and statuses within FlutKit dashboards. With extensive styling options and flexible layout behavior, it adapts well to various UI scenarios while maintaining clarity and consistency.

Use CustomBadge to enhance information density without sacrificing readability or user experience.

Share this Doc

Badges Widget

Or copy link

CONTENTS