Skip to content

Commit

Permalink
Merge branch 'main' into symmetricPieceSet
Browse files Browse the repository at this point in the history
  • Loading branch information
veloce authored Sep 2, 2024
2 parents 1f57d6c + 43e4a32 commit 62a0afa
Show file tree
Hide file tree
Showing 16 changed files with 1,085 additions and 852 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
## 4.1.0

## 5.0.0

- Added another `Chessboard.fixed` constructor that allows to set the board to a
fixed position.
- Premove state is now lifted up to the parent widget, in order to allow
instant play of premoves.
- Promotion state is now lifted up to the parent widget, in order to allow more
control over the promotion dialog.
- Add symmetric piece set (`PieceAssets.symmetric`).
- `ChessboardEditor` now supports highlighting squares.
- Flip `BoardSettings.dragFeedbackOffset.dy` for flipped pieces.
Support displaying all pieces upside down based on side to move.
- Fix: ensure the board background does not overflow the board.

### Breaking changes:
- `Chessboard` now require a `game` parameter of type `GameData` instead
of `BoardData`.
- Added required parameters `piece` and `pieceAssets` to `PieceShape`, removed `role`. Added optional
`opacity` parameter.
- Remove 'ChessboardState.opponentsPiecesUpsideDown' in favor of `ChessboardSettings.pieceOrientationBehavior`.

## 4.0.0

Expand Down
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ This package exports a `Chessboard` widget which can be interactable or not.
It is configurable with a `ChessboardSettings` object which defines the board
behavior and appearance.

You must provide a `ChessboardState` object to the `Chessboard` widget. This
object is immutable and contains the board state (the position, which side has
to move, etc.).
To interact with the board in order to play a game, you must provide a `GameData`
object to the `Chessboard` widget. This object is immutable and contains the game
state (which side is to move, the current valid moves, etc.), along with the
callback functions to handle user interactions.

All chess logic must be handled outside of this package. Any change in the state
of the game needs to be transferred to the board by creating a new `ChessboardState` object.
of the game needs to be transferred to the board by creating a new `GameData` object.

## Usage

Expand Down Expand Up @@ -62,13 +64,10 @@ class _MyHomePageState extends State<MyHomePage> {
title: const Text('Chessground demo'),
),
body: Center(
child: Chessboard(
child: Chessboard.fixed(
size: screenWidth,
state: ChessboardState(
interactableSide: InteractableSide.none,
orientation: Side.white,
fen: fen,
),
orientation: Side.white,
fen: fen,
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
Expand Down
9 changes: 3 additions & 6 deletions example/lib/board_thumbnails.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BoardThumbnailsPage extends StatelessWidget {
children: [
for (final fen in positions)
LayoutBuilder(builder: (context, constraints) {
return Chessboard(
return Chessboard.fixed(
size: constraints.biggest.width,
settings: ChessboardSettings(
enableCoordinates: false,
Expand All @@ -43,11 +43,8 @@ class BoardThumbnailsPage extends StatelessWidget {
),
],
),
state: ChessboardState(
interactableSide: InteractableSide.none,
orientation: Side.white,
fen: fen,
),
orientation: Side.white,
fen: fen,
);
}),
],
Expand Down
Loading

0 comments on commit 62a0afa

Please sign in to comment.