ScrollList.count constructor

ScrollList.count({
  1. Key? key,
  2. bool reverse = false,
  3. bool shrinkWrap = false,
  4. bool noScrollBehavior = false,
  5. bool? primary,
  6. Axis scrollDirection = Axis.vertical,
  7. Clip clipBehavior = Clip.hardEdge,
  8. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  9. String? restorationId,
  10. double? cacheExtent,
  11. ScrollPhysics? physics,
  12. EdgeInsetsGeometry? padding,
  13. RefreshConfig? refreshConfig,
  14. ScrollController? controller,
  15. SemanticIndexCallback semanticIndexCallback = kDefaultSemanticIndexCallback,
  16. bool addAutomaticKeepALives = true,
  17. bool addRepaintBoundaries = true,
  18. bool addSemanticIndexes = true,
  19. GridStyle gridStyle = GridStyle.none,
  20. required List<Widget> children,
  21. double? itemExtent,
  22. Widget? prototypeItem,
  23. int crossAxisCount = 1,
  24. double? maxCrossAxisExtent,
  25. double mainAxisSpacing = 0,
  26. double crossAxisSpacing = 0,
  27. double childAspectRatio = 1,
  28. double? mainAxisExtent,
  29. Widget placeholder = const PlaceholderChild(),
  30. Widget? header,
  31. Widget? footer,
})

Implementation

ScrollList.count({
  super.key,
  super.reverse = false,
  super.shrinkWrap = false,
  super.noScrollBehavior = false,
  super.primary,
  super.scrollDirection = Axis.vertical,
  super.clipBehavior = Clip.hardEdge,
  super.dragStartBehavior = DragStartBehavior.start,
  super.restorationId,
  super.cacheExtent,
  super.physics,
  super.padding,
  super.refreshConfig,
  super.controller,
  SemanticIndexCallback semanticIndexCallback = kDefaultSemanticIndexCallback,
  bool addAutomaticKeepALives = true,
  bool addRepaintBoundaries = true,
  bool addSemanticIndexes = true,
  GridStyle gridStyle = GridStyle.none,
  required List<Widget> children,

  /// use [SliverFixedExtentList]、[itemExtent] 优先 [prototypeItem]
  double? itemExtent,

  /// use [SliverPrototypeExtentList]、[itemExtent] 优先 [prototypeItem]
  Widget? prototypeItem,

  /// 横轴子元素的数量 自适应最大像素
  /// use [SliverGridDelegateWithFixedCrossAxisCount] or [SliverSimpleGridDelegateWithFixedCrossAxisCount]
  int crossAxisCount = 1,

  /// 横轴元素最大像素 自适应列数
  /// use [SliverGridDelegateWithMaxCrossAxisExtent] or [SliverSimpleGridDelegateWithMaxCrossAxisExtent]
  double? maxCrossAxisExtent,

  /// 主轴方向子元素的间距
  double mainAxisSpacing = 0,

  /// 横轴方向子元素的间距
  double crossAxisSpacing = 0,

  /// 子元素在横轴长度和主轴长度的比例
  /// [gridStyle] == [GridStyle.none] 生效
  double childAspectRatio = 1,

  /// 子元素在主轴上的长度。[mainAxisExtent] 优先 [childAspectRatio]
  /// [gridStyle] == [GridStyle.none] 生效
  double? mainAxisExtent,

  /// 占位
  Widget placeholder = const PlaceholderChild(),
  this.header,
  this.footer,
}) : sliver = [
        SliverListGrid.count(
            semanticIndexCallback: semanticIndexCallback,
            placeholder: placeholder,
            mainAxisExtent: mainAxisExtent,
            maxCrossAxisExtent: maxCrossAxisExtent,
            childAspectRatio: childAspectRatio,
            crossAxisCount: crossAxisCount,
            mainAxisSpacing: mainAxisSpacing,
            crossAxisSpacing: crossAxisSpacing,
            addSemanticIndexes: addSemanticIndexes,
            addRepaintBoundaries: addRepaintBoundaries,
            addAutomaticKeepALives: addAutomaticKeepALives,
            itemExtent: itemExtent,
            prototypeItem: prototypeItem,
            gridStyle: gridStyle,
            children: children)
      ];