GridBuilder<T>.count constructor
const
GridBuilder<T>.count ({
- Key? key,
- Axis scrollDirection = Axis.vertical,
- bool reverse = false,
- ScrollController? controller,
- bool? primary,
- ScrollPhysics? physics,
- bool shrinkWrap = false,
- EdgeInsetsGeometry? padding,
- required List<
T> source, - required int crossAxisCount,
- required Widget builder(
- BuildContext context,
- T item,
- int index
- bool addAutomaticKeepAlives = true,
- bool addRepaintBoundaries = true,
- bool addSemanticIndexes = true,
- double? cacheExtent,
- int? semanticChildCount,
- bool listenWhenListenable = true,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
- ScrollViewKeyboardDismissBehavior keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
- String? restorationId,
- Clip clipBehavior = Clip.hardEdge,
- double mainAxisSpacing = 0.0,
- double crossAxisSpacing = 0.0,
- double childAspectRatio = 1.0,
- double? mainAxisExtent,
Draw a grid list with elements generated from builder
given source
.
It is possible to configure the grid by specifying the number of horizontal pieces in crossAxisCount
.
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
から生成された要素でグリッドリストを描画します。
crossAxisCount
で横の個数を指定してグリッドを構成することが可能です。
listenWhenListenable
がtrue
になっている場合、source
にListenableを継承している場合ListenableListenerが各要素にラップされます。
そのため、source
の各要素をそれぞれ監視し、いずれかの要素が更新された場合その要素のみ描画が更新されます。
Implementation
const GridBuilder.count({
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.crossAxisCount,
required this.builder,
this.addAutomaticKeepAlives = true,
this.addRepaintBoundaries = true,
this.addSemanticIndexes = true,
this.cacheExtent,
this.semanticChildCount,
this.listenWhenListenable = true,
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,
}) : maxCrossAxisExtent = 0.0,
assert(
crossAxisCount > 0,
"[crossAxisCount] must be greater than or equal to 0.",
);