-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add onTappedSquare to Chessboard widget, add squareHighlights field #66
base: main
Are you sure you want to change the base?
Conversation
We'll need this if we want to switch the coordinate trainer in the app from `ChessboardEditor` to `Chessboard` in order to fix lichess-org/mobile#1017
@@ -549,6 +570,8 @@ class _BoardState extends State<Chessboard> { | |||
final square = widget.offsetSquare(details.localPosition); | |||
if (square == null) return; | |||
|
|||
widget.onTappedSquare?.call(square); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling this onTapped
is misleading since the callback is executed on pointer down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yeah I wasn't sure whether to put this into pointer down or up - Now that I think about it again, if we call it onTapped
it should probably be in pointer up instead? And we should only invoke the callback if the pointer up happened on the same square as the previous pointer down event
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or should we keep it in _onPointerDown
and change the callback's name instead?
We'll need this if we want to switch the coordinate trainer in the app
from
ChessboardEditor
toChessboard
in order to fix lichess-org/mobile#1017