📱 Flutter Intermediate

What is GestureDetector in Flutter?

Answer

GestureDetector is a widget that detects touch gestures and triggers callbacks — without adding any visual indicator. It wraps any widget and provides callbacks like onTap, onDoubleTap, onLongPress, onPanUpdate (drag), onScaleUpdate (pinch), and more. It is the primary way to add interactivity to custom widgets that are not inherently tappable. For standard interactive elements like buttons, use built-in widgets like ElevatedButton or InkWell instead, as they include accessibility support.