print(‘onTapDown’);
},
onTapUp: (TapUpDetails tapUpDetails) {
print(‘onTapUp’);
},
onTap: () {
print(‘onTap’);
},
onTapCancel: () {
print(‘onTapCancel’);
},
child: Center(child: Container(width: 200,height: 200,color: Colors.red,),),
)
按下然后抬起调用顺序
onTapDown-> onTapUp-> onTap
按下后移动的调用顺序
onTapDown-> onTapCancel
双击事件
双击是快速且连续2次在同一个位置点击,双击监听使用onDoubleTap方法,用法如下:
GestureDetector(
onDoubleTap: ()=>print(‘onDoubleTap’),
child: Center(
child: Container(
width: 200,
height: 200,
color: Colors.red,
),
),
)
长按事件
长按事件(LongPress)包含长按开始、移动、抬起、结束事件,说明如下:
-
onLongPressStart:长按开始事件回调
-
onLongPressMoveUpdate:长按移动事件回调
-
onLongPressUp:长按抬起事件回调
-
onLongPressEnd:长按结束事件回调
-
onLongPress:长按事件回调
示例
GestureDetector(
onLongPressStart: (v) => print(‘onLongPressStart’),
onLongPressMoveUpdate: (v) => print(‘onLongPressMoveUpdate’),
onLongPressUp: () => print(‘onLongPressUp’),
onLongPressEnd: (v) => print(‘onLongPressEnd’),
onLongPress: () => print(‘onLongPress’),
child: Center(
child: Container(
width: 200,
height: 200,
color: Colors.red,
),
),
)
水平/垂直拖动事件
垂直/水平拖动事件包括按下、开始、移动更新、结束、取消事件,以垂直为例说明如下
-
onVerticalDragDown:垂直拖动按下事件回调
-
onVerticalDragStart:垂直拖动开始事件回调
-
onVerticalDragUpdate:指针移动更新事件回调
-
onVerticalDragEnd:垂直拖动结束事件回调
-
onVerticalDragCancel:垂直拖动取消事件回调
示例
GestureDetector(
onVerticalDragStart: (v) => print(‘onVerticalDragStart’),
onVerticalDragDown: (v) => print(‘onVerticalDragDown’),
onVerticalDragUpdate: (v) => print(‘onVerticalDragUpdate’),
onVerticalDragCancel: () => print(‘onVerticalDragCancel’),
onVerticalDragEnd: (v) => print(‘onVerticalDragEnd’),
child: Center(
child: Container(
width: 200,
height: 200,
color: Colors.red,
),
),
)
用户垂直方向拖动调用顺序如下
onVerticalDragDown->onVerticalDragStart->onVerticalDragUpdate-> … -> onVerticalDragUpdate-> onVerticalDragEnd。
缩放事件
缩放(Scale)包含缩放开始、更新、结束。说明如下
-
onScaleStart:缩放开始事件回调
-
onScaleUpdate:缩放更新事件回调
-
onScaleEnd:缩放结束事件回调
示例
GestureDetector(
onScaleStart: (v) => print(‘onScaleStart’),
onScaleUpdate: (ScaleUpdateDetails v) => print(‘onScaleUpdate’),
onScaleEnd: (v) => print(‘onScaleEnd’),
child: Center(
child: Container(
width: 200,
height: 200,
color: Colors.red,
),
),
自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。
深知大多数初中级安卓工程师,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年最新Android移动开发全套学习资料》送给大家,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频
如果你觉得这些内容对你有帮助,可以添加下面V无偿领取!(备注Android)
925031289)]
[外链图片转存中…(img-9BibXEi2-1710925031289)]
[外链图片转存中…(img-vKlGDn7y-1710925031290)]
[外链图片转存中…(img-T2aTJoDZ-1710925031290)]
由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频
如果你觉得这些内容对你有帮助,可以添加下面V无偿领取!(备注Android)
[外链图片转存中…(img-lCzYPqX1-1710925031290)]