withBadge method

Widget withBadge(
  1. String value, {
  2. VoidCallback? onBadgeTap,
  3. Color textColor = Colors.white,
  4. Color bgColor = Colors.red,
  5. Alignment align = Alignment.topLeft,
})

Implementation

Widget withBadge(
  String value, {
  VoidCallback? onBadgeTap,
  Color textColor = Colors.white,
  Color bgColor = Colors.red,
  Alignment align = Alignment.topLeft,
}) =>
    [
      this,
      value
          .toText(size: 12, color: textColor)
          .toCenter()
          .toSizedBox(24, 24)
          .toDecoratedBox(bgColor: bgColor)
          .toClipOval()
          .toInkWell(onTap: onBadgeTap)
          .toPositioned(
              left: align == Alignment.topLeft ? 5 : null,
              top: 0,
              right: align == Alignment.topRight ? 5 : null),
    ].toStack(alignment: Alignment.center, clipOutside: false);