GlassBadge constructor

const GlassBadge({
  1. required Widget child,
  2. Key? key,
  3. int count = 0,
  4. BadgePosition position = BadgePosition.topRight,
  5. Color? backgroundColor,
  6. Color? textColor,
  7. LiquidGlassSettings? settings,
  8. GlassQuality? quality,
  9. bool showZero = false,
  10. int maxCount = 99,
  11. String? semanticLabel,
  12. 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;