Badge.count constructor

Badge.count(
  1. {Key? key,
  2. Color? backgroundColor,
  3. Color? textColor,
  4. double? smallSize,
  5. double? largeSize,
  6. TextStyle? textStyle,
  7. EdgeInsetsGeometry? padding,
  8. AlignmentGeometry? alignment,
  9. Offset? offset,
  10. required int count,
  11. bool isLabelVisible = true,
  12. Widget? child}
)

Convenience constructor for creating a badge with a numeric label with 1-3 digits based on count.

Initializes label with a Text widget that contains count. If count is greater than 999, then the label is '999+'.

Implementation

Badge.count({
  super.key,
  this.backgroundColor,
  this.textColor,
  this.smallSize,
  this.largeSize,
  this.textStyle,
  this.padding,
  this.alignment,
  this.offset,
  required int count,
  this.isLabelVisible = true,
  this.child,
}) : label = Text(count > 999 ? '999+' : '$count');