initialFontSize method
Returns the style?.fontSize
of the first TextSpan
with text, or null
if none.
Implementation
double? initialFontSize() {
final span = this;
if (span is TextSpan) {
double? fontSize;
if (span.text?.isNotEmpty ?? false) {
return span.style?.fontSize;
} else {
fontSize = span.children?.firstWhereOrNull((s) => s is TextSpan)?.initialFontSize();
}
return fontSize ?? span.style?.fontSize;
}
return null; // ignore: avoid_returning_null
}