AiChatWidget class

A customizable chat widget for AI conversations.

Inheritance

Constructors

AiChatWidget({Key? key, required ChatUser currentUser, required ChatUser aiUser, required ChatMessagesController controller, required void onSendMessage(ChatMessage), List<ChatMessage>? messages, InputOptions? inputOptions, MessageOptions? messageOptions, MessageListOptions? messageListOptions, List<ChatUser>? typingUsers, bool readOnly = false, QuickReplyOptions? quickReplyOptions, ScrollToBottomOptions? scrollToBottomOptions, ScrollController? scrollController, WelcomeMessageConfig? welcomeMessageConfig, List<ExampleQuestion> exampleQuestions = const [], bool persistentExampleQuestions = false, bool enableAnimation = true, double? maxWidth, LoadingConfig? loadingConfig, PaginationConfig? paginationConfig, EdgeInsets? padding, bool enableMarkdownStreaming = true, Duration streamingDuration = const Duration(milliseconds: 30), String aiName = 'AI', ScrollBehaviorConfig? scrollBehaviorConfig, VoiceOptions? voiceOptions})
const

Properties

aiName String
Name of the AI assistant (for display)
final
aiUser ChatUser
The AI assistant in the conversation
final
controller ChatMessagesController
The controller for managing chat messages
final
currentUser ChatUser
The current user in the conversation
final
enableAnimation bool
Whether to enable animations
final
enableMarkdownStreaming bool
Whether to enable markdown streaming animations
final
exampleQuestions List<ExampleQuestion>
Example questions to show in the welcome message. When non-empty, these will enable the welcome message at the start of the conversation even if welcomeMessageConfig is null.
final
hashCode int
The hash code for this object.
no setterinherited
inputOptions InputOptions?
Customization options for the input field
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
loadingConfig LoadingConfig?
Configuration for loading states
final
maxWidth double?
Maximum width of the chat widget
final
messageListOptions MessageListOptions?
Customization options for the message list
final
messageOptions MessageOptions?
Customization options for messages
final
messages List<ChatMessage>?
Optional list of messages (if not using controller)
final
onSendMessage → void Function(ChatMessage)
Callback when a message is sent
final
padding EdgeInsets?
Padding around the entire widget
final
paginationConfig PaginationConfig?
Configuration for pagination
final
persistentExampleQuestions bool
Whether to show example questions persistently
final
quickReplyOptions QuickReplyOptions?
Customization options for quick replies
final
readOnly bool
Whether the chat interface is in read-only mode
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollBehaviorConfig ScrollBehaviorConfig?
Style sheet for markdown rendering Configuration for scroll behavior
final
scrollController ScrollController?
Optional scroll controller
final
scrollToBottomOptions ScrollToBottomOptions?
Customization options for the scroll-to-bottom button
final
streamingDuration Duration
Duration for streaming animations
final
typingUsers List<ChatUser>?
Users who are currently typing
final
voiceOptions VoiceOptions?
Optional file upload options
final
welcomeMessageConfig WelcomeMessageConfig?
Configuration for welcome messages. When provided, the welcome message will be shown at the start of the conversation. If this is null and exampleQuestions is empty, no welcome message will be displayed.
final

Methods

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