Skip to content

Conversation

@rkishan516
Copy link
Contributor

Fix: Delay showing tooltip during page transition
fixes: #167359

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
  • All existing and new tests are passing.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Apr 23, 2025
final ModalRoute<dynamic>? route = ModalRoute.of(context);
if (route?.secondaryAnimation != null && route!.secondaryAnimation!.isAnimating) {
_timer?.cancel();
_timer = Timer(route.transitionDuration, show);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to listen to when the animation ends and start the timer then? The current way isn't compatible with cases where this happens halfway during the transition or simulation-based transition where there isn't a predefined duration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yaa, was thinking the same. but for some reason below written code doesn't fix the issue.

if (route?.secondaryAnimation != null && route!.secondaryAnimation!.isAnimating) {
   _timer?.cancel();
   void onAnimationDismiss(AnimationStatus status) {
        if (status == AnimationStatus.dismissed) {
           route.secondaryAnimation!.removeStatusListener(onAnimationDismiss);
           show();
       }
   }

    route.secondaryAnimation!.addStatusListener(onAnimationDismiss);
    return;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases the secondaryAnimation is swapped for a different one, so that may be why. The secondaryAnimation with the status listener is replaced.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than putting the logic here, should we have the check happen in tandem with the _visible check for _ExclusiveMouseRegion? So it ignores all mouse events while the route transitions are in motion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, that will be better place and we don't even need listener.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed the change, everything looks good. Thanks.

@rkishan516 rkishan516 force-pushed the tooltip-transition branch 4 times, most recently from 4ef9c09 to 0617cf1 Compare April 25, 2025 01:51
Copy link
Contributor

@MitchellGoodwin MitchellGoodwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you for making this fix. Just left one tiny nit.

expect(tester.element(textAncestors.first).size, equals(tooltipConstraints.biggest));
});

testWidgets('Tooltip does not show while transitioning from another page', (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extreme nit, for this case I think it needs a link to the issue it is checking against.

Suggested change
testWidgets('Tooltip does not show while transitioning from another page', (
// This is a regression test for https://github.com/flutter/flutter/issues/167359.
testWidgets('Tooltip does not show while transitioning from another page', (

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for suggestion. Pushed the change.

Copy link
Contributor

@Piinks Piinks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@Piinks Piinks added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 30, 2025
@auto-submit auto-submit bot added this pull request to the merge queue Apr 30, 2025
Merged via the queue into flutter:master with commit fb18bb4 Apr 30, 2025
76 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Apr 30, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 1, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 5, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 7, 2025
@gnprice gnprice mentioned this pull request May 20, 2025
9 tasks
github-merge-queue bot pushed a commit that referenced this pull request Aug 8, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](#168546) and [Delay
showing tooltip during page
transition](#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](#169741)
SydneyBao pushed a commit to SydneyBao/flutter that referenced this pull request Aug 11, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter#168546) and [Delay
showing tooltip during page
transition](flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter#169741)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
romanejaquez pushed a commit to romanejaquez/flutter that referenced this pull request Aug 14, 2025
Fix: Delay showing tooltip during page transition
fixes: flutter#167359 

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
ksokolovskyi pushed a commit to ksokolovskyi/flutter that referenced this pull request Aug 19, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter#168546) and [Delay
showing tooltip during page
transition](flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter#169741)
mboetger pushed a commit to mboetger/flutter that referenced this pull request Sep 18, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter#168546) and [Delay
showing tooltip during page
transition](flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter#169741)
korca0220 pushed a commit to korca0220/flutter that referenced this pull request Sep 22, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter#168546) and [Delay
showing tooltip during page
transition](flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter#169741)
lucaantonelli pushed a commit to lucaantonelli/flutter that referenced this pull request Nov 21, 2025
Makes the tooltip interactive if the route is the current route and the
route is not animating out.

Added `_route` to cache `ModalRoute.of(context)`.

Consolidates [Fix the issue with
Tooltip](flutter#168546) and [Delay
showing tooltip during page
transition](flutter#167614)

Fix [[Desktop] [Web] [Regression] [3.32] AppBar back - RenderBox was not
laid out -
TooltipState._buildTooltipOverlay](flutter#169741)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PopupMenuButton asserts when rendering tooltip after navigating back using Cupertino tab layout

4 participants