How to add suggetionbox in web when cursor is on button - flutter

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

You need to wrap widget with Tooltip see example.
flutter tooltip example

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->

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

Flutter Question: OnTap and OnHover works together?

Im trying to use onHoover and onTap of a inkwell widget, but not OnHoover together with onTap doesn't work
I tried various combination, but with no success. please help.
I'm not sure if I understand your question,
but you can't use onHover without onTap.
But you can make onTap like this onTap: () {} // <- doesn't do anything when clicked
I'm not sure what you are trying to archive but may be you can use GestureDetector widget see if it can work

Looking for advice on how to add routes

I'm very new in all this, so please don't judge me for asking something that many of you know so well.
Basically I'm looking for some advice, how I can add route to second screen in my first app. I can share the code, if you need. I have icons row, and I'm wondering how I can add route to one of the icons?
Wrap one of your icons in a GestureDetector widget. And call Navigator.push() on its onTap method to navigate to the second screen. Follow the below example
GestureDetector(
child: Icon(Icons.navigate_next),
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => SecondPage()));
},
),
Take a look at the Navigator class to find out more about other navigation options.
The GestureDetector widget allows you to detect gestures such as a tap on the screen.
Call the below method to return back to the first screen
Navigator.pop(context);
Once you are familiar with this process, take a look at named routes as mentioned in #mmcdon20's comment

Flutter: Recognise touch immediately

Is there a way to recognize a touch input immediately in Flutter? Normal buttons of course don't work since they trigger on lift off. The closest thing I could find was using onTapDown by the GestureDetector widget. But this only triggers after a short delay. Thank you for any advice!
You could try wrapping your widget with the Listener widget and use the onPointerDown property.
e.g.
Listener(
child: Scaffold(),
onPointerDown: (_) {},
)

Using a FloatingActionButton on different pages if using a Backdrop?

I'm learning Flutter and using the Shrine demo app ( https://codelabs.developers.google.com/codelabs/mdc-101-flutter/ ) they provide as a base for trying out other widgets.
I'm using the Shrine menu for navigation as an alternative to a Drawer.
I've got a few different routes/pages, and I want each to have their own FloatingActionButton that performs different functions on each of them, with no button on some of them, and maybe a BottomAppBar on some others.
In order to use a FloatingActionButton it needs to be passed as an argument to a Scaffold, but the Shrine Backdrop only has one Scaffold, which also holds the state for which menu option is selected.
If each page had its own Scaffold then this would be easy, but then I'd lose the cool menu that the Shrine app has.
How could I use the Shrine style menu with multiple different pages, each with their own unique FloatingActionButton or BottomAppBar?
Should I be moving menu state elsewhere? Should I somehow pass a button action from the child widget back up to the Backdrop's Scaffold (if so, how)? Should I give up and use a Drawer?
Instead of using the FloactingActionButton property in a Scaffold, you can position the button at the bottom right of your pages with the 'Positioned' widget in individual pages.
For example:
body: Stack( // must add Stack widget
chidren: <Widget> [
.
.
. // your other widgets on this page
.
Positioned(
right: 10,
bottom: 10,
child: FloatingActionButton(
onPressed: () => yourFunction,
),
child: Icon(Icons.add),
backgroundColor: Colors.red,
),
),
],
);
Hope this helps :)

Impressions or tracking on Flutter widget

I want to track if a widget is show on the screen. Like a card in a list view.
There is a widget in Flutter like GestureDetector for impression or tracking?
You might want to look into the firebase_analytics plugin. You can set it up to track when users look at certain pages. See the plugin page for more info.
I wrote a library for this https://github.com/623637646/flutter_impression
ImpressionDetector(
impressedCallback: () {
debugPrint('impressed');
},
child: MyWidget(),
)