Closed malaschitz closed 1 year 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:
BoardBackground
should take a BoxDecoration
. Either that or we allow a completely custom square builder function but I think that's just overkill and you can make an overlay at that point.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.
@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
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.
@malaschitz Xiangqi is now live and functional in 1.1.0, thanks for your help!
Enhancements for chess board graphics:
possibility to define a border for a square on the chessboard, to make even colorless chessboards - small chess diagrams or for playing shogi and other games.
possibility to make the squares on the chessboard blank and to draw the whole custom background of the chessboard. This could also support XiangQi, where stones are placed on the intersections.
Or solve this by allowing a custom implementation of the BoardBackground class.