PrismAiMessageBubble class

One conversation turn as a token-styled chat bubble.

User messages render as an aligned filled bubble; assistant messages render as markdown with optional tool-call collapsibles. While isStreaming is true the bubble shows a PrismAiThinkingIndicator instead of content.

Every interactive affordance is optional: pass onCopy to show a copy action, onRegenerate to show a regenerate button on the last assistant turn, and onToolCallTap to react to tool-call taps.

PrismAiMessageBubble(
  message: lastMessage,
  isStreaming: controller.isStreaming,
  onRegenerate: () => controller.resend(),
)
Inheritance

Constructors

PrismAiMessageBubble({Key? key, required AiChatMessage message, bool isStreaming = false, bool markdownAssistant = true, String? thinkingLabel, double maxWidth = 560, VoidCallback? onCopy, VoidCallback? onRegenerate, void onToolCallTap(AiToolCallRequest call)?})
Creates a chat bubble for message.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
isStreaming → bool
When true, shows a thinking indicator instead of the message body (only meaningful for assistant turns that have no content yet).
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
markdownAssistant → bool
Whether assistant text is rendered as markdown (defaults to true).
final
maxWidth → double
Maximum bubble width before text wraps.
final
message → AiChatMessage
The message to render.
final
onCopy → VoidCallback?
Copy affordance; omit to hide.
final
onRegenerate → VoidCallback?
Regenerate affordance; omit to hide.
final
onToolCallTap → void Function(AiToolCallRequest call)?
Called when a tool-call chip is tapped.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
thinkingLabel → String?
Label shown by the thinking indicator while isStreaming is true.
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