varunpvp / flutter_chessboard

Chessboard Widget for Flutter

Home Page:https://pub.dev/packages/flutter_stateless_chessboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The widget is broken following README

huydung opened this issue · comments

I tried the widget today, and with the code shown in instruction, the widget is broken and cannot be built.

I found out that the chess_piece.dart expected piece.toString() to returns something like "wr", but instead, maybe due to a change in the chess package, it received "Color.WHITEr".

Therefore, I made a local copy of the widget, and then, in utils.dart, getPieceMap function, I changed from:
map[square] = Piece(piece.type.toString(), piece.color.toString()); to map[square] = Piece(piece.type.toString(), piece.color == ch.Color.BLACK ? 'b' : 'w');

And the widget works perfectly afterward!

Thank you for the widget, please check this issue and fix it (more properly, I assume) for others!

Thanks for letting me know. Actually I'm working on writing proper data types. I'll push the changes ASAP.

Thanks.

This is fixed with latest release. Thanks