GlassBadge constructor
const
GlassBadge({
- required Widget child,
- Key? key,
- int count = 0,
- BadgePosition position = BadgePosition.topRight,
- Color? backgroundColor,
- Color? textColor,
- LiquidGlassSettings? settings,
- GlassQuality? quality,
- bool showZero = false,
- int maxCount = 99,
- String? semanticLabel,
- int? semanticCount,
Creates a badge with a count number.
semanticLabel fully replaces the VoiceOver/TalkBack announcement.
When omitted the default is "$count notifications" (or "$maxCount+
notifications" when capped).
semanticCount overrides only the number spoken by the screen reader
while leaving the visual count unchanged. Useful when the displayed count
is capped at maxCount but accessibility should announce the true value:
GlassBadge(
count: items.length, // visual (may show 99+)
semanticCount: items.length, // always speaks the real number
child: ...,
)
Implementation
const GlassBadge({
required this.child,
super.key,
this.count = 0,
this.position = BadgePosition.topRight,
this.backgroundColor,
this.textColor,
this.settings,
this.quality,
this.showZero = false,
this.maxCount = 99,
this.semanticLabel,
this.semanticCount,
}) : isDot = false,
dotColor = null;