Skip to content

Global enable/disable of tooltips in Flutter apps and provide API control over widget tooltips #66993

@rydmike

Description

@rydmike

Use case

As Flutter is entering more and more into both the desktop and web arena the usage and presence of tooltips via mouse hover is more obvious than on long press on device apps. To ensure that tooltips never get in the way or become a nuisance, some improvements on their presence should be considered.

Tooltips provide nice guidance for new users to applications on web and desktop applications. However, as users get more used to an application it is a good practice to in the app provide a user/app settings that allows the user to turn off the tooltips.

Tooltips may get in the way and bothersome when you are familiar with an application, being able to turn them off when no longer desired increases the user experience.

It would be very useful for such a use case scenario if tooltips could be enabled/disabled on a MaterialApp level and if SDK widgets always included a control for it as well, including easy API control over the actual tooltip string(s). Currently many SDK widgets do not offer any capability to turn off built in tooltips and they provide limited control over their tooltip strings.

Proposal App tooltip enable/disable

Provide a setting for Material(/Cupertino/Widget) apps that can be used to disable tooltips for all SDK Widgets used in the app that implement tooltips.

For example:

MaterialApp(
  title: 'Demo',
  useTooltips: true
  home: MyStatefulWidget(),
);

If some platforms support enabling/disabling tooltips in the platform (now or will in the future), then certainly consider having it as an enum with platform, on, off values instead, similar to the theme mode. For example:

enum Tooltips {platform, on, off}`

Could default to Tooltips.on for backwards compatibility.

MaterialApp(
  title: 'Demo',
  useTooltips: Tooltips.on
  home: MyStatefulWidget(),
);

Widget tooltip control

When Flutter SDK widgets implement tooltips, please ensure that such widgets always includes an API for enabling/disabling its tooltips. Widgets that implement tooltips should always also include an API that can be used to set the tooltip string to a value that differs from its default tooltip string(s).

Case examples

The following two issues are example where the lack of tooltip APIs has been reproted to be an issue:

  1. PopupMenuButton has no option remove tooltip #60418 "PopupMenuButton has no option remove tooltip"
  2. BottomNavigationBar has no option to remove tooltip or change the tooltip from its icon label [Web] [Desktop] #71049 "BottomNavigationBar has no option remove tooltip or change the tooltip from its icon label [Web] [Desktop]"

The BottomNavigationBarItem case is just one example case, there might be more Widgets with similar tooltip issues on web and desktop.

Update 22.11.2020

Removed the 2nd part and instead added specific reported cases as examples where the lack of API to control the tooltips is reported as an issue.


Flutter doctor
flutter doctor -v
[√] Flutter (Channel beta, 1.22.0-12.3.pre, on Microsoft Windows [Version 10.0.18363.1016], locale en-US)
    • Flutter version 1.22.0-12.3.pre at C:\Users\mryds\fvm\versions\beta
    • Framework revision d408d302e2 (22 hours ago), 2020-09-29 11:49:17 -0700
    • Engine revision 5babba6c4d
    • Dart version 2.10.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.1)
    • Android SDK at C:\Users\mryds\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 49.0.2
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] IntelliJ IDEA Community Edition (version 2019.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.1
    • Flutter plugin version 35.3.3
    • Dart plugin version 192.7402

[√] VS Code (version 1.49.2)
    • VS Code at C:\Users\mryds\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.14.1

[√] Connected device (3 available)
    • Web Server (web) • web-server • web-javascript • Flutter Tools
    • Chrome (web)     • chrome     • web-javascript • Google Chrome 85.0.4183.121
    • Edge (web)       • edge       • web-javascript • Microsoft Edge 85.0.564.63

• No issues found!

Metadata

Metadata

Labels

P3Issues that are less important to the Flutter projecta: desktopRunning on desktopc: new featureNothing broken; request for a new capabilitycustomer: housecustomer: web10f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.platform-webWeb applications specifically

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions