diff --git a/android/gradle.properties b/android/gradle.properties index f0fcf6cdd8fc72bc76b35e7be0dc622b20c03b0f..408253ceb04c0c7c49b3b9daf597f35b66ce16c1 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.26 -app.versionCode=26 +app.versionName=0.0.27 +app.versionCode=27 diff --git a/lib/provider/data.dart b/lib/provider/data.dart index 5a24b8d1723ea3ac364ef74bb5ba2c323890f010..a7571bc91e47812f282fc0b49e362a6ae12bfd7a 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -13,7 +13,7 @@ class Data extends ChangeNotifier { List _tiles = []; // application state - bool _shuffling = false; + bool _isShufflingBoard = false; bool _displayTipImage = false; String get image => _image; @@ -44,10 +44,10 @@ class Data extends ChangeNotifier { notifyListeners(); } - bool get shuffling => _shuffling; + bool get isShufflingBoard => _isShufflingBoard; - set updateShuffling(bool value) { - _shuffling = value; + set updateIsShufflingBoard(bool value) { + _isShufflingBoard = value; notifyListeners(); } diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 1db426d1ec4a4a33df0f26d47e58a15b45bb508e..3a4b4f669831e4c9a36b40094b2b5877a050399c 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:typed_data'; import 'dart:math'; @@ -41,10 +42,11 @@ class Home extends StatelessWidget { } Future<void> selectImage(Data myProvider, String imageCode, double tileImageSize) async { - myProvider.updateShuffling = true; + myProvider.updateIsShufflingBoard = true; myProvider.updateImage = imageCode; - myProvider.updateTiles = await splitImageInTiles(myProvider, tileImageSize); - myProvider.updateShuffling = false; + Timer timer = new Timer(new Duration(seconds: 1), () { + splitImageInTiles(myProvider, tileImageSize); + }); } void shuffleImages(Data myProvider) { @@ -161,7 +163,7 @@ class Home extends StatelessWidget { return tiles; } - Future<List<Tile>> splitImageInTiles(Data myProvider, double tileImageSize) async { + Future<void> splitImageInTiles(Data myProvider, double tileImageSize) async { String imageAsset = getImageAssetName(myProvider.image); Uint8List imageData = (await rootBundle.load(imageAsset)) .buffer @@ -194,7 +196,8 @@ class Home extends StatelessWidget { y += height; } - return shuffleTiles(tiles); + myProvider.updateTiles = shuffleTiles(tiles); + myProvider.updateIsShufflingBoard = false; } bool _checkTilesetIsOrdered(List<Tile> tiles) { @@ -307,6 +310,8 @@ class Home extends StatelessWidget { color: Colors.black, ), ), + SizedBox(height: 20), + CircularProgressIndicator(), ], ), ); @@ -321,7 +326,7 @@ class Home extends StatelessWidget { double _selectorImageSize = (MediaQuery.of(context).size.width - 140) / _selectImageColumnsCount; double _tileImageSize = (MediaQuery.of(context).size.width - 70) / _myProvider.tilesCount; - if (_myProvider.shuffling) { + if (_myProvider.isShufflingBoard) { content = _buildShufflingIndicatorWidget(); } else { if (_myProvider.image == '') {