GridBuilder<T> class
Draw a grid list with elements generated from builder given source.
With GridBuilder.count, it is possible to configure a grid by specifying the number of horizontal pieces in crossAxisCount.
GridBuilder.extent allows you to configure the grid by specifying the maximum horizontal width with maxCrossAxisExtent.
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から生成された要素でグリッドリストを描画します。
GridBuilder.countだとcrossAxisCountで横の個数を指定してグリッドを構成することが可能です。
GridBuilder.extentだとmaxCrossAxisExtentで横の最大幅を指定してグリッドを構成することができます。
listenWhenListenableがtrue
になっている場合、sourceにListenableを継承している場合ListenableListenerが各要素にラップされます。
そのため、sourceの各要素をそれぞれ監視し、いずれかの要素が更新された場合その要素のみ描画が更新されます。
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- GridBuilder
Constructors
-
GridBuilder.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
givensource
.const -
GridBuilder.extent({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 double maxCrossAxisExtent, required Widget builder(BuildContext context, T item, int index), bool addAutomaticKeepAlives = true, bool addRepaintBoundaries = true, bool addSemanticIndexes = true, bool listenWhenListenable = true, double? cacheExtent, int? semanticChildCount, 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
givensource
.const
Properties
- addAutomaticKeepAlives → bool
-
If this is set to
true
, it will prevent a rebuild if AutomaticKeepAliveClientMixin is mixdrunk in the Widget in the List and is shown or hidden in the List.final - addRepaintBoundaries → bool
-
Set to
true
to provide a redraw area for the list (the part that is displayed on the screen).final - addSemanticIndexes → bool
-
Automatically add semantics indexes.
final
- builder → Widget Function(BuildContext context, T item, int index)
-
Builder for display on a grid.
final
- cacheExtent → double?
-
Specify the area to hold the cache.
final
- childAspectRatio → double
-
Aspect ratio of the child element.
final
- clipBehavior → Clip
-
Specify here to adjust the clip function of the listing.
final
- controller → ScrollController?
-
If you want to control scrolling from the outside, pass ScrollController.
final
- crossAxisCount → int
-
Number of horizontal elements in the grid.
final
- crossAxisSpacing → double
-
Space width between elements in the horizontal direction of the grid.
final
- dragStartBehavior → DragStartBehavior
-
Provides the ability to initiate a drag.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardDismissBehavior → ScrollViewKeyboardDismissBehavior
-
Define here if you want to implement a mechanism to close the keyboard triggered by scrolling.
final
- listenWhenListenable → bool
-
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.final - mainAxisExtent → double?
-
Specifies the width of the main element.
final
- mainAxisSpacing → double
-
Space width between vertical elements of the grid.
final
- maxCrossAxisExtent → double
-
Maximum width of the grid's horizontal elements.
final
- padding → EdgeInsetsGeometry?
-
Grid view padding.
final
- physics → ScrollPhysics?
-
Pass ScrollPhysics to set the scrolling method.
final
- primary → bool?
-
If this is
true
, it is recognized as the primary scrolling view.final - restorationId → String?
-
Restore ID to save and restore the scroll offset of the listing.
final
- reverse → bool
-
If this is
true
, the scroll direction is reversed.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollDirection → Axis
-
Scroll direction.
final
- semanticChildCount → int?
-
Explicitly communicate the number of child widgets.
final
- shrinkWrap → bool
-
If this is
true
, the area for scrolling is reduced to only where the content resides.final -
source
→ List<
T> -
List of data to be displayed on the grid.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited