mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Improve compositing strategy for Shrine (#5014)
This patch includes a number of improvements: * Material page routes now put a repaint boundary inside their transition so they don't repaint during the transition. * Heroes that are on a quest now get a repaint boundary so we repaint them individually. * I've hoisted the transparent material for the product items up in the widget tree, which doesn't affect performance but makes the ink splashes reach the edge of the product cards. * I've changed the repaint rainbow visualization to make it easier to see what's going on.
This commit is contained in:
parent
1a292ff66a
commit
39e759212f
@ -258,7 +258,9 @@ class ProductItem extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return new Card(
|
return new Card(
|
||||||
child: new Column(
|
child: new Stack(
|
||||||
|
children: <Widget>[
|
||||||
|
new Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
new Align(
|
new Align(
|
||||||
alignment: FractionalOffset.centerRight,
|
alignment: FractionalOffset.centerRight,
|
||||||
@ -268,21 +270,13 @@ class ProductItem extends StatelessWidget {
|
|||||||
width: 144.0,
|
width: 144.0,
|
||||||
height: 144.0,
|
height: 144.0,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||||
child: new Stack(
|
child: new Hero(
|
||||||
children: <Widget>[
|
|
||||||
new Hero(
|
|
||||||
tag: productHeroTag,
|
tag: productHeroTag,
|
||||||
key: new ObjectKey(product),
|
key: new ObjectKey(product),
|
||||||
child: new Image(
|
child: new Image(
|
||||||
image: new AssetImage(product.imageAsset),
|
image: new AssetImage(product.imageAsset),
|
||||||
fit: ImageFit.contain
|
fit: ImageFit.contain
|
||||||
)
|
)
|
||||||
),
|
|
||||||
new Material(
|
|
||||||
color: Theme.of(context).canvasColor.withAlpha(0x00),
|
|
||||||
child: new InkWell(onTap: onPressed)
|
|
||||||
),
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
new Padding(
|
new Padding(
|
||||||
@ -290,6 +284,12 @@ class ProductItem extends StatelessWidget {
|
|||||||
child: new VendorItem(vendor: product.vendor)
|
child: new VendorItem(vendor: product.vendor)
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
),
|
||||||
|
new Material(
|
||||||
|
type: MaterialType.transparency,
|
||||||
|
child: new InkWell(onTap: onPressed)
|
||||||
|
),
|
||||||
|
]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -173,8 +173,13 @@ class PaintingContext {
|
|||||||
if (!_isRecording)
|
if (!_isRecording)
|
||||||
return;
|
return;
|
||||||
assert(() {
|
assert(() {
|
||||||
if (debugRepaintRainbowEnabled)
|
if (debugRepaintRainbowEnabled) {
|
||||||
canvas.drawRect(_paintBounds, new Paint()..color = debugCurrentRepaintColor.toColor());
|
Paint paint = new Paint()
|
||||||
|
..style = PaintingStyle.stroke
|
||||||
|
..strokeWidth = 6.0
|
||||||
|
..color = debugCurrentRepaintColor.toColor();
|
||||||
|
canvas.drawRect(_paintBounds.deflate(3.0), paint);
|
||||||
|
}
|
||||||
if (debugPaintLayerBordersEnabled) {
|
if (debugPaintLayerBordersEnabled) {
|
||||||
Paint paint = new Paint()
|
Paint paint = new Paint()
|
||||||
..style = PaintingStyle.stroke
|
..style = PaintingStyle.stroke
|
||||||
|
@ -272,7 +272,7 @@ class _HeroQuestState implements HeroHandle {
|
|||||||
size: animationArea.size,
|
size: animationArea.size,
|
||||||
child: new RotationTransition(
|
child: new RotationTransition(
|
||||||
turns: currentTurns.animate(animation),
|
turns: currentTurns.animate(animation),
|
||||||
child: new KeyedSubtree(
|
child: new RepaintBoundary(
|
||||||
key: key,
|
key: key,
|
||||||
child: child
|
child: child
|
||||||
)
|
)
|
||||||
|
@ -426,15 +426,14 @@ class _ModalScopeState extends State<_ModalScope> {
|
|||||||
context,
|
context,
|
||||||
config.route.animation,
|
config.route.animation,
|
||||||
config.route.forwardAnimation,
|
config.route.forwardAnimation,
|
||||||
contents
|
new RepaintBoundary(child: contents)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
contents = new Focus(
|
return new Focus(
|
||||||
key: config.route.focusKey,
|
key: config.route.focusKey,
|
||||||
child: new RepaintBoundary(child: contents)
|
child: contents
|
||||||
);
|
);
|
||||||
return contents;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user