Now that we have the ball moving, and the bat responding to our gestures, we need to tell when the ball reaches the bottom of the screen without touching the bat. This is when we actually lose the game.
We need to modify the checkBorders() method. Here, we are dealing with the four borders of the screen: top, left, right, and bottom. The only change we need to make is for the bottom. It is here that we need to check whether the bat is in the correct position to make the ball bounce back up, or if the game needs to stop.
In the pong.dart file, edit the checkBorders() method, at the point where you check for Direction.down, as indicated here:
if (posY >= height - 50 - batHeight && vDir == Direction.down) {
//check if the bat is here, otherwise loose
if (posX >= (batPosition - 50) && posX <= (batPosition +
batWidth + 50...