Skip to content

Commit

Permalink
Request a layout when a paragraph's overflow mode is changed (flutter…
Browse files Browse the repository at this point in the history
…#9485)

A change in overflow mode requires calculation of the text size and resetting
the overflow shader
  • Loading branch information
jason-simmons committed Apr 20, 2017
1 parent a657428 commit da7867b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/rendering/paragraph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class RenderParagraph extends RenderBox {
return;
_overflow = value;
_textPainter.ellipsis = value == TextOverflow.ellipsis ? _kEllipsis : null;
markNeedsPaint();
markNeedsLayout();
}

/// The number of font pixels for each logical pixel.
Expand Down
4 changes: 4 additions & 0 deletions packages/flutter/test/rendering/paragraph_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ void main() {
relayoutWith(maxLines: 3, softWrap: true, overflow: TextOverflow.fade);
expect(paragraph.debugHasOverflowShader, isTrue);

// Change back to ellipsis and check that the fade shader is cleared.
relayoutWith(maxLines: 3, softWrap: true, overflow: TextOverflow.ellipsis);
expect(paragraph.debugHasOverflowShader, isFalse);

relayoutWith(maxLines: 100, softWrap: true, overflow: TextOverflow.fade);
expect(paragraph.debugHasOverflowShader, isFalse);
});
Expand Down

0 comments on commit da7867b

Please sign in to comment.