expose builder for empty state

This commit is contained in:
Neevash Ramdial
2020-11-14 14:47:48 -04:00
parent a34b8bb63b
commit 581a9a2def
+9 -1
View File
@@ -63,6 +63,7 @@ class ChannelListView extends StatefulWidget {
this.channelPreviewBuilder, this.channelPreviewBuilder,
this.separatorBuilder, this.separatorBuilder,
this.errorBuilder, this.errorBuilder,
this.emptyBuilder,
this.onImageTap, this.onImageTap,
this.pullToRefresh = true, this.pullToRefresh = true,
}) : super(key: key); }) : super(key: key);
@@ -70,6 +71,9 @@ class ChannelListView extends StatefulWidget {
/// The builder that will be used in case of error /// The builder that will be used in case of error
final Widget Function(Error error) errorBuilder; final Widget Function(Error error) errorBuilder;
/// The builder used when the channel list is empty.
final WidgetBuilder emptyBuilder;
/// The query filters to use. /// The query filters to use.
/// You can query on any of the custom fields you've defined on the [Channel]. /// You can query on any of the custom fields you've defined on the [Channel].
/// You can also filter other built-in channel fields. /// You can also filter other built-in channel fields.
@@ -231,7 +235,11 @@ class _ChannelListViewState extends State<ChannelListView>
final channels = snapshot.data; 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( return LayoutBuilder(
builder: (context, viewportConstraints) { builder: (context, viewportConstraints) {
return SingleChildScrollView( return SingleChildScrollView(