childAtOffset method
Returns child of this container located at the specified local offset.
If offset is above this container (offset.dy is negative) returns
the first child. Likewise, if offset is below this container then
returns the last child.
Implementation
RenderEditableBox childAtOffset(Offset offset) {
assert(firstChild != null);
resolvePadding();
if (offset.dy <= _resolvedPadding!.top) {
return firstChild!;
}
if (offset.dy >= size.height - _resolvedPadding!.bottom) {
return lastChild!;
}
var child = firstChild;
final dx = -offset.dx;
var dy = _resolvedPadding!.top;
while (child != null) {
if (child.size.contains(offset.translate(dx, -dy))) {
return child;
}
dy += child.size.height;
child = childAfter(child);
}
// this case possible, when editor not scrollable,
// but minHeight > content height and tap was under content
return lastChild!;
}