public override RenderComparison compareTo(InlineSpan other) { if (Equals(this, other)) { return(RenderComparison.identical); } if (other.GetType() != GetType()) { return(RenderComparison.layout); } TextSpan textSpan = other as TextSpan; if (textSpan.text != text || children?.Count != textSpan.children?.Count || (style == null) != (textSpan.style == null)) { return(RenderComparison.layout); } RenderComparison result = recognizer == textSpan.recognizer ? RenderComparison.identical : RenderComparison.metadata; if (style != null) { RenderComparison candidate = style.compareTo(textSpan.style); if (candidate > result) { result = candidate; } if (result == RenderComparison.layout) { return(result); } } if (children != null) { for (int index = 0; index < children.Count; index += 1) { RenderComparison candidate = children[index].compareTo(textSpan.children[index]); if (candidate > result) { result = candidate; } if (result == RenderComparison.layout) { return(result); } } } return(result); }
public TextPainter(InlineSpan text = null, TextAlign textAlign = TextAlign.left, TextDirection textDirection = TextDirection.ltr, float textScaleFactor = 1.0f, int?maxLines = null, string ellipsis = null, Locale locale = null, StrutStyle strutStyle = null, TextWidthBasis textWidthBasis = TextWidthBasis.parent, TextHeightBehavior textHeightBehavior = null) { D.assert(text == null || text.debugAssertIsValid()); D.assert(maxLines == null || maxLines > 0); _text = text; _textAlign = textAlign; _textDirection = textDirection; _textScaleFactor = textScaleFactor; _maxLines = maxLines; _ellipsis = ellipsis; _locale = locale; _strutStyle = strutStyle; _textWidthBasis = textWidthBasis; _textHeightBehavior = textHeightBehavior; }