Skip to content
Snippets Groups Projects
Commit b9a5cd76 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Forbid change on initial cells

parent 2186f567
No related branches found
No related tags found
1 merge request!7Resolve "Forbid change on initial cells"
Pipeline #1382 passed
This commit is part of merge request !7. Comments created here will be created in the context of that merge request.
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.6
app.versionCode=6
app.versionName=0.0.7
app.versionCode=7
......@@ -7,11 +7,13 @@ class Cell {
int value;
final int col;
final int row;
final bool isFixed;
Cell(
@required this.value,
@required this.col,
@required this.row,
@required this.isFixed,
);
Container widget(Data myProvider) {
......@@ -26,7 +28,7 @@ class Cell {
Color borderDarkColor = Colors.black;
Color borderLightColor = Colors.grey;
Color borderSelectedColor = Colors.red;
Color backgroundColor = Colors.grey[200];
Color backgroundColor = this.isFixed ? Colors.grey[300] : Colors.grey[100];
Border borders = Border(
top: BorderSide(width: borderWidth, color: ((this.row % size) == 0) ? borderDarkColor : borderLightColor),
......@@ -54,7 +56,7 @@ class Cell {
),
onTap: () {
if (this.col != null && this.row != null) {
if (this.col != myProvider.currentCellCol || this.row != myProvider.currentCellRow) {
if (!this.isFixed && (this.col != myProvider.currentCellCol || this.row != myProvider.currentCellRow)) {
myProvider.selectCell(this.col, this.row);
} else {
myProvider.selectCell(null, null);
......
......@@ -51,7 +51,7 @@ class Home extends StatelessWidget {
List row = [];
for (var colIndex = 0; colIndex < pow(size, 2); colIndex++) {
int value = int.parse(grid[index++]);
row.add(Cell(value, colIndex, rowIndex));
row.add(Cell(value, colIndex, rowIndex, (value != 0)));
}
cells.add(row);
}
......@@ -67,7 +67,7 @@ class Home extends StatelessWidget {
for (var rowIndex = 0; rowIndex < pow(size, 2); rowIndex++) {
List row = [];
for (var colIndex = 0; colIndex < pow(size, 2); colIndex++) {
row.add(Cell(0, colIndex, rowIndex));
row.add(Cell(0, colIndex, rowIndex, false));
}
cells.add(row);
}
......@@ -231,7 +231,8 @@ class Home extends StatelessWidget {
Cell(
isCellSelected ? value : 0,
isCellSelected ? myProvider.currentCellCol : null,
isCellSelected ? myProvider.currentCellRow : null
isCellSelected ? myProvider.currentCellRow : null,
false
).widgetUpdateValue(myProvider)
]
),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment