Improve cooperation between scale and drag gestures (#9298)
Now the scale gesture will accept if its focal point moves more than the pan slop. This change lets it compete with a drag gesture (e.g., a containing scrol view) in the same way that the pan gesture does. Fixes #8735
This commit is contained in:
@@ -121,22 +121,18 @@ class _GridPhotoViewerState extends State<GridPhotoViewer> with SingleTickerProv
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return new GestureDetector(
|
||||
onScaleStart: _handleOnScaleStart,
|
||||
onScaleUpdate: _handleOnScaleUpdate,
|
||||
onScaleEnd: _handleOnScaleEnd,
|
||||
child: new Transform(
|
||||
transform: new Matrix4.identity()
|
||||
..translate(_offset.dx, _offset.dy)
|
||||
..scale(_scale),
|
||||
child: new ClipRect(
|
||||
child: new Image.asset(config.photo.assetName, fit: BoxFit.cover),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return new GestureDetector(
|
||||
onScaleStart: _handleOnScaleStart,
|
||||
onScaleUpdate: _handleOnScaleUpdate,
|
||||
onScaleEnd: _handleOnScaleEnd,
|
||||
child: new ClipRect(
|
||||
child: new Transform(
|
||||
transform: new Matrix4.identity()
|
||||
..translate(_offset.dx, _offset.dy)
|
||||
..scale(_scale),
|
||||
child: new Image.asset(config.photo.assetName, fit: BoxFit.cover),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user