MessageOptions class Customization

Constructors

MessageOptions({bool showCurrentUserAvatar = false, bool showOtherUsersAvatar = true, bool showOtherUsersName = true, Widget userNameBuilder(ChatUser user)?, Widget avatarBuilder(ChatUser, Function? onPressAvatar, Function? onLongPressAvatar)?, dynamic onPressAvatar(ChatUser)?, dynamic onLongPressAvatar(ChatUser)?, dynamic onLongPressMessage(ChatMessage)?, dynamic onPressMessage(ChatMessage)?, dynamic onPressMention(Mention)?, Color? currentUserContainerColor, Color? currentUserTextColor, Color containerColor = const Color(0xFFF5F5F5), Color textColor = Colors.black, EdgeInsets messagePadding = const EdgeInsets.all(11), double? maxWidth, BoxDecoration messageDecorationBuilder(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage)?, Widget top(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage)?, Widget bottom(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage)?, Widget messageRowBuilder(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage, bool isAfterDateSeparator, bool isBeforeDateSeparator)?, Widget messageTextBuilder(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage)?, List<MatchText>? parsePatterns, bool textBeforeMedia = true, void onTapMedia(ChatMedia media)?, bool showTime = false, DateFormat? timeFormat, Widget messageTimeBuilder(ChatMessage message, bool isOwnMessage)?, Widget messageMediaBuilder(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage)?, double borderRadius = 18.0, Color? currentUserTimeTextColor, EdgeInsets marginDifferentAuthor = const EdgeInsets.only(top: 15), EdgeInsets marginSameAuthor = const EdgeInsets.only(top: 2), double spaceWhenAvatarIsHidden = 10.0, double timeFontSize = 10.0, EdgeInsets timePadding = const EdgeInsets.only(top: 5), Color? timeTextColor})
const

Properties

avatarBuilder → (Widget Function(ChatUser, Function? onPressAvatar, Function? onLongPressAvatar)?)
Builder to create your own avatar You can use DefaultAvatar to only override some variables
final
borderRadius double
Border radius of the chat bubbles
final
bottom → (Widget Function(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage)?)
A widget to show under the chat bubble
final
containerColor Color
Color of the other users chat bubbles
final
hashCode int
The hash code for this object.
no setterinherited
marginDifferentAuthor EdgeInsets
Margin around the chat bubble when previous author is different
final
marginSameAuthor EdgeInsets
Margin around the chat bubble when previous author is the same
final
maxWidth double?
Max message width
final
messageDecorationBuilder → (BoxDecoration Function(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage)?)
To create your own BoxDecoration fot the chat bubble You can use defaultMessageDecoration to only override some variables
final
messageMediaBuilder → (Widget Function(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage)?)
Builder to create your own media container widget
final
messagePadding EdgeInsets
Padding around the text in chat bubbles
final
messageRowBuilder → (Widget Function(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage, bool isAfterDateSeparator, bool isBeforeDateSeparator)?)
Builder to create the entire message row yourself
final
messageTextBuilder → (Widget Function(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage)?)
Builder to create own message text widget
final
messageTimeBuilder → (Widget Function(ChatMessage message, bool isOwnMessage)?)
Builder to create your own time widget (shown under the text when showTime is true)
final
onLongPressAvatar → (dynamic Function(ChatUser)?)
Function to call when the user long press on an avatar
final
onLongPressMessage → (dynamic Function(ChatMessage)?)
Function to call when the user long press on a message
final
onPressAvatar → (dynamic Function(ChatUser)?)
Function to call when the user press on an avatar
final
onPressMention → (dynamic Function(Mention)?)
Function to call when the user press on a message mention
final
onPressMessage → (dynamic Function(ChatMessage)?)
Function to call when the user press on a message
final
onTapMedia → (void Function(ChatMedia media)?)
Function to call when the user clicks on a media Will not work with the default video player
final
parsePatterns List<MatchText>?
List of MatchText using flutter_parsed_text library to parse and customize accordingly some part of the text By default ParsedType.URL is set and will use launchUrl to open the link
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showCurrentUserAvatar bool
If you want to show the avatar of the current user
final
showOtherUsersAvatar bool
If you want to show the avatar of the other users
final
showOtherUsersName bool
If you want to show the name of the other users above the messages Useful in group chats
final
showTime bool
If you want to show the time under the text of each message
final
spaceWhenAvatarIsHidden double
Space between chat bubble and edge of the list when avatar is hidden via showOtherUsersAvatar or showCurrentUserAvatar
final
textBeforeMedia bool
When a message have both an text and a list of media it will determine which one th show first
final
textColor Color
Color of the other users text in chat bubbles
final
timeFontSize double
Font size of the time text in chat bubbles
final
timeFormat → DateFormat?
Format of the time if showTime is true Default to: DateFormat('HH:mm')
final
timePadding EdgeInsets
Space between time and message text in chat bubbles
final
top → (Widget Function(ChatMessage message, ChatMessage? previousMessage, ChatMessage? nextMessage)?)
A widget to show above the chat bubble
final
userNameBuilder → (Widget Function(ChatUser user)?)
If you want to create your own userName widget when showOtherUsersName is true You can use DefaultUserName to only override some variables
final

Methods

currentUserContainerColor(BuildContext context) Color
Color of the current user chat bubbles
currentUserTextColor(BuildContext context) Color
Color of the current user text in chat bubbles
currentUserTimeTextColor(BuildContext context) Color
Color of current user time text in chat bubbles
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
timeTextColor() Color
Color of other users time text in chat bubbles
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited