I have a GestureDetector
in a custom stateless view.
when onTap
triggered I show a snack bar that displays some info.
When the user makes multiple clic
Create a bool
flag and define a method:
bool _enabled = true;
void _onTap () {
// Disable GestureDetector's 'onTap' property.
setState(() => _enabled = false);
// Enable it after 1s.
Timer(Duration(seconds: 1), () => setState(() => _enabled = true));
// Rest of your code.
}
Usage:
GestureDetector(
onTap: _enabled ? _onTap: null,
child: Icon(Icons.content_copy),
)