effectiveLineHeight property

double? get effectiveLineHeight

Calculates the effective line height as a multiplier for TextStyle.height.

Flutter's TextStyle.height is a multiplier (e.g., 1.5 means 1.5x font size).

  • heightLine is stored as pixels, so we divide by fontSize to get multiplier
  • heightLineFactor is already a multiplier (e.g., from leading-loose)

Implementation

double? get effectiveLineHeight {
  if (heightLine != null && fontSize != null && fontSize! > 0) {
    // Convert pixel value to multiplier: 36px / 24px = 1.5
    return heightLine! / fontSize!;
  } else if (heightLineFactor != null) {
    // Already a factor like 1.5
    return heightLineFactor;
  }
  return null;
}