flutter_stateless_chessboard 0.0.4 copy "flutter_stateless_chessboard: ^0.0.4" to clipboard
flutter_stateless_chessboard: ^0.0.4 copied to clipboard

outdated

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.

25
likes
0
pub points
71%
popularity

Publisher

unverified uploader

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

License

unknown (LICENSE)

Dependencies

chess, chess_vectors_flutter, flutter

More

Packages that depend on flutter_stateless_chessboard