SliverGridLayout class abstract

The size and position of all the tiles in a RenderSliverGrid.

Rather that providing a grid with a SliverGridLayout directly, the grid is provided a SliverGridDelegate, which computes a SliverGridLayout given a set of SliverConstraints. This allows the algorithm to dynamically respond to changes in the environment (e.g. the user rotating the device).

The tiles can be placed arbitrarily, but it is more efficient to place tiles roughly in order by scroll offset because grids reify a contiguous sequence of children.

This example shows how to construct a custom SliverGridLayout to lay tiles in a grid form with some cells stretched to fit the entire width of the grid (sometimes called "hero tiles").
link

To create a local project with this code sample, run:
flutter create --sample=rendering.SliverGridLayout.1 mysample

See also:

Implementers
Annotations

Constructors

SliverGridLayout()
Abstract const constructor. This constructor enables subclasses to provide const constructors so that they can be used in const expressions.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

computeMaxScrollOffset(int childCount) double
The scroll extent needed to fully display all the tiles if there are childCount children in total.
getGeometryForChildIndex(int index) SliverGridGeometry
The size and position of the child with the given index.
getMaxChildIndexForScrollOffset(double scrollOffset) int
The maximum child index that intersects with (or is before) this scroll offset.
getMinChildIndexForScrollOffset(double scrollOffset) int
The minimum child index that intersects with (or is after) this scroll offset.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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