badgeSolid method
Widget
badgeSolid(
- BuildContext context,
- String? text, {
- IconData? icon,
- BadgeColor color = BadgeColor.primary,
- BadgeHierarchy? hierarchy = BadgeHierarchy.primary,
Implementation
Widget badgeSolid(BuildContext context, String? text,
{IconData? icon,
BadgeColor color = BadgeColor.primary,
BadgeHierarchy? hierarchy = BadgeHierarchy.primary}) {
Color bgColor = _getBGColor(context, color);
return Container(
padding: const EdgeInsets.only(left: 6, right: 6, top: 3, bottom: 1),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(DUI.spacing.borderRadius / 2),
color: hierarchy == BadgeHierarchy.primary
? bgColor
: bgColor.lighten()),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
icon != null
? Padding(
padding: EdgeInsets.only(bottom: 2),
child: Icon(icon,
size: 12,
color: (hierarchy == BadgeHierarchy.primary
? bgColor
: bgColor.lighten())
.calculateLuminance()),
)
: const SizedBox.shrink(),
icon != null && text != null
? DUI.spacing.hSpacer(small: true)
: const SizedBox.shrink(),
text == null
? SizedBox.shrink()
: DUI.text.xs(context, text,
bold: true,
color: (hierarchy == BadgeHierarchy.primary
? bgColor
: bgColor.lighten())
.calculateLuminance())
],
),
);
}