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?
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.
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();
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With