StreamMessageListView class

screenshot screenshot

Shows the list of messages in the current channel.

class ChannelPage extends StatelessWidget {
  const ChannelPage({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: StreamChannelHeader(),
      body: Column(
        children: <Widget>[
          Expanded(
            child: StreamMessageListView(
              threadBuilder: (_, parentMessage) {
                return ThreadPage(
                  parent: parentMessage,
                );
              },
            ),
          ),
          StreamMessageInput(),
        ],
      ),
    );
  }
}

A StreamChannel ancestor widget is required in order to provide the information about the channels.

Uses a ScrollablePositionedList to render the list of channels.

The UI is rendered based on the first ancestor of type StreamChatTheme. Modify it to change the widget's appearance.

Inheritance

Constructors

StreamMessageListView({Key? key, bool showScrollToBottom = true, bool showUnreadCountOnScrollToBottom = false, Widget scrollToBottomBuilder(int unreadCount, Future<void> scrollToBottomDefaultTapAction(int))?, bool showUnreadIndicator = true, Widget unreadIndicatorBuilder(int unreadCount, Future<void> scrollToUnreadDefaultTapAction(String), Future<void> dismissIndicatorDefaultTapAction())?, bool markReadWhenAtTheBottom = false, MessageBuilder? messageBuilder, ParentMessageBuilder? parentMessageBuilder, Message? parentMessage, ThreadBuilder? threadBuilder, ThreadTapCallback? onThreadTap, Widget dateDividerBuilder(DateTime)?, ScrollPhysics? scrollPhysics = const ClampingScrollPhysics(), int? initialScrollIndex, double? initialAlignment, ItemScrollController? scrollController, ItemPositionsListener? itemPositionListener, bool highlightInitialMessage = false, Color? messageHighlightColor, bool showConnectionStateTile = false, WidgetBuilder? headerBuilder, WidgetBuilder? footerBuilder, WidgetBuilder? loadingBuilder, WidgetBuilder? emptyBuilder, SystemMessageBuilder? systemMessageBuilder, EphemeralMessageBuilder? ephemeralMessageBuilder, Widget messageListBuilder(BuildContext, List<Message>)?, ErrorBuilder? errorBuilder, bool messageFilter(Message)?, OnMessageTap? onMessageTap, OnMessageTap? onSystemMessageTap, bool showFloatingDateDivider = true, dynamic threadSeparatorBuilder(BuildContext context, Message parentMessage)?, Widget unreadMessagesSeparatorBuilder(BuildContext context, int unreadCount)?, MessageListController? messageListController, bool reverse = true, bool shrinkWrap = false, int paginationLimit = 20, WidgetBuilder? paginationLoadingIndicatorBuilder, ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.onDrag, SpacingWidgetBuilder spacingWidgetBuilder = _defaultSpacingWidgetBuilder})
screenshot screenshot
const

Properties

dateDividerBuilder → (Widget Function(DateTime)?)
Builder used to render date dividers
final
emptyBuilder WidgetBuilder?
Function used to build an empty widget
final
ephemeralMessageBuilder EphemeralMessageBuilder?
A widget builder for creating custom ephemeral messages.
final
errorBuilder ErrorBuilder?
Callback triggered when an error occurs while performing the given request.
final
footerBuilder WidgetBuilder?
Function used to build a footer widget
final
hashCode int
The hash code for this object.
no setterinherited
headerBuilder WidgetBuilder?
Function used to build a header widget
final
highlightInitialMessage bool
If true the list will highlight the initialMessage if there is any.
final
initialAlignment double?
Determines where the leading edge of the item at initialScrollIndex should be placed.
final
initialScrollIndex int?
Index of an item to initially align within the viewport.
final
itemPositionListener ItemPositionsListener?
Provides a listenable iterable of itemPositions of items that are on screen and their locations.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardDismissBehavior ScrollViewKeyboardDismissBehavior
ScrollViewKeyboardDismissBehavior the defines how this PositionedList will dismiss the keyboard automatically.
final
loadingBuilder WidgetBuilder?
Function used to build a loading widget
final
markReadWhenAtTheBottom bool
If true will mark channel as read when the user scrolls to the bottom of the list
final
messageBuilder MessageBuilder?
A widget builder for creating custom message UI.
final
messageFilter → (bool Function(Message)?)
Predicate used to filter messages
final
messageHighlightColor Color?
Color used while highlighting initial message
final
messageListBuilder → (Widget Function(BuildContext, List<Message>)?)
Function called when messages are fetched
final
messageListController MessageListController?
A MessageListController allows pagination.
final
onMessageTap OnMessageTap?
Called when any message is tapped except a system message (use onSystemMessageTap instead)
final
onSystemMessageTap OnMessageTap?
Called when system message is tapped
final
onThreadTap ThreadTapCallback?
The action to perform when threads are tapped.
final
paginationLimit int
Limit used during pagination
final
paginationLoadingIndicatorBuilder WidgetBuilder?
Builder used to build the loading indicator shown while paginating.
final
parentMessage Message?
Parent message in case of a thread
final
parentMessageBuilder ParentMessageBuilder?
A widget builder for creating custom parent message UI.
final
reverse bool
Whether the view scrolls in the reading direction.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollController ItemScrollController?
Controller for jumping or scrolling to an item.
final
scrollPhysics ScrollPhysics?
The ScrollPhysics used by the ListView
final
scrollToBottomBuilder → (Widget Function(int unreadCount, Future<void> scrollToBottomDefaultTapAction(int))?)
Function used to build a custom scroll to bottom widget
final
showConnectionStateTile bool
Flag for showing tile on header
final
showFloatingDateDivider bool
Flag for showing the floating date divider
final
showScrollToBottom bool
If true will show a scroll to bottom button when the scroll offset is not zero
final
showUnreadCountOnScrollToBottom bool
If true will show an indicator with number of unread messages on scroll to bottom button
final
showUnreadIndicator bool
If true will show an indicator with number of unread messages that will scroll to latest read message when tapped and mark channel as read when dismissed
final
shrinkWrap bool
Whether the extent of the scroll view in the scrollDirection should be determined by the contents being viewed.
final
spacingWidgetBuilder SpacingWidgetBuilder
A widget builder for creating certain spacing after widgets.
final
systemMessageBuilder SystemMessageBuilder?
A widget builder for creating custom system messages.
final
threadBuilder ThreadBuilder?
A widget builder for creating custom thread UI.
final
threadSeparatorBuilder → (dynamic Function(BuildContext context, Message parentMessage)?)
Builder used to build the thread separator in case it's a thread view
final
unreadIndicatorBuilder → (Widget Function(int unreadCount, Future<void> scrollToUnreadDefaultTapAction(String), Future<void> dismissIndicatorDefaultTapAction())?)
Function used to build a custom unread indicator widget
final
unreadMessagesSeparatorBuilder → (Widget Function(BuildContext context, int unreadCount)?)
Builder used to build the unread message separator
final

Methods

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