@@ -222,11 +222,13 @@ class TextPainter {
222222 /// This is a convenience method that creates a text painter with the supplied
223223 /// parameters, lays it out with the supplied [minWidth] and [maxWidth] , and
224224 /// returns its [TextPainter.width] making sure to dispose the underlying
225- /// resources.
225+ /// resources. Doing this operation is expensive and should be avoided
226+ /// whenever it is possible to preserve the [TextPainter] to paint the
227+ /// text or get other information about it.
226228 static double computeWidth ({
227229 required InlineSpan text,
230+ required TextDirection textDirection,
228231 TextAlign textAlign = TextAlign .start,
229- TextDirection ? textDirection,
230232 double textScaleFactor = 1.0 ,
231233 int ? maxLines,
232234 String ? ellipsis,
@@ -262,11 +264,13 @@ class TextPainter {
262264 /// This is a convenience method that creates a text painter with the supplied
263265 /// parameters, lays it out with the supplied [minWidth] and [maxWidth] , and
264266 /// returns its [TextPainter.maxIntrinsicWidth] making sure to dispose the
265- /// underlying resources.
267+ /// underlying resources. Doing this operation is expensive and should be avoided
268+ /// whenever it is possible to preserve the [TextPainter] to paint the
269+ /// text or get other information about it.
266270 static double computeMaxIntrinsicWidth ({
267271 required InlineSpan text,
272+ required TextDirection textDirection,
268273 TextAlign textAlign = TextAlign .start,
269- TextDirection ? textDirection,
270274 double textScaleFactor = 1.0 ,
271275 int ? maxLines,
272276 String ? ellipsis,
0 commit comments