show method

Future<void> show({
  1. bool animated = true,
})

Shows the tooltip.

If already shown, calling this method brings the tooltip to the top.

This method should typically not be called while the widget tree is being rebuilt.

Testing

To avoid timeouts in widget tests, always wrap the returned Future in unawaited.

testWidgets('shows', (tester) async {
  await tester.pumpWidget(...);

  unawaited(controller.show());
  await tester.pumpAndSettle();
});

Implementation

Future<void> show({bool animated = true}) async {
  if (_animation.isForwardOrCompleted) {
    return;
  }

  _overlay.show();
  if (animated) {
    await _animation.forward();
  } else {
    _animation.value = 1;
  }
  notifyListeners();
}