flutter_stateless_chessboard 0.0.4
flutter_stateless_chessboard: ^0.0.4 copied to clipboard

Flutter Android iOS Linux macOS web Windows

A Chessboard Widget for Flutter. This package provides just the chessboard. The game logic can be implemented using chess library.

flutter_stateless_chessboard #

A Stateless Chessboard Widget for Flutter. This package provides just the chessboard. The game logic can be implemented using chess library. Check example/main.dart file, for implementing game logic.

Simple Chess App

Using the Chessboard #

To use Chessboard widget, add flutter_stateless_chessboard as a dependency in your pubspec.yaml

Example #

import 'package:flutter/material.dart';
import 'package:flutter_stateless_chessboard/flutter_stateless_chessboard.dart';

void main() {
  runApp(
    new MaterialApp(
      home: new Scaffold(
        body: new Center(
          child: Chessboard(
            size: 300,
            fen: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",
            onMove: (move) {  // optional
              // TODO: process the move
              print("move from ${move.from} to ${move.to}");
            },
            orientation: "b",  // optional
            lightSquareColor: Color.fromRGBO(240, 217, 181, 1), // optional
            darkSquareColor: Color.fromRGBO(181, 136, 99, 1), // optional
          ),
        ),
      ),
    ),
  );
}

Parameters #

fen: #

fen that should be show on the board (example rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1)

size: #

Size of the chessboard widget

onMove (optional): #

Called when a move is made on the board. Passing a ShortMove(from, to).

orientation (optional): #

Specify orientation of the chessboard. w for white side. b for black side.

lightSquareColor (optional): #

color of light square on chessboard.

darkSquareColor (optional): #

color of dart square on chessboard.

5
likes
100
pub points
60%
popularity

A Chessboard Widget for Flutter. This package provides just the chessboard. The game logic can be implemented using chess library.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

varunpvp@gmail.com

License

MIT (LICENSE)

Dependencies

chess, chess_vectors_flutter, flutter

More

Packages that depend on flutter_stateless_chessboard