Skip to content

feat(send): re-flow the QR grid to fit the viewport - #7

Merged
BlackPool25 merged 1 commit into
mainfrom
fix/adaptive-qr-grid-scaling
Aug 3, 2026
Merged

BlackPool25 merged 1 commit into
mainfrom
fix/adaptive-qr-grid-scaling

Conversation

@BlackPool25

Copy link
Copy Markdown
Owner

What & Why

The sender QR grid was sized by a fixed layout chosen at file-pick time: tile size only stepped up in whole px/module jumps and only when all tiles fit at the next size, so on a phone the QRs sat small in the center of the screen with large dead margins. Holding the phone close to the tiny QRs was the only way to get resolution.

This makes the broadcast re-flow the grid live to the current stage size:

  • BroadcastController.setLayout() swaps the grid geometry mid-broadcast, re-clamps the fps ceiling to the new layout cap, and re-seeds the encode lookahead at the new tile count. The transfer settings stay untouched — the layout is a live display concern, and receivers learn the real metadata from META frames, which are layout-independent.
  • BroadcastView now wraps the stage in a LayoutBuilder and calls suggestLayout() (the existing pure-Dart picker) with the physical stage size on every resize/rotation; the painter reads the live layout from the controller.
  • All settings.layout reads inside the controller now follow the live layout (schedule, dual-lane branch, stats), so a mid-broadcast re-flow never desynchronizes the round-robin from the rendered tile count.

Modules stay at integer px per module — no sub-pixel scaling — so scannability is unchanged (the px/module cliff in docs/ARCHITECTURE.md still holds).

How it was tested

  • New: setLayout re-flows the grid mid-broadcast (tile count, schedule branch, fps ceiling, settings untouched), setLayout clamps fps to the new layout ceiling, and a view-level test re-flows the live layout to the surface aspect (portrait→column3, landscape→row3, small square→single). The view test fails on the previous code (Expected LayoutId.column3, Actual LayoutId.grid4).

  • cd flutter_app/rust && cargo build --lib && cd flutter_app && flutter analyze && flutter test — 112 tests pass.

  • No wire-format or codec change.

  • flutter analyze + flutter test

  • Manually tested on: Flutter Android / Flutter Linux / both (layout re-flow verified at multiple aspect ratios in widget tests; rotation relies on the existing MediaQuery rebuild path)

Checklist

  • No wire-format/codec change
  • CHANGELOG / docs updated if user-facing
  • If AI-assisted, I reviewed and understood every line

@BlackPool25
BlackPool25 merged commit f11431d into main Aug 3, 2026
2 checks passed
@BlackPool25
BlackPool25 deleted the fix/adaptive-qr-grid-scaling branch August 3, 2026 08:56
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.

1 participant