Shortcircuit if Tooltip message and richMessage are empty#182524
Conversation
There was a problem hiding this comment.
Code Review
This pull request addresses a regression where an empty tooltip was being displayed. The fix involves short-circuiting the build method in TooltipState if the tooltip message is empty, which correctly prevents the creation of an unnecessary overlay. A new private getter _tooltipMessage has been introduced to centralize the logic for retrieving the tooltip's text content, which improves code clarity and maintainability. Additionally, the accompanying unit tests have been updated to accurately reflect and verify this behavior, correcting previously faulty tests. The changes are well-implemented and effectively resolve the issue.
| /// The plain text message for this tooltip. | ||
| /// | ||
| /// This value will either come from [widget.message] or [widget.richMessage]. | ||
| String get _tooltipMessage => widget.message ?? widget.richMessage!.toPlainText(); |
There was a problem hiding this comment.
The original code used the empty string if rich message was null?
There was a problem hiding this comment.
If richMessage is just a widget span, this may be shortcircuited as well. Is this the existing behavior before the change?
There was a problem hiding this comment.
Yes, this is existing behavior before RawTooltip.
flutter/flutter@91b2d41...dad6f9d 2026-02-23 engine-flutter-autoroll@skia.org Roll Packages from 9da22bf to 12b43a1 (19 revisions) (flutter/flutter#182758) 2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 55fae1660572 to 9a5a3c92c336 (7 revisions) (flutter/flutter#182749) 2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 256e2b47b303 to 55fae1660572 (1 revision) (flutter/flutter#182741) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 141ed451f007 to 256e2b47b303 (1 revision) (flutter/flutter#182732) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from e59de8a12e7e to 141ed451f007 (1 revision) (flutter/flutter#182729) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from f6ea7ef42d14 to e59de8a12e7e (1 revision) (flutter/flutter#182726) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 34fa7b2373f3 to f6ea7ef42d14 (1 revision) (flutter/flutter#182721) 2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from 3ca547c8b816 to 34fa7b2373f3 (2 revisions) (flutter/flutter#182711) 2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from c91ad88e89f8 to 3ca547c8b816 (9 revisions) (flutter/flutter#182696) 2026-02-21 victorsanniay@gmail.com Shortcircuit if Tooltip message and richMessage are empty (flutter/flutter#182524) 2026-02-21 50643541+Mairramer@users.noreply.github.com Add fields getter to FormState (flutter/flutter#180815) 2026-02-20 1961493+harryterkelsen@users.noreply.github.com fix(web_ui): use static whitelist for image codec tests (flutter/flutter#182648) 2026-02-20 victorsanniay@gmail.com Add cupertino docimports for CupertinoPageTransitionsBuilder and fix typos (flutter/flutter#182685) 2026-02-20 katelovett@google.com Fix Chat invite link (flutter/flutter#182675) 2026-02-20 engine-flutter-autoroll@skia.org Roll Skia from ce5854495a3a to c91ad88e89f8 (58 revisions) (flutter/flutter#182678) 2026-02-20 30870216+gaaclarke@users.noreply.github.com Manual dart sdk flutter 174bcc79 25ff 4267 8e26 d0e902f18681 1771486449 (flutter/flutter#182624) 2026-02-20 97480502+b-luk@users.noreply.github.com Don't compile shaders to SkSL unless --sksl arg is present (flutter/flutter#182519) 2026-02-20 katelovett@google.com Correct PerformanceOverlay optionsMask checks and add tests (flutter/flutter#182309) 2026-02-20 jason-simmons@users.noreply.github.com [Impeller] libImpeller: Dispose thread local caches on each Vulkan frame (flutter/flutter#182402) 2026-02-20 31859944+LongCatIsLooong@users.noreply.github.com Update CHANGELOG for 3.41.2 stable hotfix (flutter/flutter#182647) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…2524) Regressed when migrating to `RawTooltip`. The unit tests added in flutter#87638 to prevent this from happening were faulty, I've updated them to reflect this feature. Fixes [[flutter 3.41.x] NavigationDestination shows empty tooltip](flutter#182495)
…r#11102) flutter/flutter@91b2d41...dad6f9d 2026-02-23 engine-flutter-autoroll@skia.org Roll Packages from 9da22bf to 12b43a1 (19 revisions) (flutter/flutter#182758) 2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 55fae1660572 to 9a5a3c92c336 (7 revisions) (flutter/flutter#182749) 2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 256e2b47b303 to 55fae1660572 (1 revision) (flutter/flutter#182741) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 141ed451f007 to 256e2b47b303 (1 revision) (flutter/flutter#182732) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from e59de8a12e7e to 141ed451f007 (1 revision) (flutter/flutter#182729) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from f6ea7ef42d14 to e59de8a12e7e (1 revision) (flutter/flutter#182726) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 34fa7b2373f3 to f6ea7ef42d14 (1 revision) (flutter/flutter#182721) 2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from 3ca547c8b816 to 34fa7b2373f3 (2 revisions) (flutter/flutter#182711) 2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from c91ad88e89f8 to 3ca547c8b816 (9 revisions) (flutter/flutter#182696) 2026-02-21 victorsanniay@gmail.com Shortcircuit if Tooltip message and richMessage are empty (flutter/flutter#182524) 2026-02-21 50643541+Mairramer@users.noreply.github.com Add fields getter to FormState (flutter/flutter#180815) 2026-02-20 1961493+harryterkelsen@users.noreply.github.com fix(web_ui): use static whitelist for image codec tests (flutter/flutter#182648) 2026-02-20 victorsanniay@gmail.com Add cupertino docimports for CupertinoPageTransitionsBuilder and fix typos (flutter/flutter#182685) 2026-02-20 katelovett@google.com Fix Chat invite link (flutter/flutter#182675) 2026-02-20 engine-flutter-autoroll@skia.org Roll Skia from ce5854495a3a to c91ad88e89f8 (58 revisions) (flutter/flutter#182678) 2026-02-20 30870216+gaaclarke@users.noreply.github.com Manual dart sdk flutter 174bcc79 25ff 4267 8e26 d0e902f18681 1771486449 (flutter/flutter#182624) 2026-02-20 97480502+b-luk@users.noreply.github.com Don't compile shaders to SkSL unless --sksl arg is present (flutter/flutter#182519) 2026-02-20 katelovett@google.com Correct PerformanceOverlay optionsMask checks and add tests (flutter/flutter#182309) 2026-02-20 jason-simmons@users.noreply.github.com [Impeller] libImpeller: Dispose thread local caches on each Vulkan frame (flutter/flutter#182402) 2026-02-20 31859944+LongCatIsLooong@users.noreply.github.com Update CHANGELOG for 3.41.2 stable hotfix (flutter/flutter#182647) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…2524) Regressed when migrating to `RawTooltip`. The unit tests added in flutter#87638 to prevent this from happening were faulty, I've updated them to reflect this feature. Fixes [[flutter 3.41.x] NavigationDestination shows empty tooltip](flutter#182495)
…r#11102) flutter/flutter@91b2d41...dad6f9d 2026-02-23 engine-flutter-autoroll@skia.org Roll Packages from 9da22bf to 12b43a1 (19 revisions) (flutter/flutter#182758) 2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 55fae1660572 to 9a5a3c92c336 (7 revisions) (flutter/flutter#182749) 2026-02-23 engine-flutter-autoroll@skia.org Roll Skia from 256e2b47b303 to 55fae1660572 (1 revision) (flutter/flutter#182741) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 141ed451f007 to 256e2b47b303 (1 revision) (flutter/flutter#182732) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from e59de8a12e7e to 141ed451f007 (1 revision) (flutter/flutter#182729) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from f6ea7ef42d14 to e59de8a12e7e (1 revision) (flutter/flutter#182726) 2026-02-22 engine-flutter-autoroll@skia.org Roll Skia from 34fa7b2373f3 to f6ea7ef42d14 (1 revision) (flutter/flutter#182721) 2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from 3ca547c8b816 to 34fa7b2373f3 (2 revisions) (flutter/flutter#182711) 2026-02-21 engine-flutter-autoroll@skia.org Roll Skia from c91ad88e89f8 to 3ca547c8b816 (9 revisions) (flutter/flutter#182696) 2026-02-21 victorsanniay@gmail.com Shortcircuit if Tooltip message and richMessage are empty (flutter/flutter#182524) 2026-02-21 50643541+Mairramer@users.noreply.github.com Add fields getter to FormState (flutter/flutter#180815) 2026-02-20 1961493+harryterkelsen@users.noreply.github.com fix(web_ui): use static whitelist for image codec tests (flutter/flutter#182648) 2026-02-20 victorsanniay@gmail.com Add cupertino docimports for CupertinoPageTransitionsBuilder and fix typos (flutter/flutter#182685) 2026-02-20 katelovett@google.com Fix Chat invite link (flutter/flutter#182675) 2026-02-20 engine-flutter-autoroll@skia.org Roll Skia from ce5854495a3a to c91ad88e89f8 (58 revisions) (flutter/flutter#182678) 2026-02-20 30870216+gaaclarke@users.noreply.github.com Manual dart sdk flutter 174bcc79 25ff 4267 8e26 d0e902f18681 1771486449 (flutter/flutter#182624) 2026-02-20 97480502+b-luk@users.noreply.github.com Don't compile shaders to SkSL unless --sksl arg is present (flutter/flutter#182519) 2026-02-20 katelovett@google.com Correct PerformanceOverlay optionsMask checks and add tests (flutter/flutter#182309) 2026-02-20 jason-simmons@users.noreply.github.com [Impeller] libImpeller: Dispose thread local caches on each Vulkan frame (flutter/flutter#182402) 2026-02-20 31859944+LongCatIsLooong@users.noreply.github.com Update CHANGELOG for 3.41.2 stable hotfix (flutter/flutter#182647) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC louisehsu@google.com,stuartmorgan@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Regressed when migrating to
RawTooltip.The unit tests added in #87638 to prevent this from happening were faulty, I've updated them to reflect this feature.
Fixes [flutter 3.41.x] NavigationDestination shows empty tooltip