Badge
A compact indicator component for displaying counts, status, or labels
A compact component for displaying counts, status indicators, or labels.
When to use this
- Notification counts: Show unread message or notification counts
- Status indicators: Display online/offline status or alert levels
- Labels: Attach categorical labels to other UI elements
- Counters: Show numerical values in a compact format
Basic implementation
import 'package:flutter/material.dart';
import 'package:remix/remix.dart';
class BadgeExample extends StatelessWidget {
const BadgeExample({super.key});
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 16,
children: [
RemixBadge(
label: '8',
style: styleLabel,
),
RemixBadge(
style: styleIcon,
child: const Icon(Icons.camera_alt),
),
],
);
}
RemixBadgeStyle get styleLabel {
return RemixBadgeStyle()
.size(24, 24)
.wrapClipOval()
.label(
TextStyler()
.fontSize(15)
.wrapAlign(Alignment.center)
.fontFeatures([const FontFeature.tabularFigures()]),
)
.foregroundColor(Colors.greenAccent.shade700)
.labelColor(Colors.white)
.labelFontWeight(FontWeight.bold)
.labelFontSize(15);
}
RemixBadgeStyle get styleIcon {
return RemixBadgeStyle()
.size(24, 24)
.wrapClipOval()
.label(
TextStyler()
.fontSize(15)
.wrapAlign(Alignment.center)
.fontFeatures([const FontFeature.tabularFigures()]),
)
.foregroundColor(Colors.redAccent)
.wrapIconTheme(const IconThemeData(color: Colors.white, size: 15));
}
}
Fortal styles
Remix includes Fortal-themed style helpers for this component:
import 'package:flutter/material.dart';
import 'package:remix/remix.dart';
class FortalBadgeExample extends StatelessWidget {
const FortalBadgeExample({super.key});
@override
Widget build(BuildContext context) {
return Row(
spacing: 16,
children: [
RemixBadge(
label: '5',
style: FortalBadgeStyle.solid(),
),
RemixBadge(
label: 'New',
style: FortalBadgeStyle.soft(),
),
],
);
}
}
See the FortalBadgeStyle source code for all available options.
Constructor
const RemixBadge({
Key? key,
Widget? child,
String? label,
RemixBadgeLabelBuilder? labelBuilder,
RemixBadgeStyle style = const RemixBadgeStyle.create(),
RemixBadgeSpec? styleSpec,
})
style → RemixBadgeStyle
Optional. The style configuration for the badge. Customize colors, sizing, shape, and state-based styling.
styleSpec → RemixBadgeSpec?
Optional. A pre-resolved style spec that bypasses style resolution. Useful for performance when sharing resolved styles across multiple instances.
child → Widget?
Optional. Optional fully custom badge content. When provided the badge style is applied only to the container.
labelBuilder → RemixBadgeLabelBuilder?
Optional. Optional builder that receives the resolved [TextSpec] so callers can render text with custom widgets while preserving badge typography.
foregroundDecoration(DecorationMix value)
Sets a foreground decoration painted on top of the component.

