PieceSet class

Used to define the widgets that will be built to represent pieces. Simply provide a map pieces of String keys and WidgetBuilder values. The keys should be uppercase for white pieces, and lowercase for black, e.g. a white pawn is 'P' and a black pawn is 'p'.

Constructors

PieceSet({required Map<String, WidgetBuilder> pieces})
const
PieceSet.fromImageAssets({required String folder, String? package, required List<String> symbols, String format = 'png'})
Specifies a set of WidgetBuilders from a set of image files in a folder. The file names should be in a format like 'wB.png' (white bishop), 'bN.png' (black knight). A format other than 'png' can be specified, as long as it works with Image.asset. SVG cannot be used with this, but look at piece_set.dart for a commented out example of how flutter_svg can be used. Make sure that every symbol in symbols has a 'wSymbol' and 'bSymbol' file. If the images are coming from a package (for example, from Squares), then specify package. See PieceSet.merida() for an example.
factory
PieceSet.letters({TextStyle? style})
Specifies a set of WidgetBuilders that render Text widgets with only the piece's symbol inside.
factory
PieceSet.merida()
The classic Merida chess set, including some extra pieces. Taken from Pychess, thanks CoachTomato! (presumably)
factory
PieceSet.text({required Map<String, String> strings, TextStyle? style})
Specifies a set of WidgetBuilders that render Text widgets, using map of piece keys mapped to strings. Hint: this works with emojis. See the example app.
factory
PieceSet.xiangqi()
The traditional Xiangqi piece set.
factory
PieceSet.xiangqiIcons()
A Xiangqi piece set using chess-like icons.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
pieces Map<String, WidgetBuilder>
The builders used to create the widgets to represent pieces.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
piece(BuildContext context, String symbol) Widget
Build a piece Widget for symbol.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

defaultSymbols → const List<String>
extendedSymbols → const List<String>
xiangqiSymbols → const List<String>