diff --git a/android/gradle.properties b/android/gradle.properties index db7a1ee2908d6e94aeb319e1c1b548a8bb245891..14eed3944b547f02179b1b42f4b601f91b7957c0 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.3 -app.versionCode=3 +app.versionName=0.0.4 +app.versionCode=4 diff --git a/lib/layout/game.dart b/lib/layout/game.dart index b2720f65cb133a1e237dbb2c58ac66792dac0a17..342f1a2737733bc5d6c15e61524403b365a954b1 100644 --- a/lib/layout/game.dart +++ b/lib/layout/game.dart @@ -17,6 +17,18 @@ class Game { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ + SizedBox(height: 8), + Container( + child: Text( + myProvider.movesCount.toString(), + style: TextStyle( + fontSize: 40, + fontWeight: FontWeight.w600, + color: Colors.black, + ), + ), + ), + SizedBox(height: 2), Expanded( child: Board.buildGameBoard(myProvider), ), diff --git a/lib/provider/data.dart b/lib/provider/data.dart index 9a16b9dbf93b6aee450f6a505cdfe7de900322ed..4f044ed5c04be6c32250366895ee80b4a19c2b86 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -21,6 +21,7 @@ class Data extends ChangeNotifier { bool _gameWon = false; int _boardSize = 0; int _colorsCount = 0; + int _movesCount = 0; List _cells = []; String get level => _level; @@ -125,6 +126,15 @@ class Data extends ChangeNotifier { notifyListeners(); } + int get movesCount => _movesCount; + void updateMovesCount(int movesCount) { + _movesCount = movesCount; + notifyListeners(); + } + void incrementMovesCount() { + updateMovesCount(movesCount + 1); + } + bool get gameIsRunning => _gameIsRunning; void updateGameIsRunning(bool gameIsRunning) { _gameIsRunning = gameIsRunning; @@ -144,6 +154,7 @@ class Data extends ChangeNotifier { void resetGame() { _gameIsRunning = false; _gameWon = false; + _movesCount = 0; notifyListeners(); } diff --git a/lib/utils/board_utils.dart b/lib/utils/board_utils.dart index 61848e3a0c76fea4819eb1e352e52bf3a9fb919c..6971073b68872d5f9daff86237ef7fbf13cb2f54 100644 --- a/lib/utils/board_utils.dart +++ b/lib/utils/board_utils.dart @@ -47,6 +47,8 @@ class BoardUtils { for (var cellIndex = 0; cellIndex < cellsToFill.length; cellIndex++) { myProvider.updateCellValue(cellsToFill[cellIndex][1], cellsToFill[cellIndex][0], value); } + + myProvider.incrementMovesCount(); } static List getSiblingFillableCells(Data myProvider, row, col, siblingCells) {