DynamicBadge.counter constructor

const DynamicBadge.counter({
  1. required int count,
  2. required double childSize,
  3. Color? textColor,
  4. Color? backgroundColor,
  5. AlignmentGeometry? alignment,
  6. Widget? child,
  7. Key? key,
})

Constructor to create a badge with a counter, The counter is limited to 999, if the counter is greater than 999 the label will be "999+"

Implementation

const DynamicBadge.counter({
  required int count,
  required double childSize,
  Color? textColor,
  Color? backgroundColor,
  AlignmentGeometry? alignment,
  Widget? child,
  super.key,
})  : _label = count > 999 ? '999+' : '$count',
      _backgroundColor = backgroundColor ?? Colors.redAccent,
      _childSize = childSize,
      _alignment = alignment ?? Alignment.center,
      _textColor = textColor ?? Colors.white,
      _child = child ?? const SizedBox();