withBadge method

Widget withBadge({
  1. Widget? badge,
  2. Alignment alignment = Alignment.topRight,
  3. double? width = 8,
  4. double? height = 8,
})

Implementation

Widget withBadge({
  Widget? badge,
  Alignment alignment = Alignment.topRight,
  double? width = 8,
  double? height = 8,
}) => Stack(
  clipBehavior: Clip.none,
  children: [
    this,
    Positioned(
      top: 0,
      right: 0,
      child:
          badge ??
          Container(
            width: width,
            height: height,
            decoration: BoxDecoration(
              color: Colors.red,
              shape: BoxShape.circle,
            ),
          ),
    ),
  ],
);