From f2a4893b6ffd6b4300cc851b384ac9de38ca5cf5 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 12 Aug 2023 11:43:51 +0200 Subject: [PATCH] Do not convert short piece name to lower case. --- android/build.gradle | 2 +- lib/chess/chess_board.dart | 11 +++++++---- lib/chess_bloc/chess_bloc.dart | 7 +++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 58a8c74..713d7f6 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/lib/chess/chess_board.dart b/lib/chess/chess_board.dart index 25f226a..517a930 100644 --- a/lib/chess/chess_board.dart +++ b/lib/chess/chess_board.dart @@ -35,8 +35,11 @@ class ChessBoard extends StatelessWidget { Widget build(BuildContext context) { log("ChessBoard's build()"); - return Column( - children: _buildBoard(bState.bottomColor == ChessColor.black)); + return Container( + decoration: const BoxDecoration( + boxShadow: [BoxShadow(color: Colors.black, offset: Offset(10, 10))]), + child: _buildBoard(bState.bottomColor == ChessColor.black), + ); } Row _buildChessRow(int rowNo, bool flipped) { @@ -56,7 +59,7 @@ class ChessBoard extends StatelessWidget { } } - List _buildBoard(bool flipped) { + Column _buildBoard(bool flipped) { List chessBoard = []; if (!flipped) { @@ -69,7 +72,7 @@ class ChessBoard extends StatelessWidget { } } - return chessBoard; + return Column(children: [...chessBoard]); } ChessSquare getSquareAtCoordinate(ChessCoordinate coord) { diff --git a/lib/chess_bloc/chess_bloc.dart b/lib/chess_bloc/chess_bloc.dart index fe3bf62..391c20b 100644 --- a/lib/chess_bloc/chess_bloc.dart +++ b/lib/chess_bloc/chess_bloc.dart @@ -112,13 +112,13 @@ class ChessBloc extends Bloc { var pieceAtStartSquare = ChessPosition.getInstance().getPieceAt( ChessCoordinate(event.startSquare.column, event.startSquare.row)); if (pieceAtStartSquare == null) { - log('received a promotion but piece on start square was empty'); + log('received a promotion but start square was empty'); return; } ChessPieceClass pieceClass = ChessPieceClass.none; for (var piece in chessPiecesShortName.entries) { - if (piece.value.toLowerCase() == event.piece) { + if (piece.value == event.piece) { pieceClass = piece.key.pieceClass; break; } @@ -169,8 +169,7 @@ class ChessBloc extends Bloc { OwnPromotionPlayed event, Emitter emit) { var apiMove = event.move.toApiMove(); var shorNameForPiece = chessPiecesShortName[ - ChessPieceAssetKey(pieceClass: event.pieceClass, color: myColor!)]! - .toLowerCase(); + ChessPieceAssetKey(pieceClass: event.pieceClass, color: myColor!)]!; apiMove.promotionToPiece = shorNameForPiece; var message = ApiWebsocketMessage( type: MessageType.move,