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,6 +268,7 @@ class _ShrineHomeState extends State<ShrineHome> { ...@@ -268,6 +268,7 @@ 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 RepaintBoundary(
child: new Column( child: new Column(
children: <Widget>[ children: <Widget>[
new Container( new Container(
...@@ -281,15 +282,18 @@ class _ShrineHomeState extends State<ShrineHome> { ...@@ -281,15 +282,18 @@ class _ShrineHomeState extends State<ShrineHome> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
tileAspectRatio: 160.0 / 216.0, // width/height tileAspectRatio: 160.0 / 216.0, // width/height
children: _products.map((Product product) { children: _products.map((Product product) {
return new ProductItem( return new RepaintBoundary(
child: new ProductItem(
product: product, product: product,
onPressed: () { showOrderPage(product); } onPressed: () { showOrderPage(product); }
)
); );
}).toList() }).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