Merge branch 'worktree-agent-a82ec5e9fdf8ca159' into integrate/gaps-e

# Conflicts:
#	app/test/features/search/search_bar_layout_test.dart
This commit is contained in:
2026-10-31 04:31:13 +00:00
31 changed files with 1348 additions and 395 deletions
@@ -124,17 +124,15 @@ class _SchedulesDestinationState extends State<SchedulesDestination> {
),
],
);
// The page reaches its top edge: the search strip floats under the bar
// and the list scrolls behind both.
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: bar,
child: SafeArea(child: body),
child: SafeArea(top: false, bottom: false, child: body),
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: SafeArea(left: false, right: false, bottom: false, child: body),
);
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body);
}
Widget _body(bool cupertino) {
+26 -16
View File
@@ -8,7 +8,10 @@ import '../features/templates/ui/template_detail.dart'
import '../shell/destination.dart';
import '../shell/shell_bar.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/floating_bar_layout.dart';
import '../ui/adaptive/segmented_bar.dart';
import '../ui/adaptive/top_bar_notices.dart';
import '../ui/theme/app_theme.dart';
import 'app_session.dart';
import 'connection_status.dart';
import 'server_endpoint.dart';
@@ -76,16 +79,22 @@ class _TemplatesDestinationState extends State<TemplatesDestination> {
listenable: _bar,
builder: (context, _) => _segmentedBar(cupertino),
);
// The page reaches its top edge: the gallery and an open template scroll
// behind the bar and pad their own content by its height.
final page = SafeArea(top: false, bottom: false, child: body);
if (cupertino) {
// Inset-grouped rows on the grouped background, as in Settings; the
// bar's scrim takes the same colour.
return CupertinoPageScaffold(
backgroundColor: AppColors.groupedBackground,
navigationBar: _BarSlot(cupertino: true, child: bar),
child: SafeArea(child: body),
child: page,
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: _BarSlot(cupertino: false, child: bar),
body: SafeArea(child: body),
body: page,
);
}
@@ -113,25 +122,26 @@ class _TemplatesDestinationState extends State<TemplatesDestination> {
Widget _body(bool cupertino) {
final session = widget.session;
if (!session.everConnected) {
return ConnectionGate(
session: session,
server: widget.server,
cupertino: cupertino,
return BelowTopBar(
child: ConnectionGate(
session: session,
server: widget.server,
cupertino: cupertino,
),
);
}
return Column(
children: [
// A connection banner stays below the bar; the gallery keeps its place.
return TopBarNotices(
notices: [
if (!session.connected)
ConnectionBanner(session: session, cupertino: cupertino),
Expanded(
child: TemplatesScreen(
gateway: session.gateway,
embedded: true,
onCreated: widget.onCreated,
initialKey: widget.initialKey,
),
),
],
child: TemplatesScreen(
gateway: session.gateway,
embedded: true,
onCreated: widget.onCreated,
initialKey: widget.initialKey,
),
);
}
}
@@ -36,11 +36,12 @@ Widget buildCupertinoRunDetail({
configuredEndpoint: configuredEndpoint,
initialStageKey: initialStageKey,
initialVisit: initialVisit,
// A glass strip under the top bar: as wide as its content.
header: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 0),
padding: const EdgeInsetsDirectional.fromSTEB(12, 4, 12, 4),
child: Wrap(
spacing: 12,
runSpacing: 4,
@@ -68,7 +69,7 @@ class _CupertinoNotice extends StatelessWidget {
@override
Widget build(BuildContext context) => Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
padding: const EdgeInsetsDirectional.fromSTEB(12, 0, 12, 8),
child: Semantics(liveRegion: true, child: Text(text)),
);
}
@@ -37,11 +37,12 @@ Widget buildMaterialRunDetail({
configuredEndpoint: configuredEndpoint,
initialStageKey: initialStageKey,
initialVisit: initialVisit,
// A glass strip under the top bar: as wide as its content.
header: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
padding: const EdgeInsets.fromLTRB(12, 4, 12, 4),
child: Wrap(
spacing: 12,
runSpacing: 4,
@@ -68,7 +69,7 @@ class _Notice extends StatelessWidget {
@override
Widget build(BuildContext context) => Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: const EdgeInsets.fromLTRB(12, 0, 12, 8),
child: Semantics(liveRegion: true, child: Text(text)),
);
}
+58 -64
View File
@@ -1,5 +1,6 @@
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../ui/adaptive/top_glass_strip.dart';
import 'dart:math' as math;
import 'package:flutter/cupertino.dart';
@@ -29,8 +30,9 @@ import 'run_search_selection.dart';
/// reserve keeps its bounded canvas positive at 320px with 2x text.
const double kRunDetailMinContentHeight = 240;
/// The run detail's tabbed body: the host-built header above the bounded
/// selected tab, with the floating tab bar over the bottom of the tab.
/// The run detail's tabbed body: the selected tab fills the detail and
/// scrolls behind the top bar, the host-built header (a glass strip just
/// under the bar) and the floating tab bar.
///
/// The Graph tab fills its slot with [RunGraphView] from the run's own pinned
/// graph and recorded steps. A visited stage click selects that stage's latest
@@ -54,7 +56,7 @@ class RunDetailTabs extends StatefulWidget {
final JsonMap run;
/// The host's own header: identity, status and the run actions. It stays
/// The host's own header: status, the run actions and notices. It floats
/// outside the tab body, so switching tabs never drops an action.
final Widget header;
@@ -297,35 +299,25 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
onClose: () => Navigator.of(pageContext).pop(),
)
: const Center(child: Text('This visit is no longer recorded.'));
// The pane names the visit; the bar names the run it belongs to.
final title = detailTitle(run);
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: SegmentedBar(
cupertino: true,
leading: SegmentedBackButton(
key: const Key('run-visit-back'),
cupertino: true,
onPressed: () => Navigator.of(pageContext).pop(),
),
title: title,
),
child: SafeArea(child: pane),
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(
cupertino: false,
leading: SegmentedBackButton(
key: const Key('run-visit-back'),
cupertino: false,
onPressed: () => Navigator.of(pageContext).pop(),
),
title: title,
// The bar names the stage over its visit and run, so the body
// repeats neither; the sections scroll behind it.
final known = index < visits.length;
final bar = SegmentedBar(
cupertino: cupertino,
leading: SegmentedBackButton(
key: const Key('run-visit-back'),
cupertino: cupertino,
onPressed: () => Navigator.of(pageContext).pop(),
),
body: SafeArea(child: pane),
title: known ? visits[index].stage : detailTitle(run),
titleKey: const Key('run-visit-title'),
subtitle: known ? runVisitSubtitle(run, visits[index]) : null,
);
final body = SafeArea(top: false, bottom: false, child: pane);
if (cupertino) {
return CupertinoPageScaffold(navigationBar: bar, child: body);
}
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body);
},
);
final route = cupertino
@@ -368,42 +360,41 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
return LayoutBuilder(
builder: (context, constraints) {
final headerLimit = _headerLimit(constraints);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// The header (status, actions, notices) starts below the floating
// top bar; the tab body below it no longer sees the bar's height.
ConstrainedBox(
// The header (status, actions, notices) is a glass strip floating
// just under the top bar, so every tab scrolls behind both and pads
// its first item clear of them at rest. Below it, the tabs float over
// the tab, at its bottom on a page or at its top beside a list, and
// the tab learns their height as its padding on that edge too. Every
// tab gets the whole height: the scrolling tabs own their content and
// the Graph tab fills the slot, so its canvas is never asked for an
// unbounded extent.
return FloatingBarOverlay(
edge: FloatingBarEdge.top,
bar: TopGlassStrip(
key: const Key('run-detail-header'),
cupertino: widget.cupertino,
padding: const EdgeInsets.symmetric(vertical: 4),
child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: headerLimit),
child: SingleChildScrollView(
key: ValueKey('run-detail-header-${widget.run['id']}'),
padding: EdgeInsets.only(top: topBarInset(context)),
child: widget.header,
),
),
// Every tab gets the bounded remaining height. The scrolling tabs
// own their content; the Graph tab fills the slot so its canvas is
// never asked for an unbounded extent. The tabs float over the
// tab, at its bottom on a page or at its top beside a list, and
// the tab learns their height as its padding on that edge.
Expanded(
key: ValueKey('run-detail-body-${widget.run['id']}'),
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: FloatingBarOverlay(
edge: edge,
bar: RunDetailTabStrip(
tabs: tabs,
edge: edge,
selected: shown,
onSelected: (tab) => setState(() => _tab = tab),
),
child: _body(shown),
),
),
child: KeyedSubtree(
key: ValueKey('run-detail-body-${widget.run['id']}'),
child: FloatingBarOverlay(
edge: edge,
bar: RunDetailTabStrip(
tabs: tabs,
edge: edge,
selected: shown,
onSelected: (tab) => setState(() => _tab = tab),
),
child: _body(shown),
),
],
),
);
},
);
@@ -429,12 +420,15 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
),
);
case RunDetailTab.graph:
return RunGraphView(
key: const Key('run-detail-graph'),
graph: detailGraph(widget.run),
run: widget.run,
selectedStage: _selectedStage,
onStageSelected: _openStage,
// A canvas with its own overlay controls starts below the header.
return BelowTopBar(
child: RunGraphView(
key: const Key('run-detail-graph'),
graph: detailGraph(widget.run),
run: widget.run,
selectedStage: _selectedStage,
onStageSelected: _openStage,
),
);
case RunDetailTab.input:
return runDetailFieldTab(
+36 -208
View File
@@ -1,20 +1,14 @@
import '../../../ui/status/run_status_icon.dart';
import '../../graph/widgets/graph_stage_node.dart' show graphStatusState;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/adaptive/host.dart';
import 'run_detail_content.dart';
import 'run_detail_visit_facts.dart';
import 'run_detail_visit_facts_view.dart';
import 'run_detail_visit_sections.dart';
/// The selected recorded visit inside the Timeline tab.
///
/// It leads with the visit's own headline facts, then native tabbed sections.
/// A fact the reply did not record is not drawn at all; a blank verdict or
/// diagnostic is not rendered as an empty decision.
/// The selected recorded visit's page body: its sections under floating
/// tabs. The page's bar carries the stage and its coordinates
/// ([runVisitSubtitle]); the Summary section leads with the visit's facts.
class RunVisitPane extends StatefulWidget {
const RunVisitPane({
super.key,
@@ -68,208 +62,42 @@ class _RunVisitPaneState extends State<RunVisitPane> {
@override
Widget build(BuildContext context) {
final style = _VisitStyle.of(context);
final facts = detailVisitFacts(widget.step);
final verdict = detailVisitVerdict(widget.step);
final diagnostic = detailVisitDiagnostic(widget.step);
// The facts take what they need, up to 40% of the height (then scroll);
// the section fills everything else, so the tabs always end at the
// bottom of the screen however short the facts or the section are.
return LayoutBuilder(
builder: (context, constraints) => Column(
key: const Key('run-visit-pane'),
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ConstrainedBox(
constraints: BoxConstraints(maxHeight: constraints.maxHeight * 0.4),
child: SingleChildScrollView(
key: const Key('run-visit-facts'),
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_bar(style),
_FactGrid(facts: facts, style: style),
if (verdict != null) ...[
const SizedBox(height: 8),
Text('Verdict', style: style.heading),
if (verdict.option != null) Text(verdict.option!),
if (verdict.reason != null)
Text(verdict.reason!, style: style.value),
],
if (diagnostic != null) ...[
const SizedBox(height: 8),
Text('Diagnostic', style: style.heading),
Text(diagnostic, style: style.value),
],
],
),
),
),
// The sections are floating tabs over the bottom of what they
// show; the section learns their height as bottom padding.
Expanded(
child: FloatingBarOverlay(
bar: RunVisitSectionStrip(
selected: _section,
onSelected: (section) => setState(() => _section = section),
),
child: runVisitSectionBody(
section: _section,
run: widget.run,
step: widget.step,
visitIndex: widget.visitIndex,
stageKey: widget.visit.stage,
runSteps: widget.runSteps,
gateway: widget.gateway,
onRunChanged: widget.onRunChanged,
configuredEndpoint: widget.configuredEndpoint,
cupertino: widget.cupertino,
),
),
),
],
),
);
}
/// Keep stage identity visually distinct from the visit/run coordinates.
/// Back is the page bar's; this heading is the selected recorded stage.
Widget _bar(_VisitStyle style) {
final runId = '${widget.run['id'] ?? ''}'.trim();
return Padding(
padding: const EdgeInsetsDirectional.fromSTEB(0, 8, 0, 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Semantics(
container: true,
header: true,
identifier: 'run-stage-heading',
child: Text(
widget.visit.stage,
key: const Key('run-visit-title'),
style: style.stageTitle,
softWrap: true,
),
),
const SizedBox(height: 4),
Wrap(
spacing: 12,
runSpacing: 4,
children: [
if (widget.visit.sequence != null)
Text('Visit ${widget.visit.sequence}', style: style.muted),
if (runId.isNotEmpty) Text('Run $runId', style: style.muted),
],
),
],
),
);
}
}
/// The visit's facts several to a line: status and outcome as coloured
/// pills, a long value (the model) on a line of its own.
class _FactGrid extends StatelessWidget {
const _FactGrid({required this.facts, required this.style});
final List<VisitFact> facts;
final _VisitStyle style;
static String _stateOf(VisitFact fact) {
final value = fact.value.trim().toLowerCase();
if (fact.label == 'Outcome') {
if (value == 'error' || value == 'failed' || value == 'blocked') {
return 'failed';
}
if (value == 'success') return 'succeeded';
return 'running';
}
return graphStatusState(fact.value);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 4),
child: Wrap(
key: const Key('run-visit-facts-grid'),
spacing: 16,
runSpacing: 8,
children: [
for (final fact in facts)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(fact.label, style: style.muted),
const SizedBox(height: 2),
if (fact.label == 'Status' || fact.label == 'Outcome')
_pill(context, fact)
else
Text(fact.value, style: style.value),
],
),
],
),
);
}
Widget _pill(BuildContext context, VisitFact fact) {
final color = runStatusColor(_stateOf(fact)).resolveFrom(context);
return DecoratedBox(
decoration: ShapeDecoration(
color: color.withValues(alpha: 0.16),
shape: const StadiumBorder(),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
child: Text(
fact.value,
style: style.value.copyWith(
color: color,
fontWeight: FontWeight.w700,
),
// The section fills the page and scrolls behind the page's top bar (which
// names the stage and its visit) and the floating tabs, padding its
// content clear of both at rest. Summary leads with the visit's facts.
return KeyedSubtree(
key: const Key('run-visit-pane'),
child: FloatingBarOverlay(
bar: RunVisitSectionStrip(
selected: _section,
onSelected: (section) => setState(() => _section = section),
),
child: runVisitSectionBody(
section: _section,
run: widget.run,
step: widget.step,
visitIndex: widget.visitIndex,
stageKey: widget.visit.stage,
runSteps: widget.runSteps,
gateway: widget.gateway,
onRunChanged: widget.onRunChanged,
configuredEndpoint: widget.configuredEndpoint,
cupertino: widget.cupertino,
facts: RunVisitFactsView(step: widget.step),
),
),
);
}
}
/// Host text roles only: no palette, font family or explicit size.
class _VisitStyle {
const _VisitStyle({
required this.value,
required this.muted,
required this.heading,
required this.stageTitle,
});
factory _VisitStyle.of(BuildContext context) {
if (usesCupertinoHost(context)) {
final theme = CupertinoTheme.of(context);
final secondary = CupertinoColors.secondaryLabel.resolveFrom(context);
return _VisitStyle(
value: theme.textTheme.textStyle,
muted: theme.textTheme.textStyle.copyWith(color: secondary),
heading: theme.textTheme.navTitleTextStyle,
stageTitle: theme.textTheme.navLargeTitleTextStyle,
);
}
final theme = Theme.of(context);
return _VisitStyle(
value: theme.textTheme.bodyMedium ?? const TextStyle(),
muted: (theme.textTheme.bodySmall ?? const TextStyle()).copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
heading: theme.textTheme.titleSmall ?? const TextStyle(),
stageTitle: theme.textTheme.headlineSmall ?? const TextStyle(),
);
}
final TextStyle value;
final TextStyle muted;
final TextStyle heading;
final TextStyle stageTitle;
/// The page bar's subtitle for a recorded visit: its sequence, then the run
/// it belongs to (`Visit 2 · Run 7 · Nightly report`).
String runVisitSubtitle(JsonMap run, DetailVisit visit) {
final runId = '${run['id'] ?? ''}'.trim();
final title = detailTitle(run);
return [
if (visit.sequence != null) 'Visit ${visit.sequence}',
if (runId.isNotEmpty) 'Run $runId',
if (title.isNotEmpty && title != 'Run $runId') title,
].join(' · ');
}
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../graph/widgets/stage_definition_view.dart';
import 'run_detail_content.dart';
import 'run_detail_visit_facts.dart';
@@ -26,7 +27,7 @@ class RunVisitDefinition extends StatelessWidget {
if (!detailVisitHasDefinition(graph, stageKey)) {
return ListView(
key: const Key('run-visit-body-definition'),
padding: const EdgeInsets.all(16),
padding: withBarClearance(context, const EdgeInsets.all(16)),
children: const [Text(unknownStageDefinition)],
);
}
@@ -0,0 +1,150 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/status/run_status_icon.dart';
import '../../graph/widgets/graph_stage_node.dart' show graphStatusState;
import 'run_detail_visit_facts.dart';
/// A recorded visit's facts, verdict and diagnostic: the head of the stage
/// page's Summary, scrolling with it behind the top bar. The stage and its
/// coordinates are the page bar's title and subtitle, so they are not
/// repeated here. A fact the reply did not record is not drawn at all; a
/// blank verdict or diagnostic is not rendered as an empty decision.
class RunVisitFactsView extends StatelessWidget {
const RunVisitFactsView({super.key, required this.step});
final JsonMap step;
@override
Widget build(BuildContext context) {
final style = _VisitStyle.of(context);
final facts = detailVisitFacts(step);
final verdict = detailVisitVerdict(step);
final diagnostic = detailVisitDiagnostic(step);
return Padding(
key: const Key('run-visit-facts'),
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 12),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_FactGrid(facts: facts, style: style),
if (verdict != null) ...[
const SizedBox(height: 8),
Text('Verdict', style: style.heading),
if (verdict.option != null) Text(verdict.option!),
if (verdict.reason != null)
Text(verdict.reason!, style: style.value),
],
if (diagnostic != null) ...[
const SizedBox(height: 8),
Text('Diagnostic', style: style.heading),
Text(diagnostic, style: style.value),
],
],
),
);
}
}
/// The visit's facts several to a line: status and outcome as coloured
/// pills, a long value (the model) on a line of its own.
class _FactGrid extends StatelessWidget {
const _FactGrid({required this.facts, required this.style});
final List<VisitFact> facts;
final _VisitStyle style;
static String _stateOf(VisitFact fact) {
final value = fact.value.trim().toLowerCase();
if (fact.label == 'Outcome') {
if (value == 'error' || value == 'failed' || value == 'blocked') {
return 'failed';
}
if (value == 'success') return 'succeeded';
return 'running';
}
return graphStatusState(fact.value);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 4),
child: Wrap(
key: const Key('run-visit-facts-grid'),
spacing: 16,
runSpacing: 8,
children: [
for (final fact in facts)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(fact.label, style: style.muted),
const SizedBox(height: 2),
if (fact.label == 'Status' || fact.label == 'Outcome')
_pill(context, fact)
else
Text(fact.value, style: style.value),
],
),
],
),
);
}
Widget _pill(BuildContext context, VisitFact fact) {
final color = runStatusColor(_stateOf(fact)).resolveFrom(context);
return DecoratedBox(
decoration: ShapeDecoration(
color: color.withValues(alpha: 0.16),
shape: const StadiumBorder(),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
child: Text(
fact.value,
style: style.value.copyWith(
color: color,
fontWeight: FontWeight.w700,
),
),
),
);
}
}
/// Host text roles only: no palette, font family or explicit size.
class _VisitStyle {
const _VisitStyle({
required this.value,
required this.muted,
required this.heading,
});
factory _VisitStyle.of(BuildContext context) {
if (usesCupertinoHost(context)) {
final theme = CupertinoTheme.of(context);
final secondary = CupertinoColors.secondaryLabel.resolveFrom(context);
return _VisitStyle(
value: theme.textTheme.textStyle,
muted: theme.textTheme.textStyle.copyWith(color: secondary),
heading: theme.textTheme.navTitleTextStyle,
);
}
final theme = Theme.of(context);
return _VisitStyle(
value: theme.textTheme.bodyMedium ?? const TextStyle(),
muted: (theme.textTheme.bodySmall ?? const TextStyle()).copyWith(
color: theme.colorScheme.onSurfaceVariant,
),
heading: theme.textTheme.titleSmall ?? const TextStyle(),
);
}
final TextStyle value;
final TextStyle muted;
final TextStyle heading;
}
@@ -111,6 +111,7 @@ Widget runVisitSectionBody({
required ValueChanged<JsonMap> onRunChanged,
required String configuredEndpoint,
required bool cupertino,
Widget? facts,
}) {
Widget body(RunVisitSection section) => runVisitSectionBody(
section: section,
@@ -132,6 +133,7 @@ Widget runVisitSectionBody({
input: step['input'],
output: step['output'],
cupertino: cupertino,
facts: facts,
);
case RunVisitSection.more:
return body(RunVisitSection.session);
@@ -164,12 +166,15 @@ Widget runVisitSectionBody({
steps: [step],
showSummary: false,
);
return cupertino
? Builder(
builder: (context) =>
Theme(data: hostTextTheme(context), child: viewer),
)
: viewer;
// The viewer's own header leads it, so it starts below the bar.
return BelowTopBar(
child: cupertino
? Builder(
builder: (context) =>
Theme(data: hostTextTheme(context), child: viewer),
)
: viewer,
);
case RunVisitSection.session:
return RunVisitSession(
run: run,
@@ -189,12 +194,16 @@ class _VisitSummary extends StatefulWidget {
required this.input,
required this.output,
required this.cupertino,
this.facts,
});
final dynamic input;
final dynamic output;
final bool cupertino;
/// The visit's facts, leading the scroll below the top bar.
final Widget? facts;
@override
State<_VisitSummary> createState() => _VisitSummaryState();
}
@@ -251,6 +260,10 @@ class _VisitSummaryState extends State<_VisitSummary> {
Widget build(BuildContext context) => CustomScrollView(
key: const Key('run-visit-body-summary'),
slivers: [
// Starts below the page's bar and scrolls behind it; the sticky
// sections pin just below the bar.
const SliverTopBarClearance(),
if (widget.facts case final facts?) SliverToBoxAdapter(child: facts),
_section('Input', widget.input, visitEmptyInput),
_section('Output', widget.output, visitEmptyOutput),
const SliverFloatingBarClearance(),
@@ -134,7 +134,7 @@ class _RunVisitSessionState extends State<RunVisitSession> {
}
return ListView(
key: const Key('run-visit-body-session'),
padding: withFloatingBarClearance(context, const EdgeInsets.all(16)),
padding: withBarClearance(context, const EdgeInsets.all(16)),
children: _spaced(children),
);
}
@@ -36,8 +36,9 @@ class ScheduleRefreshAction extends StatelessWidget {
);
}
/// Search and the enabled filter; the refresh control too when no bar above
/// carries it ([onRefresh] null leaves it to the bar).
/// Search and the enabled filter, and the count; the refresh control too when
/// no bar above carries it ([onRefresh] null leaves it to the bar). The list
/// floats it as a glass strip under the page's bar.
class ScheduleListToolbar extends StatelessWidget {
const ScheduleListToolbar({
super.key,
@@ -55,14 +56,15 @@ class ScheduleListToolbar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
padding: const EdgeInsets.fromLTRB(12, 12, 12, 8),
child: _search(context),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row(
children: [
Expanded(
@@ -87,7 +89,7 @@ class ScheduleListToolbar extends StatelessWidget {
),
if (controller.hasLoaded)
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
padding: const EdgeInsets.fromLTRB(12, 8, 12, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -99,6 +101,7 @@ class ScheduleListToolbar extends StatelessWidget {
],
),
),
const SizedBox(height: 12),
],
);
}
@@ -1,6 +1,9 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../../ui/adaptive/floating_bar_layout.dart';
import '../../../../ui/adaptive/top_bar_notices.dart';
import '../../../../ui/adaptive/top_glass_strip.dart';
import '../../domain/saved_schedule.dart';
import 'schedule_list_controller.dart';
import 'schedule_list_row.dart';
@@ -8,9 +11,18 @@ import 'schedule_list_toolbar.dart';
const scheduleListKey = ValueKey<String>('schedule-list');
const scheduleRetryKey = ValueKey<String>('schedule-retry');
const scheduleToolbarKey = ValueKey<String>('schedule-toolbar');
/// The widest the search and filter strip grows on a wide window.
const double kScheduleToolbarMaxWidth = 720;
/// Platform-adaptive list body. It owns no navigation chrome; the shell frames
/// it as the Schedules destination.
///
/// Search, the filter and the count float as one glass strip just under the
/// page's top bar, and the list scrolls behind both: it pads its first row
/// clear of them at rest. The strip keeps its place whatever the list shows,
/// so typing a query that empties the list never drops the field's focus.
class SchedulesListView extends StatelessWidget {
const SchedulesListView({
super.key,
@@ -35,42 +47,44 @@ class SchedulesListView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Column(
children: [
ScheduleListToolbar(
return FloatingBarOverlay(
edge: FloatingBarEdge.top,
bar: TopGlassStrip(
key: scheduleToolbarKey,
cupertino: cupertino,
maxWidth: kScheduleToolbarMaxWidth,
padding: EdgeInsets.zero,
child: ScheduleListToolbar(
controller: controller,
searchController: searchController,
cupertino: cupertino,
onRefresh: refreshInToolbar ? onRefresh : null,
),
Expanded(child: _body(context)),
],
),
child: Builder(builder: _body),
);
}
Widget _body(BuildContext context) {
final failure = controller.failure;
if (failure != null && controller.schedules.isEmpty) {
return _failureState(context, failure);
return BelowTopBar(child: _failureState(context, failure));
}
if (controller.isInitialLoading) {
return BelowTopBar(child: _loadingState(context));
}
if (controller.isInitialLoading) return _loadingState(context);
if (controller.schedules.isEmpty) {
return _emptyState('No schedules yet.');
return BelowTopBar(child: _emptyState('No schedules yet.'));
}
final content = controller.visibleSchedules.isEmpty
? _emptyState(controller.emptyMessage)
: _list(context);
// The banner slot is always present so a failed or recovered refresh does
// not change the list's ancestors. Replacing the ListView would rebuild the
// Scrollable and drop the user's scroll offset.
return Column(
children: [
if (failure != null)
_failureBanner(context, failure)
else
const SizedBox.shrink(),
Expanded(child: content),
],
? BelowTopBar(child: _emptyState(controller.emptyMessage))
: Builder(builder: _list);
// A failed refresh shows under the strip without changing the list's
// ancestors: replacing the ListView would rebuild the Scrollable and drop
// the user's scroll offset.
return TopBarNotices(
notices: [if (failure != null) _failureBanner(context, failure)],
child: content,
);
}
@@ -79,7 +93,10 @@ class SchedulesListView extends StatelessWidget {
return ListView.builder(
key: scheduleListKey,
controller: scrollController,
padding: const EdgeInsets.only(top: 4, bottom: 24),
padding: withBarClearance(
context,
const EdgeInsets.only(top: 4, bottom: 24),
),
itemCount: schedules.length,
itemBuilder: (context, index) {
final schedule = schedules[index];
+12 -6
View File
@@ -14,10 +14,10 @@ import 'ui/search_bounds_note.dart';
import 'ui/search_result_view.dart';
/// Native omni-search over the Pipelines server: the search field, a compact
/// kind menu and the syntax help in the top bar's actions pill, and a flat
/// result list whose rows open the server's own target through [onOpen]. The
/// screen never mutates server state and never guesses a route for an unknown
/// or targetless hit.
/// kind menu and the syntax help as the top bar's main pill (no title), and a
/// flat result list whose rows open the server's own target through [onOpen].
/// The screen never mutates server state and never guesses a route for an
/// unknown or targetless hit.
class SearchScreen extends StatefulWidget {
const SearchScreen({
super.key,
@@ -95,12 +95,18 @@ class _SearchScreenState extends State<SearchScreen> {
if (!ShellBar.available(context)) {
return _body(cupertino, controls: _controls(cupertino));
}
return ShellBar(actions: [_controls(cupertino)], child: _body(cupertino));
// The field takes the title's place and fills the bar.
return ShellBar(
titleWidget: _controls(cupertino),
titleWidgetMaxWidth: kSearchPillMaxWidth,
child: _body(cupertino),
);
}
final bar = SegmentedBar(
cupertino: cupertino,
title: 'Search',
actions: [_controls(cupertino)],
titleWidget: _controls(cupertino),
titleWidgetMaxWidth: kSearchPillMaxWidth,
);
if (cupertino) {
return CupertinoPageScaffold(navigationBar: bar, child: _body(cupertino));
@@ -4,22 +4,25 @@ import 'package:flutter/material.dart';
import '../../../ui/input/app_search_field.dart';
import '../../../ui/navigation/bar_icon_button.dart';
import '../domain/search_models.dart';
import 'search_layout.dart';
const searchFieldKey = ValueKey<String>('search.field');
const searchKindKey = ValueKey<String>('search.kind');
const searchHelpKey = ValueKey<String>('search.help');
const searchBarControlsKey = ValueKey<String>('search.bar');
/// The widest the search pill grows on a wide window.
const double kSearchPillMaxWidth = 560;
/// The widest the search pill grows on a wide window: the result column's
/// width, so on a wide window the field and the results share both edges.
const double kSearchPillMaxWidth = kSearchContentMaxWidth;
const searchTokenHint =
'Filter with t:pipeline or type:artifact (pipeline, run, step, field, '
'artifact, version). Last type wins; choosing Kind replaces it. Quote '
'tokens to search literally.';
/// Search's controls as one piece of the top bar's actions pill: the search
/// field, a compact Kind menu and the query-syntax help behind an info button.
/// Search's controls as the top bar's main pill (in place of a title): the
/// search field filling the pill, a compact Kind menu and the query-syntax
/// help behind an info button.
class SearchBarControls extends StatelessWidget {
const SearchBarControls({
super.key,
@@ -47,9 +50,8 @@ class SearchBarControls extends StatelessWidget {
key: searchBarControlsKey,
constraints: const BoxConstraints(maxWidth: kSearchPillMaxWidth),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Flexible(
Expanded(
child: Padding(
padding: const EdgeInsetsDirectional.only(start: 4),
child: AppSearchField(
+13 -1
View File
@@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../core/transport/pipelines_client.dart' as transport;
import '../../shell/shell_bar.dart';
import '../attention/notify/notification_controller.dart';
import 'default_endpoint.dart';
import 'settings_controller.dart';
@@ -201,7 +202,18 @@ class _SettingsScreenState extends State<SettingsScreen> {
),
],
);
if (widget.embedded) return content;
if (widget.embedded) {
// Under the shell's bar the Cupertino page is the grouped background
// right up to the top edge: the bar's scrim takes the same colour, so
// no white band or seam shows above the groups.
if (usesCupertinoControls(context) && ShellBar.available(context)) {
return ShellBar(
backgroundColor: settingsCupertinoBackground,
child: content,
);
}
return content;
}
if (usesCupertinoControls(context)) {
return CupertinoPageScaffold(
backgroundColor: settingsCupertinoBackground,
+12 -10
View File
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
import '../../core/api_gateway.dart';
import '../../shell/shell_bar.dart';
import '../../ui/adaptive/host.dart';
import '../../ui/adaptive/top_bar_notices.dart';
import 'data/template_repository.dart';
import 'domain/template_entry.dart';
import 'ui/template_create_dialog.dart';
@@ -209,17 +210,18 @@ class _TemplatesScreenState extends State<TemplatesScreen> {
/// open template never hides a failed read. The rows and selection are kept.
Widget _withFailure(BuildContext context, Widget body) {
final error = _error;
if (error == null || !_loaded) return body;
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
TemplatesFailureBanner(
message: error,
retrying: _loading,
onRetry: () => unawaited(_load()),
),
Expanded(child: body),
// The banner stays put below the top bar; without it the body scrolls
// behind the bar. The body keeps its place either way.
return TopBarNotices(
notices: [
if (error != null && _loaded)
TemplatesFailureBanner(
message: error,
retrying: _loading,
onRetry: () => unawaited(_load()),
),
],
child: body,
);
}
}
@@ -5,6 +5,7 @@ import '../../../shell/shell_bar.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../ui/navigation/bar_icon_button.dart';
import '../../../ui/theme/app_theme.dart';
const templatesRefreshKey = ValueKey<String>('templates-refresh');
const templatesBackKey = ValueKey<String>('templates-back');
@@ -72,17 +73,16 @@ class TemplatesFrame extends StatelessWidget {
title: 'Templates',
actions: [_refreshButton()],
);
// The body reaches the top edge and scrolls behind the bar.
final page = SafeArea(top: false, bottom: false, child: body);
if (cupertino) {
return CupertinoPageScaffold(
backgroundColor: AppColors.groupedBackground,
navigationBar: bar,
child: SafeArea(child: body),
child: page,
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: SafeArea(child: body),
);
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: page);
}
Widget _refreshButton() => BarIconButton(
+6 -1
View File
@@ -211,6 +211,9 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
onPressed: onBack,
),
title: spec?.title ?? label,
titleWidget: spec?.titleWidget,
titleWidgetMaxWidth: spec?.titleWidgetMaxWidth ?? double.infinity,
backgroundColor: spec?.backgroundColor,
subtitle: spec?.subtitle,
subtitleIcon: spec?.subtitleIcon,
onTitlePressed: spec?.onTitlePressed,
@@ -228,7 +231,9 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
],
),
)
else if (onSearch != null)
// A screen whose main pill is its own field (Search) needs no
// separate Search action.
else if (onSearch != null && spec?.titleWidget == null)
cupertino
? CupertinoButton(
key: const ValueKey('shell.search'),
+25
View File
@@ -15,10 +15,22 @@ class ShellBarSpec {
this.onBack,
this.actions = const [],
this.barless = false,
this.titleWidget,
this.titleWidgetMaxWidth = double.infinity,
this.backgroundColor,
});
final String? title;
/// The bar's main pill in place of the title (a search field); see
/// `SegmentedBar.titleWidget`.
final Widget? titleWidget;
final double titleWidgetMaxWidth;
/// The page's own background behind the bar (a grouped list's), so the
/// bar's scrim matches what scrolls under it; null keeps the shell's.
final Color? backgroundColor;
/// A one-line subtitle in the title pill (the item's context: its
/// pipeline and version), so the body need not repeat it.
final String? subtitle;
@@ -130,9 +142,19 @@ class ShellBar extends StatefulWidget {
this.actions = const [],
this.active = true,
this.barless = false,
this.titleWidget,
this.titleWidgetMaxWidth = double.infinity,
this.backgroundColor,
required this.child,
});
/// See [ShellBarSpec.titleWidget].
final Widget? titleWidget;
final double titleWidgetMaxWidth;
/// See [ShellBarSpec.backgroundColor].
final Color? backgroundColor;
/// See [ShellBarSpec.barless].
final bool barless;
@@ -190,6 +212,9 @@ class _ShellBarState extends State<ShellBar> {
onBack: widget.onBack,
actions: widget.actions,
barless: widget.barless,
titleWidget: widget.titleWidget,
titleWidgetMaxWidth: widget.titleWidgetMaxWidth,
backgroundColor: widget.backgroundColor,
);
// The bar is above this screen; update it after this frame's build.
WidgetsBinding.instance.addPostFrameCallback((_) {
+36 -2
View File
@@ -18,6 +18,10 @@ export 'segmented_bar_pieces.dart' show SegmentedBackButton, SegmentedPill;
/// shrinks; only when the title is down to [minTitleShare] of the bar does
/// the first action ellipsise.
///
/// A page whose bar is mainly an input (Search) passes [titleWidget] instead:
/// it takes the title pill's place as one pill that fills the space beside
/// the leading piece (up to the widget's own width cap), with no title.
///
/// Only the pieces take taps: a tap between them reaches the content behind.
/// It works as a [Scaffold.appBar] (with `extendBodyBehindAppBar`) and a
/// [CupertinoPageScaffold.navigationBar], which inset the content by the
@@ -30,6 +34,8 @@ class SegmentedBar extends StatelessWidget
super.key,
required this.cupertino,
required this.title,
this.titleWidget,
this.titleWidgetMaxWidth = double.infinity,
this.leading,
this.automaticallyImplyLeading = true,
this.subtitle,
@@ -52,6 +58,16 @@ class SegmentedBar extends StatelessWidget
/// The title; empty shows no title pill unless there is a [subtitle].
final String title;
/// The bar's main pill when it is not a title: a search field and its
/// filters. It replaces the title pill (so [title], [subtitle] and
/// [onTitlePressed] are not drawn) and fills the width beside the leading
/// piece and any [actions], up to [titleWidgetMaxWidth].
final Widget? titleWidget;
/// The widest the [titleWidget] pill grows on a wide window; it starts at
/// the leading edge, so content below can line up with it.
final double titleWidgetMaxWidth;
/// The leading control, normally a [SegmentedBackButton].
final Widget? leading;
@@ -110,7 +126,10 @@ class SegmentedBar extends StatelessWidget
bool shouldFullyObstruct(BuildContext context) => false;
Color _background(BuildContext context) {
if (backgroundColor case final color?) return color;
if (backgroundColor case final color?) {
// A dynamic system colour (the grouped background) follows the theme.
return CupertinoDynamicColor.maybeResolve(color, context) ?? color;
}
if (cupertino) {
return context
.dependOnInheritedWidgetOfExactType<
@@ -148,7 +167,22 @@ class SegmentedBar extends StatelessWidget
child: Align(
alignment: AlignmentDirectional.centerStart,
heightFactor: 1,
child: showTitle
child: titleWidget != null
// The main pill fills the row, up to its cap.
? ConstrainedBox(
constraints: BoxConstraints(
maxWidth: titleWidgetMaxWidth,
),
child: SegmentedPill(
cupertino: cupertino,
fill: pillColor,
child: SizedBox(
width: double.infinity,
child: titleWidget,
),
),
)
: showTitle
? SegmentedTitlePill(
cupertino: cupertino,
title: title,
+56
View File
@@ -0,0 +1,56 @@
import 'package:flutter/widgets.dart';
import 'glass_pill.dart';
/// The corner radius of a [TopGlassStrip].
const double kTopGlassStripRadius = 22;
/// A page's own controls as one frosted piece floating just under its top
/// bar (a run's status and actions, a list's search and filter), so content
/// scrolls behind it as it does behind the bar.
///
/// Float it with `FloatingBarOverlay(edge: FloatingBarEdge.top)`: the strip
/// sits below the bar and the content's top padding grows by the strip's
/// height, so at rest nothing is hidden. It starts at the bar's 12px side
/// inset, is as wide as its content up to [maxWidth] (and the area), and is
/// only as tall as its content; the space beside it passes taps through.
class TopGlassStrip extends StatelessWidget {
const TopGlassStrip({
super.key,
required this.cupertino,
required this.child,
this.maxWidth = double.infinity,
this.padding = const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
});
final bool cupertino;
final Widget child;
/// The widest the strip grows on a wide window.
final double maxWidth;
/// Space between the strip's edge and [child].
final EdgeInsetsGeometry padding;
@override
Widget build(BuildContext context) {
final insets = MediaQuery.paddingOf(context);
return Padding(
padding: EdgeInsets.fromLTRB(12 + insets.left, 0, 12 + insets.right, 8),
child: Align(
alignment: AlignmentDirectional.topStart,
heightFactor: 1,
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxWidth),
child: GlassPill(
cupertino: cupertino,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(kTopGlassStripRadius),
),
child: Padding(padding: padding, child: child),
),
),
),
);
}
}