As the name implies, GestureDetector is a widget that detects gestures.
In the body of your layout, insert a GestureDetector. This widget has properties that respond to gestures of your user. You can respond to several user gestures. The most common ones include onTap, onDoubleTap, and onLongPress. Inside each of those gesture properties, you can add the code needed to respond to the user's gestures. Generally, what you'll do is change the state of the widget, but you are certainly not limited to that.
In our case, we'll need to move the bat, so the state value that will change is the left property of the positioned widget that contains the bat. We only need to respond to the horizontal drag, as the bat won't need to move vertically. Let's look at the steps to do that:
- In the build() method of pong.dart file, as a child of the batPositioned...