From 83787846c90673ca6d657b7021efdb5ca4a47a7c Mon Sep 17 00:00:00 2001 From: Neevash Ramdial Date: Sat, 14 Nov 2020 14:47:48 -0400 Subject: [PATCH] expose builder for empty state --- lib/src/channel_list_view.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/src/channel_list_view.dart b/lib/src/channel_list_view.dart index f88eefbe..b716fff6 100644 --- a/lib/src/channel_list_view.dart +++ b/lib/src/channel_list_view.dart @@ -63,6 +63,7 @@ class ChannelListView extends StatefulWidget { this.channelPreviewBuilder, this.separatorBuilder, this.errorBuilder, + this.emptyBuilder, this.onImageTap, this.pullToRefresh = true, }) : super(key: key); @@ -70,6 +71,9 @@ class ChannelListView extends StatefulWidget { /// The builder that will be used in case of error final Widget Function(Error error) errorBuilder; + /// The builder used when the channel list is empty. + final WidgetBuilder emptyBuilder; + /// The query filters to use. /// You can query on any of the custom fields you've defined on the [Channel]. /// You can also filter other built-in channel fields. @@ -231,7 +235,11 @@ class _ChannelListViewState extends State final channels = snapshot.data; - if (channels.isEmpty) { + if (channels.isEmpty && widget.emptyBuilder != null) { + return widget.emptyBuilder(context); + } + + if (channels.isEmpty && widget.emptyBuilder == null) { return LayoutBuilder( builder: (context, viewportConstraints) { return SingleChildScrollView(