Skip to content

fix(apps): derive category row and title height from text size (#19238) - #21340

Merged
kodjima33 merged 3 commits into
BasedHardware:mainfrom
Dragonire9:fix/apps-category-rows-text-scale-19238
Oct 13, 2026
Merged

kodjima33 merged 3 commits into
BasedHardware:mainfrom
Dragonire9:fix/apps-category-rows-text-scale-19238

Conversation

@Dragonire9

@Dragonire9 Dragonire9 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #19238.

Derives targetItemHeight, titleSectionHeight, and childAspectRatio dynamically based on the reader text scaler in CategorySection (app/lib/pages/apps/widgets/category_section.dart).

Root Cause

Previously, CategorySection hardcoded targetItemHeight = 85.0 and titleSectionHeight = 60.0 with a static childAspectRatio = 0.28. At scaled text sizes (1.15x, 1.3x, 1.5x), the three-line metadata column within SectionAppItemCard (name, category, and rating) exceeded the 85 pt card height and threw layout overflow errors.

Fix Details

  1. Dynamic Item Height: Computes row text height dynamically using TextPainter with the current text scaler across OmiType.body, OmiType.footnote, and OmiType.caption:
    final rowText = lineOf(OmiType.body) + 2 + lineOf(OmiType.footnote) + 2 + lineOf(OmiType.caption);
    final double targetItemHeight = max(85.0, 16 + max(52.0, rowText) + 1);
  2. Dynamic Title Height: Scales header section height with OmiType.title2.
  3. Card Aspect Ratio Preservation: Dynamically maintains card width (85.0 / 0.28 pt) as cards expand vertically:
    final double childAspectRatio = targetItemHeight / (85.0 / 0.28);

Verification

  • Added hermetic regression test in app/test/widgets/apps_category_section_large_text_test.dart verifying CategorySection layout across 1.0x, 1.15x, 1.3x, and 1.5x text scales without any overflow exceptions.
  • Added unreleased changelog fragment app/changelog/unreleased/20261012-apps-category-rows-text-scaling.json.

View guided diff

@Git-on-my-level

Copy link
Copy Markdown
Collaborator

Reviewed this against #19238 — nice, well-scoped accessibility fix, and thank you for including a regression test and changelog fragment.

app/lib/pages/apps/widgets/category_section.dart

  • The TextPainter-based lineOf() measurement (with painter.dispose()) and the rowText formula match what SectionAppItemCard actually renders: OmiType.body for the name, OmiType.footnote for the category, OmiType.caption for the rating, with the 2pt gaps between them.
  • Baseline math checks out: at 1.0x the floor 16 + max(52.0, rowText) + 1 stays below 85, so the default layout is unchanged; the 52.0 floor also keeps room for the 60pt icon block.
  • Deriving childAspectRatio = targetItemHeight / (85.0 / 0.28) to hold card width constant while rows grow is the right call for the horizontal grid.
  • One tiny nit: titleSectionHeight measures OmiType.title2 (24pt) while the header text uses OmiType.title3 (20pt), so the reserved title space is slightly generous. Harmless (conservative), just noting it in case it was unintentional.

app/test/widgets/apps_category_section_large_text_test.dart

  • Good hermetic setup: PlatformManager.initializeForLocalHarness, mocked SharedPreferences, and the providers the widget reads. Asserting takeException() is null across 1.0x/1.15x/1.3x/1.5x on a 390pt viewport directly covers the reported scales.
  • Cosmetic: the reason string on the first expect ('... should not overflow at scale on width ') is missing its interpolations.

app/changelog/unreleased/20261012-apps-category-rows-text-scaling.json — matches the existing unreleased-fragment schema.

One note for maintainers: this PR's checks don't include a Flutter test run, so the new test hasn't been exercised by CI — worth running it locally before merge. Apart from that this looks merge-ready to me; the merge decision is left to the maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution flutter flutter work labels Oct 12, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed not yet fixed on main (category_section.dart still has hardcoded targetItemHeight/titleSectionHeight/childAspectRatio). Root cause stated, linked real bug #19238, scoped diff (160 lines), regression test added, CI green. Merging.

@kodjima33
kodjima33 merged commit ac1b866 into BasedHardware:main Oct 13, 2026
1 check passed
@Dragonire9

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing and merging! 🙏

Bounty Payout Details:

Git-on-my-level added a commit that referenced this pull request Oct 13, 2026
…21343 follow-ups) (#21425)

* fix(app): restore green Flutter tests on main (#21302 #21340 #21341 #21343 follow-ups)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(app): measure category card text heights

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apps: category rows overflow at larger text sizes

3 participants