, 在构造函数中的可选参数中, 大部分是回调方法设置字段 ;
class GestureDetector extends StatelessWidget {
GestureDetector({...Key key,
this.child,
this.onTapDown, // 按下
this.onTapUp, // 抬起
this.onTap, // 单击...onXxx 字段设置各种回调事件 , 字段类型是 void Function() 类型的 ;
作用组件 : 在 child 字段设置手势检测的主体组件 , 就是监听哪个组件的手势事件 ;
// 手势检测组件...onTapDown: (e){
print("点击按下");
},
// 点击抬起
onTapUp: (e){
print("点击抬起");
},
// 手势检测的作用组件..., 抬起 组成 , 如果按下后一直没有松开 , 就变成了长按操作 , 此时单击事件自动取消 ; 如果按下后滑出了 child 组件 , 则自动变为点击取消事件 ;
onTapDown : 单击按下事件