AiChatView class

A batteries-included chat surface: the AiChat transcript above an AiPromptInput, laid out and safe-area-aware. Drop it straight into a Scaffold body — the fastest path from pub add to a working chat:

Scaffold(body: AiChatView(controller: controller));

Everything is overridable; reach for AiChat + AiPromptInput directly only when you need a custom layout between them.

Inheritance

Constructors

AiChatView({Key? key, required UseChatController controller, AiTextRenderer textRenderer = const MarkdownTextRenderer(), AiWidgetRegistry? widgetRegistry, AiPartBuilder? partBuilder, AiPartActionCallback? onPartAction, Widget? emptyState, String? hintText, double? maxContentWidth, Future<List<FilePart>> onPickAttachment()?, VoidCallback? onVoice, VoidCallback? onLive, Widget messageBuilder(BuildContext context, AiMessage message)?})
Creates a chat surface bound to controller.
const

Properties

controller → UseChatController
The chat controller to drive the transcript and input.
final
emptyState → Widget?
Shown when the conversation is empty.
final
hashCode → int
The hash code for this object.
no setterinherited
hintText → String?
Composer placeholder. Defaults to the localized "Message".
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxContentWidth → double?
On wide screens, centers the transcript at this width (like ChatGPT).
final
messageBuilder → Widget Function(BuildContext context, AiMessage message)?
Optional override for how each message is built.
final
onLive → VoidCallback?
Live-voice entry point. Hidden when null.
final
onPartAction → AiPartActionCallback?
Receives addressed values from custom parts without changing history.
final
onPickAttachment → Future<List<FilePart>> Function()?
Stages attachments to send with the next message. Hidden when null.
final
onVoice → VoidCallback?
Voice-dictation entry point. Hidden when null.
final
partBuilder → AiPartBuilder?
Overrides individual parts before registry/default rendering. A whole-message builder, when supplied, owns its own part rendering.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
textRenderer → AiTextRenderer
Renderer for message text. Defaults to MarkdownTextRenderer.
final
widgetRegistry → AiWidgetRegistry?
Maps data parts to widgets. Unknown types retain the default rendering.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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