diff --git a/lib/screens/game_screen.dart b/lib/screens/game_screen.dart index f3d8635..9d4ca49 100644 --- a/lib/screens/game_screen.dart +++ b/lib/screens/game_screen.dart @@ -57,6 +57,7 @@ class MastermindGameState extends State { bool finished = false; bool isWin = false; Color? _selectedColor; + DragStartDetails? _dragStartDetails; @override void initState() { @@ -354,10 +355,20 @@ class MastermindGameState extends State { child: Row(children: [ for (int i = 0; i < rowSize; i++) buildColorButton(row, i), ]), - onDoubleTap: () { - setState(() { - guesses[currentGuess] = List.from(guesses[row]); - }); + onVerticalDragStart: (DragStartDetails verticalDragStart) { + _dragStartDetails = verticalDragStart; + }, + onVerticalDragEnd: (DragEndDetails verticalDragEnd) { + final dragDistance = _dragStartDetails!.globalPosition.dy - + verticalDragEnd.globalPosition.dy; + + if (dragDistance < -5) { + if (mounted) { + setState(() { + guesses[currentGuess] = List.from(guesses[row]); + }); + } + } }, ), buildTexts(row, true) diff --git a/lib/screens/start_screen.dart b/lib/screens/start_screen.dart index 037ee52..ef14514 100644 --- a/lib/screens/start_screen.dart +++ b/lib/screens/start_screen.dart @@ -1,3 +1,4 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import '../components/game_mode_button.dart'; @@ -44,7 +45,7 @@ class StartScreen extends StatelessWidget { ), ), Spacer(), - Text("© 2024 PyFlat - v1.0.0"), + if (kIsWeb) Text("© 2024 PyFlat - v1.0.0"), SizedBox( height: 10, )