From 18933f6ebcb47e71b9f6ebe35dc56c8af46edd86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr> Date: Mon, 8 Jul 2024 16:43:42 +0200 Subject: [PATCH] Add current game moves counter --- android/gradle.properties | 4 ++-- .../metadata/android/en-US/changelogs/25.txt | 1 + .../metadata/android/fr-FR/changelogs/25.txt | 1 + lib/ui/widgets/game/game_board.dart | 2 ++ lib/ui/widgets/game/game_moves_count.dart | 23 +++++++++++++++++++ lib/ui/widgets/game/game_moves_history.dart | 5 +++- pubspec.yaml | 2 +- 7 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/25.txt create mode 100644 fastlane/metadata/android/fr-FR/changelogs/25.txt create mode 100644 lib/ui/widgets/game/game_moves_count.dart diff --git a/android/gradle.properties b/android/gradle.properties index 1913fd1..2552329 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.1.0 -app.versionCode=24 +app.versionName=0.1.1 +app.versionCode=25 diff --git a/fastlane/metadata/android/en-US/changelogs/25.txt b/fastlane/metadata/android/en-US/changelogs/25.txt new file mode 100644 index 0000000..0b0f90c --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/25.txt @@ -0,0 +1 @@ +Display current game moves counter. diff --git a/fastlane/metadata/android/fr-FR/changelogs/25.txt b/fastlane/metadata/android/fr-FR/changelogs/25.txt new file mode 100644 index 0000000..055e1c6 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/25.txt @@ -0,0 +1 @@ +Affichage d'un compteur de mouvements de la partie. diff --git a/lib/ui/widgets/game/game_board.dart b/lib/ui/widgets/game/game_board.dart index 0fcdef2..f374604 100644 --- a/lib/ui/widgets/game/game_board.dart +++ b/lib/ui/widgets/game/game_board.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:twister/ui/widgets/game/game_current_move.dart'; +import 'package:twister/ui/widgets/game/game_moves_count.dart'; import 'package:twister/ui/widgets/game/game_moves_history.dart'; class GameBoardWidget extends StatelessWidget { @@ -13,6 +14,7 @@ class GameBoardWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ GameCurrentMoveWidget(), + GameMovesCountWidget(), GameMovesHistoryWidget(), ], ); diff --git a/lib/ui/widgets/game/game_moves_count.dart b/lib/ui/widgets/game/game_moves_count.dart new file mode 100644 index 0000000..95d1e65 --- /dev/null +++ b/lib/ui/widgets/game/game_moves_count.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import 'package:twister/cubit/game_cubit.dart'; +import 'package:twister/ui/helpers/outlined_text_widget.dart'; + +class GameMovesCountWidget extends StatelessWidget { + const GameMovesCountWidget({super.key}); + + @override + Widget build(BuildContext context) { + return BlocBuilder<GameCubit, GameState>( + builder: (BuildContext context, GameState gameState) { + return OutlinedText( + text: gameState.currentGame.history.length.toString(), + fontSize: 50, + textColor: Colors.grey, + outlineColor: Colors.grey.shade200, + ); + }, + ); + } +} diff --git a/lib/ui/widgets/game/game_moves_history.dart b/lib/ui/widgets/game/game_moves_history.dart index 67eb3e7..33d0ff0 100644 --- a/lib/ui/widgets/game/game_moves_history.dart +++ b/lib/ui/widgets/game/game_moves_history.dart @@ -54,7 +54,10 @@ class GameMovesHistoryWidget extends StatelessWidget { ); return Padding( - padding: const EdgeInsets.all(30), + padding: const EdgeInsets.only( + left: 30, + right: 30, + ), child: Table( children: [ TableRow( diff --git a/pubspec.yaml b/pubspec.yaml index 16ca4fa..6626c2e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: Twister game companion publish_to: "none" -version: 0.1.0+24 +version: 0.1.1+25 environment: sdk: "^3.0.0" -- GitLab