Commit 8fb59f1d authored by Adam Barth's avatar Adam Barth

Merge pull request #1416 from mdakin/minedigger2

Fix bounds checking error I introduced in previour cl, Address style …
parents 43190374 e509cd7d
...@@ -31,8 +31,9 @@ const List<Color> textColors = const <Color>[ ...@@ -31,8 +31,9 @@ const List<Color> textColors = const <Color>[
const Color(0xFF000000), const Color(0xFF000000),
]; ];
final List<TextStyle> textStyles = textColors.map((c) => final List<TextStyle> textStyles = textColors.map((color) {
new TextStyle(color: c, fontWeight: bold, textAlign: TextAlign.center)).toList(); return new TextStyle(color: color, fontWeight: bold, textAlign: TextAlign.center);
}).toList();
enum CellState { covered, exploded, cleared, flagged, shown } enum CellState { covered, exploded, cleared, flagged, shown }
...@@ -272,8 +273,7 @@ class MineDiggerState extends State<MineDigger> { ...@@ -272,8 +273,7 @@ class MineDiggerState extends State<MineDigger> {
int bombs(int x, int y) => inBoard(x, y) && cells[y][x] ? 1 : 0; int bombs(int x, int y) => inBoard(x, y) && cells[y][x] ? 1 : 0;
bool inBoard(int x, int y) => bool inBoard(int x, int y) => x >= 0 && x < cols && y >= 0 && y < rows;
(x > 0 && x < (cols - 1) && y > 0 && y < (rows -1));
} }
Widget buildCell(Widget child) { Widget buildCell(Widget child) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment