CometChatMentionsFormatter
class is a part of the CometChat UI Kit, a ready-to-use chat UI widget library for integrating CometChat into your Android applications. This class provides functionality to format mentions within text messages displayed in the chat interface. Mentions allow users to reference other users within a conversation, providing a convenient way to direct messages or involve specific participants.
CometChatMentionsFormatter
class into your application:
CometChatMentionsFormatter
class and configure it with desired settings, such as mention text styles and limit settings.
setOnMentionClick
).
prepareLeftMessageBubbleSpan
, prepareRightMessageBubbleSpan
, prepareComposerSpan
, and prepareConversationSpan
methods to format text messages with mentions appropriately for display in the chat interface.
CometChatMentionsFormatter
class in widgets such as CometChatConversations, CometChatMessageList, CometChatMessageComposer.
Property | Description | Code |
---|---|---|
trackingCharacter | The character that triggers the mention search. | String? trackingCharacter |
pattern | The regex pattern to identify mentions. | RegExp? pattern |
showLoadingIndicator | Whether to show a loading indicator during mention search. | bool? showLoadingIndicator |
onSearch | Callback function to perform search when mention is triggered. | void Function(String)? onSearch |
onError | Callback function to handle errors during mention search. | void Function(String)? onError |
theme | The theme for styling the mentions formatter. | ThemeData? theme |
message | The message in which mentions are to be formatted. | String? message |
messageBubbleTextStyle | The text style for the message bubble. | TextStyle? messageBubbleTextStyle |
messageInputTextStyle | The text style for the message input. | TextStyle? messageInputTextStyle |
composerId | The unique identifier for the composer. | String? composerId |
suggestionListEventSink | The event sink for the suggestion list. | EventSink<List<User>>? suggestionListEventSink |
previousTextEventSink | The event sink for the previous text before mention. | EventSink<String>? previousTextEventSink |
user | The user to be mentioned. | User? user |
group | The group in which mentions are to be formatted. | Group? group |
groupMembersRequestBuilder | The request builder for fetching group members to mention. | GroupMembersRequestBuilder? groupMembersRequestBuilder |
usersRequestBuilder | The request builder for fetching users to mention. | UsersRequestBuilder? usersRequestBuilder |
mentionsType | The type of mentions (e.g., user, group). | MentionsType? mentionsType |
onMentionTap | Callback function to handle mention tap actions. | void Function(User)? onMentionTap |
visibleIn | Defines where the mentions are visible. | Set<ComposerMentionVisibility>? visibleIn |