withBadge method
Widget
withBadge(
- String value, {
- VoidCallback? onBadgeTap,
- Color textColor = Colors.white,
- Color bgColor = Colors.red,
- 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);