SharkWithLasers
SharkWithLasers

Reputation: 143

Built-in widget with onTouched and onReleased callbacks?

I just started using Flutter a couple of days ago and I’m enjoying it a lot.

I noticed that when I use a FlatButton, onPressed gets called when the button is touched then released.

Is there a similar widget to FlatButton that has a callback when it's touched, and perhaps a call back when it is released?

Thanks!

Upvotes: 0

Views: 563

Answers (1)

Rémi Rousselet
Rémi Rousselet

Reputation: 277577

What you are looking for is GestureDetector

GestureDector(
  onTapDown: (_) => print('down'),
  onTapUp: (_) => print('up'),
  child: Text('click me'),
)

Upvotes: 1

Related Questions