BoardPieces class

The piece layer for a board. Contains pieces and empty boxes.

Inheritance

Constructors

BoardPieces({Key? key, required PieceSet pieceSet, required BoardState state, BoardSize size = BoardSize.standard, bool draggable = true, bool animatePieces = true, Duration animationDuration = Squares.defaultAnimationDuration, Curve animationCurve = Squares.defaultAnimationCurve, void onTap(int)?, void onDragStarted(int)?, void onDragCancelled(int)?, void onDragEnd(int)?, bool ignoreGestures = false, double piecePadding = 0.0, PlayerSet dragPermissions = PlayerSet.both})
const

Properties

animatePieces bool
If true and there is a last move, it will be animated.
final
animationCurve Curve
Animation curve for piece movements. Defaults to Curves.easeInQuad.
final
animationDuration Duration
How long move animations take to play.
final
draggable bool
Are the pieces draggable?
final
dragPermissions PlayerSet
Which players' pieces we can drag.
final
hashCode int
The hash code for this object.
no setterinherited
ignoreGestures bool
If set to true, all gestures will be ignored by this layer. Generally useful if you have an external drag (e.g. from a hand) happening.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDragCancelled → (void Function(int)?)
Called when a drag is cancelled.
final
onDragEnd → (void Function(int)?)
Called when a drag ends, i.e. a piece was dropped on a target.
final
onDragStarted → (void Function(int)?)
Called when a drag is started.
final
onTap → (void Function(int)?)
Called when a piece is tapped.
final
piecePadding double
Padding to add on every side of a piece, relative to the size of the square it is on. For example, 0.05 will add 5% padding to each side.
final
pieceSet PieceSet
The set of widgets to use for pieces on the board.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size BoardSize
Dimensions of the board.
final
state BoardState
The state of the board - which pieces are on which squares, etc.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<BoardPieces>
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
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}) 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