Add function to flip board.
This commit is contained in:
parent
4a0e57902c
commit
3889245c8a
@ -49,7 +49,7 @@ class ChessBloc extends Bloc<ChessEvent, ChessBoardState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ChessBoardState {
|
class ChessBoardState {
|
||||||
final bool flipped;
|
late bool flipped;
|
||||||
final ChessColor turnColor;
|
final ChessColor turnColor;
|
||||||
final Map<ChessCoordinate, ChessPiece> position;
|
final Map<ChessCoordinate, ChessPiece> position;
|
||||||
|
|
||||||
@ -111,4 +111,8 @@ class ChessBoardState {
|
|||||||
|
|
||||||
return ChessBoardState._(flipped, turnColor, position);
|
return ChessBoardState._(flipped, turnColor, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void flipBoard() {
|
||||||
|
flipped = !flipped;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user