Which is lighter in Flutter: GestureDetector or TextButton?

48 views Asked by At

After watching the widget of the week about GestureDetectors they seem filled with many callback options my average widgets won't ever need. Is there any difference in performance compared with the basic TextButton ? Doesn't the GestureDetector infringe the single responsibility principle ?

When should I use either ?

I couldn't perceive any difference in simple apps with a few buttons.

1

There are 1 answers

0
Rishab Dhar On BEST ANSWER

With respect to performance, GestureDetector is a better option since it primarily handles touch events and doesn't contain any styling functions like TextButton

If you're concerned about styling use textfield else gesture detector.