diff --git a/android/gradle.properties b/android/gradle.properties index 3487476dc637023e34426ce50caf3343f91e3038..1913fd1742a8e1553517f28698109845b429435c 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.23 -app.versionCode=23 +app.versionName=0.1.0 +app.versionCode=24 diff --git a/lib/screens/game_pick_word.dart b/lib/screens/game_pick_word.dart index ebafbfd0d014fad8ff0cbbd12247f3986f9a2112..2e76a621df487b4890824ec424534c820b860535 100644 --- a/lib/screens/game_pick_word.dart +++ b/lib/screens/game_pick_word.dart @@ -8,19 +8,19 @@ import '../utils/get_image_from_word.dart'; class GamePickWordPage extends StatelessWidget { int _count = 4; - Future<void> startGame(BuildContext context, Data myProvider) async { + Future<void> startGame(Data myProvider) async { myProvider.updateQuestionsCount = 0; myProvider.updateGoodAnswers = 0; myProvider.updateWrongAnswers = 0; - await nextWord(context, myProvider); + await nextWord(myProvider); } - Future<void> nextWord(BuildContext context, Data myProvider) async { - await pickData(context, myProvider); + Future<void> nextWord(Data myProvider) async { + await pickData(myProvider); myProvider.updateQuestionsCount = myProvider.questionsCount + 1; } - Future<void> pickData(BuildContext context, Data myProvider) async { + Future<void> pickData(Data myProvider) async { List words; List images; RandomPickWord randomPickWord; @@ -56,33 +56,43 @@ class GamePickWordPage extends StatelessWidget { } } - Future<void> checkWord(BuildContext context, Data myProvider, word) async { + Future<void> checkWord(Data myProvider, word) async { if (myProvider.word == word) { myProvider.updateGoodAnswers = myProvider.goodAnswers + 1; - nextWord(context, myProvider); + nextWord(myProvider); } else { myProvider.updateWrongAnswers = myProvider.wrongAnswers + 1; } } - Container _buildScoreContainer(BuildContext context, Data myProvider) { - String score = '' - + 'β ' + myProvider.questionsCount.toString() - + ' - ' - + 'βΊοΈ ' + myProvider.goodAnswers.toString() - + ' - ' - + 'π ' + myProvider.wrongAnswers.toString() - ; + Container _buildScoreContainer(Data myProvider) { + TextStyle style = TextStyle( + fontSize: 30, + fontWeight: FontWeight.w600, + color: Colors.black, + ); return Container( padding: EdgeInsets.all(5), - child: Text( - score, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.w400, - color: Colors.black, - ), + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'β ' + myProvider.questionsCount.toString(), + style: style, + ), + SizedBox(width: 30), + Text( + 'βΊοΈ ' + myProvider.goodAnswers.toString(), + style: style, + ), + SizedBox(width: 30), + Text( + 'π ' + myProvider.wrongAnswers.toString(), + style: style, + ), + ], ), ); } @@ -133,7 +143,7 @@ class GamePickWordPage extends StatelessWidget { ); } - Container _buildTextContainer(BuildContext context, Data myProvider, String word, Color color) { + Container _buildTextContainer(Data myProvider, String word, Color color) { return Container( child: RaisedButton( color: Colors.green, @@ -146,12 +156,12 @@ class GamePickWordPage extends StatelessWidget { color: color, ), ), - onPressed: () { checkWord(context, myProvider, word); }, + onPressed: () { checkWord(myProvider, word); }, ), ); } - Column _buildTextItemsBlock(BuildContext context, Data myProvider, String word, List otherWords) { + Column _buildTextItemsBlock(Data myProvider, String word, List otherWords) { Color color = Colors.white; if ((word == null) || (otherWords.length != (_count - 1))) { @@ -175,9 +185,9 @@ class GamePickWordPage extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ - _buildTextContainer(context, myProvider, words[0], color), + _buildTextContainer(myProvider, words[0], color), SizedBox(width: 10), - _buildTextContainer(context, myProvider, words[1], color), + _buildTextContainer(myProvider, words[1], color), ], ), SizedBox(height: 10), @@ -185,33 +195,34 @@ class GamePickWordPage extends StatelessWidget { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ - _buildTextContainer(context, myProvider, words[2], color), + _buildTextContainer(myProvider, words[2], color), SizedBox(width: 10), - _buildTextContainer(context, myProvider, words[3], color), + _buildTextContainer(myProvider, words[3], color), ], ) ], ); } - Row _buildStartGameButton(BuildContext context, Data myProvider) { + Row _buildStartGameButton(Data myProvider) { + return Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, children: [ Container( child: RaisedButton( - color: Colors.orange, + color: Colors.green, padding: EdgeInsets.all(35), child: Text( - "π", + "βΆοΈ", style: TextStyle( fontSize: 60, fontWeight: FontWeight.w600, color: Colors.black, ), ), - onPressed: () => startGame(context, myProvider), + onPressed: () => startGame(myProvider), ), ) ], @@ -225,6 +236,12 @@ class GamePickWordPage extends StatelessWidget { return Scaffold( appBar: AppBar( elevation: 0, + actions: <Widget>[ + IconButton( + icon: const Icon(Icons.loop), + onPressed: () => startGame(_myProvider), + ), + ], ), backgroundColor: Colors.blue, body: Center( @@ -234,12 +251,12 @@ class GamePickWordPage extends StatelessWidget { mainAxisSize: MainAxisSize.max, children: <Widget>[ _buildImageItemsBlock(_myProvider.images), - SizedBox(height: 5), - _buildScoreContainer(context, _myProvider), + SizedBox(height: 2), ((_myProvider.word == null) || (_myProvider.word == '')) ? - _buildStartGameButton(context, _myProvider) : - SizedBox(height: 5), - _buildTextItemsBlock(context, _myProvider, _myProvider.word, _myProvider.otherWords), + _buildStartGameButton(_myProvider) : + _buildScoreContainer(_myProvider), + SizedBox(height: 2), + _buildTextItemsBlock(_myProvider, _myProvider.word, _myProvider.otherWords), ], ), ),