computeMaxIntrinsicHeight static method
double
computeMaxIntrinsicHeight({
- required TextSpan text,
- MongolTextAlign textAlign = MongolTextAlign.top,
- @Deprecated('Use textScaler instead. ' 'Use of textScaleFactor was deprecated in preparation for the upcoming nonlinear text scaling support. ' 'This feature was deprecated after v3.12.0-2.0.pre.') double textScaleFactor = 1.0,
- TextScaler textScaler = TextScaler.noScaling,
- int? maxLines,
- String? ellipsis,
- TextHeightBasis textHeightBasis = TextHeightBasis.parent,
- double minHeight = 0.0,
- double maxHeight = double.infinity,
Computes the max intrinsic height of a configured MongolTextPainter.
This is a convenience method that creates a text painter with the supplied
parameters, lays it out with the supplied minHeight
and maxHeight
, and
returns its MongolTextPainter.maxIntrinsicHeight making sure to dispose the
underlying resources. Doing this operation is expensive and should be avoided
whenever it is possible to preserve the MongolTextPainter to paint the
text or get other information about it.
Implementation
static double computeMaxIntrinsicHeight({
required TextSpan text,
MongolTextAlign textAlign = MongolTextAlign.top,
@Deprecated(
'Use textScaler instead. '
'Use of textScaleFactor was deprecated in preparation for the upcoming nonlinear text scaling support. '
'This feature was deprecated after v3.12.0-2.0.pre.',
)
double textScaleFactor = 1.0,
TextScaler textScaler = TextScaler.noScaling,
int? maxLines,
String? ellipsis,
TextHeightBasis textHeightBasis = TextHeightBasis.parent,
double minHeight = 0.0,
double maxHeight = double.infinity,
}) {
assert(
textScaleFactor == 1.0 || identical(textScaler, TextScaler.noScaling),
'Use textScaler instead.',
);
final MongolTextPainter painter = MongolTextPainter(
text: text,
textAlign: textAlign,
textScaler: textScaler == TextScaler.noScaling
? TextScaler.linear(textScaleFactor)
: textScaler,
maxLines: maxLines,
ellipsis: ellipsis,
textHeightBasis: textHeightBasis,
)..layout(minHeight: minHeight, maxHeight: maxHeight);
try {
return painter.maxIntrinsicHeight;
} finally {
painter.dispose();
}
}