From e4f08d55c2f9dbe387dbf6bde2f30c9263c080e5 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Mon, 25 Jun 2018 11:07:48 -0700 Subject: [PATCH] Add saveLayer back if there's an overflowShader (#18739) This should fix https://github.com/flutter/flutter/issues/18729 I'll add a gold test, and try to figure out how to remove the saveLayer without affecting the correctness later. --- packages/flutter/lib/src/rendering/paragraph.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/flutter/lib/src/rendering/paragraph.dart b/packages/flutter/lib/src/rendering/paragraph.dart index b5afa6a567..31f7b8b5b3 100644 --- a/packages/flutter/lib/src/rendering/paragraph.dart +++ b/packages/flutter/lib/src/rendering/paragraph.dart @@ -355,7 +355,13 @@ class RenderParagraph extends RenderBox { if (_hasVisualOverflow) { final Rect bounds = offset & size; + if (_overflowShader != null) { + // This layer limits what the shader below blends with to be just the text + // (as opposed to the text and its background). + canvas.saveLayer(bounds, new Paint()); + } else { canvas.save(); + } canvas.clipRect(bounds); } _textPainter.paint(canvas, offset);