Pass the width constraint to the text layout engine if ellipsizing is enabled (#11877)
This commit is contained in:
parent
c5750cd7ea
commit
d77955fb1a
@ -148,7 +148,10 @@ class RenderParagraph extends RenderBox {
|
||||
}
|
||||
|
||||
void _layoutText({ double minWidth: 0.0, double maxWidth: double.INFINITY }) {
|
||||
_textPainter.layout(minWidth: minWidth, maxWidth: _softWrap ? maxWidth : double.INFINITY);
|
||||
_textPainter.layout(
|
||||
minWidth: minWidth,
|
||||
maxWidth: _softWrap || _overflow == TextOverflow.ellipsis ? maxWidth : double.INFINITY
|
||||
);
|
||||
}
|
||||
|
||||
void _layoutTextWithConstraints(BoxConstraints constraints) {
|
||||
|
@ -132,7 +132,7 @@ void main() {
|
||||
expect(paragraph.size.height, equals(lineHeight));
|
||||
|
||||
relayoutWith(maxLines: 3, softWrap: false, overflow: TextOverflow.ellipsis);
|
||||
expect(paragraph.size.height, equals(2 * lineHeight));
|
||||
expect(paragraph.size.height, equals(3 * lineHeight));
|
||||
|
||||
relayoutWith(maxLines: null, softWrap: false, overflow: TextOverflow.ellipsis);
|
||||
expect(paragraph.size.height, equals(2 * lineHeight));
|
||||
|
Loading…
x
Reference in New Issue
Block a user