diff --git a/android/gradle.properties b/android/gradle.properties index 777ac2de0980e935649cf32bd85097eaf789185a..cd2d833ca96b3d1ada4a39df51dc5f5ee67665b7 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.17 +app.versionCode=17 diff --git a/fastlane/metadata/android/en-US/changelogs/17.txt b/fastlane/metadata/android/en-US/changelogs/17.txt new file mode 100644 index 0000000000000000000000000000000000000000..2bbe4a913393aeeceb8a7d8c9812849dd191a35e --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/17.txt @@ -0,0 +1 @@ +Upgrade Flutter framework and dependencies, clean some code diff --git a/fastlane/metadata/android/fr-FR/changelogs/17.txt b/fastlane/metadata/android/fr-FR/changelogs/17.txt new file mode 100644 index 0000000000000000000000000000000000000000..864ad0a1475fcf2e546cb12d3c49c1d895ef43b2 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/17.txt @@ -0,0 +1 @@ +Mise à jour du framework Flutter et de ses dépendances, nettoyage de code diff --git a/ios/Flutter/Generated.xcconfig b/ios/Flutter/Generated.xcconfig index b2a684cab64daac2ba8b66c416cfc498f30717ca..1fa673d81a7c2bdf2e2fbd35f69b9f760e6dc7c4 100644 --- a/ios/Flutter/Generated.xcconfig +++ b/ios/Flutter/Generated.xcconfig @@ -7,7 +7,8 @@ FLUTTER_BUILD_DIR=build FLUTTER_BUILD_NAME=1.0.0 FLUTTER_BUILD_NUMBER=1 EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 +EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 DART_OBFUSCATION=false -TRACK_WIDGET_CREATION=false +TRACK_WIDGET_CREATION=true TREE_SHAKE_ICONS=false PACKAGE_CONFIG=.dart_tool/package_config.json diff --git a/ios/Flutter/flutter_export_environment.sh b/ios/Flutter/flutter_export_environment.sh index f8c2437eedfc8250871e78bdefc657525828d086..d0ba800df359afa1b5596dcb9f0bfc3a71379d2f 100755 --- a/ios/Flutter/flutter_export_environment.sh +++ b/ios/Flutter/flutter_export_environment.sh @@ -8,6 +8,6 @@ export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=false" +export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" export "PACKAGE_CONFIG=.dart_tool/package_config.json" diff --git a/lib/layout/board.dart b/lib/layout/board.dart index bd42321f768a63f9a4d90c764e8d949980c1ee60..dd71a8b5905188c27b43b506ab6344b16eb2a23f 100644 --- a/lib/layout/board.dart +++ b/lib/layout/board.dart @@ -4,7 +4,6 @@ import '../provider/data.dart'; import '../utils/game_utils.dart'; class Board { - static Container buildGameBoard(Data myProvider) { String skin = myProvider.skin; @@ -20,8 +19,8 @@ class Board { } Image imageWidget = Image( - image: AssetImage('assets/skins/'+skin+'_'+cellImage+'.png'), - fit: BoxFit.fill + image: AssetImage('assets/skins/' + skin + '_' + cellImage + '.png'), + fit: BoxFit.fill, ); Text textWidget = Text( @@ -31,16 +30,15 @@ class Board { fontSize: 40.0, fontWeight: FontWeight.w900, ), - textAlign: TextAlign.center + textAlign: TextAlign.center, ); return Stack( alignment: Alignment.center, - children: <Widget>[ imageWidget, Center(child: textWidget), - ] + ], ); } @@ -69,17 +67,10 @@ class Board { cellTip = tips[colIndex]; } - tableCells.add( - TableCell( - child: buildCellWidget(cellValue, cellTip) - ) - ); - }; - tableRows.add( - TableRow( - children: tableCells - ) - ); + tableCells.add(TableCell(child: buildCellWidget(cellValue, cellTip))); + } + + tableRows.add(TableRow(children: tableCells)); } double horizontalMargins = 20; @@ -93,7 +84,6 @@ class Board { return Container( margin: EdgeInsets.symmetric(horizontal: horizontalMargins), padding: EdgeInsets.all(2), - child: Table( defaultVerticalAlignment: TableCellVerticalAlignment.middle, border: TableBorder.all( @@ -102,8 +92,7 @@ class Board { style: BorderStyle.solid, ), children: tableRows, - ) + ), ); } - } diff --git a/lib/layout/game.dart b/lib/layout/game.dart index 6abe0c3753b64c4bbe634fa61982ed0fd29b2eb5..f485358f3c50d549eedb98f2ded936a96c036e50 100644 --- a/lib/layout/game.dart +++ b/lib/layout/game.dart @@ -1,5 +1,3 @@ -import 'dart:math'; - import 'package:flutter/material.dart'; import '../layout/board.dart'; @@ -8,7 +6,6 @@ import '../provider/data.dart'; import '../utils/game_utils.dart'; class Game { - static Container buildGameWidget(Data myProvider) { bool gameIsFinished = myProvider.isGameFinished(); @@ -25,16 +22,16 @@ class Game { height: 150, width: double.maxFinite, child: gameIsFinished - ? Game.buildEndGameMessage(myProvider) - : Keyboard.buildWidget(myProvider), + ? Game.buildEndGameMessage(myProvider) + : Keyboard.buildWidget(myProvider), ), ], ), ); } - static FlatButton buildRestartGameButton(Data myProvider) { - return FlatButton( + static TextButton buildRestartGameButton(Data myProvider) { + return TextButton( child: Container( child: Image( image: AssetImage('assets/icons/button_back.png'), @@ -55,26 +52,24 @@ class Game { Image decorationImage = Image( image: AssetImage(decorationImageAssetName), - fit: BoxFit.fill + fit: BoxFit.fill, ); return Container( margin: EdgeInsets.all(2), padding: EdgeInsets.all(2), - child: Table( defaultColumnWidth: IntrinsicColumnWidth(), children: [ TableRow( children: [ - Column(children: [ decorationImage ]), - Column(children: [ buildRestartGameButton(myProvider) ]), - Column(children: [ decorationImage ]), + Column(children: [decorationImage]), + Column(children: [buildRestartGameButton(myProvider)]), + Column(children: [decorationImage]), ], ), - ] - ) + ], + ), ); } - } diff --git a/lib/layout/keyboard.dart b/lib/layout/keyboard.dart index 16ce8ddc85bece73b446b58aa7f391131ade3cb6..5dd9d1fe4ced96203acf2d122eba6dbd951354de 100644 --- a/lib/layout/keyboard.dart +++ b/lib/layout/keyboard.dart @@ -1,12 +1,9 @@ -import 'dart:math'; - import 'package:flutter/material.dart'; import '../provider/data.dart'; import '../utils/game_utils.dart'; class Keyboard { - static Container buildWidget(Data myProvider) { final List<List<String>> keys = [ ['A', 'Z', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P'], @@ -33,7 +30,7 @@ class Keyboard { children: <Widget>[ Image( image: AssetImage('assets/icons/key.png'), - fit: BoxFit.fill + fit: BoxFit.fill, ), Center( child: TextButton( @@ -47,7 +44,7 @@ class Keyboard { fontSize: 30.0, fontWeight: FontWeight.w800, ), - textAlign: TextAlign.center + textAlign: TextAlign.center, ), onPressed: () { if (key == '<') { @@ -58,9 +55,9 @@ class Keyboard { GameUtils.addLetter(myProvider, key); } }, - ) + ), ), - ] + ], ); } @@ -68,33 +65,20 @@ class Keyboard { keys.forEach((row) { List<TableCell> tableCells = []; row.forEach((key) { - tableCells.add( - TableCell( - child: buildKeyWidget(key), - ) - ); + tableCells.add(TableCell( + child: buildKeyWidget(key), + )); }); - tableRows.add( - TableRow( - children: tableCells - ) - ); + tableRows.add(TableRow(children: tableCells)); }); return Container( margin: EdgeInsets.symmetric(horizontal: 2), padding: EdgeInsets.all(2), - child: Table( defaultVerticalAlignment: TableCellVerticalAlignment.middle, - // border: TableBorder.all( - // width: 2.0, - // color: Colors.blue, - // style: BorderStyle.solid, - // ), children: tableRows, - ) + ), ); } - } diff --git a/lib/layout/parameters.dart b/lib/layout/parameters.dart index a151ad0d59aa60df85456118c0a5017402bd6b2c..a9faa02f5608bcd12ab7963e6659bc14242ba491 100644 --- a/lib/layout/parameters.dart +++ b/lib/layout/parameters.dart @@ -4,7 +4,6 @@ import '../provider/data.dart'; import '../utils/game_utils.dart'; class Parameters { - static Container buildParametersSelector(Data myProvider) { return Container( padding: EdgeInsets.all(2), @@ -19,7 +18,6 @@ class Parameters { SizedBox(height: 5), Parameters.buildParameterSelector(myProvider, 'skin'), SizedBox(height: 5), - Parameters.buildStartGameButton(myProvider), ], ), @@ -31,15 +29,14 @@ class Parameters { children: [ Image( image: AssetImage('assets/icons/game_win.png'), - fit: BoxFit.fill + fit: BoxFit.fill, ), - ] + ], ); return Container( margin: EdgeInsets.all(2), padding: EdgeInsets.all(2), - child: Table( defaultColumnWidth: IntrinsicColumnWidth(), children: [ @@ -48,7 +45,7 @@ class Parameters { decorationImage, Column( children: [ - FlatButton( + TextButton( child: Container( child: Image( image: AssetImage('assets/icons/button_start.png'), @@ -57,13 +54,13 @@ class Parameters { ), onPressed: () => GameUtils.startGame(myProvider), ), - ] + ], ), decorationImage, ], ), - ] - ) + ], + ), ); } @@ -83,7 +80,7 @@ class Parameters { Column( children: [ _buildParameterButton(myProvider, parameterCode, availableValues[index]) - ] + ], ), ], ), @@ -91,7 +88,8 @@ class Parameters { ); } - static TextButton _buildParameterButton(Data myProvider, String parameterCode, String parameterValue) { + static TextButton _buildParameterButton( + Data myProvider, String parameterCode, String parameterValue) { String currentValue = myProvider.getParameterValue(parameterCode).toString(); bool isActive = (parameterValue == currentValue); @@ -116,5 +114,4 @@ class Parameters { onPressed: () => myProvider.setParameterValue(parameterCode, parameterValue), ); } - } diff --git a/lib/main.dart b/lib/main.dart index f4e8d27fb5fb887c9185aa132a18e36b21263aa9..7f448662ed2c1ea856492d67bacbf56f62d81c3a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -29,7 +29,8 @@ class MyApp extends StatelessWidget { routes: { Home.id: (context) => Home(), }, - )); + ), + ); }), ); } diff --git a/lib/provider/data.dart b/lib/provider/data.dart index 6edbcd756ec3958e484467ffceffccf7b339ca66..eb2462f83d91abceba2abce8a74d6f7df5346f29 100644 --- a/lib/provider/data.dart +++ b/lib/provider/data.dart @@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart'; import 'package:shared_preferences/shared_preferences.dart'; class Data extends ChangeNotifier { - // Configuration available values List _availableLangValues = ['fr']; List _availableWordLengthValues = ['4', '5', '6', '7', '8']; @@ -67,15 +66,17 @@ class Data extends ChangeNotifier { notifyListeners(); } } + void currentGuessRemoveLetter() { if (_currentGuess.length > 0) { _currentGuess = _currentGuess.substring(0, _currentGuess.length - 1); notifyListeners(); } } + void currentGuessSubmitWord() { if (_currentGuess.length == int.parse(_length)) { - print('check word: '+_currentGuess); + print('check word: ' + _currentGuess); if (_currentGuess != _word) { print('wrong'); } else { @@ -86,13 +87,15 @@ class Data extends ChangeNotifier { notifyListeners(); } } + void currentGuessSubmitWrongWord() { print('Adding unknown word'); addGuess(_currentGuess); notifyListeners(); } + void addGuess(String word) { - print('addGuess('+word+')'); + print('addGuess(' + word + ')'); _guesses.add(word); _currentGuess = ''; } @@ -100,42 +103,70 @@ class Data extends ChangeNotifier { bool get gameWon => _foundWord; getParameterValue(String parameterCode) { - switch(parameterCode) { - case 'lang': { return _lang; } - break; - case 'length': { return _length; } - break; - case 'level': { return _level; } - break; - case 'skin': { return _skin; } - break; + switch (parameterCode) { + case 'lang': + { + return _lang; + } + case 'length': + { + return _length; + } + case 'level': + { + return _level; + } + case 'skin': + { + return _skin; + } } } List getParameterAvailableValues(String parameterCode) { - switch(parameterCode) { - case 'lang': { return _availableLangValues; } - break; - case 'length': { return _availableWordLengthValues; } - break; - case 'level': { return _availableLevelValues; } - break; - case 'skin': { return _availableSkinValues; } - break; + switch (parameterCode) { + case 'lang': + { + return _availableLangValues; + } + case 'length': + { + return _availableWordLengthValues; + } + case 'level': + { + return _availableLevelValues; + } + case 'skin': + { + return _availableSkinValues; + } } return []; } setParameterValue(String parameterCode, String parameterValue) async { - switch(parameterCode) { - case 'lang': { updateLang(parameterValue); } - break; - case 'length': { updateLength(parameterValue); } - break; - case 'level': { updateLevel(parameterValue); } - break; - case 'skin': { updateSkin(parameterValue); } - break; + switch (parameterCode) { + case 'lang': + { + updateLang(parameterValue); + } + break; + case 'length': + { + updateLength(parameterValue); + } + break; + case 'level': + { + updateLevel(parameterValue); + } + break; + case 'skin': + { + updateSkin(parameterValue); + } + break; } final prefs = await SharedPreferences.getInstance(); prefs.setString(parameterCode, parameterValue); @@ -169,7 +200,7 @@ class Data extends ChangeNotifier { void updateWord(String word) { _word = word; - if (word != null) { + if (word != '') { _recentWords.insert(0, word); _recentWords = _recentWords.take(_recentWordsCount).toList(); } @@ -187,5 +218,4 @@ class Data extends ChangeNotifier { _foundWord = false; notifyListeners(); } - } diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 1381d16b440973da96a90597717c719d2a262b58..f634d8165dede4d18cb8ef5564fb10f357176d5b 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -31,7 +31,7 @@ class _HomeState extends State<Home> { if (myProvider.gameIsRunning) { menuActions = [ - FlatButton( + TextButton( child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(4), @@ -43,7 +43,7 @@ class _HomeState extends State<Home> { margin: EdgeInsets.all(8), child: Image( image: AssetImage('assets/icons/button_back.png'), - fit: BoxFit.fill + fit: BoxFit.fill, ), ), onPressed: () => toast('Long press to quit game...'), @@ -59,10 +59,10 @@ class _HomeState extends State<Home> { body: SafeArea( child: Center( child: myProvider.gameIsRunning - ? Game.buildGameWidget(myProvider) - : Parameters.buildParametersSelector(myProvider) + ? Game.buildGameWidget(myProvider) + : Parameters.buildParametersSelector(myProvider), ), - ) + ), ); } } diff --git a/lib/utils/game_utils.dart b/lib/utils/game_utils.dart index ec5d24adc5d138c91ee826cd4840c4d11beb86f9..83a2cc15e86c946eb2680a1b542379e81cb5eb84 100644 --- a/lib/utils/game_utils.dart +++ b/lib/utils/game_utils.dart @@ -1,9 +1,7 @@ import '../provider/data.dart'; -import '../utils/game_utils.dart'; import '../utils/random_pick_word.dart'; class GameUtils { - static Future<void> resetGame(Data myProvider) async { myProvider.updateGameIsRunning(false); } @@ -61,25 +59,23 @@ class GameUtils { List<String> tips = List<String>.filled(wordLength, '', growable: false); - if ( - (word.length != wordLength) - || (candidate.length != wordLength) - || (!RandomPickWord.checkWordExists(candidate)) - ) { - return List<String>.filled(wordLength, 'wrong', growable: false); + if ((word.length != wordLength) || + (candidate.length != wordLength) || + (!RandomPickWord.checkWordExists(candidate))) { + return List<String>.filled(wordLength, 'wrong', growable: false); } String replaceCharAt(String oldString, int index, String newChar) { return oldString.substring(0, index) + newChar + oldString.substring(index + 1); } - print('getTips: candidate "'+candidate+'" / word "'+word+'"'); + print('getTips: candidate "' + candidate + '" / word "' + word + '"'); // Check correctly placed letters print('Check correctly placed letters'); for (int i = 0; i < wordLength; i++) { if ((tips[i] == '') && (word[i] == candidate[i])) { - print('Found "'+word[i]+'" on the right place: '+(i+1).toString()); + print('Found "' + word[i] + '" on the right place: ' + (i + 1).toString()); word = replaceCharAt(word, i, ' '); candidate = replaceCharAt(candidate, i, ' '); tips[i] = 'good'; @@ -91,7 +87,12 @@ class GameUtils { for (int i = 0; i < wordLength; i++) { for (int j = 0; j < wordLength; j++) { if ((candidate[j] != ' ') && (candidate[j] == word[i])) { - print('Found "'+candidate[j]+'" on the wrong place: '+(j+1).toString()+' instead of '+(i+1).toString()); + print('Found "' + + candidate[j] + + '" on the wrong place: ' + + (j + 1).toString() + + ' instead of ' + + (i + 1).toString()); word = replaceCharAt(word, i, ' '); candidate = replaceCharAt(candidate, j, ' '); tips[j] = 'misplaced'; @@ -99,7 +100,7 @@ class GameUtils { } } - print('Finished check letters: '+tips.toString()); + print('Finished check letters: ' + tips.toString()); return tips; } @@ -124,5 +125,4 @@ class GameUtils { return RandomPickWord.checkWordExists(guessedWord); } - } diff --git a/lib/utils/random_pick_word.dart b/lib/utils/random_pick_word.dart index d8c573fb20d668aad21e8398947279468961e146..3352625d63510dd8697a537aff055cf48d20dbe6 100644 --- a/lib/utils/random_pick_word.dart +++ b/lib/utils/random_pick_word.dart @@ -18,7 +18,11 @@ class RandomPickWord { String get word => _word; init(String lang, int length, String level) async { - if (lang != _lang || length != _length || level != _level || wordList.isEmpty || dictionary.isEmpty) { + if (lang != _lang || + length != _length || + level != _level || + wordList.isEmpty || + dictionary.isEmpty) { _lang = lang; _length = length; _level = level; diff --git a/pubspec.lock b/pubspec.lock index a8aeb511abf801d6cd36b4fa0fe2b5a422a317df..c6a8d1d185d50a811c7dc375a759a3567d303e2f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,21 +21,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: @@ -49,21 +42,21 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.1" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.1.2" + version: "6.1.4" flutter: dependency: "direct main" description: flutter @@ -92,21 +85,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" nested: dependency: transitive description: @@ -127,7 +120,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" path_provider_linux: dependency: transitive description: @@ -148,7 +141,7 @@ packages: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.3" platform: dependency: transitive description: @@ -162,7 +155,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" process: dependency: transitive description: @@ -190,7 +183,7 @@ packages: name: shared_preferences_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.12" + version: "2.0.13" shared_preferences_ios: dependency: transitive description: @@ -218,7 +211,7 @@ packages: name: shared_preferences_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" shared_preferences_web: dependency: transitive description: @@ -244,7 +237,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -265,21 +258,21 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" vector_math: dependency: transitive description: @@ -293,14 +286,14 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.7.0" + version: "3.0.0" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.2.0+1" + version: "0.2.0+2" sdks: dart: ">=2.17.0 <3.0.0" flutter: ">=3.0.0"