Flutter จัดการ touch gestures (taps, swipes, drags, pinches) ผ่าน widget ที่ตรวจจับ gesture อย่าง GestureDetector และ InkWell บวกกับการโต้ตอบที่มีในตัว widget การเข้าใจการจัดการ gesture เป็นสิ่งจำเป็นต่อการสร้างแอปที่โต้ตอบได้
GestureDetector — ตรวจจับ gestures
// 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),
)
