How to add suggetionbox in web when cursor is on button

Viewed 252

I want to show suggestion when cursor is on button or on some widget in flutter web

I share example how I want to show suggestion box but I don't know how to add suggestion box in flutter

enter image description here

3 Answers

Try below code hope its help to you. Used Tooltip Widget

Refer Tooltip here

Test below code here

Tooltip(
  message: "Managers",
  child: ElevatedButton(
    onPressed: () {},
    child: Text('OK'),
  ),
),

Result Screen-> enter image description here

In addition to all the tooltip related recommendations, if they don't quite meet your requirements, there's OverlayEntry It allows to use any widget, but is not super easy to handle, so there's a couple packages out there that do some work with Overlays for you that you might consider.

https://pub.dev/packages/flutter_portal

https://pub.dev/packages/modals

To show overlay entry when hovering over some widget, wrap it with MouseRegion and use its onEnter and onExit methods to show and hide overlay

Related