MessageListCore class
MessageListCore is a simplified class that allows fetching a list of messages while exposing UI builders.
A MessageListController is used to paginate data.
class ChannelPage extends StatelessWidget {
const ChannelPage({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: <Widget>[
Expanded(
child: MessageListCore(
emptyBuilder: (context) {
return Center(
child: Text('Nothing here...'),
);
},
loadingBuilder: (context) {
return Center(
child: CircularProgressIndicator.adaptive(),
);
},
messageListBuilder: (context, list) {
return MessagesPage(list);
},
errorBuilder: (context, err) {
return Center(
child: Text('Error'),
);
},
),
),
],
),
);
}
}
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.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MessageListCore
Constructors
-
MessageListCore({Key? key, required WidgetBuilder loadingBuilder, required WidgetBuilder emptyBuilder, required Widget messageListBuilder(BuildContext, List<
Message> ), required ErrorBuilder errorBuilder, Message? parentMessage, MessageListController? messageListController, bool messageFilter(Message)?, int paginationLimit = 20}) -
Instantiate a new
MessageListView
.const
Properties
- emptyBuilder → WidgetBuilder
-
Function used to build an empty widget
final
- errorBuilder → ErrorBuilder
-
Callback triggered when an error occurs while performing the given
request.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loadingBuilder → WidgetBuilder
-
Function used to build a loading widget
final
- messageFilter → bool Function(Message)?
-
Predicate used to filter messages
final
-
messageListBuilder
→ Widget Function(BuildContext, List<
Message> ) -
Function called when messages are fetched
final
- messageListController → MessageListController?
-
A MessageListController allows pagination.
Use
ChannelListController.paginateData
pagination.final - paginationLimit → int
-
Limit used to paginate messages
final
- parentMessage → Message?
-
If the current message belongs to a
thread
, this property represents the first message or the parent of the conversation.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → MessageListCoreState -
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