add loadingbuilder in messagelistview
This commit is contained in:
@@ -109,6 +109,7 @@ class MessageListView extends StatefulWidget {
|
|||||||
this.scrollPhysics = const AlwaysScrollableScrollPhysics(),
|
this.scrollPhysics = const AlwaysScrollableScrollPhysics(),
|
||||||
this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
|
this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
|
||||||
this.messageFilter,
|
this.messageFilter,
|
||||||
|
this.loadingBuilder,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// Function used to build a custom message widget
|
/// Function used to build a custom message widget
|
||||||
@@ -120,6 +121,9 @@ class MessageListView extends StatefulWidget {
|
|||||||
/// Function used to build a custom thread widget
|
/// Function used to build a custom thread widget
|
||||||
final ThreadBuilder threadBuilder;
|
final ThreadBuilder threadBuilder;
|
||||||
|
|
||||||
|
/// The builder used while loading.
|
||||||
|
final WidgetBuilder loadingBuilder;
|
||||||
|
|
||||||
/// Filter applied to the message list before rendering
|
/// Filter applied to the message list before rendering
|
||||||
final bool Function(Message) messageFilter;
|
final bool Function(Message) messageFilter;
|
||||||
|
|
||||||
@@ -308,6 +312,11 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
if (!snapshot.data) {
|
if (!snapshot.data) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (widget.loadingBuilder != null) {
|
||||||
|
return widget.loadingBuilder(context);
|
||||||
|
}
|
||||||
|
|
||||||
return Center(
|
return Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
|||||||
Reference in New Issue
Block a user