Chat class
The main widget that orchestrates the chat UI.
Sets up necessary providers (ChatController, ChatTheme, Builders, etc.) and displays the chat list and composer.
- Inheritance
Constructors
- Chat.new({Key? key, required UserID currentUserId, required ResolveUserCallback resolveUser, required ChatController chatController, Builders? builders, CrossCache? crossCache, UserCache? userCache, ChatTheme? theme, OnMessageSendCallback? onMessageSend, OnMessageTapCallback? onMessageTap, OnMessageLongPressCallback? onMessageLongPress, OnAttachmentTapCallback? onAttachmentTap, Color? backgroundColor, Decoration? decoration, DateFormat? timeFormat, String? scrollToBottomArrow, required ShapeBorder? shapeBorder, required ScrollController scrollController})
-
Creates the main chat widget.
const
Properties
- backgroundColor → Color?
-
Background color for the main chat container.
Overrides the color provided by theme if set.
Ignored if decoration is provided.
final
- builders → Builders?
-
Collection of custom builder functions for UI components.
final
- chatController → ChatController
-
The controller managing the chat message state.
final
- crossCache → CrossCache?
-
Cross-platform cache utility, primarily for images.
If not provided, a default instance is created.
final
- currentUserId → UserID
-
The ID of the currently logged-in user.
final
- decoration → Decoration?
-
Decoration for the main chat container.
Overrides backgroundColor.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onAttachmentTap → OnAttachmentTapCallback?
-
Callback triggered when the attachment button in the composer is tapped.
final
- onMessageLongPress → OnMessageLongPressCallback?
-
Callback triggered when a message is long-pressed.
final
- onMessageSend → OnMessageSendCallback?
-
Callback triggered when the user attempts to send a message.
final
- onMessageTap → OnMessageTapCallback?
-
Callback triggered when a message is tapped.
final
- resolveUser → ResolveUserCallback
-
Callback to resolve a User object from a UserID.
Used for displaying user avatars and potentially names.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController
-
final
- scrollToBottomArrow → String?
-
final
- shapeBorder → ShapeBorder?
-
final
- theme → ChatTheme?
-
The visual theme for the chat UI.
If not provided, defaults to ChatTheme.light.
final
- timeFormat → DateFormat?
-
Date format for displaying message timestamps.
Defaults to 'HH:mm' (e.g., 14:30).
final
- userCache → UserCache?
-
Optional user-provided cache for resolved
User
objects. Ideally, you would not provide this and rely on the default internal LRU cache. However, you can supply your own instance if you need direct control to clear the cache for a specific user (e.g., when an avatar URL changes and requires a refresh).final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< Chat> -
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, int wrapWidth = 65}) → 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