ReplitThread class

The scrollable conversation, a list of ReplitMessageDatas.

A conversation that still fits its viewport reads from the top, the AI apps' convention; once it grows past the viewport it anchors to the bottom instead. Uses a reversed ListView underneath so the thread naturally sticks to the newest message while a reply streams in, and holds position when the user scrolls up to read history. Needs a bounded height (an Expanded in a column, or a sized parent).

Text in the thread is selectable, the way a chat in a browser is: drag across turns with a mouse, long-press on touch, then copy with the platform's shortcut or menu. Paragraphs copy on their own lines and turns a blank line apart; button labels, code headers and the thinking line stay out of it. selectable false leaves selection to the host.

Inheritance

Constructors

ReplitThread({Key? key, required List<ReplitMessageData> messages, ReplitCustomPartBuilder? customPartBuilder, void onAttachmentTap(ReplitMessageData message, String attachmentId)?, String? previewCloseTooltip, ValueChanged<ReplitCodePart>? onCodeCopy, ReplitCodePart? copiedCodePart, String? codeCopyTooltip, bool markdown = true, void onLinkTap(ReplitMessageData message, String attachmentId)?, void onRetry(ReplitMessageData message)?, String? errorTitle, String? retryLabel, void onConfirmationRespond(ReplitMessageData message, ReplitConfirmationPart part, bool approved)?, String? approveLabel, String? rejectLabel, String? approvedLabel, String? rejectedLabel, String? toolInputLabel, String? toolOutputLabel, ScrollController? controller, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.onDrag, EdgeInsetsGeometry? padding, double? itemSpacing, Widget messageBuilder(BuildContext context, ReplitMessageData message)?, Widget? messageFooter(ReplitMessageData message)?, double charactersPerSecond = 300, String? thinkingLabel, bool selectable = true})
const

Properties

approvedLabel → String?
final
approveLabel → String?
Host-localized labels for the thread's 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
charactersPerSecond → double
Forwarded to ReplitMessage for streaming text parts.
final
codeCopyTooltip → String?
Host-localized label for the code blocks' copy affordance.
final
controller → ScrollController?
Optional external scroll controller.
final
copiedCodePart → ReplitCodePart?
The part whose block shows the copied check — the instance received from onCodeCopy, passed back while the host's confirmation lasts.
final
customPartBuilder → ReplitCustomPartBuilder?
Forwarded to each ReplitMessage.
final
errorTitle → String?
Host-localized headline for the thread's error cards, e.g. 'Connection error'.
final
hashCode → int
The hash code for this object.
no setterinherited
itemSpacing → double?
Gap between messages; defaults to the design's 32.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardDismissBehavior → ScrollViewKeyboardDismissBehavior
How scrolling the thread treats an open keyboard. Defaults to dismissing it on drag — reading history and typing are different modes, the chat convention.
final
markdown → bool
Whether assistant text parts render as markdown. Forwarded to each ReplitMessage; pass false for hosts whose assistant text is literal.
final
messageBuilder → Widget Function(BuildContext context, ReplitMessageData message)?
Per-message override; defaults to a ReplitMessage.
final
messageFooter → Widget? Function(ReplitMessageData message)?
Builds each default message's footer slot — an actions row, a timestamp — without replacing the message the way messageBuilder does, so the thread's per-message wiring stays intact. Return null for no footer on that turn. Ignored when messageBuilder is set: the builder owns the whole message.
final
messages → List<ReplitMessageData>
Oldest → newest; once the conversation outgrows the viewport, the thread anchors to the newest.
final
onAttachmentTap → void Function(ReplitMessageData message, String attachmentId)?
Called with the message the attachment belongs to and its id — attachment ids only need to be unique within their own message.
final
onCodeCopy → ValueChanged<ReplitCodePart>?
Copy intent from any code block in the thread, handed the tapped ReplitCodePart. Forwarded to each ReplitMessage.
final
onConfirmationRespond → void Function(ReplitMessageData message, ReplitConfirmationPart part, bool approved)?
Approve/reject intent from a ReplitConfirmationPart's card, handed the message, the part and the decision so the host can find the request it belongs to and re-render the part settled. Forwarded to each ReplitMessage; null renders every pending card without buttons.
final
onLinkTap → void Function(ReplitMessageData message, String attachmentId)?
Link intent from any markdown content in the thread, handed the message and the tapped href. Null renders links as plain prose.
final
onRetry → void Function(ReplitMessageData message)?
Retry intent from a failed turn's error card, handed the message so the host can re-run it. Forwarded to each ReplitMessage.
final
padding → EdgeInsetsGeometry?
Around the whole conversation. Defaults to the design's 16 at the sides and 40 above and below.
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
selectable → bool
Whether the thread hosts its own selection area — one region across every turn, so a drag or a long-press selects prose, code and tables alike, and a copy joins paragraphs with line breaks and turns with a blank line, in the theme's selection colours. False leaves selection to the host: inside a host's SelectionArea the content joins it, code blocks included; with no area above, nothing in the thread selects, so long-press stays the host's.
final
thinkingLabel → String?
Forwarded to each ReplitMessage: the label beside the thinking glyph on a pending message.
final
toolInputLabel → String?
Host-localized section labels for the thread's tool cards — over each card's input and output blocks, e.g. 'Input' and 'Output'. Forwarded to each ReplitMessage; null lets a block fall back to its language id.
final
toolOutputLabel → String?
final

Methods

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