GridView class

A grid layout component for displaying items in a grid.

Inheritance

Constructors

GridView({Key? key, List<Component> children = const [], int crossAxisCount = 2, double gap = 16, String? padding, double? minItemWidth})
const
GridView.builder({Key? key, required Component builder(BuildContext context, int index)?, required int? itemCount, int crossAxisCount = 2, double gap = 16, String? padding, double? minItemWidth})
const

Properties

builder Component Function(BuildContext context, int index)?
Builder for dynamic grid generation.
final
children List<Component>
Children to display in the grid.
final
crossAxisCount int
Number of columns in the grid.
final
gap double
Gap between grid items.
final
hashCode int
The hash code for this object.
no setterinherited
itemCount int?
Number of items when using builder.
final
key Key?
Controls how one component replaces another component in the tree.
finalinherited
minItemWidth double?
Minimum item width for auto-fit columns.
final
padding String?
Padding around the grid.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context) Component
Describes the part of the user interface represented by this component.
override
createElement() Element
Creates a StatelessElement to manage this component's location in the tree.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
shouldRebuild(covariant Component newComponent) bool
Implement this method to determine whether a rebuild can be skipped.
inherited
toString() String
A string representation of this object.
inherited

Operators

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