ChatView class

Complete and configurable widget for chat.

Features:

  • Smart scrolling
  • Multiline input area
  • Reply bar
  • Pagination
  • Customizable builders
  • Error and loading handling

Example:

ChatView(
  service: chatService,
  chatId: 'chat-123',
  currentUserId: 'user-456',
  config: chatConfig,
)
Inheritance

Constructors

ChatView({Key? key, required ChatService service, required String chatId, required String currentUserId, required ChatConfig config, ChatTheme? theme, ChatTextStyle? textStyle, ChatAppActions? appActions, Widget messageBuilder(BuildContext, ChatMessage)?, Widget replyPreviewBuilder(BuildContext, ChatMessage)?, bool enableReply = true, bool listenUnreadCount = true, InputDecoration? inputDecoration, Widget? sendIcon, VoidCallback? onMessageSent, VoidCallback? onError, Widget loadingBuilder(BuildContext)?})
Creates a new ChatView.
const

Properties

appActions ChatAppActions?
Optional custom app actions.
final
chatId String
ID of the chat.
final
config ChatConfig
Configuration for the chat module.
final
currentUserId String
ID of the current user.
final
enableReply bool
Whether reply functionality is enabled.
final
hashCode int
The hash code for this object.
no setterinherited
inputDecoration InputDecoration?
Custom input decoration.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
listenUnreadCount bool
Whether to listen to unread count.
final
loadingBuilder Widget Function(BuildContext)?
Custom loading indicator builder. If not provided, uses default CircularProgressIndicator.
final
messageBuilder Widget Function(BuildContext, ChatMessage)?
Custom message builder.
final
onError VoidCallback?
Callback when an error occurs.
final
onMessageSent VoidCallback?
Callback when a message is sent.
final
replyPreviewBuilder Widget Function(BuildContext, ChatMessage)?
Custom reply preview builder.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sendIcon Widget?
Custom send icon.
final
service ChatService
The chat service implementation.
final
textStyle ChatTextStyle?
Optional custom text style.
final
theme ChatTheme?
Optional custom theme.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<ChatView>
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