getLayout method
Returns information about the size and position of the tiles in the grid.
Implementation
@override
SliverGridLayout getLayout(SliverConstraints constraints) {
final double usableCrossAxisExtent =
constraints.crossAxisExtent - crossAxisSpacing * (crossAxisCount - 1);
final double childCrossAxisExtent = usableCrossAxisExtent / crossAxisCount;
final double childMainAxisExtent = childCrossAxisExtent / childAspectRatio;
return SliverGridRegularTileLayoutAndLoading(
crossAxisCount: crossAxisCount,
mainAxisStride: childMainAxisExtent + mainAxisSpacing,
crossAxisStride: childCrossAxisExtent + crossAxisSpacing,
childMainAxisExtent: childMainAxisExtent,
childCrossAxisExtent: childCrossAxisExtent,
reverseCrossAxis:
axisDirectionIsReversed(constraints.crossAxisDirection),
fullCrossAccessExtent: usableCrossAxisExtent,
itemCount: this.itemCount);
}