startOrStopCursorTimerIfNeeded method

void startOrStopCursorTimerIfNeeded(
  1. bool hasFocus,
  2. TextSelection selection
)

Implementation

void startOrStopCursorTimerIfNeeded(bool hasFocus, TextSelection selection) {
  if (showCursor.value &&
      _cursorTimer == null &&
      hasFocus &&
      selection.isCollapsed) {
    startCursorTimer();
  } else if (_cursorTimer != null && (!hasFocus || !selection.isCollapsed)) {
    stopCursorTimer();
  }
}