FlyerChatTextStreamMessage class
A widget that displays a text message which is being streamed incrementally.
This widget expects a TextStreamMessage
and the current StreamState
(managed externally) to render the incoming text dynamically.
It supports two rendering modes via TextStreamMessageMode:
animatedOpacity
: Fades in each new chunk of text.instantMarkdown
: Renders the full accumulated text with Markdown on each update.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FlyerChatTextStreamMessage
Constructors
- FlyerChatTextStreamMessage.new({Key? key, required TextStreamMessage message, required int index, required StreamState streamState, EdgeInsetsGeometry? padding = const EdgeInsets.symmetric(horizontal: 16, vertical: 10), BorderRadiusGeometry? borderRadius, Color? sentBackgroundColor, Color? receivedBackgroundColor, TextStyle? sentTextStyle, TextStyle? receivedTextStyle, TextStyle? timeStyle, bool showTime = true, bool showStatus = true, TimeAndStatusPosition timeAndStatusPosition = TimeAndStatusPosition.end, Duration chunkAnimationDuration = const Duration(milliseconds: 350), TextStreamMessageMode mode = TextStreamMessageMode.animatedOpacity, void onLinkTap(String url, String title)?, String loadingText = 'Thinking', Color? shimmerBaseColor, Color? shimmerHighlightColor, Duration shimmerPeriod = const Duration(milliseconds: 1000), Widget loadingBuilder(BuildContext context, TextStyle? paragraphStyle)?})
-
Creates a widget to display a streaming text message.
const
Properties
- borderRadius → BorderRadiusGeometry?
-
Border radius of the message bubble.
final
- chunkAnimationDuration → Duration
-
Duration for the fade-in animation of each text chunk when
mode
is TextStreamMessageMode.animatedOpacity.final - hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
The index of the message in the list.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingBuilder → Widget Function(BuildContext context, TextStyle? paragraphStyle)?
-
A builder to completely override the default loading widget.
If provided,
loadingText
,shimmerBaseColor
, andshimmerHighlightColor
are ignored.final - loadingText → String
-
The text to display while in the loading state. Defaults to "Thinking".
final
- message → TextStreamMessage
-
The underlying
TextStreamMessage
data model.final - mode → TextStreamMessageMode
-
The rendering mode for the text content.
final
- onLinkTap → void Function(String url, String title)?
-
The callback function to handle link clicks.
final
- padding → EdgeInsetsGeometry?
-
Padding around the message bubble content.
final
- receivedBackgroundColor → Color?
-
Background color for messages received from other users.
final
- receivedTextStyle → TextStyle?
-
Text style for messages received from other users.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sentBackgroundColor → Color?
-
Background color for messages sent by the current user.
final
- sentTextStyle → TextStyle?
-
Text style for messages sent by the current user.
final
- shimmerBaseColor → Color?
-
The base color for the shimmer loading animation.
final
- shimmerHighlightColor → Color?
-
The highlight color for the shimmer loading animation.
final
- shimmerPeriod → Duration
-
The period of the shimmer loading animation.
final
- showStatus → bool
-
Whether to display the message status (sent, delivered, seen) for sent messages.
final
- showTime → bool
-
Whether to display the message timestamp.
final
- streamState → StreamState
-
The current state of the stream, determining what to display (loading,
streaming text, completed text, error).
final
- timeAndStatusPosition → TimeAndStatusPosition
-
Position of the timestamp and status indicator relative to the text.
final
- timeStyle → TextStyle?
-
Text style for the message timestamp.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< FlyerChatTextStreamMessage> -
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