From 91bb242f3b2752b153f16435f0d841a34acf0dac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr>
Date: Mon, 17 Feb 2025 14:54:14 +0100
Subject: [PATCH] Fix cell borders

---
 .../metadata/android/en-US/changelogs/7.txt   |  1 +
 .../metadata/android/fr-FR/changelogs/7.txt   |  1 +
 lib/ui/widgets/game/cell.dart                 | 10 ++--
 lib/ui/widgets/game/game_board.dart           | 50 ++++++++-----------
 pubspec.yaml                                  |  2 +-
 5 files changed, 29 insertions(+), 35 deletions(-)
 create mode 100644 fastlane/metadata/android/en-US/changelogs/7.txt
 create mode 100644 fastlane/metadata/android/fr-FR/changelogs/7.txt

diff --git a/fastlane/metadata/android/en-US/changelogs/7.txt b/fastlane/metadata/android/en-US/changelogs/7.txt
new file mode 100644
index 0000000..cb6b88a
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/7.txt
@@ -0,0 +1 @@
+Fix cells borders.
diff --git a/fastlane/metadata/android/fr-FR/changelogs/7.txt b/fastlane/metadata/android/fr-FR/changelogs/7.txt
new file mode 100644
index 0000000..4a6d23b
--- /dev/null
+++ b/fastlane/metadata/android/fr-FR/changelogs/7.txt
@@ -0,0 +1 @@
+Correction sur les bordures des cellules.
diff --git a/lib/ui/widgets/game/cell.dart b/lib/ui/widgets/game/cell.dart
index 4452b3a..08385db 100644
--- a/lib/ui/widgets/game/cell.dart
+++ b/lib/ui/widgets/game/cell.dart
@@ -157,26 +157,24 @@ class CellWidget extends StatelessWidget {
       borders = Border(
         top: BorderSide(
             width: cellBorderWidth,
-            color: (hasBlockBorderTop ||
-                    (((cell.location.row) % activity.board.boardSizeVertical) == 0))
+            color: (hasBlockBorderTop || (cell.location.row == 0))
                 ? cellBorderDarkColor
                 : cellBorderLightColor),
         left: BorderSide(
             width: cellBorderWidth,
-            color: (hasBlockBorderLeft ||
-                    (((cell.location.col) % activity.board.boardSizeHorizontal) == 0))
+            color: (hasBlockBorderLeft || (cell.location.col == 0))
                 ? cellBorderDarkColor
                 : cellBorderLightColor),
         right: BorderSide(
             width: cellBorderWidth,
             color: (hasBlockBorderRight ||
-                    ((((cell.location.col) + 1) % activity.board.boardSizeHorizontal) == 0))
+                    ((cell.location.col + 1) == activity.board.boardSizeHorizontal))
                 ? cellBorderDarkColor
                 : cellBorderLightColor),
         bottom: BorderSide(
             width: cellBorderWidth,
             color: (hasBlockBorderBottom ||
-                    ((((cell.location.row) + 1) % activity.board.boardSizeVertical) == 0))
+                    ((cell.location.row + 1) == activity.board.boardSizeVertical))
                 ? cellBorderDarkColor
                 : cellBorderLightColor),
       );
diff --git a/lib/ui/widgets/game/game_board.dart b/lib/ui/widgets/game/game_board.dart
index fc1dc77..50bed58 100644
--- a/lib/ui/widgets/game/game_board.dart
+++ b/lib/ui/widgets/game/game_board.dart
@@ -47,36 +47,30 @@ class GameBoardWidget extends StatelessWidget {
                             children: [
                               CellWidget(
                                 cell: currentActivity.board.get(CellLocation.go(row, col)),
-                                hasBlockBorderBottom:
-                                    row == currentActivity.board.boardSizeVertical ||
-                                        currentActivity.board
-                                                .get(CellLocation.go(row, col))
-                                                .blockId !=
-                                            currentActivity.board
-                                                .get(CellLocation.go(row + 1, col))
-                                                .blockId,
-                                hasBlockBorderLeft: col == 0 ||
+                                hasBlockBorderBottom: currentActivity.board
+                                        .get(CellLocation.go(row, col))
+                                        .blockId !=
                                     currentActivity.board
-                                            .get(CellLocation.go(row, col))
-                                            .blockId !=
-                                        currentActivity.board
-                                            .get(CellLocation.go(row, col - 1))
-                                            .blockId,
-                                hasBlockBorderRight:
-                                    col == currentActivity.board.boardSizeVertical ||
-                                        currentActivity.board
-                                                .get(CellLocation.go(row, col))
-                                                .blockId !=
-                                            currentActivity.board
-                                                .get(CellLocation.go(row, col + 1))
-                                                .blockId,
-                                hasBlockBorderTop: row == 0 ||
+                                        .get(CellLocation.go(row + 1, col))
+                                        .blockId,
+                                hasBlockBorderLeft: currentActivity.board
+                                        .get(CellLocation.go(row, col))
+                                        .blockId !=
                                     currentActivity.board
-                                            .get(CellLocation.go(row, col))
-                                            .blockId !=
-                                        currentActivity.board
-                                            .get(CellLocation.go(row - 1, col))
-                                            .blockId,
+                                        .get(CellLocation.go(row, col - 1))
+                                        .blockId,
+                                hasBlockBorderRight: currentActivity.board
+                                        .get(CellLocation.go(row, col))
+                                        .blockId !=
+                                    currentActivity.board
+                                        .get(CellLocation.go(row, col + 1))
+                                        .blockId,
+                                hasBlockBorderTop: currentActivity.board
+                                        .get(CellLocation.go(row, col))
+                                        .blockId !=
+                                    currentActivity.board
+                                        .get(CellLocation.go(row - 1, col))
+                                        .blockId,
                               )
                             ],
                           ),
diff --git a/pubspec.yaml b/pubspec.yaml
index 04dbd79..b308120 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@ description: A suguru game application.
 
 publish_to: "none"
 
-version: 0.0.6+6
+version: 0.0.7+7
 
 environment:
   sdk: "^3.0.0"
-- 
GitLab