Flutterはタッチジェスチャー(タップ、スワイプ、ドラッグ、ピンチ)をGestureDetectorやInkWellなどのジェスチャー検出ウィジェット、およびビルトイン ウィジェット相互作用を通じて処理します。ジェスチャー処理を理解することは、インタラクティブなアプリを構築するために不可欠です。
GestureDetector — ジェスチャーを検出
// GestureDetector wraps a widget and detects gestures on it
GestureDetector(
onTap: () => print('tapped'),
onDoubleTap: () => print('double tapped'),
onLongPress: () => print('long pressed'),
onPanUpdate: (details) => print('dragging: ${details.delta}'), // drag
onScaleUpdate: (details) => print('pinch: ${details.scale}'), // pinch/zoom
child: Container(width: 100, height: 100, color: Colors.blue),
)
