show method

void show({
  1. int? duration,
  2. Offset? position,
  3. Object? tooltipData,
  4. String? tooltipContent,
  5. String? tooltipHeader,
  6. Widget? template,
})

Displays the tooltip at the position.

*position - the x and y position at which the tooltip needs to be shown. *duration - the duration in milliseconds for which the tooltip animation needs to happen. *template - the widget that will be rendered instead of default tooltip *tooltipData - the data which allows this widget to decide whether it is activated for the same point

Implementation

void show(
    {int? duration,
    Offset? position,
    Object? tooltipData,
    String? tooltipContent,
    String? tooltipHeader,
    Widget? template}) {
  duration ??= widget.animationDuration;
  _hidden = false;
  animationController!.duration = Duration(milliseconds: duration);
  if (renderBox != null) {
    renderBox!._position = position;
  }
  _timer?.cancel();
  if (_previousTooltipData == null ||
      !(_previousTooltipData == tooltipData) ||
      (_previouslocation == null || _previouslocation != position)) {
    _previouslocation = position;
    _show = true;
    _template = template;
    _previousTooltipData = tooltipData;
    _animating = true;
    _showDuration = duration;
    if (tooltipContent != null) {
      renderBox!._stringValue = tooltipContent;
    }
    if (tooltipHeader != null) {
      renderBox!._header = tooltipHeader;
    }
    if (mounted) {
      setState(() {
        animationController!.duration = Duration(milliseconds: duration!);
        if (animationController?.status != AnimationStatus.forward) {
          animationController!.forward(from: 0.0);
        }
      });
    }
  } else {
    if (!_animating) {
      animationController!.duration = Duration.zero;
    }
  }
}