StacGridView class

A Stac model representing Flutter's GridView widget.

Displays its children in a two-dimensional, scrollable grid.

{@tool snippet} Dart Example:

const StacGridView(
  crossAxisCount: 2,
  mainAxisSpacing: 10,
  crossAxisSpacing: 10,
  childAspectRatio: 1.0,
  padding: StacEdgeInsets.all(10),
  children: [
    StacText(data: 'Item 1'),
    StacText(data: 'Item 2'),
  ],
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "gridView",
  "crossAxisCount": 2,
  "mainAxisSpacing": 10,
  "crossAxisSpacing": 10,
  "childAspectRatio": 1.0,
  "padding": 10,
  "children": [
    {"type": "text", "data": "Item 1"},
    {"type": "text", "data": "Item 2"}
  ]
}

{@end-tool}

See also:

Inheritance
Annotations
  • @JsonSerializable()

Constructors

StacGridView.new({StacAxis? scrollDirection, bool? reverse, bool? primary, StacScrollPhysics? physics, bool? shrinkWrap, StacEdgeInsets? padding, int? crossAxisCount, double? mainAxisSpacing, double? crossAxisSpacing, double? childAspectRatio, double? mainAxisExtent, bool? addAutomaticKeepAlives, bool? addRepaintBoundaries, bool? addSemanticIndexes, double? cacheExtent, List<StacWidget>? children, int? semanticChildCount, StacDragStartBehavior? dragStartBehavior, StacScrollViewKeyboardDismissBehavior? keyboardDismissBehavior, String? restorationId, StacClip? clipBehavior})
Creates a StacGridView with the given properties.
const
StacGridView.fromJson(Map<String, dynamic> json)
Creates a StacGridView from a JSON map.
factory

Properties

addAutomaticKeepAlives bool?
Whether to add automatic keep-alives. Defaults to true in Flutter's GridView.
final
addRepaintBoundaries bool?
Whether to add repaint boundaries. Defaults to true in Flutter's GridView.
final
addSemanticIndexes bool?
Whether to add semantic indexes. Defaults to true in Flutter's GridView.
final
cacheExtent double?
The extent to which the content is cached.
final
childAspectRatio double?
The ratio of the cross-axis to the main-axis extent of each child. Defaults to 1.0.
final
children List<StacWidget>?
The widgets below this widget in the tree.
final
clipBehavior StacClip?
The clip behavior of the grid. Defaults to StacClip.hardEdge.
final
crossAxisCount int?
The number of children in the cross axis.
final
crossAxisSpacing double?
The amount of space between the children in the cross axis. Defaults to 0.0.
final
dragStartBehavior StacDragStartBehavior?
The drag start behavior. Defaults to StacDragStartBehavior.start.
final
hashCode int
The hash code for this object.
no setterinherited
jsonData Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
keyboardDismissBehavior StacScrollViewKeyboardDismissBehavior?
The keyboard dismiss behavior. Defaults to StacScrollViewKeyboardDismissBehavior.manual.
final
mainAxisExtent double?
The extent of each child in the main axis.
final
mainAxisSpacing double?
The amount of space between the children in the main axis. Defaults to 0.0.
final
padding StacEdgeInsets?
The amount of space by which to inset the grid.
final
physics StacScrollPhysics?
The physics for the scroll view.
final
primary bool?
Whether this is the primary scroll view associated with the parent PrimaryScrollController. Defaults to false.
final
restorationId String?
The restoration ID to save and restore the scroll offset.
final
reverse bool?
Whether the grid scrolls in the reverse direction. Defaults to false.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollDirection StacAxis?
The axis along which the grid scrolls. Defaults to StacAxis.vertical.
final
semanticChildCount int?
The number of children for semantics purposes.
final
shrinkWrap bool?
Whether the extent of the scroll view in the scroll direction should be determined by the contents being viewed rather than the viewport. Defaults to false.
final
type String
Widget type identifier.
no setteroverride

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this StacGridView instance to a JSON map.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited