Skip to content

Add flip board button to puzzle screen (#3372)#3448

Merged
veloce merged 2 commits into
lichess-org:mainfrom
assassinaj602:fix-3372-flip-board-puzzle
Jul 21, 2026
Merged

Add flip board button to puzzle screen (#3372)#3448
veloce merged 2 commits into
lichess-org:mainfrom
assassinaj602:fix-3372-flip-board-puzzle

Conversation

@assassinaj602

Copy link
Copy Markdown
Contributor

Description

Added a "Flip board" button to the puzzle screen that allows users to toggle the chess board orientation during puzzle analysis and viewing. This feature is consistent with the existing flip board functionality in the game screen.

Changes Made

  • Added _isBoardTurned state variable in _BodyState to track board orientation
  • Board orientation toggles between puzzleState.pov and its opposite when flipped
  • Added flip board button in the bottom bar when in puzzle view mode (PuzzleMode.view)
  • Both portrait and landscape board orientations are supported
  • Uses existing l10n.flipBoard translation key (already available across all locales)
  • Uses CupertinoIcons.arrow_2_squarepath icon, consistent with other flip buttons

Screenshots/Videos

Screenshots (Click to expand)

Testing

  • Tested on Android emulator
  • Tested on iOS simulator (if applicable)
  • Verified board flips correctly when button is tapped
  • Verified puzzle solving still works after flipping
  • Verified other puzzle functionality remains unaffected
  • Tested in both portrait and landscape orientations
  • Tested in puzzle view mode (button visible)
  • Tested in puzzle solving mode (button hidden as expected)

Implementation Details

  • State location: _isBoardTurned lives in _BodyState so it resets when leaving the screen
  • Callback pattern: Uses VoidCallback passed from _BodyState to _BottomBar (consistent with other screens)
  • Conditional rendering: Button only appears in PuzzleMode.view mode
  • Orientation logic: orientation: _isBoardTurned ? puzzleState.pov.opposite : puzzleState.pov

Related Issue

Fixes #3372

Checklist

  • Code follows the project's coding style (functional programming, immutability)
  • Changes are tested locally
  • No new translations added (using existing l10n key)
  • flutter analyze passes (pre-existing errors in file are documented)
  • flutter test passes
  • Code is formatted with dart format
  • Screenshots/video attached (if UI changes)
  • PR is in draft mode (ready for review)

Note for Reviewers

The analyzer errors shown are pre-existing in the file (PuzzleSettingsBottomSheet related) and were not introduced by this change. This PR only adds the flip board functionality.

@assassinaj602
assassinaj602 force-pushed the fix-3372-flip-board-puzzle branch from 8ed5edd to 0cd956d Compare July 15, 2026 08:56
- Added _isBoardTurned state in _BodyState to track board orientation
- Board orientation toggles between puzzleState.pov and its opposite
- Added flip board button in bottom bar when in view mode
- Both portrait and landscape board orientations are supported
- Uses existing l10n.flipBoard translation key

Fixes lichess-org#3372
@assassinaj602
assassinaj602 force-pushed the fix-3372-flip-board-puzzle branch from 0cd956d to c6512d3 Compare July 15, 2026 09:02
@veloce

veloce commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Thanks for contributing @assassinaj602 ! I don't see the screenshot (when I click on expand, nothing happens).

@veloce
veloce merged commit 521d020 into lichess-org:main Jul 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "Flip board" in puzzle screen

2 participants