SliverGridDelegateWithMaxCrossAxisExtent class

Creates grid layouts with tiles that each have a maximum cross-axis extent.

This delegate will select a cross-axis extent for the tiles that is as large as possible subject to the following conditions:

  • The extent evenly divides the cross-axis extent of the grid.
  • The extent is at most maxCrossAxisExtent.

For example, if the grid is vertical, the grid is 500.0 pixels wide, and maxCrossAxisExtent is 150.0, this delegate will create a grid with 4 columns that are 125.0 pixels wide.

This delegate creates grids with equally sized and spaced tiles.

See also:



SliverGridDelegateWithMaxCrossAxisExtent({@required double maxCrossAxisExtent, double mainAxisSpacing: 0.0, double crossAxisSpacing: 0.0, double childAspectRatio: 1.0 })
Creates a delegate that makes grid layouts with tiles that have a maximum cross-axis extent. [...]


childAspectRatio → double
The ratio of the cross-axis to the main-axis extent of each child.
crossAxisSpacing → double
The number of logical pixels between each child along the cross axis.
mainAxisSpacing → double
The number of logical pixels between each child along the main axis.
maxCrossAxisExtent → double
The maximum extent of tiles in the cross axis. [...]
hashCode → int
The hash code for this object. [...]
read-only, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited


getLayout(SliverConstraints constraints) SliverGridLayout
Returns information about the size and position of the tiles in the grid.
shouldRelayout(SliverGridDelegateWithMaxCrossAxisExtent oldDelegate) → bool
Override this method to return true when the children need to be laid out. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() → String
Returns a string representation of this object.


operator ==(dynamic other) → bool
The equality operator. [...]