From 24f8a3971ffa5b48d1308b1ee72e39a823f4e17b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr> Date: Tue, 11 Feb 2025 13:43:53 +0100 Subject: [PATCH] Fix display big vertical board --- .../metadata/android/en-US/changelogs/2.txt | 1 + .../metadata/android/fr-FR/changelogs/2.txt | 1 + lib/ui/widgets/game/cell.dart | 14 +------------- lib/ui/widgets/game/game_board.dart | 17 ++++++++++++++++- pubspec.yaml | 2 +- 5 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/2.txt create mode 100644 fastlane/metadata/android/fr-FR/changelogs/2.txt diff --git a/fastlane/metadata/android/en-US/changelogs/2.txt b/fastlane/metadata/android/en-US/changelogs/2.txt new file mode 100644 index 0000000..d0b6b8e --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/2.txt @@ -0,0 +1 @@ +Fix display big vertical grids. diff --git a/fastlane/metadata/android/fr-FR/changelogs/2.txt b/fastlane/metadata/android/fr-FR/changelogs/2.txt new file mode 100644 index 0000000..14a59d1 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/2.txt @@ -0,0 +1 @@ +Correction sur l'affichage des grandes grilles verticales. diff --git a/lib/ui/widgets/game/cell.dart b/lib/ui/widgets/game/cell.dart index 13d0d85..c2b8c7a 100644 --- a/lib/ui/widgets/game/cell.dart +++ b/lib/ui/widgets/game/cell.dart @@ -1,4 +1,3 @@ -import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; @@ -124,18 +123,7 @@ class CellWidget extends StatelessWidget { const Color cellBorderSelectedColor = Colors.red; Color cellBorderColor = cellBorderSelectedColor; - double cellBorderWidth = 4; - - final int boardSizeReference = - max(activity.boardSizeHorizontal, activity.boardSizeVertical); - - // Reduce cell border width on big boards - if (boardSizeReference > 8) { - cellBorderWidth = 2; - if (boardSizeReference > 10) { - cellBorderWidth = 1; - } - } + final double cellBorderWidth = 4; if (!activity.isRunning) { cellBorderColor = Colors.green.shade700; diff --git a/lib/ui/widgets/game/game_board.dart b/lib/ui/widgets/game/game_board.dart index 7b2ef33..1ec0775 100644 --- a/lib/ui/widgets/game/game_board.dart +++ b/lib/ui/widgets/game/game_board.dart @@ -1,3 +1,4 @@ + import 'package:flutter/material.dart'; import 'package:flutter_custom_toolbox/flutter_toolbox.dart'; @@ -17,7 +18,11 @@ class GameBoardWidget extends StatelessWidget { final Color borderColor = Theme.of(context).colorScheme.onSurface; - return Container( + final Size size = MediaQuery.of(context).size; + final double width = size.width; + final double height = size.height; + + final Container board = Container( margin: const EdgeInsets.all(2), padding: const EdgeInsets.all(2), decoration: BoxDecoration( @@ -81,6 +86,16 @@ class GameBoardWidget extends StatelessWidget { ], ), ); + + return ConstrainedBox( + constraints: BoxConstraints.tightFor( + width: width, + height: height * .6, + ), + child: FittedBox( + child: board, + ), //Text + ); }, ); } diff --git a/pubspec.yaml b/pubspec.yaml index a0962c0..f03814e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A suguru game application. publish_to: "none" -version: 0.0.1+1 +version: 0.0.2+2 environment: sdk: "^3.0.0" -- GitLab