MessageListView class

screenshot screenshot

It shows the list of messages of the current channel.

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

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

Make sure to have a StreamChannel ancestor in order to provide the information about the channels. The widget uses a ListView.custom to render the list of channels.

The widget components render the ui based on the first ancestor of type StreamChatTheme. Modify it to change the widget appearance.

Constructors

MessageListView({Key key, MessageBuilder messageBuilder, ParentMessageBuilder parentMessageBuilder, Message parentMessage, ThreadBuilder threadBuilder, ThreadTapCallback onThreadTap, Widget dateDividerBuilder(DateTime), dynamic onMessageTap(Message), dynamic onSystemMessageTap(Message), dynamic onParentMessageTap(Message), ScrollPhysics scrollPhysics = const AlwaysScrollableScrollPhysics(), ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual})
Instantiate a new MessageListView

Properties

dateDividerBuilder → Widget Function(DateTime)
Builder used to render date dividers
final
hashCode → int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
key → Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
keyboardDismissBehavior → ScrollViewKeyboardDismissBehavior
The ScrollViewKeyboardDismissBehavior used by the ListView
final
messageBuilder MessageBuilder
Function used to build a custom message widget
final
onMessageTap → dynamic Function(Message)
The function called when tapping on the message when the message is not failed
final
onParentMessageTap → dynamic Function(Message)
The function called when tapping on the parent message when the message is not failed
final
onSystemMessageTap → dynamic Function(Message)
The function called when tapping on a system message
final
onThreadTap ThreadTapCallback
Function called when tapping on a thread By default it calls Navigator.push using the widget built using threadBuilder
final
parentMessage Message
Parent message in case of a thread
final
parentMessageBuilder ParentMessageBuilder
Function used to build a custom parent message widget
final
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited
scrollPhysics → ScrollPhysics
The ScrollPhysics used by the ListView
final
threadBuilder ThreadBuilder
Function used to build a custom thread widget
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
inherited
createState() → _MessageListViewState
Creates the mutable state for this widget at a given location in the tree. [...]
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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
Returns 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. [...]
@nonVirtual, inherited