SliverGridDelegate class abstract
Controls the layout of tiles in a grid.
Given the current constraints on the grid, a SliverGridDelegate computes the layout for the tiles in the grid. 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 a SliverGridDelegate returns a SliverGridLayout
configured based on the provided SliverConstraints in getLayout.
link
To create a local project with this code sample, run:
flutter create --sample=rendering.SliverGridDelegate.1 mysample
See also:
- SliverGridDelegateWithFixedCrossAxisCount, which creates a layout with a fixed number of tiles in the cross axis.
- SliverGridDelegateWithMaxCrossAxisExtent, which creates a layout with tiles that have a maximum cross-axis extent.
- GridView, which uses this delegate to control the layout of its tiles.
- SliverGrid, which uses this delegate to control the layout of its tiles.
- RenderSliverGrid, which uses this delegate to control the layout of its tiles.
Constructors
- SliverGridDelegate()
-
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
-
getLayout(
SliverConstraints constraints) → SliverGridLayout - Returns information about the size and position of the tiles in the grid.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
shouldRelayout(
covariant SliverGridDelegate oldDelegate) → bool - Override this method to return true when the children need to be laid out.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited