flutter_chess_board 0.9.1 copy "flutter_chess_board: ^0.9.1" to clipboard
flutter_chess_board: ^0.9.1 copied to clipboard

outdated

A Chessboard Widget for Flutter. The widget also maintains game state and gives callbacks for game events.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_chess_board/src/chess_board.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ChessBoard(
              onMove: (move) {
                print(move);
              },
              onCheckMate: (color) {
                print(color);
              },
              onDraw: () {},
              size: MediaQuery.of(context).size.width,
              enableUserMoves: true,
            )
          ],
        ),
      ),
    );
  }
}
88
likes
0
pub points
82%
popularity

Publisher

verified publisherjoshi.dev

A Chessboard Widget for Flutter. The widget also maintains game state and gives callbacks for game events.

Homepage

License

unknown (license)

Dependencies

chess, chess_vectors_flutter, flutter, scoped_model

More

Packages that depend on flutter_chess_board