GithubHelp home page GithubHelp logo

ebraminio / flutter-chessground Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lichess-org/flutter-chessground

0.0 1.0 0.0 20.06 MB

Chessboard package for flutter

License: GNU General Public License v3.0

Ruby 0.82% Objective-C 0.02% Kotlin 0.08% Dart 98.83% Swift 0.25%

flutter-chessground's Introduction

Chessground is a chessboard package developed for lichess.org. It doesn't handle chess logic so you can use it with different chess variants.

Features

  • pieces animations: moving and fading away
  • board highlights: last move, piece destinations
  • move piece by tap or drag and drop
  • premoves
  • displays a shadow under dragged piece to indicate the drop square target
  • board themes
  • piece sets from lichess
  • promotion selector
  • draw arrows on board
  • move annotations
  • exclude android 10+ navigation gestures around board (needs immersive mode)

Getting started

This package exports a Board widget which can be interactable or not. It is entirely configurable with a BoardSettings object.

Usage

This will display a non-interactable board from the starting position, using the default theme:

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

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String fen = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR';

  @override
  Widget build(BuildContext context) {
    final double screenWidth = MediaQuery.of(context).size.width;

    return Scaffold(
      appBar: AppBar(
        title: const Text('Chessground demo'),
      ),
      body: Center(
        child: Board(
          size: screenWidth,
          data: BoardData(
            interactableSide: InteractableSide.none,
            orientation: Side.white,
            fen: fen,
          ),
        ),
      ),
    );
  }
}

See the example app for an interactable version against a random bot.

flutter-chessground's People

Contributors

veloce avatar bclehmann avatar csdodd avatar nav-28 avatar schlawg avatar eeqk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.