paragraphMinIntrinsicWidth property

double get paragraphMinIntrinsicWidth

Implementation

double get paragraphMinIntrinsicWidth {
  if (_paragraph == null) return 0;

  final CSSRenderStyle cStyle = (container as RenderBoxModel).renderStyle;
  final WhiteSpace ws = cStyle.whiteSpace;
  // Treat nowrap/pre as unbreakable content: min-content equals max-content.
  if (ws == WhiteSpace.nowrap || ws == WhiteSpace.pre) {
    return paragraphMaxIntrinsicWidth;
  }

  double? engineMin;
  try {
    engineMin = (_paragraph as dynamic).minIntrinsicWidth as double?;
  } catch (_) {
    engineMin = null;
  }
  final double approx = _approxParagraphMinIntrinsicWidth();
  if (engineMin != null && engineMin.isFinite && engineMin > 0) {
    // Use the smaller of engine-provided minIntrinsic and our token-based
    // approximation to better match CSS min-content behavior around hyphens
    // and similar break opportunities.
    if (approx.isFinite && approx > 0) return math.min(engineMin, approx);
    return engineMin;
  }
  if (approx.isFinite && approx > 0) return approx;
  return _paragraph!.longestLine;
}