Skip to content

Commit 6071f14

Browse files
authored
Revert "Remove obsolete drawShadow bounds workaround" (#127110)
Reverts flutter/flutter#127052, which seems to be breaking the build because of a goldens failure. ``` The following TestFailure was thrown running a test: Expected: one widget whose rasterized image matches golden image "shadow.PhysicalModel.enabled.png" Actual: _WidgetTypeFinder:<exactly one widget with type "Container" (ignoring offstage widgets): Container(bg: Color(0xfffff59d), margin: EdgeInsets.all(150.0))> ``` See https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20web_tests_6/11051/overview
1 parent f31dae2 commit 6071f14

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/flutter/lib/src/rendering/proxy_box.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,7 @@ class RenderPhysicalModel extends _RenderPhysicalModelBase<RRect> {
20172017

20182018
_updateClip();
20192019
final RRect offsetRRect = _clip!.shift(offset);
2020+
final Rect offsetBounds = offsetRRect.outerRect;
20202021
final Path offsetRRectAsPath = Path()..addRRect(offsetRRect);
20212022
bool paintShadows = true;
20222023
assert(() {
@@ -2037,6 +2038,14 @@ class RenderPhysicalModel extends _RenderPhysicalModelBase<RRect> {
20372038

20382039
final Canvas canvas = context.canvas;
20392040
if (elevation != 0.0 && paintShadows) {
2041+
// The drawShadow call doesn't add the region of the shadow to the
2042+
// picture's bounds, so we draw a hardcoded amount of extra space to
2043+
// account for the maximum potential area of the shadow.
2044+
// TODO(jsimmons): remove this when Skia does it for us.
2045+
canvas.drawRect(
2046+
offsetBounds.inflate(20.0),
2047+
_transparentPaint,
2048+
);
20402049
canvas.drawShadow(
20412050
offsetRRectAsPath,
20422051
shadowColor,

0 commit comments

Comments
 (0)