diff --git a/android/gradle.properties b/android/gradle.properties index 2c9d43c520a06b38808242c86e55863c0653df88..9afb4c689a0bff258d2a5403ef6a41e03d7faed5 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.47 -app.versionCode=47 +app.versionName=0.0.48 +app.versionCode=48 diff --git a/fastlane/metadata/android/en-US/changelogs/48.txt b/fastlane/metadata/android/en-US/changelogs/48.txt new file mode 100644 index 0000000000000000000000000000000000000000..de6b295dd6b421c2cfd93739c6a7453d1a9ec641 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/48.txt @@ -0,0 +1 @@ +Add a moves counter diff --git a/fastlane/metadata/android/fr-FR/changelogs/48.txt b/fastlane/metadata/android/fr-FR/changelogs/48.txt new file mode 100644 index 0000000000000000000000000000000000000000..03426637507b39b0c005534fe7f05cacfee304a7 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/48.txt @@ -0,0 +1 @@ +Ajout d'un compteur de coups diff --git a/lib/provider/data.dart b/lib/provider/data.dart index d11f57f5c3def7881eb4be52c5b5bc74bd5a94be..62ea9285772067ab68e9170ceb8616dc75477ee1 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -5,11 +5,12 @@ class Data extends ChangeNotifier { // application configuration int _tilesCount = 4; - // application data + // Game data List _availableImages = []; String _selectedImage = ''; List<MovingTile> _tiles = []; double _tileImageSize = 1.0; + int _movesCount = 0; // application state bool _isShufflingBoard = false; @@ -19,6 +20,7 @@ class Data extends ChangeNotifier { void updateSelectedImage(String value) { _selectedImage = value; + _movesCount = 0; notifyListeners(); } @@ -47,6 +49,16 @@ class Data extends ChangeNotifier { notifyListeners(); } + int get movesCount => _movesCount; + void updateMovesCount(int movesCount) { + _movesCount = movesCount; + notifyListeners(); + } + + void incrementMovesCount() { + updateMovesCount(movesCount + 1); + } + bool get isShufflingBoard => _isShufflingBoard; void updateIsShufflingBoard(bool isShuffling) { @@ -84,6 +96,7 @@ class Data extends ChangeNotifier { _tiles[indexTile1].currentRow = _tiles[indexTile2].currentRow; _tiles[indexTile2].currentRow = swapRow; + incrementMovesCount(); notifyListeners(); } } diff --git a/lib/screens/game.dart b/lib/screens/game.dart index 4c63e598502bca7d285893c3ea5c27c1f2b613bf..38bc89a7eacb694fc064163b9491c00cd93c71bb 100644 --- a/lib/screens/game.dart +++ b/lib/screens/game.dart @@ -144,7 +144,16 @@ class Game { children: [ TableRow( children: [ - Column(children: []), + Column(children: [ + Text( + myProvider.movesCount.toString(), + style: TextStyle( + fontSize: 40, + fontWeight: FontWeight.w600, + color: Colors.black, + ), + ), + ]), Column(children: []), ], ),