boundingTextSize static method
Implementation
static Size boundingTextSize(
String text,
TextStyle style, {
int maxLines = 2 ^ 31,
double maxWidth = double.infinity,
}) {
if (text.isEmpty) {
return Size.zero;
}
final TextPainter textPainter = TextPainter(
textDirection: TextDirection.ltr,
text: TextSpan(
text: text,
style: style,
),
maxLines: maxLines,
)..layout(maxWidth: maxWidth);
return textPainter.size;
}