import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main()=>runApp(MyApp());
class MyAppextends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home:Scaffold(
body:GestureDetector(
child:Container(
width:200,
height:200,
color: Colors.red,
),
// 单击
onTap: (){
print("单击");
},
// 双击
onDoubleTap: (){
print("双击");
},
// 长按
onLongPress: (){
print("长按");
},
// 拖动
onHorizontalDragStart: (e){
print("拖动");
},
// 缩放
onScaleUpdate: (e){
print("缩放");
},
),
)
);
}
}
网友评论