BoardController class
Constructors
BoardController ({Key ? key , required BoardState state , required PlayState playState , required PieceSet pieceSet , BoardTheme theme = BoardTheme.blueGrey , BoardSize size = const BoardSize(8, 8) , MarkerTheme ? markerTheme , void onMove (Move )?, void onSetPremove (Move ? )?, void onPremove (Move )?, PromotionBehaviour promotionBehaviour = PromotionBehaviour.alwaysSelect , List <String > pieceHierarchy = Squares.defaultPieceHierarchy , List <Move > moves = const [] , bool draggable = true , double dragFeedbackSize = 2.0 , Offset dragFeedbackOffset = const Offset(0.0, -1.0) , DragTargetFeedback ? dragTargetFeedback , bool animatePieces = true , Duration animationDuration = Squares.defaultAnimationDuration , Curve animationCurve = Squares.defaultAnimationCurve , double premovePieceOpacity = Squares.defaultPremovePieceOpacity , LabelConfig labelConfig = LabelConfig.standard , BackgroundConfig backgroundConfig = BackgroundConfig.standard , Widget ? background , double piecePadding = 0.0 , List <Widget > overlays = const [] , List <Widget > underlays = 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
background
→ Widget ?
A widget to be placed behind everything on the board.
Useful for games with backgrounds like Xiangqi.
If you use this then you need to either set boardConfig
or set the colour
of the basic squares in theme to transparent.
final
backgroundConfig
→ BackgroundConfig
Configuration for the background. Determines which squares to draw, and
allows an opacity for squares to be defined.
final
bestPiece
→ String
no setter
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
dragPermissions
→ PlayerSet
no setter
dragTargetFeedback
→ DragTargetFeedback ?
Builds feedback for squares being hovered over by a dragged piece.
final
drops
↔ List <Move >
late final
hashCode
→ int
The hash code for this object.
no setter inherited
key
→ Key ?
Controls how one widget replaces another widget in the tree.
final inherited
labelConfig
→ LabelConfig
Configuration for the rank and file labels on the board.
Set this to LabelConfig.disabled to hide them entirely.
final
markerTheme
→ MarkerTheme ?
Widget builders for the various types of square highlights used.
final
moveMap
↔ Map <int , List <Move > >
late final
moves
→ List <Move >
A list of moves that can be played/premoved.
final
onMove
→ (void Function(Move ) ?)
Called when a move is successfully made.
final
onPremove
→ (void Function(Move ) ?)
Called when a premove is triggered.
final
onSetPremove
→ (void Function(Move ? ) ?)
Called when the premove is changed.
final
overlays
→ List <Widget >
A list of widgest that will be inserted on top of the piece layer, but
below any visible piece selectors. Ensure these don't absorb any gestures
to preserve board behaviour.
final
pieceHierarchy
→ List <String >
The relative hierarchy of pieces, specified by their symbols, in order
from best to worst. Used in ordering the pieces in piece selectors, and
in deciding which piece to auto promote to.
Note that this won't change which pieces are available in selectors - that
depends on the moves available - it only orders them.
All symbols should be lower case.
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
playState
→ PlayState
The state of the game, from the perspective of the current player.
final
premovePieceOpacity
→ double
Opacity of overlay pieces shown on the board resulting from promotion
or dropping premoves.
final
promotionBehaviour
→ PromotionBehaviour
How to behave on promotion moves.
final
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
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
underlays
→ List <Widget >
A list of widgets that will be inserted between the board background and
the piece layer. Ensure these don't absorb any gestures to preserve board
behaviour.
final