fix(game): center time-control header on Android (#3074)#3106
fix(game): center time-control header on Android (#3074)#3106CloudyDino wants to merge 1 commit into
Conversation
The AppBar title for the active game and the lobby seek/challenge flows defaulted to left alignment on Android. Add centerTitle: true to the relevant AppBars so the icon + time control text is centered. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Hi! Thanks for this. Few comments
|
|
In the bottom right photo, it's being centered in the remaining space. If we want it centered while ignoring the bars on the left, we could add a fake empty box on the right that's the same size as the bars on the left. I'll go ahead and close this though since that other PR exists. I didn't realize! |
That's odd though becuase both the top right and bottom right after photos have bars on left but top right looks centered despite that. My instinct is the bars on left shouldn't influence the centering but admittedly I'm not a designer. Lastly, your approach was slightly different then the other pr. Looks like you did your code line in 7 places. I'm not sure which is better but if you thought it necessary to include it perhaps it shouldn't be discounted? |
That's because the kebab menu on the top right is about the same size as the bars on the top left. On the bottom right photo, that menu isn't there and so the title scoots over to the right so we'd need to make the kebab menu space still be taken up, but not display anything so that the title is still centered. I don't mind taking a look again after the other PR is merged in and we can see all the places the centering is / isn't happening |
Closes #3074.
Summary
The active-game
AppBarinlib/src/view/game/game_screen.dartdefaulted to the Material left-aligned title on Android, so the time-control header (e.g.🐢 1+0 • Rated) sat near the left edge instead of being centered between the leading ping icon and the trailing ⋯ menu.This adds
centerTitle: trueto the sevenAppBars in_GameScreenState.buildthat render time-control / challenge / lobby titles (active game, lobby seek, challenge sent/received, cancelled/declined/errored states, open challenge).Proof
Built and ran the BEFORE (main) and AFTER (this branch) APKs on an Android emulator (API 36) with two test accounts pairing on a 1+0 Bullet seek, then measured the title text bounding box in each screenshot.
Screen width is 1080 px. AFTER lands within 2 px of the screen midpoint; BEFORE was off by 155 px.
The lobby-seek-loading AppBar was also tested but is visually unchanged because that variant has no trailing actions, so the M3 layout already centered it. The fix is still applied there for consistency.
Test plan
flutter analyzecleanflutter testclean (per pre-merge checklist)