ReplitMessage class
Renders a single ReplitMessageData with role-appropriate presentation:
- user — right-aligned bubble, a wash of ink over the page.
- assistant — plain full-width content, no bubble.
- system — centered muted text (notices, dividers).
ReplitMessageStatus.pending assistant messages show a ReplitThinkingIndicator; ReplitMessageStatus.streaming animates the last text part via ReplitStreamingText. A ReplitMessageStatus.error assistant turn keeps its parts in normal ink and closes with a ReplitErrorState card — the message's own ReplitErrorPart, or a default one when the host supplies none; an error user bubble recolors to the error container. A ReplitConfirmationPart renders a ReplitConfirmation card, its buttons reporting through onConfirmationRespond; a ReplitToolPart renders a ReplitTool card, its blocks copying through onCodeCopy like any code part.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- ReplitMessage
Constructors
-
ReplitMessage(ReplitMessageData message, {Key? key, ReplitCustomPartBuilder? customPartBuilder, ValueChanged<
String> ? onAttachmentTap, String? previewCloseTooltip, ValueChanged<ReplitCodePart> ? onCodeCopy, ReplitCodePart? copiedCodePart, String? codeCopyTooltip, bool markdown = true, ValueChanged<String> ? onLinkTap, VoidCallback? onRetry, String? errorTitle, String? retryLabel, void onConfirmationRespond(ReplitConfirmationPart part, bool approved)?, String? approveLabel, String? rejectLabel, String? approvedLabel, String? rejectedLabel, String? toolInputLabel, String? toolOutputLabel, Widget? leading, double maxBubbleWidthFraction = 0.75, TextStyle? textStyle, double charactersPerSecond = 300, String? thinkingLabel, BorderRadius? bubbleRadius, EdgeInsetsGeometry? bubblePadding, ReplitMessageStyle? style}) -
const
Properties
- approvedLabel → String?
-
final
- approveLabel → String?
-
Host-localized labels for the confirmation cards — the approve and
reject buttons, and the settled row's approved and rejected text. A
null button label hides that button; a null settled label leaves the
outcome glyph alone.
final
- bubblePadding → EdgeInsetsGeometry?
-
Inside the user bubble. Defaults to the design's 16/10.
final
- bubbleRadius → BorderRadius?
-
Corner radius of the user bubble, its error state included.
Defaults to the design's 12.
final
- charactersPerSecond → double
-
Forwarded to ReplitStreamingText while streaming.
final
- codeCopyTooltip → String?
-
Host-localized label for each code block's copy affordance.
final
- copiedCodePart → ReplitCodePart?
-
The part whose block shows the copied check — pass back the instance
received from onCodeCopy for as long as the confirmation should
last; the host owns the timing.
final
- customPartBuilder → ReplitCustomPartBuilder?
-
Hook for ReplitCustomPart content.
final
- errorTitle → String?
-
Host-localized headline for the error cards, e.g. 'Connection
error'. Null lets each card's message take the glyph row.
final
-
Slot below the content, e.g. message actions.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- leading → Widget?
-
Slot beside the content, e.g. an avatar.
final
- markdown → bool
-
Whether assistant text parts render as markdown (
ReplitMarkdown). User bubbles and system notices always render plain — what the user typed is a transcription, not prose to typeset. Pass false for hosts whose assistant text is literal.final - maxBubbleWidthFraction → double
-
User-bubble max width as a fraction of the available width.
final
- message → ReplitMessageData
-
The view model to render.
final
-
onAttachmentTap
→ ValueChanged<
String> ? -
Called with the tapped attachment's id, instead of opening the
built-in full-screen preview. Sent attachments are never removable, so
this is the only intent they report — and a host that just wants to
observe the tap should call
showReplitAttachmentPreviewfrom the handler, or the images stop opening.final -
onCodeCopy
→ ValueChanged<
ReplitCodePart> ? -
Copy intent from a ReplitCodePart's block, handed the part so the
host knows which code to write to the clipboard. Null hides every
block's copy affordance.
final
- onConfirmationRespond → void Function(ReplitConfirmationPart part, bool approved)?
-
Approve/reject intent from a ReplitConfirmationPart's card, handed
the part and the decision. Null renders every pending card without
buttons — a read-only notice.
final
-
onLinkTap
→ ValueChanged<
String> ? -
Link intent from markdown content, handed the tapped href. Null
renders links as plain prose; the package never launches URLs.
final
- onRetry → VoidCallback?
-
Retry intent from the turn's error card — the default card a failed
assistant turn renders, or any ReplitErrorPart's (unless the part
says
retryable: false). Null hides every retry affordance.final - previewCloseTooltip → String?
-
Host-localized label for the built-in preview's close button.
final
- rejectedLabel → String?
-
final
- rejectLabel → String?
-
final
- retryLabel → String?
-
Host-localized label for the error cards' retry pill; null renders
the pill glyph-only.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → ReplitMessageStyle?
-
Per-instance restyling, merged over ReplitTheme.messageStyle's
fields; nulls fall through to the theme tokens.
final
- textStyle → TextStyle?
-
Override for text parts; merged over
bodyLarge+ the role foreground.final - thinkingLabel → String?
-
Host-localized label beside the thinking glyph on a pending message,
e.g. 'Thinking…'. Null shows the glyph alone — the package ships no
strings.
final
- toolInputLabel → String?
-
Host-localized section labels over a tool card's input and output
blocks, e.g. 'Input' and 'Output'. Null lets each block fall back to
its language id, as a fence does.
final
- toolOutputLabel → String?
-
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