style(app): quiet section headings without bands or stripes

Review finding F4: section headings were a solid surfaceContainerHighest
band with a 3px accent stripe. They are now a muted grouped-list label
on the page background; pinned headings keep a light translucent scrim.
Implemented by pipeline run #201 (Code/Review on Terra); its UIReview
blocked on a stale probe, verified by the manager instead.
This commit is contained in:
2026-10-31 03:07:57 +00:00
parent ea0f22dfc7
commit edecc59bfc
3 changed files with 70 additions and 80 deletions
+35 -42
View File
@@ -3,9 +3,8 @@ import 'package:flutter/material.dart';
import '../adaptive/host.dart';
/// The look every section title shares, so it reads as a divider and not as
/// another row: a tinted strip with an accent bar, a bold title and a hairline
/// underneath.
/// The look every section title shares: a quiet, grouped-list label rather than
/// another filled row.
class SectionHeadingStyle {
const SectionHeadingStyle({
required this.background,
@@ -17,8 +16,7 @@ class SectionHeadingStyle {
final Color background;
/// The surface under a section's content: between the page and the title,
/// so the content reads as belonging to its section.
/// The page surface used behind pinned headings and section content.
final Color body;
final Color accent;
final TextStyle title;
@@ -28,27 +26,31 @@ class SectionHeadingStyle {
if (usesCupertinoHost(context)) {
final base = CupertinoTheme.of(context).textTheme.textStyle;
return SectionHeadingStyle(
background: CupertinoColors.tertiarySystemGroupedBackground.resolveFrom(
context,
),
body: CupertinoColors.secondarySystemGroupedBackground.resolveFrom(
background: CupertinoColors.systemGroupedBackground.resolveFrom(
context,
),
body: CupertinoColors.systemGroupedBackground.resolveFrom(context),
accent: CupertinoTheme.of(context).primaryColor,
title: base.copyWith(
fontWeight: FontWeight.w700,
color: CupertinoColors.label.resolveFrom(context),
fontSize: 13,
fontWeight: FontWeight.w600,
letterSpacing: 0.4,
color: CupertinoColors.secondaryLabel.resolveFrom(context),
),
line: CupertinoColors.separator.resolveFrom(context),
);
}
final scheme = Theme.of(context).colorScheme;
return SectionHeadingStyle(
background: scheme.surfaceContainerHighest,
body: scheme.surfaceContainerLow,
background: scheme.surface,
body: scheme.surface,
accent: scheme.primary,
title: (Theme.of(context).textTheme.titleSmall ?? const TextStyle())
.copyWith(fontWeight: FontWeight.w700, color: scheme.onSurface),
title: (Theme.of(context).textTheme.labelLarge ?? const TextStyle())
.copyWith(
fontWeight: FontWeight.w600,
letterSpacing: 0.4,
color: scheme.onSurfaceVariant,
),
line: scheme.outlineVariant,
);
}
@@ -76,34 +78,25 @@ class SectionHeading extends StatelessWidget {
@override
Widget build(BuildContext context) {
final style = SectionHeadingStyle.of(context);
return DecoratedBox(
decoration: BoxDecoration(
color: style.background,
border: Border(
left: BorderSide(color: style.accent, width: 3),
bottom: BorderSide(color: style.line, width: 0.5),
),
),
child: ConstrainedBox(
constraints: BoxConstraints(minHeight: minHeight),
child: Padding(
padding: padding,
child: Row(
children: [
if (leading != null) ...[leading!, const SizedBox(width: 8)],
Expanded(
child: Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: titleColor == null
? style.title
: style.title.copyWith(color: titleColor),
),
return ConstrainedBox(
constraints: BoxConstraints(minHeight: minHeight),
child: Padding(
padding: padding,
child: Row(
children: [
if (leading != null) ...[leading!, const SizedBox(width: 8)],
Expanded(
child: Text(
title,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: titleColor == null
? style.title
: style.title.copyWith(color: titleColor),
),
...trailing,
],
),
),
...trailing,
],
),
),
);
+17 -38
View File
@@ -92,7 +92,8 @@ class StickySectionTitle extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
// The shared section-title look: it reads as a divider, not a row.
// The shared section-title look is deliberately quiet, like a grouped-list
// label rather than a separate, filled row.
final heading = SectionHeadingStyle.of(context);
final muted = cupertino
? CupertinoColors.secondaryLabel.resolveFrom(context)
@@ -137,39 +138,32 @@ class StickySectionTitle extends StatelessWidget {
],
),
);
final decoration = BoxDecoration(
color: heading.background,
border: Border(
left: BorderSide(color: heading.accent, width: 3),
bottom: BorderSide(color: heading.line, width: 0.5),
),
);
// The whole strip opens and closes the section; its own buttons (copy)
// still take their taps first.
// The translucent page-colour scrim keeps this pinned heading readable as
// content moves underneath without returning to the old solid section band.
final scrim = heading.background.withValues(alpha: 0.94);
final Widget strip = cupertino
? GestureDetector(
behavior: HitTestBehavior.opaque,
excludeFromSemantics: true,
onTap: onToggle,
child: DecoratedBox(decoration: decoration, child: row),
child: ColoredBox(color: scrim, child: row),
)
: Material(
color: heading.background,
child: Ink(
decoration: decoration,
child: InkWell(
onTap: onToggle,
excludeFromSemantics: true,
child: row,
),
color: scrim,
child: InkWell(
onTap: onToggle,
excludeFromSemantics: true,
child: row,
),
);
return Stack(
clipBehavior: Clip.none,
fit: StackFit.expand,
children: [
// A few pixels of the title's colour above it: at fractional pixel
// ratios content scrolling under a pinned title could peek through.
// A few pixels of the page scrim above it prevent content peeking
// through at fractional pixel ratios.
Positioned(
left: 0,
right: 0,
@@ -183,8 +177,7 @@ class StickySectionTitle extends StatelessWidget {
}
}
/// A section's open content: its own surface, a faint continuation of the
/// title's accent, and room between the title and the first line.
/// A section's open content, with room between the heading and first line.
class _SectionBody extends StatelessWidget {
const _SectionBody({required this.child});
@@ -192,29 +185,15 @@ class _SectionBody extends StatelessWidget {
@override
Widget build(BuildContext context) {
final heading = SectionHeadingStyle.of(context);
final decoration = BoxDecoration(
color: heading.body,
border: Border(
left: BorderSide(
color: heading.accent.withValues(alpha: 0.35),
width: 3,
),
bottom: BorderSide(color: heading.line, width: 0.5),
),
);
final content = Padding(
padding: const EdgeInsets.only(top: 12, bottom: 4),
child: child,
);
if (usesCupertinoHost(context)) {
return DecoratedBox(decoration: decoration, child: content);
return content;
}
// Rows inside paint their ripples on this surface.
return Material(
color: heading.body,
child: Ink(decoration: decoration, child: content),
);
// Rows inside retain a Material ancestor for their ink reactions.
return Material(type: MaterialType.transparency, child: content);
}
}
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/layout/section_heading.dart';
import 'package:pipelines_app/ui/layout/sticky_section.dart';
class _Host extends StatefulWidget {
@@ -61,4 +62,21 @@ void main() {
await tester.pumpAndSettle();
expect(find.text('line 0'), findsNothing);
});
testWidgets('section headings use a quiet label without a filled band', (
tester,
) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(body: SectionHeading(title: 'Today')),
),
);
final heading = tester.widget<Text>(find.text('Today'));
final scheme = Theme.of(tester.element(find.text('Today'))).colorScheme;
expect(heading.style!.color, scheme.onSurfaceVariant);
expect(heading.style!.fontWeight, FontWeight.w600);
expect(heading.style!.letterSpacing, 0.4);
expect(find.byType(DecoratedBox), findsNothing);
});
}