sliverList method

SliverList sliverList({
  1. int count = 0,
  2. Widget gap = const SizedBox.shrink(),
})

构建Sliver列表布局

@param count 列表项总数 @param gap 列表项之间的间隔组件 @return 返回SliverList布局组件

Implementation

SliverList sliverList({int count = 0, Widget gap = const SizedBox.shrink()}) {
  return SliverList(
      delegate: SliverChildBuilderDelegate((context, index) {
    if (index == 0) {
      return itemBuilder(context, index);
    } else {
      return Column(
        children: [
          gap,
          itemBuilder(context, index),
        ],
      );
    }
  }, childCount: count));
}