Flutter Question: OnTap and OnHover works together? - flutter

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

Related

How to add suggetionbox in web when cursor is on button

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

How to access "index" propery in Flutter Widget: minhhung2556 / romantic_project_flutter_horizontal_featured_list?

I'm new to Flutter / Dart so sorry if this is a dumb question.
I'm trying the "flutter_horizontal_featured_list" widget but don't know how to access item index inside onPressedItem? As this method is outside itemBuilder I can't seem to access the index property...
Found no documentation here: https://github.com/minhhung2556/romantic_project_flutter_horizontal_featured_list
Thanks!
Use Listview.builder which has a context and index.
for tap you can use inkWell or GestureDetector
Here is the example for listview.builder
You can use InkWell or GestureDetector() as a return Widget of the builder the add the function inside the you can get Widget index.

Flutter: Dismissible Widget using button

I would like to have a dismissible widget. So far I've used the Dismissible widget that works well when you want to swipe to dismiss.
Is there a way to dismiss by clicking a button/icon? Something like this.
Have a look at the package another_flushbar. I used the predecessor flushbar which had loads of options. another_flushbar seems to have the same functionality so you might be able to achieve this

How to achieve this drop down container in flutter?

This is like a dropdown menu but doesn't accept any ontap function, just readability.
Please see the image to know how it looks and works
Use a listview of widgets and wrap each widget in the list with flutter-expandable
Check this
https://github.com/aryzhov/flutter-expandable/blob/master/README.md

Flutter onPressed() vs onTap()

I've been using Flutter for about 8 weeks.
It's awesome, no question.
However, there has been something bugging me since I've started, and that is, why do some widgets have an onTap method whilst others have onPressed? Google has not been able to give me any answers.
If this is not relevant or on-topic enough for Stack Overflow, sorry about that, please point me to the right community to ask.
In my experience, onTap() is used for any gesture capture and onPressed() especially for buttons.
Just like in real life, when you have to use a button, you'll press it.
Hope this will solve your troubles even though I'm not totally sure about that.
Currently they both are same. Just use onPressed with Buttons and onTap with other widgets.
Flutter is still new so there are lots of overlaps. May be in future updates they will make it more streamline . Like they will merge many widgets which are almost same.
The Source of differents between onTap and onPressed is GestureDetector used in buttons.
onTap should give you response in the first moment touching the screen.
onPressed should be equvalent to .onTapDown property - the last moment touching the screen.