Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/src/model/game/game_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ class GameController extends _$GameController {
final curState = state.requireValue;
if (curState.stepCursor < curState.game.steps.length - 1) {
state = AsyncValue.data(
curState.copyWith(stepCursor: curState.stepCursor + 1, premove: null),
curState.copyWith(
stepCursor: curState.stepCursor + 1,
premove: null,
promotionMove: null,
),
);
final san = curState.game.stepAt(curState.stepCursor + 1).sanMove?.san;
if (san != null) {
Expand All @@ -292,6 +296,7 @@ class GameController extends _$GameController {
newState.copyWith(
stepCursor: didCancel ? newState.stepCursor : newState.stepCursor - 1,
premove: null,
promotionMove: null,
),
);
final san = state.requireValue.game.stepAt(state.requireValue.stepCursor).sanMove?.san;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ class OverTheBoardGameController extends _$OverTheBoardGameController {

void goForward() {
if (state.canGoForward) {
state = state.copyWith(stepCursor: state.stepCursor + 1);
state = state.copyWith(stepCursor: state.stepCursor + 1, promotionMove: null);
}
}

void goBack() {
if (state.canGoBack) {
state = state.copyWith(stepCursor: state.stepCursor - 1);
state = state.copyWith(stepCursor: state.stepCursor - 1, promotionMove: null);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ class _BodyState extends ConsumerState<_Body> {
if (stepCursor > 0) {
setState(() {
stepCursor = stepCursor - 1;
promotionMove = null;
});
_playReplayMoveSound();
}
Expand All @@ -312,6 +313,7 @@ class _BodyState extends ConsumerState<_Body> {
if (stepCursor < game.steps.length - 1) {
setState(() {
stepCursor = stepCursor + 1;
promotionMove = null;
});
_playReplayMoveSound();
}
Expand Down