diff --git a/android/gradle.properties b/android/gradle.properties index 81949dfd2077495aaea8a6bc81ad9c75442f9ebb..957c40bc42f3a742d2266dc3a403ad014458ba3f 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=0.0.14 -app.versionCode=14 +app.versionName=0.0.15 +app.versionCode=15 diff --git a/lib/entities/cell.dart b/lib/entities/cell.dart index 75c44821e5d768c60cc6cfd6e5681d7851446d88..db64fe3da8cc674ce906691be13baa28f3d5e78d 100644 --- a/lib/entities/cell.dart +++ b/lib/entities/cell.dart @@ -39,7 +39,9 @@ class Cell { fit: BoxFit.fill ), onTap: () { - BoardUtils.fillBoardFromFirstCell(myProvider, this.value); + if (!myProvider.animationInProgress) { + BoardUtils.fillBoardFromFirstCell(myProvider, this.value); + } }, ) ); diff --git a/lib/provider/data.dart b/lib/provider/data.dart index 24178992c06361f75293dc948036de3051bd00b0..fcb9770337638d7737296937bff4f42fec5d5ec5 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -32,6 +32,7 @@ class Data extends ChangeNotifier { // Game data bool _gameIsRunning = false; + bool _animationInProgress = false; bool _gameWon = false; int _boardSize = 0; int _colorsCount = 0; @@ -224,6 +225,12 @@ class Data extends ChangeNotifier { notifyListeners(); } + bool get animationInProgress => _animationInProgress; + void updateAnimationInProgress(bool animationInProgress) { + _animationInProgress = animationInProgress; + notifyListeners(); + } + void resetGame() { _gameIsRunning = false; _gameWon = false; diff --git a/lib/utils/board_utils.dart b/lib/utils/board_utils.dart index 029cbed521f085ab4efd5c25442a161f0bd844c2..b91858c68b70c00a65b6bd3eed52bddd13667ed1 100644 --- a/lib/utils/board_utils.dart +++ b/lib/utils/board_utils.dart @@ -66,6 +66,7 @@ class BoardUtils { Timer _timerAnimateBoard; const interval = const Duration(milliseconds: 10); int cellIndex = 0; + myProvider.updateAnimationInProgress(true); _timerAnimateBoard = new Timer.periodic( interval, (Timer timer) { @@ -81,6 +82,7 @@ class BoardUtils { myProvider.updateProgress(progressAfterMove); myProvider.incrementMovesCount(); + myProvider.updateAnimationInProgress(false); if (BoardUtils.checkBoardIsSolved(myProvider)) { myProvider.updateGameWon(true);