Untitled
unknown
dart
3 years ago
714 B
7
Indexable
body: GestureDetector(
child: GameBoard(isPlaying: isPlaying, body: body, food: food),
onHorizontalDragUpdate: (details) {
if (direction != 'left' && details.delta.dx > 0) {
print("right ${details.delta.dx}");
direction = directionRIGHT;
} else if (direction != 'right' && details.delta.dx < 0) {
print("left ${details.delta.dx}");
direction = directionLEFT;
}
},
onVerticalDragUpdate: (details) {
if (direction != 'down' && details.delta.dy < 0) {
print("up ${details.delta.dy}");
direction = directionUP;
} else if (direction != 'up' && details.delta.dy > 0) {
print("down ${details.delta.dy}");
direction = directionDOWN;
}
},
),Editor is loading...