setFloatingCursor method

void setFloatingCursor (FloatingCursorDragState state, Offset boundedOffset, TextPosition lastTextPosition, { double resetLerpValue })

Sets the screen position of the floating cursor and the text position closest to the cursor.

Implementation

void setFloatingCursor(FloatingCursorDragState state, Offset boundedOffset, TextPosition lastTextPosition, { double resetLerpValue }) {
  assert(state != null);
  assert(boundedOffset != null);
  assert(lastTextPosition != null);
  if (state == FloatingCursorDragState.Start) {
    _relativeOrigin = const Offset(0, 0);
    _previousOffset = null;
    _resetOriginOnBottom = false;
    _resetOriginOnTop = false;
    _resetOriginOnRight = false;
    _resetOriginOnBottom = false;
  }
  _floatingCursorOn = state != FloatingCursorDragState.End;
  _resetFloatingCursorAnimationValue = resetLerpValue;
  if (_floatingCursorOn) {
    _floatingCursorOffset = boundedOffset;
    _floatingCursorTextPosition = lastTextPosition;
  }
  markNeedsPaint();
}