-
-
Notifications
You must be signed in to change notification settings - Fork 310
468 show captured pieces instead of material imbalance #1142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
veloce
merged 29 commits into
lichess-org:main
from
Jimima:468-show-captured-pieces-instead-of-material-imbalance
Dec 9, 2024
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
afd2afc
WIP
Jimima ae16f79
WIP
Jimima f467822
Format fix
Jimima 7691710
WIP with settings option
Jimima 9f528bf
Version with single option with 3 choices
Jimima 985c69f
Added in-game preference option
Jimima c6ff78b
Fix format
Jimima 338fda4
Merge branch 'main' into 468-show-captured-pieces-instead-of-material…
Jimima f6f7f81
Removed comments
Jimima 3fe1a77
Refactored enum
Jimima 21fa1e9
Added test for captured pieces
Jimima c5e81ee
Format
Jimima 3dfd6b3
Parameterised starting position
Jimima 913d4a1
Refactor
Jimima b784f93
Removed comment
Jimima 46a7480
Placeholder l10n implementation
Jimima b8e7a04
Refactor
Jimima a4716f7
Syntax fix(?)
Jimima 13e003d
Merge branch 'main' into 468-show-captured-pieces-instead-of-material…
Jimima 66d561a
Merge fix
Jimima c3f98e2
Refactor
Jimima b6d4599
Modified null handling
Jimima 18297ce
Removed duplicates from board settings page
Jimima 9a84086
Removed from game settings (also duplicates)
Jimima 3815037
Appeased linter
Jimima 556a374
Merge branch 'main' into 468-show-captured-pieces-instead-of-material…
Jimima 5a6db91
Added alternate picker on ios
Jimima daf377a
Merge branch '468-show-captured-pieces-instead-of-material-imbalance'…
Jimima 442a4fd
Linter fix
Jimima File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Jimima marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| import 'package:chessground/chessground.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter/widgets.dart'; | ||
| import 'package:freezed_annotation/freezed_annotation.dart'; | ||
| import 'package:lichess_mobile/l10n/l10n.dart'; | ||
| import 'package:lichess_mobile/src/model/settings/preferences_storage.dart'; | ||
| import 'package:lichess_mobile/src/styles/styles.dart'; | ||
| import 'package:lichess_mobile/src/utils/color_palette.dart'; | ||
|
|
@@ -84,9 +86,11 @@ class BoardPreferences extends _$BoardPreferences | |
| return save(state.copyWith(dragTargetKind: dragTargetKind)); | ||
| } | ||
|
|
||
| Future<void> toggleShowMaterialDifference() { | ||
| Future<void> setMaterialDifferenceFormat( | ||
| MaterialDifferenceFormat materialDifferenceFormat, | ||
| ) { | ||
| return save( | ||
| state.copyWith(showMaterialDifference: !state.showMaterialDifference), | ||
| state.copyWith(materialDifferenceFormat: materialDifferenceFormat), | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -120,7 +124,7 @@ class BoardPrefs with _$BoardPrefs implements Serializable { | |
| required bool boardHighlights, | ||
| required bool coordinates, | ||
| required bool pieceAnimation, | ||
| required bool showMaterialDifference, | ||
| required MaterialDifferenceFormat materialDifferenceFormat, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A new |
||
| required ClockPosition clockPosition, | ||
| @JsonKey( | ||
| defaultValue: PieceShiftMethod.either, | ||
|
|
@@ -150,7 +154,7 @@ class BoardPrefs with _$BoardPrefs implements Serializable { | |
| boardHighlights: true, | ||
| coordinates: true, | ||
| pieceAnimation: true, | ||
| showMaterialDifference: true, | ||
| materialDifferenceFormat: MaterialDifferenceFormat.materialDifference, | ||
| clockPosition: ClockPosition.right, | ||
| pieceShiftMethod: PieceShiftMethod.either, | ||
| enableShapeDrawings: true, | ||
|
|
@@ -317,6 +321,27 @@ enum BoardTheme { | |
| ); | ||
| } | ||
|
|
||
| enum MaterialDifferenceFormat { | ||
| materialDifference(label: 'Material difference'), | ||
| capturedPieces(label: 'Captured pieces'), | ||
| hidden(label: 'Hidden'); | ||
|
|
||
| const MaterialDifferenceFormat({ | ||
| required this.label, | ||
| }); | ||
|
|
||
| final String label; | ||
Jimima marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| bool get visible => this != MaterialDifferenceFormat.hidden; | ||
|
|
||
| String l10n(AppLocalizations l10n) => switch (this) { | ||
| //TODO: Add l10n | ||
| MaterialDifferenceFormat.materialDifference => materialDifference.label, | ||
| MaterialDifferenceFormat.capturedPieces => capturedPieces.label, | ||
| MaterialDifferenceFormat.hidden => hidden.label, | ||
| }; | ||
| } | ||
|
|
||
| enum ClockPosition { | ||
| left, | ||
| right; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.