CometChatMessageList(
user: user, // User object
group: group, // Group object
messagesRequestBuilder: MessagesRequestBuilder()
..limit = 30
..types = [
...CometChatUIKit.getDataSource().getAllMessageTypes(),
"contact"
] // Add the custom type here
..categories = CometChatUIKit.getDataSource().getAllMessageCategories(),
templates: [
CometChatMessageTemplate(
type: "contact",
// Define the template type̵
category: MessageCategoryConstants.custom,
// Define the template category
contentView: (baseMessage, context, alignment,
{additionalConfigurations}) {
return Padding(
padding: const EdgeInsets.fromLTRB(8, 8, 8, 0),
child: Row(
children: [
CircleAvatar(
backgroundColor: Color(0xFFEDEAFA),
child: Icon(
Icons.person,
color: Colors.white,
),
),
SizedBox(
width: 8,
),
Text("Safiya Fareena",
style: TextStyle(
color: alignment == BubbleAlignment.right
? Colors.white
: Colors.black,
fontSize: 14,
))
],
),
);
},
bottomView: (baseMessage, context, alignment,
{additionalConfigurations}) {
return DecoratedBox(
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: Color(0xFF7965DB), width: 1))),
child: ToggleButtons(
children: [
Padding(
padding: EdgeInsets.fromLTRB(20, 8, 0, 8),
child: Text("Add Contact",
style: TextStyle(
color: alignment == BubbleAlignment.right
? Colors.white
: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w500)),
),
VerticalDivider(
color: Color(0xFF7965DB),
width: 0,
),
Padding(
padding: EdgeInsets.fromLTRB(0, 8, 20, 8),
child: Text("Message",
style: TextStyle(
color: alignment == BubbleAlignment.right
? Colors.white
: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w500)),
)
],
isSelected: [false, false, false],
renderBorder: false,
),
);
})
],
);