Message class
Base widget for all message types in the chat. Renders bubbles around messages and status. Sets maximum width for a message for a nice look on larger screens.
- Inheritance
Constructors
-
Message({Key? key, Widget audioMessageBuilder(AudioMessage, {required int messageWidth})?, Widget avatarBuilder(String userId)?, Widget bubbleBuilder(Widget child, {required Message message, required bool nextMessageInGroup})?, BubbleRtlAlignment? bubbleRtlAlignment, Widget customMessageBuilder(CustomMessage, {required int messageWidth})?, Widget customStatusBuilder(Message message, {required BuildContext context})?, required EmojiEnlargementBehavior emojiEnlargementBehavior, Widget fileMessageBuilder(FileMessage, {required int messageWidth})?, required bool hideBackgroundOnEmojiMessages, Map<
String, String> ? imageHeaders, Widget imageMessageBuilder(ImageMessage, {required int messageWidth})?, ImageProvider<Object> imageProviderBuilder({required Conditional conditional, required Map<String, String> ? imageHeaders, required String uri})?, required Message message, required int messageWidth, Widget nameBuilder(User)?, void onAvatarTap(User)?, 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 bool roundBorder, required bool showAvatar, required bool showName, required bool showStatus, required bool showUserAvatars, Widget textMessageBuilder(TextMessage, {required int messageWidth, required bool showName})?, required TextMessageOptions textMessageOptions, required bool usePreviewData, String? userAgent, Widget videoMessageBuilder(VideoMessage, {required int messageWidth})?}) -
Creates a particular message from any message type.
const
Properties
- audioMessageBuilder → Widget Function(AudioMessage, {required int messageWidth})?
-
Build an audio message inside predefined bubble.
final
- avatarBuilder → Widget Function(String userId)?
-
This is to allow custom user avatar builder
By using this we can fetch newest user info based on id.
final
- bubbleBuilder → Widget Function(Widget child, {required Message message, required bool nextMessageInGroup})?
-
Customize the default bubble using this function.
child
is a content you should render inside your bubble,message
is a current message (containsauthor
inside) andnextMessageInGroup
allows you to see if the message is a part of a group (messages are grouped when written in quick succession by the same author).final - bubbleRtlAlignment → BubbleRtlAlignment?
-
Determine the alignment of the bubble for RTL languages. Has no effect
for the LTR languages.
final
- customMessageBuilder → Widget Function(CustomMessage, {required int messageWidth})?
-
Build a custom message inside predefined bubble.
final
- customStatusBuilder → Widget Function(Message message, {required BuildContext context})?
-
Build a custom status widgets.
final
- emojiEnlargementBehavior → EmojiEnlargementBehavior
-
Controls the enlargement behavior of the emojis in the
types.TextMessage
. Defaults to EmojiEnlargementBehavior.multi.final - fileMessageBuilder → Widget Function(FileMessage, {required int messageWidth})?
-
Build a file message inside predefined bubble.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hideBackgroundOnEmojiMessages → bool
-
Hide background for messages containing only emojis.
final
-
imageHeaders
→ Map<
String, String> ? -
See Chat.imageHeaders.
final
- imageMessageBuilder → Widget Function(ImageMessage, {required int messageWidth})?
-
Build an image message inside predefined bubble.
final
-
imageProviderBuilder
→ ImageProvider<
Object> Function({required Conditional conditional, required Map<String, String> ? imageHeaders, required String uri})? -
See Chat.imageProviderBuilder.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- message → Message
-
Any message type.
final
- messageWidth → int
-
Maximum message width.
final
- nameBuilder → Widget Function(User)?
-
See TextMessage.nameBuilder.
final
- onAvatarTap → void Function(User)?
-
See UserAvatar.onAvatarTap.
final
- onMessageDoubleTap → void Function(BuildContext context, Message)?
-
Called when user double taps on any message.
final
- onMessageLongPress → void Function(BuildContext context, Message)?
-
Called when user makes a long press on any message.
final
- onMessageStatusLongPress → void Function(BuildContext context, Message)?
-
Called when user makes a long press on status icon in any message.
final
- onMessageStatusTap → void Function(BuildContext context, Message)?
-
Called when user taps on status icon in any message.
final
- onMessageTap → void Function(BuildContext context, Message)?
-
Called when user taps on any message.
final
- onMessageVisibilityChanged → void Function(Message, bool visible)?
-
Called when the message's visibility changes.
final
- onPreviewDataFetched → void Function(TextMessage, PreviewData)?
-
See TextMessage.onPreviewDataFetched.
final
- roundBorder → bool
-
Rounds border of the message to visually group messages together.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showAvatar → bool
-
Show user avatar for the received message. Useful for a group chat.
final
- showName → bool
-
See TextMessage.showName.
final
- showStatus → bool
-
Show message's status.
final
- showUserAvatars → bool
-
Show user avatars for received messages. Useful for a group chat.
final
- textMessageBuilder → Widget Function(TextMessage, {required int messageWidth, required bool showName})?
-
Build a text message inside predefined bubble.
final
- textMessageOptions → TextMessageOptions
-
See TextMessage.options.
final
- usePreviewData → bool
-
See TextMessage.usePreviewData.
final
- userAgent → String?
-
See TextMessage.userAgent.
final
- videoMessageBuilder → Widget Function(VideoMessage, {required int messageWidth})?
-
Build an audio message inside predefined bubble.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited