BoardController constructor

BoardController({
  1. Key? key,
  2. required BoardState state,
  3. required PlayState playState,
  4. required PieceSet pieceSet,
  5. BoardTheme theme = BoardTheme.blueGrey,
  6. BoardSize size = const BoardSize(8, 8),
  7. MarkerTheme? markerTheme,
  8. void onMove(
    1. Move
    )?,
  9. void onSetPremove(
    1. Move?
    )?,
  10. void onPremove(
    1. Move
    )?,
  11. PromotionBehaviour promotionBehaviour = PromotionBehaviour.alwaysSelect,
  12. List<String> pieceHierarchy = Squares.defaultPieceHierarchy,
  13. List<Move> moves = const [],
  14. bool draggable = true,
  15. double dragFeedbackSize = 2.0,
  16. Offset dragFeedbackOffset = const Offset(0.0, -1.0),
  17. bool animatePieces = true,
  18. Duration animationDuration = Squares.defaultAnimationDuration,
  19. Curve animationCurve = Squares.defaultAnimationCurve,
  20. double premovePieceOpacity = Squares.defaultPremovePieceOpacity,
  21. LabelConfig labelConfig = LabelConfig.standard,
  22. BackgroundConfig backgroundConfig = BackgroundConfig.standard,
  23. Widget? background,
  24. double piecePadding = 0.0,
  25. List<Widget> overlays = const [],
  26. 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);
    }
  }
}