Skip to content

fix: prevent eval string wrapping on tablet via FittedBox#3216

Open
algojogacor wants to merge 1 commit into
lichess-org:mainfrom
algojogacor:fix/eval-string-wrap-tablet
Open

fix: prevent eval string wrapping on tablet via FittedBox#3216
algojogacor wants to merge 1 commit into
lichess-org:mainfrom
algojogacor:fix/eval-string-wrap-tablet

Conversation

@algojogacor
Copy link
Copy Markdown

Summary of changes

Wrap the eval display Text widget in a FittedBox with BoxFit.scaleDown to 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 a FittedBox(fit: BoxFit.scaleDown, child: ...). This ensures the text automatically scales down to fit within the available width without breaking to multiple lines.

Testing done

  • Verified the Flutter analyzer passes: flutter analyze lib/src/view/engine/engine_gauge.dart
  • The FittedBox widget is a standard Flutter widget available in all Flutter versions
  • The BoxFit.scaleDown fit ensures text only shrinks when needed (never grows beyond original size)
  • No behavior change on phones where text already fits — scaleDown only activates when content overflows

Screenshots

N/A — visual change on tablet devices only. The eval string will now scale down to fit rather than wrapping.

Closes #2694

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
@veloce
Copy link
Copy Markdown
Contributor

veloce commented May 19, 2026

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.

@ijm8710 ijm8710 mentioned this pull request May 19, 2026
@ijm8710
Copy link
Copy Markdown

ijm8710 commented May 19, 2026

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

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.

Analysis: eval string wraps on Tablet

3 participants