From 2ab631b7026a4cf48d7614802179c1fe9a8af8a1 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Mon, 1 May 2017 11:32:09 -0700 Subject: [PATCH] Add space to the clipping region of physical model layers with shadows (#9654) --- packages/flutter/lib/src/rendering/object.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index d1cb3f5587..ee01e421cf 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -472,6 +472,12 @@ class PaintingContext { childContext._stopRecordingIfNeeded(); } else { if (elevation != 0) { + // The drawShadow call doesn't add the region of the shadow to the + // picture's bounds, so we draw a hardcoded amount of extra space to + // account for the maximum potential area of the shadow. + // TODO(jsimmons): remove this when Skia does it for us. + canvas.drawRect(offsetBounds.inflate(20.0), + new Paint()..color=const Color(0)); canvas.drawShadow( new Path()..addRRect(offsetClipRRect), const Color(0xFF000000),