🐣
【Flutter】GestureDetector widget ボタンではないものをボタンとして扱う
GestureDetectorについて
ボタンではないウィジェットをボタンとして扱うときに使います
初期起動アプリを使っていきます。※記載は省略
GestureDetector(
onTap: () {
print('押されました');
},
onDoubleTap: () {
print('ダブルタップされました');
},
child: Container(
width: 100,
height: 50,
color: Colors.green,
),
)
ボタンにしたいWidgetの直上にGestureDetectorを追加
以上、GestureDetectorです。
Discussion