getOffsetForCaret method

  1. @override
Offset getOffsetForCaret(
  1. TextPosition position
)
override

Returns the offset at which to paint the caret.

The position parameter must be relative to the node's content.

Valid only after layout.

Implementation

@override
Offset getOffsetForCaret(TextPosition position) {
  final child = childAtPosition(position);
  return child.getOffsetForCaret(TextPosition(
        offset: position.offset - child.getContainer().offset,
        affinity: position.affinity,
      )) +
      (child.parentData as BoxParentData).offset;
}