production
This commit is contained in:
@@ -57,7 +57,21 @@ void main() {
|
||||
// One ground now, and everything on it inverts. The wash survives as
|
||||
// `milerGlassSurface()` for the sheets, which sit over content and still
|
||||
// want it.
|
||||
testWidgets('is solid brand, so every tab shares one chrome', (
|
||||
// ── The wash gave way to the brand, and the brand grew a gradient ──
|
||||
//
|
||||
// The four tabs wore a 7% frosted brand wash flattened against white while
|
||||
// Home wore solid brand, so switching tab changed the colour of the top
|
||||
// 76pt of the phone AND the colour of the status-bar glyphs — which reads
|
||||
// as arriving in a different app rather than a different page.
|
||||
//
|
||||
// One ground now. It is [kBrandGradient] rather than a flat fill: two stops
|
||||
// about eight per cent apart, enough that the bar reads as a surface with
|
||||
// light on it and not enough to be seen as a gradient. A colour cannot be a
|
||||
// gradient, so it rides as `flexibleSpace` — and the fill underneath stays
|
||||
// the brand red, so a bar that fails to paint its surface comes out the
|
||||
// right colour rather than transparent. Both halves are asserted, because
|
||||
// it is the pair that makes the fallback safe.
|
||||
testWidgets('is one brand ground, so every tab shares one chrome', (
|
||||
tester,
|
||||
) async {
|
||||
await pump(
|
||||
@@ -66,12 +80,23 @@ void main() {
|
||||
);
|
||||
|
||||
final bar = tester.widget<AppBar>(find.byType(AppBar));
|
||||
expect(bar.backgroundColor, ColorConstants.primary);
|
||||
expect(
|
||||
bar.flexibleSpace,
|
||||
isNull,
|
||||
reason: 'a solid ground needs no surface layered over it',
|
||||
);
|
||||
// ── The fill is transparent, and the surface paints ──
|
||||
//
|
||||
// It was the brand as a safety net behind [kBrandGradient]. It cannot be
|
||||
// one now: the bar's bottom corners are rounded so the page shows through
|
||||
// them (see [milerBrandSurface]), and an opaque rectangle behind a
|
||||
// rounded surface fills in exactly the two corners the curve exists to
|
||||
// open. What must hold is that the bar still *renders* the brand, which
|
||||
// is the gradient assertion below.
|
||||
expect(bar.backgroundColor, Colors.transparent);
|
||||
expect(bar.flexibleSpace, isNotNull);
|
||||
|
||||
final painted = tester
|
||||
.widgetList<DecoratedBox>(find.byType(DecoratedBox))
|
||||
.map((d) => d.decoration)
|
||||
.whereType<BoxDecoration>()
|
||||
.where((d) => d.gradient == kBrandGradient);
|
||||
expect(painted, isNotEmpty, reason: 'the bar does not wear the brand');
|
||||
});
|
||||
|
||||
testWidgets('inverts everything drawn on it', (tester) async {
|
||||
@@ -106,9 +131,10 @@ void main() {
|
||||
const Scaffold(appBar: MilerAppBar(title: 'Activity')),
|
||||
);
|
||||
|
||||
// The wash is a surface, and a surface against an untinted page is
|
||||
// already an edge. A hairline under it drew that boundary a second time —
|
||||
// the same doubled-up border this app has been pulling out of its cards.
|
||||
// The brand ground is a surface, and a surface against an untinted page
|
||||
// is already an edge. A hairline under it drew that boundary a second
|
||||
// time — the same doubled-up border this app has been pulling out of its
|
||||
// cards.
|
||||
final bar = tester.widget<AppBar>(find.byType(AppBar));
|
||||
expect(bar.bottom, isNull);
|
||||
});
|
||||
@@ -140,25 +166,17 @@ void main() {
|
||||
);
|
||||
|
||||
final bar = tester.widget<AppBar>(find.byType(AppBar));
|
||||
expect(bar.backgroundColor, ColorConstants.primary);
|
||||
expect(bar.flexibleSpace, isNull);
|
||||
// ── The fill is transparent, and the surface paints ──
|
||||
//
|
||||
// It was the brand as a safety net behind [kBrandGradient]. It cannot be
|
||||
// one now: the bar's bottom corners are rounded so the page shows through
|
||||
// them (see [milerBrandSurface]), and an opaque rectangle behind a
|
||||
// rounded surface fills in exactly the two corners the curve exists to
|
||||
// open. What must hold is that the bar still *renders* the brand, which
|
||||
// is the gradient assertion below.
|
||||
expect(bar.backgroundColor, Colors.transparent);
|
||||
expect(bar.flexibleSpace, isNotNull);
|
||||
expect(bar.bottom, isNull, reason: 'no rule under the bar here either');
|
||||
});
|
||||
});
|
||||
|
||||
// The wash survives as `milerGlassSurface()`, which the SHEETS use — they sit
|
||||
// over scrolling content and genuinely want a translucent surface, where a
|
||||
// bar sits over nothing and does not. This still pins what the wash has to
|
||||
// be, wherever it is used.
|
||||
test('the wash is a brand tint light enough to carry near-black type', () {
|
||||
// Flattened against white, which is what the sheets composite it over.
|
||||
final flat = Color.alphaBlend(ColorConstants.glassRed, Colors.white);
|
||||
expect(
|
||||
flat.computeLuminance(),
|
||||
greaterThan(0.85),
|
||||
reason:
|
||||
'a saturated red surface would force white text onto a mid-tone '
|
||||
'red, the weakest contrast pairing in the palette',
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user