Enhance postcard puzzles and narration
This commit is contained in:
+97
-6
@@ -120,11 +120,14 @@ class Board extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
clue(
|
||||
'${puzzle.rows[row]}',
|
||||
complete(
|
||||
List.generate(n, (i) => row * n + i),
|
||||
puzzle.rows[row],
|
||||
),
|
||||
puzzle.hiddenRow == row
|
||||
? '?'
|
||||
: '${puzzle.rows[row]}',
|
||||
puzzle.hiddenRow != row &&
|
||||
complete(
|
||||
List.generate(n, (i) => row * n + i),
|
||||
puzzle.rows[row],
|
||||
),
|
||||
),
|
||||
for (var col = 0; col < n; col++)
|
||||
Builder(
|
||||
@@ -132,6 +135,16 @@ class Board extends StatelessWidget {
|
||||
final i = row * n + col,
|
||||
value = cells[i],
|
||||
fixed = puzzle.given[i],
|
||||
lantern = puzzle.lanternPairs.any(
|
||||
(pair) => pair.contains(i),
|
||||
),
|
||||
mirrored = puzzle.mirrorPairs.any(
|
||||
(pair) => pair.contains(i),
|
||||
),
|
||||
footprint = puzzle.footprintTrails
|
||||
.any(
|
||||
(trail) => trail.contains(i),
|
||||
),
|
||||
inside = r?.contains(i, n) ?? false;
|
||||
final state = value == 0
|
||||
? 'empty'
|
||||
@@ -142,7 +155,7 @@ class Board extends StatelessWidget {
|
||||
selected: inside,
|
||||
label: CopyScope.text(
|
||||
context,
|
||||
'Row ${row + 1}, column ${col + 1}, $state${fixed ? ', fixed clue' : ''}',
|
||||
'Row ${row + 1}, column ${col + 1}, $state${fixed ? ', fixed clue' : ''}${lantern ? ', lantern pair: exactly one is lit' : ''}${mirrored ? ', mirrored pair: both cells match' : ''}${footprint ? ', footprint trail: two adjacent cells are lit' : ''}',
|
||||
),
|
||||
button: !fixed && !won,
|
||||
enabled: !fixed && !won,
|
||||
@@ -199,6 +212,84 @@ class Board extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (lantern)
|
||||
Positioned(
|
||||
left: 1,
|
||||
top: 1,
|
||||
child: Container(
|
||||
key: ValueKey(
|
||||
'lantern-$i',
|
||||
),
|
||||
decoration:
|
||||
const BoxDecoration(
|
||||
color: cream,
|
||||
shape: BoxShape
|
||||
.circle,
|
||||
),
|
||||
padding:
|
||||
const EdgeInsets.all(
|
||||
1,
|
||||
),
|
||||
child: Icon(
|
||||
Icons
|
||||
.lightbulb_outline,
|
||||
size: u * .31,
|
||||
color: regionInk,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (mirrored)
|
||||
Positioned(
|
||||
left: 1,
|
||||
top: 1,
|
||||
child: Container(
|
||||
key: ValueKey(
|
||||
'mirror-$i',
|
||||
),
|
||||
decoration:
|
||||
const BoxDecoration(
|
||||
color: cream,
|
||||
shape: BoxShape
|
||||
.circle,
|
||||
),
|
||||
padding:
|
||||
const EdgeInsets.all(
|
||||
1,
|
||||
),
|
||||
child: Icon(
|
||||
Icons
|
||||
.auto_awesome,
|
||||
size: u * .31,
|
||||
color: regionInk,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (footprint)
|
||||
Positioned(
|
||||
left: 1,
|
||||
top: 1,
|
||||
child: Container(
|
||||
key: ValueKey(
|
||||
'footprint-$i',
|
||||
),
|
||||
decoration:
|
||||
const BoxDecoration(
|
||||
color: cream,
|
||||
shape: BoxShape
|
||||
.circle,
|
||||
),
|
||||
padding:
|
||||
const EdgeInsets.all(
|
||||
1,
|
||||
),
|
||||
child: Icon(
|
||||
Icons
|
||||
.directions_walk,
|
||||
size: u * .31,
|
||||
color: regionInk,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (fixed)
|
||||
Positioned(
|
||||
right: 3,
|
||||
|
||||
Reference in New Issue
Block a user