BoardController class
A wrapper that handles interactions and certain elements of board state (such as premoves) for a Board.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BoardController
Constructors
-
BoardController({required PieceSet pieceSet, required BoardState state, required BoardTheme theme, BoardSize size = const BoardSize(8, 8), HighlightTheme? highlightTheme, dynamic onMove(Move)?, dynamic onSetPremove(Move?)?, dynamic onPremove(Move)?, List<
Move> moves = const [], required bool canMove, bool draggable = true, double dragFeedbackSize = 2.0, Offset dragFeedbackOffset = const Offset(0.0, -1.0), bool allowAnimation = true, Duration? animationDuration, Curve? animationCurve})
Properties
- allowAnimation → 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
- canMove → bool
-
If false, premoves will be allowed.
final
- dragFeedbackOffset → Offset
-
A vector to offset the position of dragged pieces by, relative to the size of the piece.
No offset is recommended for web, and Offset(0,-1) for mobile, in which case
the bottom of the piece will be anchored to the finger.
final
- dragFeedbackSize → double
-
The size of pieces being dragged will be multiplied by this.
/// 1.5 is a good value for mobile, but 1.0 is preferable for web.
final
- draggable → bool
-
final
-
drops
↔ List<
Move> -
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
- highlightTheme → HighlightTheme?
-
Widget builders for the various types of square highlights used.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
moveMap
↔ Map<
int, List< Move> > -
latefinal
-
moves
→ List<
Move> -
A list of moves that can be played/premoved.
final
- onMove → (dynamic Function(Move)?)
-
Called when a move is successfully made.
final
- onPremove → (dynamic Function(Move)?)
-
Called when a premove is triggered.
final
- onSetPremove → (dynamic Function(Move?)?)
-
Called when the premove is changed.
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
- theme → BoardTheme
-
Colour scheme for the board.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _BoardControllerState -
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