Chat Page Config
ChatPage accepts ChatPageConfig for the built-in chat page. The config covers the app bar, page background, message list behavior, input area, bubble style, long-press menu, custom message content callbacks, and message send hooks.
Entry Point
Dart
ChatPage(
channel: channel,
config: ChatPageConfig(
appBarConfig: ChatAppBarConfig(title: 'Support'),
backgroundConfig: ChatBackgroundConfig(backgroundColor: Colors.white),
inputConfig: MessageInputConfig(hintText: 'Message'),
bubbleConfig: BubbleConfig(borderRadius: 14),
),
)
ChatPageConfig
Fields:
appBarConfig: built-in chat app bar.backgroundConfig: page and safe-area background.messageListConfig: message list behavior and labels.inputConfig: built-in input area config.bubbleConfig: built-in message bubble style.longPressMenuConfig: built-in message long-press menu.onForwardSelectedMessages: override selected-message forwarding.customMessageBubbleBuilders: mapMessageTypeto a custom message-content builder.profileProvider: resolves sender profile data for the message list and input.onBeforeSendMessage: intercepts outbound messages before sending.onAfterSendMessage: observes outbound messages after sending.onAsyncMessageReceived: observes received messages asynchronously.
For a standalone ChatPage, configure ChatPageConfig.profileProvider directly. When a built-in ChannelPage opens the default chat page, ChannelConfig.profileProvider is passed through automatically and can be used as the shared channel-list/chat-page resolver.
ChatAppBarConfig
Fields:
heighttitletitleResolvercenterTitlebackgroundColortitleTextStyleshowSearchButtonshowBackUnreadBadgesearchButtonTooltipsearchPageTitleactions
Example:
Dart
ChatPageConfig(
appBarConfig: ChatAppBarConfig(
titleResolver: (context, channel) async => 'Support',
showSearchButton: true,
actions: [
IconButton(
icon: const Icon(Icons.info_outline),
onPressed: () {},
),
],
),
)
ChatBackgroundConfig
Fields:
backgroundColorsafeAreaColorbackgroundImagebackgroundImageUrlimageFitModeimageRepeat
Example:
Dart
ChatPageConfig(
backgroundConfig: const ChatBackgroundConfig(
backgroundColor: Color(0xFFF7F8FA),
safeAreaColor: Colors.white,
),
)
MessageListConfig
Fields:
backgroundColoremptyTextshowAvatarshowSenderNameshowSentStatusshowUnreadHistoryTipshowNewMessageTipshowTypingStatusTiphistoryMessageCountmaxSelectedMessagesshowNetworkStatusTipnetworkStatusTextunreadHistoryTipTextnewMessageTipTexttypingStatusTipTextshowReadReceiptUserListreadReceiptUsersTitlereadReceiptUsersReadTabTextreadReceiptUsersUnreadTabTextreadReceiptUsersLoadingTextreadReceiptUsersEmptyTextreadReceiptUsersLoadFailedTextonLinkTaponPhoneTaponReadReceiptStatusTaponResendMessagereadReceiptUsersLoaderenableSwipeToReference: deprecated; use long press reply instead.
Example:
Dart
ChatPageConfig(
messageListConfig: MessageListConfig(
showSenderName: true,
showSentStatus: true,
onLinkTap: (context, message, uri) {
// Open the link with your application router or URL handler.
},
),
)
Long-Press Menu
ChatMessageLongPressMenuConfig controls the built-in menu:
enabledshowCopyButtonshowDeleteButtonshowDeleteForAllButtonshowReferenceButtonshowMoreButtonshowForwardButtoncopyTextdeleteTextdeleteForAllTextreferenceTextmoreTextforwardTextdeleteBehavioronCopyonDeleteonDeleteForAllonReference
Example:
Dart
ChatPageConfig(
longPressMenuConfig: ChatMessageLongPressMenuConfig(
showForwardButton: true,
deleteBehavior: ChatMessageDeleteBehavior.forMe,
),
)
Related Configs
- Use Bubble config for
BubbleConfig. - Use Message input config for
MessageInputConfig. - Use Custom message bubble builders for
customMessageBubbleBuilders.