Commit 130f7717 authored by Adam Barth's avatar Adam Barth

Make Shrine scroll fast (#4408)

This fix isn't completely statisfying because it has a scaling limit. The ideal
fix would actually viewport the tiles in the grid. However, this fix is much
easier at the moment.

Fixes #4395
parent 4f4f24ea
...@@ -268,26 +268,30 @@ class _ShrineHomeState extends State<ShrineHome> { ...@@ -268,26 +268,30 @@ class _ShrineHomeState extends State<ShrineHome> {
final Product featured = _products.firstWhere((Product product) => product.featureDescription != null); final Product featured = _products.firstWhere((Product product) => product.featureDescription != null);
return new ShrinePage( return new ShrinePage(
body: new ScrollableViewport( body: new ScrollableViewport(
child: new Column( child: new RepaintBoundary(
children: <Widget>[ child: new Column(
new Container( children: <Widget>[
margin: new EdgeInsets.only(bottom: 8.0), new Container(
child: new FeatureItem(product: featured) margin: new EdgeInsets.only(bottom: 8.0),
), child: new FeatureItem(product: featured)
new FixedColumnCountGrid( ),
columnCount: 2, new FixedColumnCountGrid(
rowSpacing: 8.0, columnCount: 2,
columnSpacing: 8.0, rowSpacing: 8.0,
padding: const EdgeInsets.all(8.0), columnSpacing: 8.0,
tileAspectRatio: 160.0 / 216.0, // width/height padding: const EdgeInsets.all(8.0),
children: _products.map((Product product) { tileAspectRatio: 160.0 / 216.0, // width/height
return new ProductItem( children: _products.map((Product product) {
product: product, return new RepaintBoundary(
onPressed: () { showOrderPage(product); } child: new ProductItem(
); product: product,
}).toList() onPressed: () { showOrderPage(product); }
) )
] );
}).toList()
)
]
)
) )
) )
); );
......
...@@ -7,6 +7,7 @@ import 'dart:ui' show Offset; ...@@ -7,6 +7,7 @@ import 'dart:ui' show Offset;
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:vector_math/vector_math_64.dart'; import 'package:vector_math/vector_math_64.dart';
import 'package:meta/meta.dart';
import 'package:mojo_services/mojo/gfx/composition/scene_token.mojom.dart' as mojom; import 'package:mojo_services/mojo/gfx/composition/scene_token.mojom.dart' as mojom;
import 'debug.dart'; import 'debug.dart';
...@@ -30,6 +31,7 @@ abstract class Layer { ...@@ -30,6 +31,7 @@ abstract class Layer {
Layer _previousSibling; Layer _previousSibling;
/// Removes this layer from its parent layer's child list /// Removes this layer from its parent layer's child list
@mustCallSuper
void detach() { void detach() {
if (_parent != null) if (_parent != null)
_parent._remove(this); _parent._remove(this);
...@@ -94,12 +96,15 @@ abstract class Layer { ...@@ -94,12 +96,15 @@ abstract class Layer {
} }
/// Add additional information to the given description for use by [toStringDeep]. /// Add additional information to the given description for use by [toStringDeep].
@protected
@mustCallSuper
void debugFillDescription(List<String> description) { void debugFillDescription(List<String> description) {
if (debugCreator != null) if (debugCreator != null)
description.add('creator: $debugCreator'); description.add('creator: $debugCreator');
} }
/// Returns a description of this layer's children for use by [toStringDeep]. /// Returns a description of this layer's children for use by [toStringDeep].
@protected
String debugDescribeChildren(String prefix) => ''; String debugDescribeChildren(String prefix) => '';
} }
......
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