initialLineHeightScale method

double? initialLineHeightScale()

Returns the style?.height of the first TextSpan with text, or null if none.

Implementation

double? initialLineHeightScale() {
  final span = this;
  if (span is TextSpan) {
    double? lineHeight;
    if (span.text?.isNotEmpty ?? false) {
      return span.style?.height;
    } else {
      lineHeight =
          span.children?.firstWhereOrNull((s) => s is TextSpan)?.initialLineHeightScale();
    }
    return lineHeight ?? span.style?.height;
  }
  return null; // ignore: avoid_returning_null
}