Do not convert short piece name to lower case.
This commit is contained in:
parent
105b6e7565
commit
f2a4893b6f
@ -26,6 +26,6 @@ subprojects {
|
|||||||
project.evaluationDependsOn(':app')
|
project.evaluationDependsOn(':app')
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
tasks.register("clean", Delete) {
|
||||||
delete rootProject.buildDir
|
delete rootProject.buildDir
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,11 @@ class ChessBoard extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
log("ChessBoard's build()");
|
log("ChessBoard's build()");
|
||||||
|
|
||||||
return Column(
|
return Container(
|
||||||
children: _buildBoard(bState.bottomColor == ChessColor.black));
|
decoration: const BoxDecoration(
|
||||||
|
boxShadow: [BoxShadow(color: Colors.black, offset: Offset(10, 10))]),
|
||||||
|
child: _buildBoard(bState.bottomColor == ChessColor.black),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Row _buildChessRow(int rowNo, bool flipped) {
|
Row _buildChessRow(int rowNo, bool flipped) {
|
||||||
@ -56,7 +59,7 @@ class ChessBoard extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Row> _buildBoard(bool flipped) {
|
Column _buildBoard(bool flipped) {
|
||||||
List<Row> chessBoard = <Row>[];
|
List<Row> chessBoard = <Row>[];
|
||||||
|
|
||||||
if (!flipped) {
|
if (!flipped) {
|
||||||
@ -69,7 +72,7 @@ class ChessBoard extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return chessBoard;
|
return Column(children: [...chessBoard]);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChessSquare getSquareAtCoordinate(ChessCoordinate coord) {
|
ChessSquare getSquareAtCoordinate(ChessCoordinate coord) {
|
||||||
|
@ -112,13 +112,13 @@ class ChessBloc extends Bloc<ChessEvent, ChessBoardState> {
|
|||||||
var pieceAtStartSquare = ChessPosition.getInstance().getPieceAt(
|
var pieceAtStartSquare = ChessPosition.getInstance().getPieceAt(
|
||||||
ChessCoordinate(event.startSquare.column, event.startSquare.row));
|
ChessCoordinate(event.startSquare.column, event.startSquare.row));
|
||||||
if (pieceAtStartSquare == null) {
|
if (pieceAtStartSquare == null) {
|
||||||
log('received a promotion but piece on start square was empty');
|
log('received a promotion but start square was empty');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChessPieceClass pieceClass = ChessPieceClass.none;
|
ChessPieceClass pieceClass = ChessPieceClass.none;
|
||||||
for (var piece in chessPiecesShortName.entries) {
|
for (var piece in chessPiecesShortName.entries) {
|
||||||
if (piece.value.toLowerCase() == event.piece) {
|
if (piece.value == event.piece) {
|
||||||
pieceClass = piece.key.pieceClass;
|
pieceClass = piece.key.pieceClass;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -169,8 +169,7 @@ class ChessBloc extends Bloc<ChessEvent, ChessBoardState> {
|
|||||||
OwnPromotionPlayed event, Emitter<ChessBoardState> emit) {
|
OwnPromotionPlayed event, Emitter<ChessBoardState> emit) {
|
||||||
var apiMove = event.move.toApiMove();
|
var apiMove = event.move.toApiMove();
|
||||||
var shorNameForPiece = chessPiecesShortName[
|
var shorNameForPiece = chessPiecesShortName[
|
||||||
ChessPieceAssetKey(pieceClass: event.pieceClass, color: myColor!)]!
|
ChessPieceAssetKey(pieceClass: event.pieceClass, color: myColor!)]!;
|
||||||
.toLowerCase();
|
|
||||||
apiMove.promotionToPiece = shorNameForPiece;
|
apiMove.promotionToPiece = shorNameForPiece;
|
||||||
var message = ApiWebsocketMessage(
|
var message = ApiWebsocketMessage(
|
||||||
type: MessageType.move,
|
type: MessageType.move,
|
||||||
|
Loading…
Reference in New Issue
Block a user