StaticChessboard class

A chessboard widget that cannot be interacted with.

This widget makes use of Scrollable.recommendDeferredLoadingForContext to avoid loading pieces when rapidly scrolling. This should allow for a better scrolling experience when displaying a lot of chessboards in a ListView or GridView.

The fen property is used to describe the position of the board. Pass a new FEN to update the board position. The board will animate the pieces to their new positions.

Inheritance

Constructors

StaticChessboard.new({required double size, required Side orientation, required String fen, Move? lastMove, ChessboardColorScheme colorScheme = ChessboardColorScheme.brown, double brightness = 1.0, double hue = 0.0, PieceAssets pieceAssets = PieceSet.stauntyAssets, BorderRadiusGeometry borderRadius = BorderRadius.zero, List<BoxShadow> boxShadow = const <BoxShadow>[], bool enableCoordinates = false, Duration animationDuration = const Duration(milliseconds: 200), Key? key})
const

Properties

animationDuration Duration
Piece animation duration
final
borderRadius BorderRadiusGeometry
Border radius of the board
final
boxShadow List<BoxShadow>
Box shadow of the board
final
brightness double
Brightness adjustment of the board
final
colorScheme ChessboardColorScheme
Theme of the board
final
enableCoordinates bool
Whether to show board coordinates
final
fen String
FEN string describing the position of the board.
final
hashCode int
The hash code for this object.
no setterinherited
hue double
Hue adjustment of the board
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lastMove → Move?
Last move played, used to highlight corresponding squares.
final
orientation → Side
Side by which the board is oriented.
final
pieceAssets PieceAssets
Piece set
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size double
Size of the board in logical pixels.
final
squareSize double
Size of a single square on the board.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StaticChessboard>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
offsetSquare(Offset offset) → Square?
Converts a board offset to a square.
inherited
squareOffset(Square square) Offset
Converts a square to a board offset.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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