Chat class
Entry widget, represents the complete chat
- Inheritance
Constructors
-
Chat({Key? key, Widget buildCustomMessage(Message, MessageContainBaseBuild )?, Widget buildListContentContain(Widget chatList)?, String customDateHeaderText(DateTime)?, DateFormat? dateFormat, String? dateLocale, bool? disableImageGallery, bool? isAttachmentUploading, bool? isLastPage, ChatL10n l10n = const ChatL10nEn(), required List<
Message> messages, void onAttachmentPressed()?, Future<void> onEndReached()?, double? onEndReachedThreshold, void onMessageLongPress(Message)?, void onMessageTap(Message)?, void onPreviewDataFetched(TextMessage, PreviewData)?, required void onSendPressed(PartialText), void onTextChanged(String)?, bool showUserAvatars = false, bool showUserNames = false, ChatTheme theme = const DefaultChatTheme(), DateFormat? timeFormat, bool usePreviewData = true, required User user}) -
Creates a chat widget
const
Properties
- buildCustomMessage → (Widget Function(Message, MessageContainBaseBuild )?)
-
See Message.buildCustomMessage
final
- buildListContentContain → (Widget Function(Widget chatList)?)
-
创建消息列表容器
final
- customDateHeaderText → (String Function(DateTime)?)
-
If dateFormat, dateLocale and/or timeFormat is not enough to
customize date headers in your case, use this to return an arbitrary
string based on a DateTime of a particular message. Can be helpful to
return "Today" if DateTime is today. IMPORTANT: this will replace
all default date headers, so you must handle all cases yourself, like
for example today, yesterday and before. Or you can just return the same
date header for any message.
final
- dateFormat → DateFormat?
-
Allows you to customize the date format. IMPORTANT: only for the date,
do not return time here. See timeFormat to customize the time format.
dateLocale will be ignored if you use this, so if you want a localized date
make sure you initialize your
DateFormat
with a locale. See customDateHeaderText for more customization.final - dateLocale → String?
-
Locale will be passed to the
Intl
package. Make sure you initialized date formatting in your app before passing any locale here, otherwise an error will be thrown. Also see customDateHeaderText, dateFormat, timeFormat.final - disableImageGallery → bool?
-
Disable automatic image preview on tap.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAttachmentUploading → bool?
-
See Input.isAttachmentUploading
final
- isLastPage → bool?
-
See ChatList.isLastPage
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- l10n → ChatL10n
-
Localized copy. Extend ChatL10n class to create your own copy or use
existing one, like the default ChatL10nEn. You can customize only
certain variables, see more here ChatL10nEn.
final
-
messages
→ List<
Message> -
List of
types.Message
to render in the chat widgetfinal - onAttachmentPressed → (void Function()?)
-
See Input.onAttachmentPressed
final
-
onEndReached
→ (Future<
void> Function()?) -
See ChatList.onEndReached
final
- onEndReachedThreshold → double?
-
See ChatList.onEndReachedThreshold
final
- onMessageLongPress → (void Function(Message)?)
-
See Message.onMessageLongPress
final
- onMessageTap → (void Function(Message)?)
-
See Message.onMessageTap
final
- onPreviewDataFetched → (void Function(TextMessage, PreviewData)?)
-
See Message.onPreviewDataFetched
final
- onSendPressed → void Function(PartialText)
-
See Input.onSendPressed
final
- onTextChanged → (void Function(String)?)
-
See Input.onTextChanged
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showUserAvatars → bool
-
See Message.showUserAvatars
final
- showUserNames → bool
-
Show user names for received messages. Useful for a group chat. Will be
shown only on text messages.
final
- theme → ChatTheme
-
Chat theme. Extend ChatTheme class to create your own theme or use
existing one, like the DefaultChatTheme. You can customize only certain
variables, see more here DefaultChatTheme.
final
- timeFormat → DateFormat?
-
Allows you to customize the time format. IMPORTANT: only for the time,
do not return date here. See dateFormat to customize the date format.
dateLocale will be ignored if you use this, so if you want a localized time
make sure you initialize your
DateFormat
with a locale. See customDateHeaderText for more customization.final - usePreviewData → bool
-
See Message.usePreviewData
final
- user → User
-
See
InheritedUser.user
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _ChatState -
Creates the mutable state for this widget at a given location in the tree.
override
-
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