feat(garage_ui): PageHeading, a real extraBold, and a mono that chains
The weight helpers went through _StyledText, which merges a style naming one property and lets everything else in scope stand. That works for a colour and it doesnt work for a weight: google_fonts encodes the weight in the family NAME, so merging w800 over an already resolved family changes no font file and skia synthesises instead. Skia has one fake bold, so w600, w700 and w800 all came out the same stroke and extraBold was indistinguishable from bold. They re-resolve the family now, keeping whichever face is in scope, so .mono().bold() and .bold().mono() both land on the real mono bold. PageHeading is lifted out of the hub, where it was drawn by hand above every section. A&A's licence page wanted the same block and a lookalike drifts from the original inside a day. pageGutter and propertiesSectionGap are new density tokens. Both were local magic numbers - `fontSize * 3` copied into every app that copied the hub, and a flat gapLg that a dense editor pane full of sections wears badly. garage_auth takes an optional handoff code on signIn/beginSignIn and sends it as _handoff, so a desktop build can hand its user to the web one without a second sign in. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FkzfwZf59HNP6R8jXcC1NR
This commit is contained in:
@@ -393,6 +393,77 @@ Plainest thing that works. If a page wants more, it's asking for a new garage_ui
|
||||
component, not a one-off.
|
||||
|
||||
|
||||
## Rules and paradigms
|
||||
|
||||
The sections above say which widget. These say what a screen is *for* —
|
||||
the calls that aren't visible from the API, learned the hard way from apps
|
||||
that used the right widgets and still came out wrong.
|
||||
|
||||
### The rail header is the app, not the page
|
||||
|
||||
The band at the top of a nav rail says whose app this is. It is never the
|
||||
current section's name — that's already the selected nav item, and saying it
|
||||
twice in the accent turns the header into a page title stuck in the wrong
|
||||
place.
|
||||
|
||||
- The app's name as a wordmark: all caps, the black cut (w900), default
|
||||
foreground. Not `primary`, not `.large()`.
|
||||
- One muted w600 line under it, `textXs`, and the wordmark sized so it's
|
||||
exactly as wide as that line (measure both, scale by the ratio, clamp).
|
||||
The hub's `GarageHeader(fillWidth: true)` is the reference.
|
||||
- The line under it is the app's *context* — the company for the hub, the
|
||||
stand you're working for an app bound to one. This is the one place a
|
||||
name is allowed in a subtitle-shaped line, because it's identity, not a
|
||||
heading.
|
||||
- The band is `railWidth / 2` tall, contents left-aligned and centred
|
||||
vertically in a `FittedBox(scaleDown)` so a long context line shrinks the
|
||||
pair rather than overflowing.
|
||||
- A full-width `Divider(color: panelBorder)` under it — the wordmark isn't a
|
||||
destination, so it's ruled off from the list, not sat in it.
|
||||
- A weight above `.extraBold()` isn't an extension. Go through
|
||||
`theme.typography.sansStyle(TextStyle(fontWeight: ...))` so the weight picks
|
||||
the font file; `copyWith(fontWeight:)` on the ambient style gets skia's fake
|
||||
bold.
|
||||
|
||||
|
||||
### A page breathes: the page frame owns its spacing
|
||||
|
||||
A page is a centred reading column: gutter either side, `gapXxl` above the
|
||||
`PageHeading`, **`gapXxl` under it**, `gapXxl` at the bottom. The gap under
|
||||
the heading is the biggest on the page on purpose: it separates "what page
|
||||
this is" from everything on it, so it must be bigger than any gap *between*
|
||||
things on the page (sections are `gapXxl` apart; nothing inside one is).
|
||||
|
||||
- Gutter: `fontSize * 3` beside a rail, `gapMd` on a phone (sections add
|
||||
their own `gapXs` on top). Cap at `density.contentMax`.
|
||||
- The heading gap belongs to whatever builds the page frame (the hub's shell,
|
||||
an app's page scaffold), not to each screen. Left to screens, every one
|
||||
picks its own `Gap.xl()` / `Gap.lg()` / nothing, and the pages stop lining
|
||||
up with each other.
|
||||
- So the first section heading under a page heading adds **no** space above
|
||||
itself, because the frame already put it there. Stacking both is how a gap
|
||||
comes out right on one screen and doubled on the next.
|
||||
- When in doubt, err roomy. `gapXl` under a title looks fine alone and
|
||||
cramped beside the hub.
|
||||
|
||||
|
||||
### Rule between sections, not just space
|
||||
|
||||
When a page is a stack of separate jobs (fill in the sheet, share it,
|
||||
check it), whitespace alone doesn't separate them. A heading after a big gap
|
||||
still reads as a continuation of the section above it, especially when that
|
||||
section ends in unboxed `SettingsRow`s. Put a rule between them.
|
||||
|
||||
- A full-width `Divider(color: divider)` across the reading column, sitting
|
||||
in the middle of the `gapXxl` before the next section heading. Not
|
||||
instead of the gap, and not tight under the heading.
|
||||
- *Between* sections only. None above the first (the page heading gap is
|
||||
already there) and none under the last. A rule with nothing after it is
|
||||
fencing off empty space.
|
||||
- It's part of the section heading, not something each screen drops in by
|
||||
hand, so the spacing either side is the same on every page.
|
||||
|
||||
|
||||
## Dont copy these
|
||||
|
||||
Known overrides in the reference apps. They're debt, not patterns.
|
||||
|
||||
Reference in New Issue
Block a user