Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter onPressed() vs onTap()

Tags:

flutter

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.

like image 569
iron59 Avatar asked Aug 16 '19 14:08

iron59


1 Answers

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.

like image 84
Barracud Apps Avatar answered Sep 19 '22 04:09

Barracud Apps