diff --git a/android/gradle.properties b/android/gradle.properties index 84a39fb6aee8980f9270dced44cace0da07918aa..b2c845d9eaedef81b02fdf55b68883c9283831c4 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -2,5 +2,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true android.enableR8=true -app.versionName=1.1.10 -app.versionCode=10 +app.versionName=1.2.0 +app.versionCode=11 diff --git a/assets/audio/error.aac b/assets/audio/error.aac deleted file mode 100644 index 5c6c2a6144029adb1a2de89486abe3cea77ca290..0000000000000000000000000000000000000000 Binary files a/assets/audio/error.aac and /dev/null differ diff --git a/assets/audio/gameover.aac b/assets/audio/gameover.aac deleted file mode 100644 index a2b088a046ea83ba523d29896fdd9e772230e319..0000000000000000000000000000000000000000 Binary files a/assets/audio/gameover.aac and /dev/null differ diff --git a/assets/audio/success.aac b/assets/audio/success.aac deleted file mode 100644 index 532123dc1bb205f3044849578b6fd6c9715bf31f..0000000000000000000000000000000000000000 Binary files a/assets/audio/success.aac and /dev/null differ diff --git a/assets/audio/victory.aac b/assets/audio/victory.aac deleted file mode 100644 index a6eae02c2856deea2eb625d30065fdf8ccec1a27..0000000000000000000000000000000000000000 Binary files a/assets/audio/victory.aac and /dev/null differ diff --git a/assets/images/icon128.png b/assets/images/icon128.png deleted file mode 100644 index d717a1fee2af97525e23f7549fa3fd2c8cca5cbd..0000000000000000000000000000000000000000 Binary files a/assets/images/icon128.png and /dev/null differ diff --git a/icons/build_icons.sh b/icons/build_icons.sh index ea9fbc54fcddead79bd90a19444c9518dd4e7925..a605267fe7744fa5f6720fc9087b8df8a4fa1610 100755 --- a/icons/build_icons.sh +++ b/icons/build_icons.sh @@ -4,7 +4,6 @@ command -v inkscape >/dev/null 2>&1 || { echo >&2 "I require inkscape but it's not installed. Aborting."; exit 1; } command -v scour >/dev/null 2>&1 || { echo >&2 "I require scour but it's not installed. Aborting."; exit 1; } command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not installed. Aborting."; exit 1; } -command -v convert >/dev/null 2>&1 || { echo >&2 "I require convert (imagemagick) but it's not installed. Aborting."; exit 1; } CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" BASE_DIR="$(dirname "${CURRENT_DIR}")" @@ -47,6 +46,5 @@ build_icon 72 ${BASE_DIR}/android/app/src/main/res/mipmap-hdpi/ic_launcher build_icon 192 ${BASE_DIR}/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher build_icon 48 ${BASE_DIR}/android/app/src/main/res/mipmap-mdpi/ic_launcher build_icon 216 ${BASE_DIR}/android/app/src/main/res/mipmap-xhdpi/ic_launcher -build_icon 128 ${BASE_DIR}/assets/images/icon128 build_icon 192 ${BASE_DIR}/fastlane/metadata/android/en-US/images/icon build_icon 192 ${BASE_DIR}/fastlane/metadata/android/fr-FR/images/icon diff --git a/lib/main.dart b/lib/main.dart index 73b4b1dfa1b364faf21b3cb3364ecee71af33d9d..3e35935610f6b1cf90b5ff086e52dd1c0b106d06 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,7 +3,6 @@ import 'package:provider/provider.dart'; import 'provider/data.dart'; import 'screens/home.dart'; -import 'screens/info.dart'; import 'screens/settings.dart'; import 'screens/game.dart'; import 'screens/scores.dart'; @@ -30,7 +29,6 @@ class Hangman extends StatelessWidget { Game.id: (context) => Game(), Settings.id: (context) => Settings(), Scores.id: (context) => Scores(), - Info.id: (context) => Info(), }, ); }), diff --git a/lib/provider/data.dart b/lib/provider/data.dart index ae86605450410692f83748e97cde4acad9d3034f..ca67cc61c42412f7c135aa7adaeca637ce995af0 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -1,6 +1,5 @@ import 'package:flutter/foundation.dart'; import '../utils/shared_prefs.dart'; -import '../utils/package_info.dart'; import '../utils/constants.dart'; class Data extends ChangeNotifier { @@ -8,7 +7,6 @@ class Data extends ChangeNotifier { final SharedPrefs _sharedPrefs = SharedPrefs(); // screen settings - bool _soundValue = true; bool _gameModeValue = false; String _levelValue = defaultLevel; @@ -31,27 +29,12 @@ class Data extends ChangeNotifier { int _victoryCount = 0; int _defeatCount = 0; - // pack info - String _version = 'Non disponible'; - var _packInfo = PackInfo(); - Data() { - _readVersion(); _getPrefs(); } - void _readVersion() async { - await _packInfo.init(); - String versionInfo = _packInfo.version; - _version = versionInfo; - notifyListeners(); - } - - String get version => _version; - void _getPrefs() async { await _sharedPrefs.init(); - _soundValue = _sharedPrefs.sound ?? true; _gameModeValue = _sharedPrefs.gameMode ?? onlineGameMode.keys .firstWhere((k) => onlineGameMode[k].contains(_sharedPrefs.level), orElse: () => false); @@ -63,17 +46,11 @@ class Data extends ChangeNotifier { notifyListeners(); } - bool get soundPref => _sharedPrefs.sound ?? true; bool get gameModePref => _sharedPrefs.gameMode ?? false; String get levelPref => _sharedPrefs.level ?? onlineGameMode[gameModePref].first; void resetValues() => _getPrefs(); - set setPrefSound(bool prefSound) { - _sharedPrefs.sound = prefSound; - notifyListeners(); - } - set setPrefGameMode(bool prefGameMode) { _sharedPrefs.gameMode = prefGameMode; notifyListeners(); @@ -84,13 +61,6 @@ class Data extends ChangeNotifier { notifyListeners(); } - bool get soundValue => _soundValue; - - set updateSound(bool value) { - _soundValue = value; - notifyListeners(); - } - bool get gameModeValue => _gameModeValue; set updateGameMode(bool value) { diff --git a/lib/screens/home.dart b/lib/screens/home.dart index b908bdb9ad2428367cea8b78d00e4487cadad875..45f9e9a20e1a001eb8355b06aec127d292640012 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -15,24 +15,6 @@ class Home extends StatelessWidget { Orientation orientation = MediaQuery.of(context).orientation; Data _myProvider = Provider.of<Data>(context); - List<Widget> _listWidgets() { - return [ - Image.asset( - 'assets/images/icon128.png', - scale: orientation == Orientation.portrait ? 1 : 1.5, - ), - Padding( - padding: orientation == Orientation.portrait - ? EdgeInsets.only(top: 10.0) - : EdgeInsets.only(left: 10.0), - child: Text( - 'Version: ${_myProvider.version}', - textAlign: orientation == Orientation.portrait ? TextAlign.center : TextAlign.left, - ), - ), - ]; - } - void _errorWord(context) { showDialog( context: context, @@ -59,10 +41,6 @@ class Home extends StatelessWidget { onWillPop: () async => false, child: Center( child: CircularProgressIndicator(), - /*child: Text( - 'Generando una palabra,\nespera un momento por favor...', - textAlign: TextAlign.center, - ),*/ ), ) : Container( @@ -86,15 +64,6 @@ class Home extends StatelessWidget { ), ), ), - Container( - child: orientation == Orientation.portrait - ? Column(children: _listWidgets()) - : Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: _listWidgets(), - ), - ), RaisedButton.icon( shape: RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(10.0))), diff --git a/lib/screens/info.dart b/lib/screens/info.dart deleted file mode 100644 index d31812904fc0e91555d791265a8ff1b3c98fde93..0000000000000000000000000000000000000000 --- a/lib/screens/info.dart +++ /dev/null @@ -1,75 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart' show Clipboard, ClipboardData; - -class Info extends StatelessWidget { - static const String id = 'info'; - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('Informations'), - actions: [ButtonCoffee()], - ), - body: SingleChildScrollView( - padding: EdgeInsets.all(10.0), - child: Text( - textoInfo, - style: TextStyle(fontSize: 18.0), - ), - ), - ); - } -} - -class ButtonCoffee extends StatelessWidget { - const ButtonCoffee({Key key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return IconButton( - icon: Icon(Icons.free_breakfast), - onPressed: () { - showDialog( - context: context, - builder: (BuildContext context) => Scaffold( - backgroundColor: Colors.transparent, - body: Builder( - builder: (context) => DialogInfo(), - ), - ), - ); - }, - ); - } -} - -class DialogInfo extends StatelessWidget { - const DialogInfo({Key key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return AlertDialog( - title: Text('Informations sur cette application'), - content: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('Le jeu du pendu est un logiciel libre, sans publicité.'), - ], - ), - ), - actions: [ - FlatButton( - child: Text('Fermer'), - onPressed: () => Navigator.of(context).pop(), - ) - ], - ); - } -} - -const String textoInfo = ''' -LE JEU DU PENDU -'''; diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index 5b7d8101b8e190d03520f4630a978d06a360a72f..00e2ba994b5ed2e70bcfe0f0a6081d8b5f70093e 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -16,19 +16,6 @@ class Settings extends StatelessWidget { padding: const EdgeInsets.only(top: 30.0, left: 30.0, right: 30.0), child: Column( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text('Son'), - Switch( - value: _myProvider.soundValue, - onChanged: (bool value) => _myProvider.updateSound = value, - activeTrackColor: Color(board), - activeColor: Colors.greenAccent[400], - ), - ], - ), - Divider(color: Colors.grey), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -67,7 +54,6 @@ class Settings extends StatelessWidget { color: Color(board), padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0), onPressed: () { - _myProvider.setPrefSound = _myProvider.soundValue; _myProvider.setPrefGameMode = _myProvider.gameModeValue; _myProvider.setPrefLevel = _myProvider.levelValue; Navigator.pop(context); diff --git a/lib/utils/package_info.dart b/lib/utils/package_info.dart deleted file mode 100644 index 5f7da5a50161d5a0856823284d59ba054071a69e..0000000000000000000000000000000000000000 --- a/lib/utils/package_info.dart +++ /dev/null @@ -1,16 +0,0 @@ -import 'package:package_info/package_info.dart'; - -class PackInfo { - static PackageInfo _packageInfo; - - static String _version = 'Not available'; - - init() async { - if (_packageInfo == null) { - _packageInfo = await PackageInfo.fromPlatform(); - _version = _packageInfo.version; - } - } - - String get version => _version; -} diff --git a/lib/utils/shared_prefs.dart b/lib/utils/shared_prefs.dart index 9291b99dcf3db0c4f10382ac42e570160ef89530..f3352af2bfff67580b89f2cfeb3aedd772c19eb0 100644 --- a/lib/utils/shared_prefs.dart +++ b/lib/utils/shared_prefs.dart @@ -2,7 +2,6 @@ import 'package:shared_preferences/shared_preferences.dart'; class SharedPrefs { static SharedPreferences _sharedPrefs; - static const String _prefsSound = 'sound'; static const String _prefsGameMode = 'gameMode'; static const String _prefsLevel = 'level'; static const String _prefsVictoryCount = 'victoryCount'; @@ -14,10 +13,6 @@ class SharedPrefs { } } - bool get sound => _sharedPrefs?.getBool(_prefsSound); - - set sound(bool value) => _sharedPrefs.setBool(_prefsSound, value); - bool get gameMode => _sharedPrefs?.getBool(_prefsGameMode); set gameMode(bool value) => _sharedPrefs.setBool(_prefsGameMode, value); diff --git a/lib/utils/sound.dart b/lib/utils/sound.dart deleted file mode 100644 index 75f98581370e4f8b82fdd55b53f172bc827fc3e3..0000000000000000000000000000000000000000 --- a/lib/utils/sound.dart +++ /dev/null @@ -1,26 +0,0 @@ -import 'package:assets_audio_player/assets_audio_player.dart'; - -enum Archive { success, error, defeat, victory } - -extension ArchiveExtension on Archive { - static const files = { - Archive.success: 'assets/audio/success.aac', - Archive.error: 'assets/audio/error.aac', - Archive.defeat: 'assets/audio/gameover.aac', - Archive.victory: 'assets/audio/victory.aac', - }; - - String get file => files[this]; -} - -class Sound { - AssetsAudioPlayer assetsAudioPlayer; - - Sound() { - assetsAudioPlayer = AssetsAudioPlayer(); - } - - Future<void> play(String archive) async => await assetsAudioPlayer.open(Audio(archive)); - - Future<void> stop() async => await assetsAudioPlayer.stop(); -} diff --git a/lib/widgets/dialog_gameover.dart b/lib/widgets/dialog_gameover.dart index 05f1bf97dd33cfd72205cd51332473079f306d36..9925deee99e5ee3c5ab07f230087c4c8d986176f 100644 --- a/lib/widgets/dialog_gameover.dart +++ b/lib/widgets/dialog_gameover.dart @@ -4,12 +4,10 @@ import '../screens/home.dart'; import '../screens/game.dart'; import '../provider/data.dart'; import '../utils/constants.dart'; -import '../utils/sound.dart'; class DialogGameOver extends StatelessWidget { final GameOver gameOver; - final Sound sound; - const DialogGameOver(this.gameOver, this.sound); + const DialogGameOver(this.gameOver); @override Widget build(BuildContext context) { @@ -43,9 +41,6 @@ class DialogGameOver extends StatelessWidget { FlatButton( child: const Text('QUITTER'), onPressed: () { - if (_myProvider.soundValue == true) { - sound.stop(); - } Navigator.pushNamed(context, Home.id); }, ), diff --git a/lib/widgets/letters.dart b/lib/widgets/letters.dart index d1745045fb46ab6f1208cf415d849ba75252d0ac..850dcf2c848ff6885a0d83619fd017380571182c 100644 --- a/lib/widgets/letters.dart +++ b/lib/widgets/letters.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../provider/data.dart'; import '../utils/constants.dart'; -import '../utils/sound.dart'; import '../widgets/dialog_gameover.dart'; class LetterButtons extends StatelessWidget { @@ -12,15 +11,11 @@ class LetterButtons extends StatelessWidget { Widget build(BuildContext context) { Orientation orientation = MediaQuery.of(context).orientation; var size = MediaQuery.of(context).size; - /*24 is for notification bar on Android*/ - //final double itemHeight = (size.height - kToolbarHeight - 24) / 2; - //final double itemWidth = size.width / 2; final double paddingTop = MediaQuery.of(context).padding.top; final double itemHeight = (size.height - paddingTop) / 2; final double itemWidth = size.width / 2; Data _myProvider = Provider.of<Data>(context); - Sound sound = Sound(); List<String> lettersList = letters.split(''); List<Widget> keys = []; @@ -45,36 +40,20 @@ class LetterButtons extends StatelessWidget { if (_myProvider.hiddenWord == _myProvider.secretWord) { _myProvider.addVictory(); - if (_myProvider.soundValue == true) { - sound.play(Archive.victory.file); - } showDialog( context: context, - builder: (context) => DialogGameOver(victory, sound), + builder: (context) => DialogGameOver(victory), ); - } else { - if (_myProvider.soundValue == true) { - sound.play(Archive.success.file); - } } } else { _myProvider.addError(); if (_myProvider.errors == 8) { - if (_myProvider.soundValue == true) { - await sound.play(Archive.error.file); - await Future.delayed(Duration(seconds: 1)); - await sound.play(Archive.defeat.file); - } await Future.delayed(Duration(milliseconds: 900)); //???? _myProvider.addDefeat(); showDialog( context: context, - builder: (context) => DialogGameOver(defeat, sound), + builder: (context) => DialogGameOver(defeat), ); - } else { - if (_myProvider.soundValue == true) { - sound.play(Archive.error.file); - } } } }, diff --git a/lib/widgets/my_app_bar.dart b/lib/widgets/my_app_bar.dart index e7160c25b614286d75799367b55ca28e04ba0289..76a85b6faa4172cc1e46cc865edbf9523475c479 100644 --- a/lib/widgets/my_app_bar.dart +++ b/lib/widgets/my_app_bar.dart @@ -5,7 +5,6 @@ import 'package:provider/provider.dart'; import '../provider/data.dart'; import '../screens/settings.dart'; import '../screens/scores.dart'; -import '../screens/info.dart'; class MyAppBar extends StatelessWidget implements PreferredSizeWidget { final AppBar appBar; @@ -40,14 +39,10 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget { Scaffold.of(context).removeCurrentSnackBar(); Navigator.pushNamed(context, Scores.id); break; - case 'Informations': - Scaffold.of(context).removeCurrentSnackBar(); - Navigator.pushNamed(context, Info.id); - break; } }, itemBuilder: (BuildContext context) { - return {'Scores', 'Informations', 'Quitter'}.map((String choice) { + return {'Scores', 'Quitter'}.map((String choice) { return PopupMenuItem<String>( value: choice, child: Text(choice), diff --git a/pubspec.lock b/pubspec.lock index 878188b8517e34577b6092d0c559a08c6096f4cf..4766d527d1025d74ac2cd7a818e1168176be0e64 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,27 +1,13 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - assets_audio_player: - dependency: "direct main" - description: - name: assets_audio_player - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.15" - assets_audio_player_web: - dependency: transitive - description: - name: assets_audio_player_web - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.15" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.7.0" boolean_selector: dependency: transitive description: @@ -57,20 +43,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" - convert: - dependency: transitive - description: - name: convert - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.1" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "2.1.5" csslib: dependency: transitive description: @@ -78,13 +50,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.16.2" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - url: "https://pub.dartlang.org" - source: hosted - version: "1.0.3" diacritic: dependency: "direct main" description: @@ -176,7 +141,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.4.0" nested: dependency: transitive description: @@ -184,13 +149,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" - package_info: - dependency: "direct main" - description: - name: package_info - url: "https://pub.dartlang.org" - source: hosted - version: "0.4.3+4" path: dependency: transitive description: @@ -198,13 +156,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0" - path_provider: - dependency: transitive - description: - name: path_provider - url: "https://pub.dartlang.org" - source: hosted - version: "1.6.28" path_provider_linux: dependency: transitive description: @@ -212,13 +163,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.0.1+2" - path_provider_macos: - dependency: transitive - description: - name: path_provider_macos - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.4+8" path_provider_platform_interface: dependency: transitive description: @@ -268,13 +212,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.3.3" - rxdart: - dependency: transitive - description: - name: rxdart - url: "https://pub.dartlang.org" - source: hosted - version: "0.25.0" shared_preferences: dependency: "direct main" description: @@ -363,7 +300,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.0" typed_data: dependency: transitive description: @@ -371,13 +308,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.0" - uuid: - dependency: transitive - description: - name: uuid - url: "https://pub.dartlang.org" - source: hosted - version: "2.2.2" vector_math: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 4983a15ee17f6296afbc632aa264480832279871..00d79eb6c42b4d02f56e6cd6d7c6d054dda5e3a5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,8 +1,6 @@ name: hangman description: Hangman game, have fun with words and letters! - publish_to: 'none' # Remove this line if you wish to publish to pub.dev - version: 1.1.3+1 environment: @@ -11,30 +9,22 @@ environment: dependencies: flutter: sdk: flutter - - cupertino_icons: ^1.0.0 provider: ^4.3.2+3 - package_info: ^0.4.3+2 shared_preferences: ^0.5.12+4 html: ^0.14.0+4 http: ^0.12.2 diacritic: ^0.1.1 - assets_audio_player: ^2.0.13+1 list_french_words: ^0.1.0 dev_dependencies: flutter_test: sdk: flutter - flutter: - uses-material-design: true assets: - assets/images/ - assets/files/ - - assets/audio/ - fonts: - family: Tiza fonts: