From 698e79cbf8179ded8e7158cfaa1aa3ab0d69e287 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr>
Date: Sat, 19 Jun 2021 09:41:18 +0200
Subject: [PATCH] Fix "fixed cells state" when randomize board

---
 android/gradle.properties | 4 ++--
 lib/entities/cell.dart    | 2 +-
 lib/screens/home.dart     | 7 +++++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/android/gradle.properties b/android/gradle.properties
index f0be9fb..d9abd55 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.11
-app.versionCode=11
+app.versionName=0.0.12
+app.versionCode=12
diff --git a/lib/entities/cell.dart b/lib/entities/cell.dart
index 8b9039d..89ea653 100644
--- a/lib/entities/cell.dart
+++ b/lib/entities/cell.dart
@@ -7,7 +7,7 @@ class Cell {
   int value;
   final int col;
   final int row;
-  final bool isFixed;
+  bool isFixed;
 
   Cell(
     @required this.value,
diff --git a/lib/screens/home.dart b/lib/screens/home.dart
index 98bf741..74b014b 100644
--- a/lib/screens/home.dart
+++ b/lib/screens/home.dart
@@ -123,6 +123,13 @@ class Home extends StatelessWidget {
       break;
     }
 
+    // Fix cells fixed states
+    for (var rowIndex = 0; rowIndex < sideLength; rowIndex++) {
+      for (var colIndex = 0; colIndex < sideLength; colIndex++) {
+        cells[rowIndex][colIndex].isFixed = (cells[rowIndex][colIndex].value != 0) ? true : false;
+      }
+    }
+
     return cells;
   }
 
-- 
GitLab