Git Product home page Git Product logo

flutter_shogi_board's Introduction

flutter_shogi_board

A shogi board widget for Flutter. This widget can be used in conjunction with shogi to render static game board positions, tsume problems or shogi castles.

As this package is still highly experimental, 0.0.x versioning is used. shogi is also in active development and similarly versioned.

Getting Started

Import the package

To import this package, simply add flutter_shogi_board as a dependency in pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  flutter_shogi_board:

Example

import 'package:flutter/material.dart';
import 'package:flutter_shogi_board/flutter_shogi_board.dart';
import 'package:shogi/shogi.dart';

void main() {
  runApp(
    MaterialApp(
      home: Scaffold(
        body: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Center(
            child: ShogiBoard(
              gameBoard: ShogiUtils.initialBoard,
            ),
          ),
        ),
      ),
    ),
  );
}

For more information, see the Flutter app in the example directory. This example is also hosted online.

Basic Usage

ShogiGameBoard

This widget renders a shogi game board using a GameBoard and ShogiBoardStyle. Unless style.maxSize is set, it fills its maximum size to that of its parent. The board pieces are rendered as text.

Parameter Description
gameBoard A GameBoard to render.
style Optional. A style to render the shogi board, defaults to constants listed below.
showPiecesInHand Optional. Whether pieces in hand should be shown, defaults to true.

ShogiBoardStyle

A model used to paint a ShogiBoard.

Parameter Description
maxSize The maximum size of the board. Defaults to double.infinity.
pieceColor Optional. The standard piece color, defaults to black.
promotedPieceColor Optional. The promoted piece color, defaults to red.
cellColor Optional. The board cell background color, defaults to transparent.
borderColor Optional. The board cell background color, defaults to gray.
usesJapanese Optional. Whether japanese characters or english letters are displayed, defaults to true.
showCoordIndicators Optional. Whether board coordinate indicators should be shown, defaults to true.
coordIndicatorType Optional. The type of coordinate indicators show, defaults to CoordIndicatorType.japanese.

DefaultShogiBoardStyle

The ShogiBoardStyle to apply to descendant ShogiBoard widgets without an explicit style.

DefaultShogiBoardStyle(
  style: ShogiBoardStyle(
    cellColor: BoardColors.brown,
  ),
  child: MaterialApp(
    ...

Showcase

Name Description
shogi_proverbs A mobile application containing various Shogi proverbs.
kifu_viewer An application to view Shogi games by loading Kifu files.

Future Plans

This package grew out of my desired to visualize shogi castles in Flutter, and with no game board widget or even a shogi engine available, I decided to roll my own.

For the future I would like to utilize this widget not just for displaying static game boards, but also for tsume problems, thus user interaction may be considered.

Raising Issues and Contributing

Please report bugs and issues, and raise feature requests on GitHub.

To contribute, submit a PR with a detailed description and tests, if applicable.

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.