Chat constructor
const
Chat({
- Key? key,
- Widget audioMessageBuilder(
- AudioMessage, {
- required int messageWidth,
- Widget avatarBuilder(
- String userId
- Widget bubbleBuilder(})?,
- BubbleRtlAlignment? bubbleRtlAlignment = BubbleRtlAlignment.right,
- Widget? customBottomWidget,
- String customDateHeaderText()?,
- Widget customMessageBuilder(
- CustomMessage, {
- required int messageWidth,
- Widget customStatusBuilder(
- Message message, {
- required BuildContext context,
- DateFormat? dateFormat,
- Widget dateHeaderBuilder()?,
- int dateHeaderThreshold = 900000,
- bool dateIsUtc = false,
- String? dateLocale,
- bool? disableImageGallery,
- EmojiEnlargementBehavior emojiEnlargementBehavior = EmojiEnlargementBehavior.multi,
- Widget? emptyState,
- Widget fileMessageBuilder(
- FileMessage, {
- required int messageWidth,
- int groupMessagesThreshold = 60000,
- bool hideBackgroundOnEmojiMessages = true,
- ImageGalleryOptions imageGalleryOptions = const ImageGalleryOptions(maxScale: PhotoViewComputedScale.covered, minScale: PhotoViewComputedScale.contained),
- Map<
String, String> ? imageHeaders, - Widget imageMessageBuilder(
- ImageMessage, {
- required int messageWidth,
- ImageProvider<
Object> imageProviderBuilder({- required Conditional conditional,
- required Map<
String, String> ? imageHeaders, - required String uri,
- InputOptions inputOptions = const InputOptions(),
- bool? isAttachmentUploading,
- bool? isLastPage,
- ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
- ChatL10n l10n = const ChatL10nEn(),
- Widget? listBottomWidget,
- required List<
Message> messages, - Widget nameBuilder(
- User
- VoidCallback? onAttachmentPressed,
- void onAvatarTap(
- User
- VoidCallback? onBackgroundTap,
- Future<
void> onEndReached()?, - double? onEndReachedThreshold,
- void onMessageDoubleTap(
- BuildContext context,
- Message
- void onMessageLongPress(
- BuildContext context,
- Message
- void onMessageStatusLongPress(
- BuildContext context,
- Message
- void onMessageStatusTap(
- BuildContext context,
- Message
- void onMessageTap(
- BuildContext context,
- Message
- void onMessageVisibilityChanged(
- Message,
- bool visible
- void onPreviewDataFetched(
- TextMessage,
- PreviewData
- required void onSendPressed(
- PartialText
- AutoScrollController? scrollController,
- ScrollPhysics? scrollPhysics,
- ScrollToUnreadOptions scrollToUnreadOptions = const ScrollToUnreadOptions(),
- bool showUserAvatars = false,
- bool showUserNames = false,
- Widget systemMessageBuilder(
- SystemMessage
- Widget textMessageBuilder(})?,
- TextMessageOptions textMessageOptions = const TextMessageOptions(),
- ChatTheme theme = const DefaultChatTheme(),
- DateFormat? timeFormat,
- TypingIndicatorOptions typingIndicatorOptions = const TypingIndicatorOptions(),
- bool usePreviewData = true,
- required User user,
- String? userAgent,
- bool? useTopSafeAreaInset,
- Widget videoMessageBuilder(
- VideoMessage, {
- required int messageWidth,
Creates a chat widget.
Implementation
const Chat({
super.key,
this.audioMessageBuilder,
this.avatarBuilder,
this.bubbleBuilder,
this.bubbleRtlAlignment = BubbleRtlAlignment.right,
this.customBottomWidget,
this.customDateHeaderText,
this.customMessageBuilder,
this.customStatusBuilder,
this.dateFormat,
this.dateHeaderBuilder,
this.dateHeaderThreshold = 900000,
this.dateIsUtc = false,
this.dateLocale,
this.disableImageGallery,
this.emojiEnlargementBehavior = EmojiEnlargementBehavior.multi,
this.emptyState,
this.fileMessageBuilder,
this.groupMessagesThreshold = 60000,
this.hideBackgroundOnEmojiMessages = true,
this.imageGalleryOptions = const ImageGalleryOptions(
maxScale: PhotoViewComputedScale.covered,
minScale: PhotoViewComputedScale.contained,
),
this.imageHeaders,
this.imageMessageBuilder,
this.imageProviderBuilder,
this.inputOptions = const InputOptions(),
this.isAttachmentUploading,
this.isLastPage,
this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
this.l10n = const ChatL10nEn(),
this.listBottomWidget,
required this.messages,
this.nameBuilder,
this.onAttachmentPressed,
this.onAvatarTap,
this.onBackgroundTap,
this.onEndReached,
this.onEndReachedThreshold,
this.onMessageDoubleTap,
this.onMessageLongPress,
this.onMessageStatusLongPress,
this.onMessageStatusTap,
this.onMessageTap,
this.onMessageVisibilityChanged,
this.onPreviewDataFetched,
required this.onSendPressed,
this.scrollController,
this.scrollPhysics,
this.scrollToUnreadOptions = const ScrollToUnreadOptions(),
this.showUserAvatars = false,
this.showUserNames = false,
this.systemMessageBuilder,
this.textMessageBuilder,
this.textMessageOptions = const TextMessageOptions(),
this.theme = const DefaultChatTheme(),
this.timeFormat,
this.typingIndicatorOptions = const TypingIndicatorOptions(),
this.usePreviewData = true,
required this.user,
this.userAgent,
this.useTopSafeAreaInset,
this.videoMessageBuilder,
});