StreamMessageListView constructor

const StreamMessageListView({
  1. Key? key,
  2. bool showScrollToBottom = true,
  3. bool showUnreadCountOnScrollToBottom = false,
  4. Widget scrollToBottomBuilder(
    1. int unreadCount,
    2. Future<void> scrollToBottomDefaultTapAction(
      1. int
      )
    )?,
  5. bool showUnreadIndicator = true,
  6. Widget unreadIndicatorBuilder(
    1. int unreadCount,
    2. Future<void> scrollToUnreadDefaultTapAction(
      1. String
      ),
    3. Future<void> dismissIndicatorDefaultTapAction()
    )?,
  7. bool markReadWhenAtTheBottom = false,
  8. MessageBuilder? messageBuilder,
  9. ParentMessageBuilder? parentMessageBuilder,
  10. Message? parentMessage,
  11. ThreadBuilder? threadBuilder,
  12. ThreadTapCallback? onThreadTap,
  13. Widget dateDividerBuilder(
    1. DateTime
    )?,
  14. ScrollPhysics? scrollPhysics = const ClampingScrollPhysics(),
  15. int? initialScrollIndex,
  16. double? initialAlignment,
  17. ItemScrollController? scrollController,
  18. ItemPositionsListener? itemPositionListener,
  19. bool highlightInitialMessage = false,
  20. Color? messageHighlightColor,
  21. bool showConnectionStateTile = false,
  22. WidgetBuilder? headerBuilder,
  23. WidgetBuilder? footerBuilder,
  24. WidgetBuilder? loadingBuilder,
  25. WidgetBuilder? emptyBuilder,
  26. SystemMessageBuilder? systemMessageBuilder,
  27. EphemeralMessageBuilder? ephemeralMessageBuilder,
  28. Widget messageListBuilder(
    1. BuildContext,
    2. List<Message>
    )?,
  29. ErrorBuilder? errorBuilder,
  30. bool messageFilter(
    1. Message
    )?,
  31. OnMessageTap? onMessageTap,
  32. OnMessageTap? onSystemMessageTap,
  33. bool showFloatingDateDivider = true,
  34. dynamic threadSeparatorBuilder(
    1. BuildContext context,
    2. Message parentMessage
    )?,
  35. Widget unreadMessagesSeparatorBuilder(
    1. BuildContext context,
    2. int unreadCount
    )?,
  36. MessageListController? messageListController,
  37. bool reverse = true,
  38. bool shrinkWrap = false,
  39. int paginationLimit = 20,
  40. WidgetBuilder? paginationLoadingIndicatorBuilder,
  41. ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.onDrag,
  42. SpacingWidgetBuilder spacingWidgetBuilder = _defaultSpacingWidgetBuilder,
})

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.

Implementation

const StreamMessageListView({
  super.key,
  this.showScrollToBottom = true,
  this.showUnreadCountOnScrollToBottom = false,
  this.scrollToBottomBuilder,
  this.showUnreadIndicator = true,
  this.unreadIndicatorBuilder,
  this.markReadWhenAtTheBottom = false,
  this.messageBuilder,
  this.parentMessageBuilder,
  this.parentMessage,
  this.threadBuilder,
  this.onThreadTap,
  this.dateDividerBuilder,
  // we need to use ClampingScrollPhysics to avoid the list view to bounce
  // when we are at the either end of the list view and try to use 'animateTo'
  // to animate in the same direction.
  this.scrollPhysics = const ClampingScrollPhysics(),
  this.initialScrollIndex,
  this.initialAlignment,
  this.scrollController,
  this.itemPositionListener,
  this.highlightInitialMessage = false,
  this.messageHighlightColor,
  this.showConnectionStateTile = false,
  this.headerBuilder,
  this.footerBuilder,
  this.loadingBuilder,
  this.emptyBuilder,
  this.systemMessageBuilder,
  this.ephemeralMessageBuilder,
  this.messageListBuilder,
  this.errorBuilder,
  this.messageFilter,
  this.onMessageTap,
  this.onSystemMessageTap,
  this.showFloatingDateDivider = true,
  this.threadSeparatorBuilder,
  this.unreadMessagesSeparatorBuilder,
  this.messageListController,
  this.reverse = true,
  this.shrinkWrap = false,
  this.paginationLimit = 20,
  this.paginationLoadingIndicatorBuilder,
  this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.onDrag,
  this.spacingWidgetBuilder = _defaultSpacingWidgetBuilder,
});