Commit 0bcecef5 authored by Adam Barth's avatar Adam Barth Committed by GitHub

Convert ShrineHome to use CustomScrollView (#7887)

This patch converts the Shrine home page to using a sliver-based grid.
This required using a CustomScrollView to mix the block at the top with
the grid below.
parent 921c0fa5
...@@ -24,10 +24,10 @@ import 'sliver_multi_box_adaptor.dart'; ...@@ -24,10 +24,10 @@ import 'sliver_multi_box_adaptor.dart';
class SliverGridGeometry { class SliverGridGeometry {
/// Creates an object that describes the placement of a child in a [RenderSliverGrid]. /// Creates an object that describes the placement of a child in a [RenderSliverGrid].
const SliverGridGeometry({ const SliverGridGeometry({
this.scrollOffset, @required this.scrollOffset,
this.crossAxisOffset, @required this.crossAxisOffset,
this.mainAxisExtent, @required this.mainAxisExtent,
this.crossAxisExtent, @required this.crossAxisExtent,
}); });
/// The scroll offset of the leading edge of the child relative to the leading /// The scroll offset of the leading edge of the child relative to the leading
...@@ -195,7 +195,7 @@ class SliverGridRegularTileLayout extends SliverGridLayout { ...@@ -195,7 +195,7 @@ class SliverGridRegularTileLayout extends SliverGridLayout {
double estimateMaxScrollOffset(int childCount) { double estimateMaxScrollOffset(int childCount) {
if (childCount == null) if (childCount == null)
return null; return null;
final int mainAxisCount = ((childCount - 1) / crossAxisCount).floor() + 1; final int mainAxisCount = ((childCount - 1) ~/ crossAxisCount) + 1;
final double mainAxisSpacing = mainAxisStride - childMainAxisExtent; final double mainAxisSpacing = mainAxisStride - childMainAxisExtent;
return mainAxisStride * mainAxisCount - mainAxisSpacing; return mainAxisStride * mainAxisCount - mainAxisSpacing;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment