Skip to content

Commit

Permalink
Fix piece shadow is not shown when image is null
Browse files Browse the repository at this point in the history
  • Loading branch information
calcitem committed Oct 5, 2024
1 parent 00ad0d2 commit 9ba9fa7
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,22 @@ class PiecePainter extends CustomPainter {
}
}

// Draw shadow of pieces if image is not available
if (pieceImages == null) {
canvas.drawShadow(shadowPath, Colors.black, 2, true);
// Draw shadow if image is null for any piece
for (final Piece piece in piecesToDraw) {
if (piece.image == null) {
canvas.drawShadow(
Path()
..addOval(
Rect.fromCircle(
center: piece.pos,
radius: piece.diameter / 2,
),
),
Colors.black,
2,
true,
);
}
}

paint.style = PaintingStyle.fill;
Expand Down

0 comments on commit 9ba9fa7

Please sign in to comment.