BoardController constructor
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()?,
- void onSetPremove(
- Move?
- void onPremove()?,
- 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),
- 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 [],
Implementation
BoardController({
super.key,
required this.state,
required this.playState,
required this.pieceSet,
this.theme = BoardTheme.blueGrey,
this.size = const BoardSize(8, 8),
this.markerTheme,
this.onMove,
this.onSetPremove,
this.onPremove,
this.promotionBehaviour = PromotionBehaviour.alwaysSelect,
this.pieceHierarchy = Squares.defaultPieceHierarchy,
this.moves = const [],
this.draggable = true,
this.dragFeedbackSize = 2.0,
this.dragFeedbackOffset = const Offset(0.0, -1.0),
this.animatePieces = true,
this.animationDuration = Squares.defaultAnimationDuration,
this.animationCurve = Squares.defaultAnimationCurve,
this.premovePieceOpacity = Squares.defaultPremovePieceOpacity,
this.labelConfig = LabelConfig.standard,
this.backgroundConfig = BackgroundConfig.standard,
this.background,
this.piecePadding = 0.0,
this.overlays = const [],
this.underlays = const [],
}) {
moveMap = {};
drops = [];
for (Move m in moves) {
if (m.handDrop) {
drops.add(m);
continue;
}
if (!moveMap.containsKey(m.from)) {
moveMap[m.from] = [m];
} else {
moveMap[m.from]!.add(m);
}
}
}