getTextRanges method
gets the TextRange for all the children inside this span helpfull for getting TextBox from the Paragraph renderbox.
it accumulate all the lengths of the texts in the span.
Implementation
List<InlineSpanTextRange> getTextRanges({
bool includePlaceholders = true,
bool includeSemanticsLabels = true,
}) {
final result = <InlineSpanTextRange>[];
var offset = Accumulator();
visitChildren((span) {
String? text;
if (span is TextSpan) {
text = span.text;
}
if (text != null) {
result.add(
InlineSpanTextRange(
span,
TextRange(
start: offset.value,
end: offset.value + text.length,
),
),
);
offset.increment(text.length);
}
return true;
});
return result;
}