advanced_chess_board 2.1.0 copy "advanced_chess_board: ^2.1.0" to clipboard
advanced_chess_board: ^2.1.0 copied to clipboard

A modern looking chess board with advanced features.

advanced_chess_board #

It's a chess board developed in using plain flutter widgets without using images of a board. So you can customize board color as per your need. It uses a ChessBoardController to control the board state.

Screenshot Screenshot

Features #

  • You can load the board with custom FEN.
  • Control the orientation of the board.
  • Enable/Disable moves on board.
  • Move the pieces either by clicking/tapping or dragging.
  • Highlight the valid moves upon clicking/tapping or dragging.
  • Draw arrows on the board
  • Make a move using the controller programmatically.
  • Get the move history, playerToMove, isCheckmate, undo move etc.
  • Add a listener using the controller.
  • Controller also exposes the game object to control the board further.

Getting started #

  • Add a dependency to this package (advanced_chess_board) in your pubspec.yaml
  • Add an AdvancedChessBoard widget and provide a ChessBoardController object to it.
  • Optional : If you to provide custom colors for board you can provide corresponding darkSquareColor and lightSquareColor parameters.
  • Optional : By default board orientation is for white. You can provide optional boardOrientation to be either black or white.

Usage #

Below is the basic example with minimal parameters. See the example/main.dart for more details.

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Chess Board Example',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      darkTheme: ThemeData(brightness: Brightness.dark, useMaterial3: true),
      themeMode: ThemeMode.dark,
      home: Scaffold(
        appBar: AppBar(title: const Text('Chess Board Example')),
        body: Center(
          child: AdvancedChessBoard(
            controller: controller,
          ),
        ),
      ),
    );
  }

Credits #

For the images of pieces, it currently uses the images of Chess.com.

Additional information #

Support for drawing arrow will be added in upcoming release.

1
likes
130
points
43
downloads

Publisher

verified publishermohitkumarverma.com

Weekly Downloads

A modern looking chess board with advanced features.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-2-Clause (license)

Dependencies

chess, flutter

More

Packages that depend on advanced_chess_board