StreamMessageListView constructor
const
StreamMessageListView({
- Key? key,
- bool showScrollToBottom = true,
- bool showUnreadCountOnScrollToBottom = false,
- Widget scrollToBottomBuilder()?,
- bool showUnreadIndicator = true,
- Widget unreadIndicatorBuilder()?,
- bool markReadWhenAtTheBottom = false,
- MessageBuilder? messageBuilder,
- ParentMessageBuilder? parentMessageBuilder,
- Message? parentMessage,
- ThreadBuilder? threadBuilder,
- ThreadTapCallback? onThreadTap,
- Widget dateDividerBuilder()?,
- ScrollPhysics? scrollPhysics = const ClampingScrollPhysics(),
- int? initialScrollIndex,
- double? initialAlignment,
- ItemScrollController? scrollController,
- ItemPositionsListener? itemPositionListener,
- bool highlightInitialMessage = false,
- Color? messageHighlightColor,
- bool showConnectionStateTile = false,
- WidgetBuilder? headerBuilder,
- WidgetBuilder? loadingBuilder,
- WidgetBuilder? emptyBuilder,
- SystemMessageBuilder? systemMessageBuilder,
- EphemeralMessageBuilder? ephemeralMessageBuilder,
- Widget messageListBuilder()?,
- ErrorBuilder? errorBuilder,
- bool messageFilter()?,
- 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,
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,
});