Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show tooltip programmatically

Tags:

flutter

dart

enter image description here

I want to make if floating action button pressed, it show tooltip. But i don't know how to show it programmatically.

Is there a way to show it?

like image 401
Arvin Avatar asked Mar 02 '18 11:03

Arvin


People also ask

How do I add ToolTip in Winforms?

From within the designer: 1) From the ToolBox, drop a ToolTip control to your form. 2) Check the properties of this toolTip1 object to make sure Active is set to true. 3) Click on your button, and in its Property page, set the ToolTip on toolTip1 entry.


1 Answers

Currently there's no official way to do this.

BUT, there's a workaround : use ensureTooltipVisible from _TooltipState using a GlobalKey to fetch it.

Typically you'd the following field inside the widget instantiating Tooltip : final key = new GlobalKey();

Then, on your tooltip, you'll assign this key :

new Tooltip(
  key: key,
  ...
),

And finally inside the onPressed of your FloatingButton you can do :

onPressed: () {
  final dynamic tooltip = key.currentState;
  tooltip.ensureTooltipVisible();
},
like image 66
Rémi Rousselet Avatar answered Sep 21 '22 11:09

Rémi Rousselet