Ref #102: add separatorBuilder to ChannelListView
This commit is contained in:
@@ -61,6 +61,7 @@ class ChannelListView extends StatefulWidget {
|
|||||||
this.onChannelLongPress,
|
this.onChannelLongPress,
|
||||||
this.channelWidget,
|
this.channelWidget,
|
||||||
this.channelPreviewBuilder,
|
this.channelPreviewBuilder,
|
||||||
|
this.separatorBuilder,
|
||||||
this.errorBuilder,
|
this.errorBuilder,
|
||||||
this.onImageTap,
|
this.onImageTap,
|
||||||
this.pullToRefresh = true,
|
this.pullToRefresh = true,
|
||||||
@@ -106,6 +107,9 @@ class ChannelListView extends StatefulWidget {
|
|||||||
/// Builder used to create a custom channel preview
|
/// Builder used to create a custom channel preview
|
||||||
final ChannelPreviewBuilder channelPreviewBuilder;
|
final ChannelPreviewBuilder channelPreviewBuilder;
|
||||||
|
|
||||||
|
/// Builder used to create a custom item separator
|
||||||
|
final Function(BuildContext, int) separatorBuilder;
|
||||||
|
|
||||||
/// The function called when the image is tapped
|
/// The function called when the image is tapped
|
||||||
final Function(Channel) onImageTap;
|
final Function(Channel) onImageTap;
|
||||||
|
|
||||||
@@ -266,6 +270,9 @@ class _ChannelListViewState extends State<ChannelListView>
|
|||||||
|
|
||||||
Widget _itemBuilder(context, int i, List<Channel> channels) {
|
Widget _itemBuilder(context, int i, List<Channel> channels) {
|
||||||
if (i % 2 != 0) {
|
if (i % 2 != 0) {
|
||||||
|
if (widget.separatorBuilder != null) {
|
||||||
|
return widget.separatorBuilder(context, i);
|
||||||
|
}
|
||||||
return _separatorBuilder(context, i);
|
return _separatorBuilder(context, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user