getInlineOffset function
Walks this text span and its descendants in pre-order and calls visitor
for each span that has text.
Implementation
// bool _visitTextSpan(InlineSpan textSpan, bool visitor(InlineSpan span)) {
// String? text = getInlineText(textSpan);
// if (textSpan is SpecialInlineSpanBase) {
// text = (textSpan as SpecialInlineSpanBase).actualText;
// }
// if (text != null) {
// if (!visitor(textSpan)) {
// return false;
// }
// }
// if (textSpan is TextSpan && textSpan.children != null) {
// for (final InlineSpan child in textSpan.children!) {
// if (!_visitTextSpan(child, visitor)) {
// return false;
// }
// //if (!child.visitTextSpan(visitor)) return false;
// }
// }
// return true;
// }
int getInlineOffset(InlineSpan inlineSpan) {
if (inlineSpan is TextSpan && inlineSpan.text != null) {
return inlineSpan.text!.length;
}
if (inlineSpan is PlaceholderSpan) {
return 1;
}
return 0;
}