ensureTooltipVisible method

bool ensureTooltipVisible()

Shows the tooltip if it is not already visible.

After made visible by this method, The tooltip does not automatically dismiss after waitDuration, until the user dismisses/re-triggers it, or Tooltip.dismissAllToolTips is called.

Returns false when the tooltip shouldn't be shown or when the tooltip was already visible.

Implementation

bool ensureTooltipVisible() {
  if (!_visible) {
    return false;
  }

  _timer?.cancel();
  _timer = null;
  switch (_controller.status) {
    case AnimationStatus.dismissed:
    case AnimationStatus.reverse:
      _scheduleShowTooltip(withDelay: Duration.zero);
      return true;
    case AnimationStatus.forward:
    case AnimationStatus.completed:
      return false;
  }
}