GridBuilder<T>.extent constructor

const GridBuilder<T>.extent({
  1. Key? key,
  2. Axis scrollDirection = Axis.vertical,
  3. bool reverse = false,
  4. ScrollController? controller,
  5. bool? primary,
  6. ScrollPhysics? physics,
  7. bool shrinkWrap = false,
  8. EdgeInsetsGeometry? padding,
  9. required List<T> source,
  10. required double maxCrossAxisExtent,
  11. required Widget builder(
    1. BuildContext context,
    2. T item,
    3. int index
    ),
  12. bool addAutomaticKeepAlives = true,
  13. bool addRepaintBoundaries = true,
  14. bool addSemanticIndexes = true,
  15. bool listenWhenListenable = true,
  16. double? cacheExtent,
  17. int? semanticChildCount,
  18. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  19. ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
  20. String? restorationId,
  21. Clip clipBehavior = Clip.hardEdge,
  22. double mainAxisSpacing = 0.0,
  23. double crossAxisSpacing = 0.0,
  24. double childAspectRatio = 1.0,
  25. double? mainAxisExtent,
})

Draw a grid list with elements generated from builder given source.

maxCrossAxisExtent allows you to configure the grid by specifying the maximum horizontal width.

If listenWhenListenable is true, ListenableListener will be wrapped around each element if source inherits Listenable. Therefore, each element of source is monitored individually, and if any element is updated, only that element is updated in the drawing.

sourceを与えてbuilderから生成された要素でグリッドリストを描画します。

maxCrossAxisExtentで横の最大幅を指定してグリッドを構成することができます。

listenWhenListenabletrueになっている場合、sourceListenableを継承している場合ListenableListenerが各要素にラップされます。 そのため、sourceの各要素をそれぞれ監視し、いずれかの要素が更新された場合その要素のみ描画が更新されます。

Implementation

const GridBuilder.extent({
  super.key,
  this.scrollDirection = Axis.vertical,
  this.reverse = false,
  this.controller,
  this.primary,
  this.physics,
  this.shrinkWrap = false,
  this.padding,
  required this.source,
  required this.maxCrossAxisExtent,
  required this.builder,
  this.addAutomaticKeepAlives = true,
  this.addRepaintBoundaries = true,
  this.addSemanticIndexes = true,
  this.listenWhenListenable = true,
  this.cacheExtent,
  this.semanticChildCount,
  this.dragStartBehavior = DragStartBehavior.start,
  this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
  this.restorationId,
  this.clipBehavior = Clip.hardEdge,
  this.mainAxisSpacing = 0.0,
  this.crossAxisSpacing = 0.0,
  this.childAspectRatio = 1.0,
  this.mainAxisExtent,
})  : crossAxisCount = 0,
      assert(
        maxCrossAxisExtent > 0,
        "[maxCrossAxisExtent] must be greater than or equal to 0.",
      );