Make special mechanics essential in postcard and story puzzles

This commit is contained in:
Hadrian Burkhardt
2026-11-14 10:10:36 +01:00
parent b19295472d
commit fc71accb38
11 changed files with 736 additions and 40 deletions
+78 -11
View File
@@ -107,11 +107,16 @@ class Board extends StatelessWidget {
SizedBox(width: u, height: u),
for (var col = 0; col < n; col++)
clue(
'${puzzle.cols[col]}',
complete(
List.generate(n, (i) => i * n + col),
puzzle.cols[col],
),
puzzle.hiddenColumn == col ||
puzzle.omittedColumn == col
? '?'
: '${puzzle.cols[col]}',
puzzle.hiddenColumn != col &&
puzzle.omittedColumn != col &&
complete(
List.generate(n, (i) => i * n + col),
puzzle.cols[col],
),
),
],
),
@@ -120,10 +125,12 @@ class Board extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
clue(
puzzle.hiddenRow == row
puzzle.hiddenRow == row ||
puzzle.omittedRow == row
? '?'
: '${puzzle.rows[row]}',
puzzle.hiddenRow != row &&
puzzle.omittedRow != row &&
complete(
List.generate(n, (i) => row * n + i),
puzzle.rows[row],
@@ -238,6 +245,25 @@ class Board extends StatelessWidget {
),
),
),
if (puzzle
.hiddenTotalCells
.contains(i))
Positioned(
left: 1,
top: 1,
child: Container(
key: ValueKey(
'diamond-$i',
),
color: cream,
child: Icon(
Icons
.diamond_outlined,
size: u * .31,
color: regionInk,
),
),
),
if (mirrored)
Positioned(
left: 1,
@@ -282,11 +308,13 @@ class Board extends StatelessWidget {
const EdgeInsets.all(
1,
),
child: Icon(
Icons
.directions_walk,
size: u * .31,
color: regionInk,
child: SizedBox.square(
dimension:
u * .31,
child: CustomPaint(
painter:
FootprintMark(),
),
),
),
),
@@ -350,6 +378,45 @@ class Board extends StatelessWidget {
);
}
/// A tiny shoe print, used only as a marker inside a puzzle cell.
class FootprintMark extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
final paint = Paint()..color = regionInk;
canvas.save();
canvas.translate(size.width * .5, size.height * .5);
canvas.rotate(-.35);
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromLTWH(
-size.width * .25,
-size.height * .46,
size.width * .5,
size.height * .55,
),
Radius.circular(size.width * .22),
),
paint,
);
canvas.drawRRect(
RRect.fromRectAndRadius(
Rect.fromLTWH(
-size.width * .2,
size.height * .16,
size.width * .4,
size.height * .27,
),
Radius.circular(size.width * .1),
),
paint,
);
canvas.restore();
}
@override
bool shouldRepaint(covariant FootprintMark oldDelegate) => false;
}
/// Deterministic pencil strokes stay put when the player revisits a cell.
/// Both marks use paths, so their appearance never depends on a fallback font.
class PencilMark extends CustomPainter {