Skip to main content

Badge

CometChatBadge is the custom component which is used to display the unread message count. It can be used in widgets like CometChatListItem shown for Conversation objects, CometChatUI, etc.


How to integrate CometChatBadge?

Since CometChatBadge is a Widget, it can be added directly in the build method. CometChatBadge includes various attributes and methods to customize its UI.

Usage

CometChatBadge(
count: 7,
);

Properties

ParametersTypeDescription
int countintused to set value of count.

BadgeStyle

ParametersTypeDescription
textStyleTextStyleused to set style for the count
borderRadiusdoubleused to modify the border radius
backgroundColorused to set background color
borderBoxBorderused to set border
gradientGradientused to set a gradient background
heightdoubleused to set height
widthdoubleused to set width

Usage

CometChatBadge(
count: 7,
style: BadgeStyle(
width: 16,
height: 16,
background: Colors.blue,
borderRadius: 24,
border: Border.all(
color: Colors.amber,
width: 1,
),
nameTextStyle: TextStyle(
fontSize: 12,
color: Colors.yellow)
)
);