Repository navigation
feat(send): re-flow the QR grid to fit the viewport - #7
Merged
Merged
Conversation
5 tasks done
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.
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.BroadcastViewnow wraps the stage in aLayoutBuilderand callssuggestLayout()(the existing pure-Dart picker) with the physical stage size on every resize/rotation; the painter reads the live layout from the controller.settings.layoutreads 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 testre-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 testManually 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