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:
ImBenji
2026-10-09 15:21:48 +01:00
co-authored by Claude Opus 5
parent b5e5ed5b75
commit 7aa5cb8f8b
7 changed files with 276 additions and 23 deletions
+85
View File
@@ -0,0 +1,85 @@
import "package:flutter/widgets.dart";
import "surface.dart";
import "theme/garage_theme.dart";
import "theme/theme_data.dart";
/// The heading a page wears above its content.
///
/// The name a step up, a muted line under it saying what youre looking at,
/// both left aligned on the same margin as whatever follows. Promoted out of
/// the hub, where it was drawn over every section, because A&A's licence page
/// wanted the same thing and a lookalike drifts from the real one within a day
/// of being written.
///
/// Its a heading, not a bar - nothing chrome coloured, no rule under it, no
/// height of its own beyond what the two lines need. A pane that wants a strip
/// across the top of it wants [ChromeBar] instead.
class PageHeading extends StatelessWidget {
/// How tall this comes out, for a page that needs to know what room is
/// left under it.
///
/// Derived rather than measured: title on [Density.textLg] over a subtitle
/// on the ambient font, both on Geist's own line box, with a gapXs between.
/// A layout that has to wait for a frame to find this out cant use it on
/// the frame it needs it.
static double heightIn(Density d) =>
(d.textLg * Density.geistLineRatio).roundToDouble() +
d.gapXs +
(d.fontSize * Density.geistLineRatio).roundToDouble();
const PageHeading({
required this.title,
this.subtitle,
this.trailing,
super.key,
});
final String title;
final String? subtitle;
/// Sits at the far end of the heading, vertically centred on the whole
/// block rather than on the title line.
///
/// For the one action that belongs to the SUBJECT rather than to a section
/// of it - Disconnect on an agent, and the like.
final Widget? trailing;
@override
Widget build(BuildContext context) {
final theme = GarageTheme.of(context);
final density = theme.density;
final heading = Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(title, style: theme.typography.normal).large(),
if (subtitle != null) ...[
const Gap.xs(),
Text(
subtitle!,
style: TextStyle(color: theme.colorScheme.mutedForeground),
),
],
],
);
// Nudged in by gapXs: thats the side margin a PropertiesSection carries on
// itself, and without it a heading starts LEFT of the sections it
// introduces - the sort of thing you cant unsee once youve seen it.
return Padding(
padding: EdgeInsets.symmetric(horizontal: density.gapXs),
child: trailing == null
? heading
: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(child: heading),
Gap(density.gapMd),
trailing!,
],
),
);
}
}