Skip to content

Commit

Permalink
Show engine move promotion
Browse files Browse the repository at this point in the history
Closes #571
  • Loading branch information
veloce committed Mar 6, 2024
1 parent e401450 commit ec01452
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
41 changes: 34 additions & 7 deletions lib/src/view/analysis/analysis_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,40 @@ class _Board extends ConsumerWidget {
bestMoves != null
? ISet(
bestMoves.where((move) => move != null).mapIndexed(
(i, move) => cg.Arrow(
color:
const Color(0x40003088).withOpacity(0.4 - 0.15 * i),
orig: move!.cg.from,
dest: move.cg.to,
),
),
(i, move) {
switch (move!) {
case NormalMove(
from: _,
to: _,
promotion: final promRole
):
return [
cg.Arrow(
color: const Color(0x40003088)
.withOpacity(0.4 - 0.15 * i),
orig: move.cg.from,
dest: move.cg.to,
),
if (promRole != null)
cg.PieceShape(
color: const Color(0x40003088)
.withOpacity(0.4 - 0.15 * i),
orig: move.cg.to,
role: promRole.cg,
),
];
case DropMove(role: final role, to: _):
return [
cg.PieceShape(
color: const Color(0x40003088)
.withOpacity(0.4 - 0.15 * i),
orig: move.cg.to,
role: role.cg,
),
];
}
},
).expand((e) => e),
)
: null,
annotations: sanMove != null && annotation != null
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ packages:
dependency: "direct main"
description:
name: chessground
sha256: "64a68714ab0da717c8e1268e1a0cce143818897f3dc2327c52dfa4f61b7a8b22"
sha256: "5d8969f5f05aae3ca54edf7365c86701b1ca40bc67ef12c53724ab06f7f84c94"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
version: "2.5.0"
ci:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ environment:
dependencies:
async: ^2.10.0
cached_network_image: ^3.2.2
chessground: ^2.4.0
chessground: ^2.5.0
collection: ^1.17.0
connectivity_plus: ^5.0.0
crypto: ^3.0.3
Expand Down

0 comments on commit ec01452

Please sign in to comment.