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

Improve board grid colors and borders

parent d00388d8
No related branches found
No related tags found
1 merge request!5Resolve "Improve board grid colors and borders"
Pipeline #7781 passed
Improve grid display.
Amélioration de l'affichage de la grille.
import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
......@@ -76,19 +75,35 @@ class CellWidget extends StatelessWidget {
return 'assets/ui/cell_empty.png';
}
Color getBaseColorFromBlockId(String blockId) {
const List<Color> paletteColors = [
Color.fromRGBO(0xbe, 0x7f, 0x51, 1),
Color.fromRGBO(0x50, 0x72, 0x8b, 1),
Color.fromRGBO(0xae, 0x70, 0x6f, 1),
Color.fromRGBO(0x91, 0x61, 0x87, 1),
Color.fromRGBO(0xe1, 0x8a, 0x2b, 1),
Color.fromRGBO(0x88, 0x77, 0x6d, 1),
Color.fromRGBO(0xd4, 0xbe, 0x1e, 1),
Color.fromRGBO(0xba, 0x96, 0x3a, 1),
Color.fromRGBO(0xa2, 0x9a, 0x5c, 1),
];
final int blockIdValue = blockId.codeUnits.first - 'A'.codeUnits.first;
return paletteColors[blockIdValue % paletteColors.length].lighten(20);
}
// Compute cell background color, from cell state
Color getBackgroundColor(Activity activity) {
final Color editableCellColor = Colors.grey.shade100;
final Color editableCellColorConflict = Colors.pink.shade100;
final Color fixedCellColor = Colors.grey.shade300;
final int fixedCellColorDarkAmount = 10;
final Color fixedCellColorConflict = Colors.pink.shade200;
final Color editableAnimated = Colors.green.shade200;
final Color fixedAnimated = Colors.green.shade300;
Color backgroundColor = editableCellColor;
Color backgroundColor = getBaseColorFromBlockId(cell.blockId);
if (cell.isFixed == true) {
backgroundColor = fixedCellColor;
backgroundColor = backgroundColor.darken(fixedCellColorDarkAmount);
}
final int conflictsCount = activity.boardConflicts[cell.location.row][cell.location.col];
......@@ -118,12 +133,14 @@ class CellWidget extends StatelessWidget {
// Compute cell borders, from board size and cell state
Border getCellBorders(Activity activity) {
final Color cellBorderDarkColor = Colors.grey.shade800;
final Color cellBorderLightColor = Colors.grey.shade400;
final Color baseColor = getBaseColorFromBlockId(cell.blockId);
final Color cellBorderDarkColor = baseColor.darken(50);
final Color cellBorderLightColor = baseColor.lighten(10);
const Color cellBorderSelectedColor = Colors.red;
Color cellBorderColor = cellBorderSelectedColor;
final double cellBorderWidth = 4;
const double cellBorderWidth = 8;
if (!activity.isRunning) {
cellBorderColor = Colors.green.shade700;
......
......@@ -3,7 +3,7 @@ description: A suguru game application.
publish_to: "none"
version: 0.0.3+3
version: 0.0.4+4
environment:
sdk: "^3.0.0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment