Use paragraph getter in TextPainter (#127607)
This commit is contained in:
parent
224667e90f
commit
ab3602b7df
@ -369,6 +369,7 @@ class _TextPainterLayoutCacheWithOffset {
|
|||||||
TextWidthBasis.parent => clampDouble(layout.maxIntrinsicLineExtent, minWidth, maxWidth),
|
TextWidthBasis.parent => clampDouble(layout.maxIntrinsicLineExtent, minWidth, maxWidth),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to resize the contentWidth to fit the new input constraints, by just
|
// Try to resize the contentWidth to fit the new input constraints, by just
|
||||||
// adjusting the paint offset (so no line-breaking changes needed).
|
// adjusting the paint offset (so no line-breaking changes needed).
|
||||||
//
|
//
|
||||||
@ -398,8 +399,8 @@ class _TextPainterLayoutCacheWithOffset {
|
|||||||
assert(paragraph.width == double.infinity);
|
assert(paragraph.width == double.infinity);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final double maxIntrinsicWidth = layout._paragraph.maxIntrinsicWidth;
|
final double maxIntrinsicWidth = paragraph.maxIntrinsicWidth;
|
||||||
if ((layout._paragraph.width - maxIntrinsicWidth) > -precisionErrorTolerance && (maxWidth - maxIntrinsicWidth) > -precisionErrorTolerance) {
|
if ((paragraph.width - maxIntrinsicWidth) > -precisionErrorTolerance && (maxWidth - maxIntrinsicWidth) > -precisionErrorTolerance) {
|
||||||
// Adjust the paintOffset and contentWidth to the new input constraints.
|
// Adjust the paintOffset and contentWidth to the new input constraints.
|
||||||
contentWidth = newContentWidth;
|
contentWidth = newContentWidth;
|
||||||
return true;
|
return true;
|
||||||
@ -1129,7 +1130,7 @@ class TextPainter {
|
|||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
final ui.Paragraph paragraph = layoutCache.layout._paragraph;
|
final ui.Paragraph paragraph = layoutCache.paragraph;
|
||||||
// Unfortunately even if we know that there is only paint changes, there's
|
// Unfortunately even if we know that there is only paint changes, there's
|
||||||
// no API to only make those updates so the paragraph has to be recreated
|
// no API to only make those updates so the paragraph has to be recreated
|
||||||
// and re-laid out.
|
// and re-laid out.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user