alexobviously / squares

A flexible chessboard widget for Flutter
https://pub.dev/packages/squares
Other
37 stars 15 forks source link

Enhancements for chess board graphics #8

Closed malaschitz closed 1 year ago

malaschitz commented 2 years ago

Enhancements for chess board graphics:

Or solve this by allowing a custom implementation of the BoardBackground class.

alexobviously commented 2 years ago

Yep this is definitely desirable and is one of the next things I'm planning to add. Actually it's possible to create a BoardBuilder that builds square borders or whatever you want, and put it in underlays when you build Board/BoardController, and you could also have an underlay which is just a background image since underlays is just a List<Widget>, though you probably want to put it in a FittedBox or similar. So all that is really needed is to achieve this is to add some flag that hides the default board background. Actually if you had a solid image in underlays, it would hide the default background anyway.

The problem with this is that BoardBackground has the highlights for selected pieces and such, so the above isn't a complete solution (obv you can add an overlay that has the highlights in but I think we can do this better). So I think some customisation parameters for that class is the way to go, maybe a config class like we have for LabelOverlay. And then of course we need a way to put an image under the background layer.

A couple of other things to note:

This is partly a reply to @malaschitz and partly a bunch of notes to self so I don't have to think this through again when I come back to it.

Incidentally, I have recently been working on Xiangqi support for bishop so this is very much on my todo list.

alexobviously commented 2 years ago

@malaschitz before I spend the time making some myself, do you have any good quality MIT licensed Xiangqi piece graphics (also a background)?

I'm going to implement this soon, and Bishop will be ready for Xiangqi in a week or so

malaschitz commented 2 years ago

A long time ago for a web project I used svg files: https://www.dropbox.com/s/zb168etw9nlaibu/xiangqi.zip?dl=0

But I don't know their origin anymore (it's possible that some were commercially purchased). Simple svg files are at https://en.wikipedia.org/wiki/Xiangqi

I suppose in Flutter you could also create the playing stones programmatically using Unicode symbols.

alexobviously commented 1 year ago

@malaschitz Xiangqi is now live and functional in 1.1.0, thanks for your help!