Files
pipelines/app/lib/ui/layout/section_heading.dart
T
alan edecc59bfc 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.
2026-10-31 03:07:57 +00:00

105 lines
3.0 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../adaptive/host.dart';
/// The look every section title shares: a quiet, grouped-list label rather than
/// another filled row.
class SectionHeadingStyle {
const SectionHeadingStyle({
required this.background,
required this.body,
required this.accent,
required this.title,
required this.line,
});
final Color background;
/// The page surface used behind pinned headings and section content.
final Color body;
final Color accent;
final TextStyle title;
final Color line;
static SectionHeadingStyle of(BuildContext context) {
if (usesCupertinoHost(context)) {
final base = CupertinoTheme.of(context).textTheme.textStyle;
return SectionHeadingStyle(
background: CupertinoColors.systemGroupedBackground.resolveFrom(
context,
),
body: CupertinoColors.systemGroupedBackground.resolveFrom(context),
accent: CupertinoTheme.of(context).primaryColor,
title: base.copyWith(
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.surface,
body: scheme.surface,
accent: scheme.primary,
title: (Theme.of(context).textTheme.labelLarge ?? const TextStyle())
.copyWith(
fontWeight: FontWeight.w600,
letterSpacing: 0.4,
color: scheme.onSurfaceVariant,
),
line: scheme.outlineVariant,
);
}
}
/// A section title strip: [title], then any [trailing] controls.
class SectionHeading extends StatelessWidget {
const SectionHeading({
super.key,
required this.title,
this.leading,
this.trailing = const [],
this.titleColor,
this.padding = const EdgeInsetsDirectional.only(start: 12, end: 8),
this.minHeight = 40,
});
final String title;
final Widget? leading;
final List<Widget> trailing;
final Color? titleColor;
final EdgeInsetsGeometry padding;
final double minHeight;
@override
Widget build(BuildContext context) {
final style = SectionHeadingStyle.of(context);
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,
],
),
),
);
}
}