diff --git a/android/gradle.properties b/android/gradle.properties index 777ac2de0980e935649cf32bd85097eaf789185a..30298b3b3f04073678e48519b8c043edba635df8 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.16 -app.versionCode=16 +app.versionName=0.0.18 +app.versionCode=18 diff --git a/assets/ui/tip-hidden.png b/assets/ui/tip-hidden.png new file mode 100644 index 0000000000000000000000000000000000000000..d784375e59ef2d694808dcf040ac19f0c72f08d5 Binary files /dev/null and b/assets/ui/tip-hidden.png differ diff --git a/lib/provider/data.dart b/lib/provider/data.dart index 6980aa51593fd5019406361661ab67a0315d626f..fecfa5a30dfda331d0a9b7d4ff5302e07739b99c 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -14,6 +14,7 @@ class Data extends ChangeNotifier { // application state bool _shuffling = false; + bool _displayTipImage = false; String get image => _image; @@ -50,6 +51,13 @@ class Data extends ChangeNotifier { notifyListeners(); } + bool get displayTipImage => _displayTipImage; + + set updateDisplayTipImage(bool value) { + _displayTipImage = value; + notifyListeners(); + } + void swapTiles(List<int> tile1, List<int> tile2) { int indexTile1 = _tiles.indexWhere((tile) => ((tile.currentCol == tile1[0]) && (tile.currentRow == tile1[1]))); int indexTile2 = _tiles.indexWhere((tile) => ((tile.currentCol == tile2[0]) && (tile.currentRow == tile2[1]))); diff --git a/lib/screens/home.dart b/lib/screens/home.dart index f20d4451cec8c7f57df556c875d66a8bf38d9ba1..0412c2d345abeb0ce265e48e5706b270655eb158 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -20,6 +20,10 @@ class Home extends StatelessWidget { myProvider.updateImage = ''; } + void toggleDisplayTipImage(Data myProvider) { + myProvider.updateDisplayTipImage = !myProvider.displayTipImage; + } + String getImageAssetName(String imageCode) { return 'assets/images/'+imageCode+'.png'; } @@ -230,21 +234,30 @@ class Home extends StatelessWidget { Container _buildTipWidget(Data myProvider) { return Container( - margin: EdgeInsets.all(4), - padding: EdgeInsets.all(4), - decoration: BoxDecoration( - color: Colors.blue, - borderRadius: BorderRadius.circular(4), - border: Border.all( - color: Colors.blue, - width: 4, + child: FlatButton( + child: Container( + margin: EdgeInsets.all(4), + padding: EdgeInsets.all(4), + decoration: BoxDecoration( + color: Colors.blue, + borderRadius: BorderRadius.circular(4), + border: Border.all( + color: Colors.blue, + width: 4, + ), + ), + child: Image( + image: AssetImage( + myProvider.displayTipImage + ? getImageAssetName(myProvider.image) + : 'assets/ui/tip-hidden.png' + ), + width: _tipImageSize, + height: _tipImageSize, + fit: BoxFit.fill + ), ), - ), - child: Image( - image: AssetImage(getImageAssetName(myProvider.image)), - width: _tipImageSize, - height: _tipImageSize, - fit: BoxFit.fill + onPressed: () => toggleDisplayTipImage(myProvider), ), ); } diff --git a/pubspec.yaml b/pubspec.yaml index 12fb8fdc04032cd82422076cfa5e2dec4ca5e823..0b9ed1a12410931590f37c5c0286330826ab5bc9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -21,3 +21,4 @@ flutter: assets: - assets/files/ - assets/images/ + - assets/ui/