GestureDetector is a feature WIdget that identifies finger movements on the screen. Common identification operations are:

  • OnTap: click on the
  • OnDoubleTap: double-click
  • OnLongPress: long press

There are many other operations to be added as needed.

class _MyHomePageState extends State<MyHomePage> { double imgWidth = 300; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Center(Child: GestureDetector(Child: image. asset("images/ Avatar.jpg ",width: imgWidth,), onTap: (){print('onTap click '); }, onDoubleTap: (){print('onDouble double '); }, onLongPress: (){print('onLongPress '); },),),); }}Copy the code