fix: prevent eval string wrapping on tablet via FittedBox#3216
Open
algojogacor wants to merge 1 commit into
Open
fix: prevent eval string wrapping on tablet via FittedBox#3216algojogacor wants to merge 1 commit into
algojogacor wants to merge 1 commit into
Conversation
Wrap the eval display Text widget in a FittedBox with BoxFit.scaleDown to auto-size the text and prevent wrapping on tablet devices where the gauge width (24px) is too narrow for the 11px font. Fixes lichess-org#2694
Contributor
|
Thanks for the fix @algojogacor Even though the description says it doesn't change visually on phone devices, I'd rather see a screenshot of a mobile (phone) confirming it still looks good. |
Veloce Just linked a new issue ticket that seems worth a view for phone behavior to match web |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary of changes
Wrap the eval display
Textwidget in aFittedBoxwithBoxFit.scaleDownto auto-size the text and prevent wrapping on tablet devices.Root cause / what was fixed
On tablet devices, the eval gauge width (24px) is too narrow for the eval string rendered at 11px font size, causing text to wrap. This was reported in issue #2694 where the eval string wraps within the gauge bar on iPad.
The fix applies the maintainer's suggestion to use auto-size text by wrapping the
Text(evalDisplay, style: evalStyle)in aFittedBox(fit: BoxFit.scaleDown, child: ...). This ensures the text automatically scales down to fit within the available width without breaking to multiple lines.Testing done
flutter analyze lib/src/view/engine/engine_gauge.dartFittedBoxwidget is a standard Flutter widget available in all Flutter versionsBoxFit.scaleDownfit ensures text only shrinks when needed (never grows beyond original size)scaleDownonly activates when content overflowsScreenshots
N/A — visual change on tablet devices only. The eval string will now scale down to fit rather than wrapping.
Closes #2694