ChatAnimatedList class
An animated list widget specifically designed for displaying chat messages.
Handles message insertion/removal animations, pagination (loading older messages), automatic scrolling, keyboard handling, and scroll-to-bottom functionality. It listens to a ChatController for message updates.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ChatAnimatedList
Constructors
- ChatAnimatedList({Key? key, required ChatItem itemBuilder, ScrollController? scrollController, bool reversed = false, Duration insertAnimationDuration = const Duration(milliseconds: 250), Duration removeAnimationDuration = const Duration(milliseconds: 250), MessageAnimationDurationResolver? insertAnimationDurationResolver, MessageAnimationDurationResolver? removeAnimationDurationResolver, Duration scrollToEndAnimationDuration = const Duration(milliseconds: 250), Duration scrollToBottomAppearanceDelay = const Duration(milliseconds: 250), double scrollToBottomAppearanceThreshold = 0, double? topPadding = 8, double? bottomPadding = 20, Widget? topSliver, Widget? bottomSliver, bool? handleSafeArea = true, ScrollViewKeyboardDismissBehavior? keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.onDrag, InitialScrollToEndMode? initialScrollToEndMode = InitialScrollToEndMode.jump, bool? shouldScrollToEndWhenSendingMessage = true, bool? shouldScrollToEndWhenAtBottom = true, PaginationCallback? onEndReached, String? scrollToBottomArrow, double? paginationThreshold = 0.01, MessagesGroupingMode? messagesGroupingMode, int? messageGroupingTimeoutInSeconds, ScrollPhysics? physics})
-
Creates an animated chat list.
const
Properties
- bottomPadding → double?
-
Padding added below the last item (before the composer).
final
- bottomSliver → Widget?
-
Optional sliver widget to place at the very bottom of the scroll view.
final
- handleSafeArea → bool?
-
Whether to handle bottom safe area padding automatically.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialScrollToEndMode → InitialScrollToEndMode?
-
How the list should initially scroll to the end.
Note: has no effect if reversed is true, as list starts at the bottom.
final
- insertAnimationDuration → Duration
-
Default duration for message insertion animations.
final
- insertAnimationDurationResolver → MessageAnimationDurationResolver?
-
Optional function to resolve custom insertion animation duration per message.
final
- itemBuilder → ChatItem
-
Builder function for creating individual chat message widgets.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardDismissBehavior → ScrollViewKeyboardDismissBehavior?
-
How the scroll view should dismiss the keyboard.
final
- messageGroupingTimeoutInSeconds → int?
-
Timeout in seconds for grouping consecutive messages from the same author.
final
- messagesGroupingMode → MessagesGroupingMode?
-
The mode to use for grouping messages.
final
- onEndReached → PaginationCallback?
-
Callback triggered when the user scrolls near the top, requesting older messages.
final
- paginationThreshold → double?
-
Threshold for triggering pagination, represented as a value between 0 and 1.
0 represents the top of the list, while 1 represents the bottom.
A value of 0.2 means pagination will trigger when scrolled to 20% from the top.
final
- physics → ScrollPhysics?
-
Physics for the scroll view.
final
- removeAnimationDuration → Duration
-
Default duration for message removal animations.
final
- removeAnimationDurationResolver → MessageAnimationDurationResolver?
-
Optional function to resolve custom removal animation duration per message.
final
- reversed → bool
-
Whether the list should be laid out and scrolled in reverse order.
When true, new items are added at the bottom and the list grows upwards.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
Optional scroll controller for the underlying CustomScrollView.
final
- scrollToBottomAppearanceDelay → Duration
-
Delay before the scroll-to-bottom button appears after scrolling up.
final
- scrollToBottomAppearanceThreshold → double
-
Threshold for triggering scroll-to-bottom button appearance.
final
- scrollToBottomArrow → String?
-
final
- scrollToEndAnimationDuration → Duration
-
Duration for scrolling to the end/bottom of the list.
final
- shouldScrollToEndWhenAtBottom → bool?
-
Whether to automatically scroll to the end if the user is already at the bottom
when a new message arrives.
Note: has no effect if reversed is true, as new items appear at the bottom.
final
- shouldScrollToEndWhenSendingMessage → bool?
-
Whether to automatically scroll to the end when a new message is sent (inserted).
final
- topPadding → double?
-
Padding added above the first item in the list.
final
- topSliver → Widget?
-
Optional sliver widget to place at the very top of the scroll view.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _ChatAnimatedListState -
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