fix(app): float content behind top bars and give each wide pane its own bar row

- Top-bar clearance helpers (withTopBarClearance, withBarClearance,
  SliverTopBarClearance, BelowTopBar, TopBarNotices); shell, DetailPane and
  the runs/pipelines/templates/artifacts/stage definition/filter/usage pages
  drop their top SafeArea and pad their own lists, pinned headers pin at the
  inset.
- Wide windows: the shell bar narrows to the list pane (ShellPaneSplit) and
  the open item's bar shares its row; item tabs float at the pane's top
  (PageTabsEdge) instead of stacking on the shell's tab bar; the floating
  tab pill no longer swells over leftover media padding.
- Pipeline detail is a DetailPane on wide too; Run/Runs move from FABs into
  the bar's actions; name and identity live in the title pill.
- Run detail title pill shows the real title with Run N, pipeline and
  version (the pill links to the pipeline); the body keeps only status,
  actions and notices; standalone detail draws the same segmented bar.
- One Runs tab badge: attention outranks running.
- Tests for content-behind-bar padding and the no-stacking wide layout;
  notes/app-chrome-fixes.md.
This commit is contained in:
2026-10-31 03:36:22 +00:00
parent ea0f22dfc7
commit c6c6dcfe18
49 changed files with 1791 additions and 693 deletions
+7 -3
View File
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import '../features/chat/screen.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/top_bar_notices.dart';
import 'app_session.dart';
import 'connection_status.dart';
import 'server_endpoint.dart';
@@ -49,12 +50,15 @@ class ChatDestination extends StatelessWidget {
cupertino: cupertino,
);
}
return Column(
children: [
// The banner stays below the top bar; without it the chat screen
// reaches the top edge (an open chat beside the list draws its own bar
// there).
return TopBarNotices(
notices: [
if (!session.connected)
ConnectionBanner(session: session, cupertino: cupertino),
Expanded(child: _chatScreen()),
],
child: _chatScreen(),
);
},
);
@@ -3,6 +3,7 @@ import '../core/servers/server_scope.dart';
import '../features/pipelines/screen.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/top_bar_notices.dart';
import 'app_session.dart';
import 'connection_status.dart';
import 'server_endpoint.dart';
@@ -72,12 +73,14 @@ class PipelinesDestination extends StatelessWidget {
cupertino: cupertino,
);
}
return Column(
children: [
// The banner stays below the top bar; without it the pipelines reach
// the top edge and scroll behind the bar.
return TopBarNotices(
notices: [
if (!session.connected)
ConnectionBanner(session: session, cupertino: cupertino),
Expanded(child: _pipelinesScreen()),
],
child: _pipelinesScreen(),
);
},
);
+6 -3
View File
@@ -5,6 +5,7 @@ import '../features/attention/runtime/attention_controller.dart';
import '../features/runs/screen.dart';
import '../features/runs/ui/run_pipeline_link.dart';
import '../ui/adaptive/host.dart';
import '../ui/adaptive/top_bar_notices.dart';
import 'app_session.dart';
import 'connection_status.dart';
import 'server_endpoint.dart';
@@ -85,13 +86,15 @@ class RunsDestination extends StatelessWidget {
cupertino: cupertino,
);
}
return Column(
children: [
// The banner stays below the top bar; without it the runs reach the top
// edge and scroll behind the bar.
return TopBarNotices(
notices: [
if (!session.connected ||
session.subscription == RunSubscriptionState.refused)
ConnectionBanner(session: session, cupertino: cupertino),
Expanded(child: _runsScreen()),
],
child: _runsScreen(),
);
},
);
+84 -46
View File
@@ -4,7 +4,11 @@ import 'package:flutter/material.dart';
import '../ui/adaptive/segmented_bar.dart';
import '../core/api_gateway.dart';
import '../features/templates/screen.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/top_bar_notices.dart';
import 'app_session.dart';
import 'connection_status.dart';
import 'server_endpoint.dart';
@@ -57,32 +61,33 @@ class TemplatesDestination extends StatelessWidget {
Widget _body(bool cupertino) {
if (!session.everConnected) {
return ConnectionGate(
session: session,
server: server,
cupertino: cupertino,
return BelowTopBar(
child: ConnectionGate(
session: session,
server: server,
cupertino: cupertino,
),
);
}
return Column(
children: [
return TopBarNotices(
notices: [
if (!session.connected)
ConnectionBanner(session: session, cupertino: cupertino),
Expanded(
child: TemplatesScreen(
gateway: session.gateway,
embedded: true,
onCreated: onCreated,
initialKey: initialKey,
),
),
],
child: TemplatesScreen(
gateway: session.gateway,
embedded: true,
onCreated: onCreated,
initialKey: initialKey,
),
);
}
}
/// The page's standard native bar. Back is named explicitly so it cannot be
/// confused with the gallery's own Back-to-gallery control.
class _TemplatesPage extends StatelessWidget {
/// confused with the gallery's own Back-to-gallery control. The gallery puts
/// Refresh in this bar ([ShellBar]); its content scrolls behind the bar.
class _TemplatesPage extends StatefulWidget {
const _TemplatesPage({
required this.cupertino,
required this.onBack,
@@ -93,39 +98,72 @@ class _TemplatesPage extends StatelessWidget {
final VoidCallback onBack;
final Widget child;
@override
State<_TemplatesPage> createState() => _TemplatesPageState();
}
class _TemplatesPageState extends State<_TemplatesPage> {
final ShellBarRegistry _bar = ShellBarRegistry();
@override
void dispose() {
_bar.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: SegmentedBar(
cupertino: true,
leading: CupertinoButton(
key: templatesPageBackKey,
padding: EdgeInsets.zero,
onPressed: onBack,
child: const Icon(
CupertinoIcons.back,
semanticLabel: 'Back to Settings',
),
),
title: 'Templates',
),
child: SafeArea(child: child),
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(
cupertino: false,
leading: IconButton(
key: templatesPageBackKey,
tooltip: 'Back to Settings',
onPressed: onBack,
icon: const Icon(Icons.arrow_back),
),
title: 'Templates',
final cupertino = widget.cupertino;
// The page reaches its top edge; the gallery pads its lists by the bar.
final body = SafeArea(
top: false,
bottom: false,
child: ShellBarScope(
registry: _bar,
destination: AppDestination.settings,
child: widget.child,
),
body: SafeArea(child: child),
);
return ListenableBuilder(
listenable: _bar,
builder: (context, _) {
final actions =
_bar.specFor(AppDestination.settings)?.actions ?? const <Widget>[];
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: SegmentedBar(
cupertino: true,
leading: CupertinoButton(
key: templatesPageBackKey,
padding: EdgeInsets.zero,
onPressed: widget.onBack,
child: const Icon(
CupertinoIcons.back,
semanticLabel: 'Back to Settings',
),
),
title: 'Templates',
actions: actions,
),
child: body,
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(
cupertino: false,
leading: IconButton(
key: templatesPageBackKey,
tooltip: 'Back to Settings',
onPressed: widget.onBack,
icon: const Icon(Icons.arrow_back),
),
title: 'Templates',
actions: actions,
),
body: body,
);
},
);
}
}
@@ -403,13 +403,13 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
cupertino: true,
title: artifactGalleryTitle,
),
child: SafeArea(child: body),
child: SafeArea(top: false, bottom: false, child: body),
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: const SegmentedBar(cupertino: false, title: artifactGalleryTitle),
body: SafeArea(child: body),
body: SafeArea(top: false, bottom: false, child: body),
);
}
}
@@ -142,9 +142,15 @@ class _ArtifactVisitListState extends State<ArtifactVisitList> {
);
}
}
// Clear of a floating tab bar when the gallery is a tab.
// Below the top bar (or a pane's top tabs) at rest and behind it when
// scrolled; pinned headers pin under it. Clear of a floating tab bar at
// the end.
return CustomScrollView(
slivers: [...slivers, const SliverFloatingBarClearance()],
slivers: [
const SliverTopBarClearance(),
...slivers,
const SliverFloatingBarClearance(),
],
);
}
+14 -9
View File
@@ -1,6 +1,7 @@
import '../../shell/destination.dart';
import '../../shell/detail_page.dart';
import '../../shell/list_detail.dart';
import '../../ui/adaptive/floating_bar_layout.dart';
import '../../ui/adaptive/host.dart';
import 'dart:async';
@@ -241,15 +242,19 @@ class _ChatScreenState extends State<ChatScreen> {
? const SizedBox.shrink()
: _thread(selected, () => Navigator.of(context).maybePop()),
);
final list = ChatSessionsScreen(
gateway: widget.gateway,
embedded: true,
syncToken: widget.syncToken,
controller: _sessions,
onOpen: _open,
onSessions: _adoptRows,
activeSessionId: selected,
publishShellBar: true,
// The shell's body now reaches the top edge; until the session list pads
// itself by the bar (owned by the chat lane), it keeps starting below it.
final list = BelowTopBar(
child: ChatSessionsScreen(
gateway: widget.gateway,
embedded: true,
syncToken: widget.syncToken,
controller: _sessions,
onOpen: _open,
onSessions: _adoptRows,
activeSessionId: selected,
publishShellBar: true,
),
);
if (!beside) return list;
return ListDetailPanes(
@@ -7,6 +7,7 @@ import 'package:flutter/material.dart';
import '../../../ui/text/markdown_source_view.dart';
import '../../chat/ui/transcript/chat_markdown_view.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/adaptive/host.dart';
import '../domain/graph_protocol.dart';
import '../domain/stage_definition.dart';
@@ -42,6 +43,7 @@ class StageDefinitionView extends StatefulWidget {
required this.pipelineId,
required this.pipelineName,
required this.version,
this.showIdentity = true,
});
final JsonMap graph;
@@ -50,16 +52,24 @@ class StageDefinitionView extends StatefulWidget {
final String pipelineName;
final int version;
/// Whether the view starts with its pipeline and version. The page leaves
/// it out: its top bar shows them under the title.
final bool showIdentity;
@override
State<StageDefinitionView> createState() => _StageDefinitionViewState();
}
/// The pinned pipeline a definition belongs to (`Demo pipeline \u00b7 v7`).
String stageDefinitionIdentity(String pipelineName, int version) =>
'${pipelineName.isEmpty ? 'Pipeline' : pipelineName} \u00b7 v$version';
class _StageDefinitionViewState extends State<StageDefinitionView> {
// One switch for every authored text block; raw is the exact text.
bool _raw = true;
String get _identity =>
'${widget.pipelineName.isEmpty ? 'Pipeline' : widget.pipelineName} \u00b7 v${widget.version}';
stageDefinitionIdentity(widget.pipelineName, widget.version);
@override
Widget build(BuildContext context) {
@@ -74,11 +84,14 @@ class _StageDefinitionViewState extends State<StageDefinitionView> {
? terminalDefinitionFields(graph, stageKey)
: const <StageDefinitionField>[];
// Scrolls behind the page's floating top bar; at rest it starts below it.
return ListView(
padding: const EdgeInsets.all(16),
padding: withBarClearance(context, const EdgeInsets.all(16)),
children: [
Text(_identity, style: style.muted),
const SizedBox(height: 16),
if (widget.showIdentity) ...[
Text(_identity, style: style.muted),
const SizedBox(height: 16),
],
if (fields.any((field) => field.block)) ...[
MarkdownModeSwitch(
raw: _raw,
@@ -131,7 +144,9 @@ Future<void> openStageDefinition(
pipelineId: pipelineId,
pipelineName: pipelineName,
version: version,
showIdentity: false,
);
final identity = stageDefinitionIdentity(pipelineName, version);
final settings = RouteSettings(
name: 'stage-definition/$pipelineId/$version/$stageKey',
);
@@ -142,16 +157,24 @@ Future<void> openStageDefinition(
? CupertinoPageRoute<void>(
settings: settings,
builder: (_) => CupertinoPageScaffold(
navigationBar: SegmentedBar(cupertino: true, title: title),
child: SafeArea(child: view),
navigationBar: SegmentedBar(
cupertino: true,
title: title,
subtitle: identity,
),
child: SafeArea(top: false, bottom: false, child: view),
),
)
: MaterialPageRoute<void>(
settings: settings,
builder: (_) => Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(cupertino: false, title: title),
body: SafeArea(child: view),
appBar: SegmentedBar(
cupertino: false,
title: title,
subtitle: identity,
),
body: SafeArea(top: false, bottom: false, child: view),
),
);
return Navigator.of(context).push(route);
+25 -28
View File
@@ -217,7 +217,20 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
final body = LayoutBuilder(
builder: (context, constraints) {
final wide = showsListBesideDetail(context);
// On a phone an open pipeline is its own page over the tabs.
// The open pipeline publishes its name, identity and Run/Runs to
// its own bar: a page over the tabs on a phone, a pane beside the
// list (on the shell bar's row) when wide.
Widget detail() => PipelineDetailPanel(
controller: _controller,
gateway: widget.gateway,
showBack: false,
onRunStarted: widget.onRunStarted,
onViewPipelineRuns: widget.onViewPipelineRuns,
stageKey: stageKey,
stagePipelineId: widget.initialPipelineId,
stageVersion: widget.initialVersion,
stageRequest: _stageRequest,
);
_page.sync(
context,
selected: _controller.hasSelection && !wide,
@@ -225,20 +238,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
onClosed: _controller.clearSelection,
builder: (context) => AnimatedBuilder(
animation: _controller,
builder: (context, _) => ShellBar(
title: _controller.detail?.displayName,
child: PipelineDetailPanel(
controller: _controller,
gateway: widget.gateway,
showBack: false,
onRunStarted: widget.onRunStarted,
onViewPipelineRuns: widget.onViewPipelineRuns,
stageKey: stageKey,
stagePipelineId: widget.initialPipelineId,
stageVersion: widget.initialVersion,
stageRequest: _stageRequest,
),
),
builder: (context, _) => detail(),
),
);
if (!wide) {
@@ -250,17 +250,14 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
list: ContentWidth(
child: PipelineListPanel(controller: _controller),
),
detail: PipelineDetailPanel(
controller: _controller,
gateway: widget.gateway,
showBack: false,
onRunStarted: widget.onRunStarted,
onViewPipelineRuns: widget.onViewPipelineRuns,
stageKey: stageKey,
stagePipelineId: widget.initialPipelineId,
stageVersion: widget.initialVersion,
stageRequest: _stageRequest,
),
detail: _controller.hasSelection
? DetailPane(
key: const ValueKey('pipeline-detail-pane'),
destination: AppDestination.pipelines,
implyBack: false,
builder: (_) => detail(),
)
: detail(),
);
},
);
@@ -362,7 +359,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
_refreshButton(context),
],
),
body: SafeArea(child: body),
body: SafeArea(top: false, child: body),
);
}
@@ -377,7 +374,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
_refreshButton(context),
],
),
child: SafeArea(child: body),
child: SafeArea(top: false, child: body),
);
}
}
@@ -24,11 +24,12 @@ class RunPipelineAction extends StatefulWidget {
required this.detail,
required this.gateway,
this.onRunStarted,
this.fab = false,
this.inBar = false,
});
/// A floating action button instead of an inline button.
final bool fab;
/// The compact icon-and-word button of a top bar's actions pill instead
/// of an inline button.
final bool inBar;
final PipelinesController controller;
final PipelineDetail detail;
@@ -169,8 +170,8 @@ class _RunPipelineActionState extends State<RunPipelineAction> {
@override
Widget build(BuildContext context) {
final label = const Text(runPipelineActionLabel);
if (widget.fab) {
return pipelineFab(
if (widget.inBar) {
return pipelineBarAction(
context,
key: runPipelineActionKey,
primary: true,
@@ -195,9 +196,10 @@ class _RunPipelineActionState extends State<RunPipelineAction> {
}
}
/// A floating action for a pipeline: Material's extended FAB, or on Cupertino
/// a filled pill with the same icon and word and a soft shadow.
Widget pipelineFab(
/// A pipeline action in its top bar's actions pill: the icon and word as one
/// compact button. The primary action (Run) is filled so it reads apart from
/// the plain ones around it.
Widget pipelineBarAction(
BuildContext context, {
required Key key,
required bool primary,
@@ -212,45 +214,39 @@ Widget pipelineFab(
children: [
Icon(cupertinoIcon, size: 18),
const SizedBox(width: 6),
Text(label),
Flexible(child: Text(label, maxLines: 1, softWrap: false)),
],
);
return DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(28),
boxShadow: const [
BoxShadow(
color: Color(0x33000000),
blurRadius: 8,
offset: Offset(0, 2),
),
],
),
child: primary
? CupertinoButton.filled(
key: key,
borderRadius: BorderRadius.circular(28),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
onPressed: onPressed,
child: content,
)
: CupertinoButton.tinted(
key: key,
borderRadius: BorderRadius.circular(28),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 14),
onPressed: onPressed,
child: content,
),
);
const padding = EdgeInsets.symmetric(horizontal: 12, vertical: 6);
return primary
? CupertinoButton.filled(
key: key,
padding: padding,
minimumSize: Size.zero,
onPressed: onPressed,
child: content,
)
: CupertinoButton(
key: key,
padding: padding,
minimumSize: Size.zero,
onPressed: onPressed,
child: content,
);
}
final scheme = Theme.of(context).colorScheme;
return FloatingActionButton.extended(
key: key,
heroTag: key,
backgroundColor: primary ? null : scheme.secondaryContainer,
foregroundColor: primary ? null : scheme.onSecondaryContainer,
onPressed: onPressed,
icon: Icon(materialIcon),
label: Text(label),
);
final icon = Icon(materialIcon);
final text = Text(label, maxLines: 1, softWrap: false);
return primary
? FilledButton.icon(
key: key,
onPressed: onPressed,
icon: icon,
label: text,
)
: TextButton.icon(
key: key,
onPressed: onPressed,
icon: icon,
label: text,
);
}
@@ -4,10 +4,12 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../shell/shell_bar.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../graph/domain/graph_definition.dart';
import '../../graph/widgets/stage_definition_view.dart';
import '../pipeline_models.dart';
import '../pipeline_query.dart';
import '../pipelines_controller.dart';
import '../ui/run_pipeline_action.dart';
import 'pipeline_controls.dart';
@@ -95,18 +97,47 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
@override
Widget build(BuildContext context) {
final detail = _controller.detail;
if (detail == null) return _withoutDetail(context);
// In a page or pane the pipeline's name, identity and actions are its top
// bar's; on its own the panel heads itself.
final inBar = ShellBar.available(context);
if (detail == null) {
// Nothing selected is the bare placeholder beside the list; it must
// not take a bar over.
if (!_controller.hasSelection) return _withoutDetail(context);
return ShellBar(child: _withoutDetail(context));
}
_retainGraphSelection(detail);
_applyStageRequest(context, detail);
final notices = [
if (!inBar) _header(context, detail),
if (_controller.detailLoading)
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: PipelineProgress(label: 'Refreshing pipeline detail'),
),
if (_controller.detailError != null)
PipelineErrorBanner(
message: _controller.detailError!,
onRetry: _controller.retryDetail,
),
];
final panel = LayoutBuilder(
builder: (context, constraints) {
final headerLimit = _headerLimit(constraints);
// The tabs float over the bottom of the tab body, as in the run
// detail: full width on a phone, at the right edge of a wide pane.
// The tabs float over the tab body: at the bottom on a phone page,
// under the pane's top bar beside a list (never on the shell's bar).
final edge = PageTabsEdge.of(context);
final tabs = PipelineDetailTabs(
selected: _tab,
edge: edge,
onSelected: (tab) => setState(() => _tab = tab),
);
// With nothing above it the tab body reaches the top edge and scrolls
// behind the bar; notices stay below the bar and the body below them.
// The structure is the same either way, so a refresh never remounts
// the open tab.
final media = MediaQuery.of(context);
final inset = media.padding.top;
return Column(
key: const Key('pipeline-detail'),
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -114,23 +145,10 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
ConstrainedBox(
constraints: BoxConstraints(maxHeight: headerLimit),
child: SingleChildScrollView(
padding: EdgeInsets.only(top: notices.isEmpty ? 0 : inset),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_header(context, detail),
if (_controller.detailLoading)
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: PipelineProgress(
label: 'Refreshing pipeline detail',
),
),
if (_controller.detailError != null)
PipelineErrorBanner(
message: _controller.detailError!,
onRetry: _controller.retryDetail,
),
],
children: notices,
),
),
),
@@ -138,36 +156,35 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
// scroll their own content; the graph fills the slot so its canvas
// is never asked for an unbounded extent inside a scroll view.
Expanded(
child: FloatingBarOverlay(
bar: tabs,
child: Builder(
builder: (context) => Stack(
children: [
Positioned.fill(
child: switch (_tab) {
PipelineDetailTab.summary => _scrolling(
PipelineSummaryView(
controller: _controller,
detail: detail,
gateway: widget.gateway,
),
),
PipelineDetailTab.graph => PipelineGraphTab(
detail: detail,
selectedStage: _graphSelection,
onSelected: (stageKey) =>
_openGraphStage(context, detail, stageKey),
),
PipelineDetailTab.source => _source(context, detail),
},
child: MediaQuery(
data: media.copyWith(
padding: media.padding.copyWith(
top: notices.isEmpty ? inset : 0,
),
),
child: FloatingBarOverlay(
edge: edge,
bar: tabs,
child: Builder(
builder: (context) => switch (_tab) {
PipelineDetailTab.summary => _scrolling(
PipelineSummaryView(
controller: _controller,
detail: detail,
gateway: widget.gateway,
showIdentity: !inBar,
),
),
// Run and Runs float over the content, above the tabs.
PositionedDirectional(
end: 16,
bottom: 16 + MediaQuery.paddingOf(context).bottom,
child: _fabs(context, detail),
PipelineDetailTab.graph => BelowTopBar(
child: PipelineGraphTab(
detail: detail,
selectedStage: _graphSelection,
onSelected: (stageKey) =>
_openGraphStage(context, detail, stageKey),
),
),
],
PipelineDetailTab.source => _source(context, detail),
},
),
),
),
@@ -176,7 +193,12 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
);
},
);
return panel;
return ShellBar(
title: detail.displayName,
subtitle: pipelineSubtitle(detail),
actions: _actions(context, detail),
child: panel,
);
}
/// The header keeps its natural height while at least
@@ -345,56 +367,62 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
: title;
return Padding(
key: const Key('pipeline-detail-header'),
// The web detail head is a compact single identity line; the recorded
// id/version/stage facts live at the top of the Summary tab.
// On its own (no top bar) the panel heads itself with the pipeline's
// name and its actions; the recorded id/version/stage facts live at the
// top of the Summary tab.
padding: const EdgeInsets.fromLTRB(12, 6, 12, 4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [heading],
children: [
heading,
Align(
alignment: AlignmentDirectional.centerEnd,
child: Wrap(
key: const Key('pipeline-actions'),
spacing: 8,
runSpacing: 4,
children: _actions(context, detail),
),
),
],
),
);
}
/// Run and Runs float at the bottom right: Runs above, the primary Run at
/// the edge.
Widget _fabs(BuildContext context, PipelineDetail detail) => Column(
key: const Key('pipeline-actions'),
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Semantics(
button: true,
label: detail.name.trim().isEmpty
? 'View runs of this pipeline'
: 'View runs of ${detail.name}',
child: ExcludeSemantics(
child: pipelineFab(
context,
key: const Key('pipeline-view-runs'),
primary: false,
materialIcon: Icons.list_alt,
cupertinoIcon: CupertinoIcons.list_bullet,
label: 'Runs',
onPressed: widget.onViewPipelineRuns == null
? null
: () => widget.onViewPipelineRuns!(detail.id),
),
/// Runs and the primary Run: the top bar's actions, never floating over
/// the content (where they used to cover the version history).
List<Widget> _actions(BuildContext context, PipelineDetail detail) => [
Semantics(
button: true,
label: detail.name.trim().isEmpty
? 'View runs of this pipeline'
: 'View runs of ${detail.name}',
child: ExcludeSemantics(
child: pipelineBarAction(
context,
key: const Key('pipeline-view-runs'),
primary: false,
materialIcon: Icons.list_alt,
cupertinoIcon: CupertinoIcons.list_bullet,
label: 'Runs',
onPressed: widget.onViewPipelineRuns == null
? null
: () => widget.onViewPipelineRuns!(detail.id),
),
),
const SizedBox(height: 12),
RunPipelineAction(
controller: _controller,
detail: detail,
gateway: widget.gateway,
onRunStarted: widget.onRunStarted,
fab: true,
),
],
);
),
RunPipelineAction(
controller: _controller,
detail: detail,
gateway: widget.gateway,
onRunStarted: widget.onRunStarted,
inBar: true,
),
];
Widget _source(BuildContext context, PipelineDetail detail) {
return ListView(
padding: withFloatingBarClearance(context, const EdgeInsets.all(16)),
padding: withBarClearance(context, const EdgeInsets.all(16)),
children: [
if (detail.source.isEmpty)
Text('No source recorded.', style: pipelineMutedStyle(context))
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../pipeline_filter.dart';
import 'pipeline_controls.dart';
@@ -24,7 +25,7 @@ class PipelineFilterMaterialBody extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListView(
padding: const EdgeInsets.all(16),
padding: withBarClearance(context, const EdgeInsets.all(16)),
children: [
TextField(
controller: name,
@@ -111,7 +111,7 @@ class _PipelineFilterPageState extends State<PipelineFilterPage> {
),
],
),
child: SafeArea(child: body),
child: SafeArea(top: false, bottom: false, child: body),
);
}
return Scaffold(
@@ -121,7 +121,7 @@ class _PipelineFilterPageState extends State<PipelineFilterPage> {
title: 'Filter pipelines',
actions: [TextButton(onPressed: _apply, child: const Text('Done'))],
),
body: SafeArea(child: body),
body: SafeArea(top: false, bottom: false, child: body),
);
}
}
@@ -2,6 +2,7 @@ import '../../../ui/theme/app_theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/status/run_status_icon.dart';
import '../pipeline_format.dart';
import '../pipeline_models.dart';
@@ -28,32 +29,42 @@ class PipelineListPanel extends StatelessWidget {
(pipeline) =>
pipeline.scheduleState == PipelineScheduleState.unclassified,
);
return Column(
// The controls and notices lead the list, so they scroll behind the top
// bar with the rows and start below it at rest.
final header = [
_scope(context, filters),
_toolbar(context, filters, hasUnclassified),
if (controller.listError != null)
PipelineErrorBanner(
message: controller.listError!,
onRetry: controller.load,
),
if (controller.runsError != null)
PipelineErrorBanner(
message:
'${controller.runsLoaded ? 'Last runs could not be refreshed' : 'Last runs unavailable'}: '
'${controller.runsError}',
onRetry: controller.load,
),
if (controller.listLoading && controller.pipelinesLoaded)
const Padding(
padding: EdgeInsets.symmetric(horizontal: kPipelineListInset),
child: PipelineProgress(label: 'Refreshing pipelines'),
),
];
return _content(context, header);
}
/// A state without rows: the controls stay at the top, below the bar.
Widget _withoutRows(List<Widget> header, Widget state) => BelowTopBar(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_scope(context, filters),
_toolbar(context, filters, hasUnclassified),
if (controller.listError != null)
PipelineErrorBanner(
message: controller.listError!,
onRetry: controller.load,
),
if (controller.runsError != null)
PipelineErrorBanner(
message:
'${controller.runsLoaded ? 'Last runs could not be refreshed' : 'Last runs unavailable'}: '
'${controller.runsError}',
onRetry: controller.load,
),
if (controller.listLoading && controller.pipelinesLoaded)
const Padding(
padding: EdgeInsets.symmetric(horizontal: kPipelineListInset),
child: PipelineProgress(label: 'Refreshing pipelines'),
),
Expanded(child: _content(context)),
...header,
Expanded(child: state),
],
);
}
),
);
/// The web's compact toolbar: filter (whose page carries the name search),
/// sort and clear, on the list's 12px inset with a separator underneath.
@@ -105,19 +116,27 @@ class PipelineListPanel extends StatelessWidget {
);
}
Widget _content(BuildContext context) {
Widget _content(BuildContext context, List<Widget> header) {
if (controller.initialListLoading) {
return _centered(context, const ['Loading pipelines…']);
return _withoutRows(
header,
_centered(context, const ['Loading pipelines…']),
);
}
if (!controller.pipelinesLoaded) {
if (controller.listError != null) return const SizedBox.shrink();
return _centered(context, const ['Loading pipelines…']);
if (controller.listError != null) {
return _withoutRows(header, const SizedBox.shrink());
}
return _withoutRows(
header,
_centered(context, const ['Loading pipelines…']),
);
}
final items = controller.visiblePipelines;
if (items.isEmpty) {
final empty = controller.emptyState;
if (empty == null) return const SizedBox.shrink();
return _empty(context, empty);
if (empty == null) return _withoutRows(header, const SizedBox.shrink());
return _withoutRows(header, _empty(context, empty));
}
// A list pane beside a detail can be very narrow (a 640px window leaves
// it ~130px): there the rows drop the identity icon and chevron so the
@@ -126,8 +145,8 @@ class PipelineListPanel extends StatelessWidget {
builder: (context, constraints) {
final compact = constraints.maxWidth < _compactRowWidth;
return useCupertinoControls(context)
? _cupertinoList(context, items, compact: compact)
: _materialList(context, items, compact: compact);
? _cupertinoList(context, header, items, compact: compact)
: _materialList(context, header, items, compact: compact);
},
);
}
@@ -178,16 +197,22 @@ class PipelineListPanel extends StatelessWidget {
Widget _materialList(
BuildContext context,
List<Widget> header,
List<PipelineSummary> items, {
required bool compact,
}) {
final now = DateTime.now();
// The default padding is the media padding: the controls start below the
// top bar and the last row clears the floating tab bar.
return ListView.separated(
key: const Key('pipeline-list'),
itemCount: items.length,
separatorBuilder: (context, index) => const Divider(height: 1),
itemCount: header.length + items.length,
separatorBuilder: (context, index) => index < header.length
? const SizedBox.shrink()
: const Divider(height: 1),
itemBuilder: (context, index) {
final pipeline = items[index];
if (index < header.length) return header[index];
final pipeline = items[index - header.length];
return ListTile(
key: Key('pipeline-row-${pipeline.id}'),
selected: controller.selectedId == pipeline.id,
@@ -210,6 +235,7 @@ class PipelineListPanel extends StatelessWidget {
Widget _cupertinoList(
BuildContext context,
List<Widget> header,
List<PipelineSummary> items, {
required bool compact,
}) {
@@ -217,6 +243,7 @@ class PipelineListPanel extends StatelessWidget {
return ListView(
key: const Key('pipeline-list'),
children: [
...header,
CupertinoListSection.insetGrouped(
backgroundColor: AppColors.groupedBackground,
children: [
@@ -20,12 +20,17 @@ class PipelineSummaryView extends StatelessWidget {
required this.controller,
required this.detail,
required this.gateway,
this.showIdentity = true,
});
final PipelinesController controller;
final PipelineDetail detail;
final ApiGateway gateway;
/// Whether to start with the recorded identity line (`id · version ·
/// stages`). False when the top bar's title pill already carries it.
final bool showIdentity;
@override
Widget build(BuildContext context) {
final historical = detail.resolvedVersion != detail.latestVersion;
@@ -34,13 +39,14 @@ class PipelineSummaryView extends StatelessWidget {
children: [
// The web's Summary subtitle: the compact header names the pipeline,
// this line carries its recorded identity.
Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: Text(
pipelineSubtitle(detail),
style: pipelineMutedStyle(context),
if (showIdentity)
Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: Text(
pipelineSubtitle(detail),
style: pipelineMutedStyle(context),
),
),
),
if (historical)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
@@ -1,5 +1,6 @@
import 'package:flutter/widgets.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/adaptive/floating_destination_bar.dart';
import 'pipeline_controls.dart';
import 'pipeline_detail_tab.dart';
@@ -7,7 +8,7 @@ import 'pipeline_detail_tab.dart';
export 'pipeline_detail_tab.dart';
/// The pipeline detail's tabs: the app's floating glass tab bar, full width on
/// a phone and sized to its tabs at the right edge of a wide pane.
/// a phone page; beside a list, sized to its tabs under the pane's top bar.
///
/// Float it over the tab body with `FloatingBarOverlay`. The whole bar is
/// keyed `pipeline-detail-tabs`, each tab `pipeline-detail-tab-<name>`.
@@ -16,11 +17,16 @@ class PipelineDetailTabs extends StatelessWidget {
super.key,
required this.selected,
required this.onSelected,
this.edge = FloatingBarEdge.bottom,
});
final PipelineDetailTab selected;
final ValueChanged<PipelineDetailTab> onSelected;
/// Where the bar floats: the bottom of a page, or the top of a pane beside
/// a list (see `PageTabsEdge`).
final FloatingBarEdge edge;
@override
Widget build(BuildContext context) {
final cupertino = useCupertinoControls(context);
@@ -30,6 +36,7 @@ class PipelineDetailTabs extends StatelessWidget {
child: FloatingDestinationBar(
cupertino: cupertino,
currentIndex: tabs.indexOf(selected),
edge: edge,
onTap: (value) => onSelected(tabs[value]),
items: [
for (final tab in tabs)
@@ -31,6 +31,19 @@ String detailTitle(JsonMap run) {
return identity.label.trim().isEmpty ? 'Run ${run['id']}' : identity.label;
}
/// The run's context under its title in the top bar: its number, then the
/// pipeline it ran and the pinned version when recorded
/// (`Run 7 · Demo pipeline · v3`).
String detailSubtitle(JsonMap run) {
final name = '${run['name'] ?? ''}'.trim();
final version = run['version'];
return [
'Run ${run['id']}',
if (name.isNotEmpty) name,
if (version is num && version > 0) 'v${version.toInt()}',
].join(' · ');
}
String detailPipeline(JsonMap run) {
final name = '${run['name'] ?? ''}'.trim();
return name.isEmpty ? 'unavailable' : name;
@@ -3,27 +3,21 @@ import 'package:flutter/cupertino.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/status/run_status_icon.dart';
import '../domain/run_models.dart';
import 'run_detail_content.dart';
import 'run_detail_tabs.dart';
import 'run_more_menu.dart';
import 'run_pipeline_link.dart';
/// The runs detail with standard Cupertino controls. It has no Material
/// ancestor: the host header keeps native navigation, actions and notices, and
/// the shared tab body uses native Cupertino expansion tiles and grouped list
/// sections. Copy feedback is an inline live-region status.
/// ancestor: the top bar carries the run's identity, Back and the more menu;
/// this header keeps the status in its colour beside the run actions, and the
/// notices. The shared tab body uses native Cupertino expansion tiles and
/// grouped list sections. Copy feedback is an inline live-region status.
Widget buildCupertinoRunDetail({
required BuildContext context,
required JsonMap run,
required Widget headerActions,
bool inShellBar = false,
ValueChanged<num>? onRunOpened,
OpenPipeline? onOpenPipeline,
required bool detailLoading,
required String? error,
required bool copying,
required String? copyStatus,
required VoidCallback onBack,
required VoidCallback onCopy,
required ApiGateway gateway,
required ValueChanged<JsonMap> onRunChanged,
@@ -31,7 +25,6 @@ Widget buildCupertinoRunDetail({
String? initialStageKey,
int? initialVisit,
}) {
final theme = CupertinoTheme.of(context);
return RunDetailTabs(
run: run,
cupertino: true,
@@ -46,82 +39,22 @@ Widget buildCupertinoRunDetail({
header: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Inside the app shell, Back and the more menu are in its bar.
if (!inShellBar)
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
child: Wrap(
alignment: WrapAlignment.spaceBetween,
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 8,
runSpacing: 4,
children: [
CupertinoButton(
padding: EdgeInsets.zero,
onPressed: onBack,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(CupertinoIcons.back),
const SizedBox(width: 4),
const Text('Back'),
],
),
),
if (copying) const CupertinoActivityIndicator(),
RunMoreMenu(
run: run,
gateway: gateway,
onRunChanged: onRunChanged,
cupertino: true,
onRunOpened: onRunOpened,
),
],
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 0),
child: Wrap(
spacing: 12,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Wrap(
spacing: 8,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
RunStatusKicker(
state: runStateOf(run['status']),
label: runStatusLabel(run),
),
],
),
const SizedBox(height: 4),
Text(
detailTitle(run),
style: theme.textTheme.navLargeTitleTextStyle,
),
const SizedBox(height: 4),
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Text('Run ${run['id']} · Pipeline '),
RunPipelineLink(
run: run,
cupertino: true,
onOpenPipeline: onOpenPipeline,
),
],
RunStatusKicker(
state: runStateOf(run['status']),
label: runStatusLabel(run),
),
if (copying) const CupertinoActivityIndicator(),
headerActions,
],
),
),
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 0),
child: Align(
alignment: AlignmentDirectional.centerStart,
child: headerActions,
),
),
if (detailLoading) const _CupertinoNotice('Refreshing run details…'),
if (error != null) _CupertinoNotice(error),
],
@@ -3,27 +3,22 @@ import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/status/run_status_icon.dart';
import '../domain/run_models.dart';
import 'run_detail_content.dart';
import 'run_detail_tabs.dart';
import 'run_more_menu.dart';
import 'run_pipeline_link.dart';
/// The runs detail with standard Material controls.
///
/// The host header keeps the run identity, status and every action; the shared
/// tab body supplies Summary, Graph, Input, Output and Timeline.
/// The top bar carries the run's identity (title, number, pipeline and
/// version), Back and the more menu; this header keeps only what the bar does
/// not: the status in its colour beside the run actions, and the notices.
/// The shared tab body supplies Summary, Timeline, Artifacts and Changes.
Widget buildMaterialRunDetail({
required BuildContext context,
required JsonMap run,
required Widget headerActions,
bool inShellBar = false,
ValueChanged<num>? onRunOpened,
OpenPipeline? onOpenPipeline,
required bool detailLoading,
required String? error,
required bool copying,
required String? copyStatus,
required VoidCallback onBack,
required VoidCallback onCopy,
required ApiGateway gateway,
required ValueChanged<JsonMap> onRunChanged,
@@ -31,7 +26,6 @@ Widget buildMaterialRunDetail({
String? initialStageKey,
int? initialVisit,
}) {
final theme = Theme.of(context);
return RunDetailTabs(
run: run,
cupertino: false,
@@ -46,76 +40,16 @@ Widget buildMaterialRunDetail({
header: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Inside the app shell, Back and the more menu are in its bar.
if (!inShellBar)
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Wrap(
spacing: 8,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
TextButton.icon(
onPressed: onBack,
icon: const Icon(Icons.arrow_back),
label: const Text('Back to list'),
),
],
),
),
RunMoreMenu(
run: run,
gateway: gateway,
onRunChanged: onRunChanged,
cupertino: false,
onRunOpened: onRunOpened,
),
],
),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: Align(
alignment: AlignmentDirectional.centerStart,
child: Wrap(
spacing: 8,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
RunStatusKicker(
state: runStateOf(run['status']),
label: runStatusLabel(run),
),
],
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
child: Text(detailTitle(run), style: theme.textTheme.headlineSmall),
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: Wrap(
spacing: 8,
spacing: 12,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Text('Run ${run['id']}'),
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
const Text('Pipeline '),
RunPipelineLink(
run: run,
cupertino: false,
onOpenPipeline: onOpenPipeline,
),
],
RunStatusKicker(
state: runStateOf(run['status']),
label: runStatusLabel(run),
),
headerActions,
],
@@ -41,6 +41,9 @@ Widget runDetailSummaryTab({
return CustomScrollView(
key: const Key('run-detail-tab-body-summary'),
slivers: [
// Below the pane's top tabs at rest (nothing on a phone page); the
// sticky sections pin under them.
const SliverTopBarClearance(),
if (graphPreview != null) SliverToBoxAdapter(child: graphPreview),
SliverToBoxAdapter(
child: cupertino
@@ -212,7 +215,7 @@ Widget runDetailFieldTab({
return Builder(
builder: (context) => ListView(
key: Key('run-detail-tab-body-$tabKey'),
padding: withFloatingBarClearance(context, const EdgeInsets.all(16)),
padding: withBarClearance(context, const EdgeInsets.all(16)),
children: [body],
),
);
@@ -1,5 +1,6 @@
import 'package:flutter/widgets.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/adaptive/floating_destination_bar.dart';
import '../../../ui/adaptive/host.dart';
import 'run_detail_tab.dart';
@@ -16,23 +17,26 @@ const List<RunDetailTab> renderedRunDetailTabs = [
RunDetailTab.changes,
];
/// The run detail's tabs: the app's floating glass tab bar, full width on a
/// phone and sized to its tabs at the right edge of a wide pane.
/// The run detail's tabs: the app's floating glass tab bar, full width at the
/// bottom of a phone page; beside a list, under the pane's top bar (sized to
/// its tabs) so it never stacks on the shell's own tab bar.
///
/// Float it over the tab body with `FloatingBarOverlay`; every tab is always
/// visible, so a tab selected by the Graph is shown selected without
/// scrolling. The whole bar is keyed `run-detail-tabs`, each tab
/// `run-detail-tab-<name>`.
/// Float it over the tab body with `FloatingBarOverlay` at the same [edge];
/// every tab is always visible, so a tab selected by the Graph is shown
/// selected without scrolling. The whole bar is keyed `run-detail-tabs`, each
/// tab `run-detail-tab-<name>`.
class RunDetailTabStrip extends StatelessWidget {
const RunDetailTabStrip({
super.key,
required this.selected,
required this.onSelected,
this.tabs = renderedRunDetailTabs,
this.edge = FloatingBarEdge.bottom,
});
final RunDetailTab selected;
final ValueChanged<RunDetailTab> onSelected;
final FloatingBarEdge edge;
/// The tabs this run offers, in [renderedRunDetailTabs] order.
final List<RunDetailTab> tabs;
@@ -46,6 +50,7 @@ class RunDetailTabStrip extends StatelessWidget {
child: FloatingDestinationBar(
cupertino: cupertino,
currentIndex: index < 0 ? 0 : index,
edge: edge,
onTap: (value) => onSelected(tabs[value]),
items: [
for (final tab in tabs)
+25 -11
View File
@@ -364,32 +364,43 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
final shown = tabs.contains(_tab) || !renderedRunDetailTabs.contains(_tab)
? _tab
: RunDetailTab.summary;
final edge = PageTabsEdge.of(context);
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(
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
// bottom of it, and the tab learns their height as bottom padding.
// 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: FloatingBarOverlay(
bar: RunDetailTabStrip(
tabs: tabs,
selected: shown,
onSelected: (tab) => setState(() => _tab = tab),
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: _body(shown),
),
),
],
@@ -458,10 +469,13 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
finalOnly: true,
);
// A CupertinoApp supplies no Material theme; follow the host so the
// viewer's section text stays readable.
return widget.cupertino
? Theme(data: hostTextTheme(context), child: viewer)
: viewer;
// viewer's section text stays readable. Its summary heads the tab, so
// the tab starts below a pane's top tabs.
return BelowTopBar(
child: widget.cupertino
? Theme(data: hostTextTheme(context), child: viewer)
: viewer,
);
case RunDetailTab.timeline:
final visits = detailTimeline(widget.run['steps']);
final index = _selectedVisit;
@@ -34,7 +34,7 @@ class RunTimelineList extends StatelessWidget {
if (visits.isEmpty) {
return ListView(
key: const Key('run-detail-tab-body-timeline'),
padding: withFloatingBarClearance(context, const EdgeInsets.all(16)),
padding: withBarClearance(context, const EdgeInsets.all(16)),
children: const [Text('No visits recorded.')],
);
}
@@ -64,7 +64,7 @@ class RunTimelineList extends StatelessWidget {
}
return ListView(
key: const Key('run-detail-tab-body-timeline'),
padding: withFloatingBarClearance(
padding: withBarClearance(
context,
const EdgeInsets.symmetric(vertical: 8),
),
+57 -20
View File
@@ -6,6 +6,8 @@ import '../../../core/api_gateway.dart';
import '../../../core/transport/pipelines_client.dart';
import '../../../ui/adaptive/host.dart';
import '../../../shell/shell_bar.dart';
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../ui/adaptive/segmented_bar_overlay.dart';
import 'run_detail_actions.dart';
import 'run_more_menu.dart';
import 'run_pipeline_link.dart';
@@ -75,14 +77,10 @@ class _RunDetailViewState extends State<RunDetailView> {
context: context,
run: run,
headerActions: headerActions,
onRunOpened: widget.onRunOpened,
onOpenPipeline: widget.onOpenPipeline,
inShellBar: inShellBar,
detailLoading: widget.controller.detailLoading,
error: widget.controller.error,
copying: _copying,
copyStatus: _copyStatus,
onBack: widget.onBack,
onCopy: () => _copyPrompt(prompt ?? '', cupertino: true),
gateway: widget.gateway,
onRunChanged: widget.controller.acceptRunDetail,
@@ -94,14 +92,10 @@ class _RunDetailViewState extends State<RunDetailView> {
context: context,
run: run,
headerActions: headerActions,
onRunOpened: widget.onRunOpened,
onOpenPipeline: widget.onOpenPipeline,
inShellBar: inShellBar,
detailLoading: widget.controller.detailLoading,
error: widget.controller.error,
copying: _copying,
copyStatus: _copyStatus,
onBack: widget.onBack,
onCopy: () => _copyPrompt(prompt ?? '', cupertino: false),
gateway: widget.gateway,
onRunChanged: widget.controller.acceptRunDetail,
@@ -109,25 +103,68 @@ class _RunDetailViewState extends State<RunDetailView> {
initialStageKey: widget.initialStageKey,
initialVisit: widget.initialVisit,
);
// The app bar becomes the run's: Back to the list, the run and its
// more menu. Search and the tab name return when the run closes.
return ShellBar(
title: 'Run ${run['id']}',
onBack: widget.onBack,
actions: [
RunMoreMenu(
run: run,
gateway: widget.gateway,
onRunChanged: widget.controller.acceptRunDetail,
// The top bar becomes the run's: Back to the list, its title over its
// number, pipeline and version (a link to that pipeline when the host
// can open it) and its more menu, so the body repeats none of them.
// Search and the tab name return when the run closes.
final title = detailTitle(run);
final subtitle = detailSubtitle(run);
final openPipeline = _openPipeline(run);
final pipelineName = detailPipeline(run);
final more = RunMoreMenu(
run: run,
gateway: widget.gateway,
onRunChanged: widget.controller.acceptRunDetail,
cupertino: cupertino,
onRunOpened: widget.onRunOpened,
);
if (inShellBar) {
return ShellBar(
title: title,
subtitle: subtitle,
onTitlePressed: openPipeline,
titleSemanticLabel: openPipeline == null
? null
: 'Open pipeline $pipelineName',
titleKey: openPipeline == null ? null : runPipelineLinkKey,
onBack: widget.onBack,
actions: [more],
child: detail,
);
}
// On its own the run draws the same bar over its content.
return SegmentedBarOverlay(
bar: SegmentedBar(
cupertino: cupertino,
leading: SegmentedBackButton(
key: const Key('run-detail-back'),
cupertino: cupertino,
onRunOpened: widget.onRunOpened,
onPressed: widget.onBack,
),
],
title: title,
subtitle: subtitle,
onTitlePressed: openPipeline,
titleSemanticLabel: openPipeline == null
? null
: 'Open pipeline $pipelineName',
titleKey: openPipeline == null ? null : runPipelineLinkKey,
actions: [more],
),
child: detail,
);
},
);
/// Opens the run's pipeline at its pinned version, or null when the run
/// names none or the host cannot navigate.
VoidCallback? _openPipeline(JsonMap run) {
final id = runPipelineId(run);
final open = widget.onOpenPipeline;
if (id == null || open == null) return null;
final version = run['version'];
return () => open(id, version is num ? version.toInt() : 0);
}
Widget _placeholder(BuildContext context, {required bool cupertino}) {
final loading = widget.controller.detailLoading;
final message = loading
+38 -25
View File
@@ -4,6 +4,7 @@ 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 '../../../ui/status/run_status_icon.dart';
import '../../attention/notify/notification_controller.dart';
@@ -112,30 +113,36 @@ class RunsList extends StatelessWidget {
if (controller.error != null && controller.runs.isEmpty) {
return _emptyError(context);
}
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (controller.error != null) _inlineError(context),
RunsFilters(controller: controller),
Expanded(
child: controller.visibleRuns.isEmpty
? _state(
context,
icon: Icon(
usesCupertinoHost(context)
? CupertinoIcons.tray
: Icons.inbox_outlined,
),
title: 'No runs found.',
subtitle: 'Try changing or clearing the filters.',
)
: _groupedRuns(context),
),
],
// The notice and the applied filters lead the list, so they scroll
// behind the top bar with the runs and start below it at rest.
final header = [
if (controller.error != null) _inlineError(context),
RunsFilters(controller: controller),
];
if (controller.visibleRuns.isNotEmpty) return _groupedRuns(context, header);
return BelowTopBar(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
...header,
Expanded(
child: _state(
context,
icon: Icon(
usesCupertinoHost(context)
? CupertinoIcons.tray
: Icons.inbox_outlined,
),
title: 'No runs found.',
subtitle: 'Try changing or clearing the filters.',
),
),
],
),
);
}
Widget _groupedRuns(BuildContext context) {
Widget _groupedRuns(BuildContext context, List<Widget> header) {
final groups = groupRunsByDay(controller.visibleRuns, DateTime.now());
final entries = <({String? label, JsonMap? run})>[];
for (final group in groups) {
@@ -145,15 +152,21 @@ class RunsList extends StatelessWidget {
// Runs that start while the list is open enter with a short fade.
return ArrivalScope(
ids: [for (final run in controller.visibleRuns) '${run['id']}'],
child: _entriesList(entries),
child: _entriesList(entries, header),
);
}
Widget _entriesList(List<({String? label, JsonMap? run})> entries) {
Widget _entriesList(
List<({String? label, JsonMap? run})> entries,
List<Widget> header,
) {
// The default padding is the media padding: the first row starts below
// the top bar and the last clears the floating tab bar.
return ListView.builder(
itemCount: entries.length,
itemCount: header.length + entries.length,
itemBuilder: (context, index) {
final entry = entries[index];
if (index < header.length) return header[index];
final entry = entries[index - header.length];
if (entry.label case final label?) {
// A day heading reads as a divider between groups of runs.
return Padding(
@@ -5,6 +5,7 @@ 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 '../../../ui/status/run_status_icon.dart';
import '../domain/run_models.dart';
@@ -39,13 +40,13 @@ class RunsStatsPage extends StatelessWidget {
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: const SegmentedBar(cupertino: true, title: 'Usage'),
child: SafeArea(child: body),
child: SafeArea(top: false, bottom: false, child: body),
);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: const SegmentedBar(cupertino: false, title: 'Usage'),
body: SafeArea(child: body),
body: SafeArea(top: false, bottom: false, child: body),
);
}
@@ -69,7 +70,7 @@ class RunsStatsPage extends StatelessWidget {
: Theme.of(context).colorScheme.onSurfaceVariant;
return ListView(
key: const ValueKey('runs.stats.page'),
padding: const EdgeInsets.all(16),
padding: withBarClearance(context, const EdgeInsets.all(16)),
children: [
Text('Usage', style: heading),
const SizedBox(height: 8),
+12 -10
View File
@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import '../../core/api_gateway.dart';
import '../../ui/adaptive/top_bar_notices.dart';
import '../../ui/adaptive/host.dart';
import 'data/template_repository.dart';
import 'domain/template_entry.dart';
@@ -208,17 +209,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.
return TopBarNotices(
notices: [
if (error != null && _loaded)
TemplatesFailureBanner(
message: error,
retrying: _loading,
onRetry: () => unawaited(_load()),
),
],
child: body,
);
}
}
@@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../../ui/adaptive/host.dart';
import '../domain/template_entry.dart';
@@ -52,7 +53,7 @@ class TemplateDetail extends StatelessWidget {
final cupertino = usesCupertinoHost(context);
return ListView(
key: templateDetailKey,
padding: const EdgeInsets.only(bottom: 24),
padding: withBarClearance(context, const EdgeInsets.only(bottom: 24)),
children: [
if (showBack) _backRow(context, cupertino),
Padding(
@@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../shell/shell_bar.dart';
import '../../../ui/adaptive/host.dart';
const templatesRefreshKey = ValueKey<String>('templates-refresh');
@@ -11,7 +12,8 @@ const templatesBackKey = ValueKey<String>('templates-back');
///
/// Standalone use keeps the host's own app bar with Back and Refresh. A shell
/// that already owns navigation passes [embedded], which drops the bar and
/// keeps Refresh at the top of the body.
/// puts Refresh in the host's bar through `ShellBar` (or, without one,
/// keeps it at the top of the body).
class TemplatesFrame extends StatelessWidget {
const TemplatesFrame({
super.key,
@@ -39,6 +41,11 @@ class TemplatesFrame extends StatelessWidget {
}
Widget _embedded(BuildContext context) {
// A host page with a bar takes Refresh into it; the body then reaches
// its top edge and scrolls behind that bar.
if (ShellBar.available(context)) {
return ShellBar(actions: [_refreshButton(context)], child: body);
}
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -69,7 +76,7 @@ class TemplatesFrame extends StatelessWidget {
title: 'Templates',
actions: [_refreshButton(context)],
),
child: SafeArea(child: body),
child: SafeArea(top: false, bottom: false, child: body),
);
}
@@ -84,7 +91,7 @@ class TemplatesFrame extends StatelessWidget {
: null,
actions: [_refreshButton(context)],
),
body: SafeArea(child: body),
body: SafeArea(top: false, bottom: false, child: body),
);
}
+63 -19
View File
@@ -7,6 +7,7 @@ import '../ui/adaptive/floating_bar_layout.dart';
import '../ui/adaptive/floating_destination_bar.dart';
import 'attention_badge.dart';
import 'destination.dart';
import 'list_detail.dart';
import 'shell_bar.dart';
class AdaptiveShell extends StatefulWidget {
@@ -95,19 +96,19 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
);
}
if (destination != AppDestination.runs) return icon;
// Runs in progress at the bottom, runs that need you at the top.
icon = ActivityBadge(
key: const ValueKey('shell.badge.runs.running'),
count: _bar.badge(destination, ShellBadgeKind.running),
label: 'runs in progress',
cupertino: widget.cupertino,
bottom: true,
child: icon,
);
// One indicator: runs that need you outrank runs in progress, so the
// tab never wears two counts at once.
final attention = widget.attentionCount > 0;
return AttentionDestinationIcon(
count: widget.attentionCount,
cupertino: widget.cupertino,
child: icon,
child: ActivityBadge(
key: const ValueKey('shell.badge.runs.running'),
count: attention ? 0 : _bar.badge(destination, ShellBadgeKind.running),
label: 'runs in progress',
cupertino: widget.cupertino,
child: icon,
),
);
}
@@ -148,10 +149,18 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
onTap: (value) => _select(AppDestination.values[value]),
items: _destinationItems(),
);
// Destinations reach the top edge and scroll behind the floating top
// bar too: each learns the bar's height as its top media padding and
// pads its own lists by it (see withTopBarClearance).
final topBar = _ListPaneBar(
split: _bar.split(_selected),
bar: _segmentedBar(spec, details.label),
);
if (widget.cupertino) {
return CupertinoPageScaffold(
navigationBar: _segmentedBar(spec, details.label),
navigationBar: topBar,
child: SafeArea(
top: false,
bottom: false,
child: FloatingBarOverlay(
bar: bar,
@@ -162,14 +171,8 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: _segmentedBar(spec, details.label),
// Destinations start below the floating top bar.
body: SafeArea(
left: false,
right: false,
bottom: false,
child: _destinationStack(contents, index),
),
appBar: topBar,
body: _destinationStack(contents, index),
extendBody: true,
bottomNavigationBar: bar,
);
@@ -208,6 +211,11 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
onPressed: onBack,
),
title: spec?.title ?? label,
subtitle: spec?.subtitle,
subtitleIcon: spec?.subtitleIcon,
onTitlePressed: spec?.onTitlePressed,
titleSemanticLabel: spec?.titleSemanticLabel,
titleKey: spec?.titleKey,
actions: [
if (published.isNotEmpty)
// A screen taking the bar over cross-fades its actions in.
@@ -244,3 +252,39 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
Widget _destinationStack(List<Widget> contents, int index) =>
IndexedStack(key: _destinationStackKey, index: index, children: contents);
}
/// The shell's top bar, over the list pane only while the tab shows a list
/// beside an open item ([ShellPaneSplit]); the item's own bar takes the rest
/// of the same row. The bar keeps its place in the scaffold either way, so a
/// split never remounts it.
class _ListPaneBar extends StatelessWidget
implements ObstructingPreferredSizeWidget {
const _ListPaneBar({required this.split, required this.bar});
final bool split;
final SegmentedBar bar;
@override
Size get preferredSize => bar.preferredSize;
@override
bool shouldFullyObstruct(BuildContext context) =>
bar.shouldFullyObstruct(context);
@override
Widget build(BuildContext context) => LayoutBuilder(
builder: (context, constraints) {
final width = split
? listDetailListWidth(
MediaQuery.sizeOf(context).width,
constraints.maxWidth,
)
: constraints.maxWidth;
return Align(
alignment: AlignmentDirectional.topStart,
heightFactor: 1,
child: SizedBox(width: width, child: bar),
);
},
);
}
+11 -8
View File
@@ -141,21 +141,24 @@ class _DetailPaneState extends State<DetailPane> {
cupertino: cupertino,
automaticallyImplyLeading: widget.implyBack,
title: title,
subtitle: spec?.subtitle,
subtitleIcon: spec?.subtitleIcon,
onTitlePressed: spec?.onTitlePressed,
titleSemanticLabel: spec?.titleSemanticLabel,
titleKey: spec?.titleKey,
actions: actions,
);
// The bottom inset (the system's, or a floating tab bar's when the
// pane sits beside a list) passes through: the open item's content
// floats its own tabs above it and pads its lists clear of it.
// Both insets pass through: the content scrolls behind the bar and
// pads its lists by the bar's height (top) and by the system's or a
// floating tab bar's (bottom), floating its own tabs clear of them.
final content = SafeArea(top: false, bottom: false, child: body);
if (cupertino) {
return CupertinoPageScaffold(
navigationBar: bar,
child: SafeArea(bottom: false, child: body),
);
return CupertinoPageScaffold(navigationBar: bar, child: content);
}
return Scaffold(
extendBodyBehindAppBar: true,
appBar: bar,
body: SafeArea(bottom: false, child: body),
body: content,
);
},
);
+73 -40
View File
@@ -3,7 +3,9 @@ import 'dart:math' as math;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/adaptive/floating_bar_layout.dart';
import '../ui/adaptive/host.dart';
import 'shell_bar.dart';
/// At least this wide, a destination keeps its list beside the open item
/// (with the destination rail) instead of pushing the item as its own page.
@@ -16,8 +18,32 @@ const double _bodyAvailableMaximum = 0.75;
bool showsListBesideDetail(BuildContext context) =>
MediaQuery.sizeOf(context).width >= kListDetailMinWidth;
/// The open item's width beside a list, for a [window] this wide and
/// [available] width for both panes and their divider.
double listDetailBodyWidth(double window, double available) {
// Target 60% of the full window. Keep at least half for the body while
// leaving a flexible share for native list controls on tighter windows.
final requestedMinimum = window * _bodyWindowMinimum;
final minimum = available > requestedMinimum
? requestedMinimum
: available * _bodyWindowMinimum;
final maximum = math.max(minimum, available * _bodyAvailableMaximum);
return (window * _bodyWindowTarget).clamp(minimum, maximum);
}
/// The list pane's width beside an open item (see [listDetailBodyWidth]),
/// one divider excluded.
double listDetailListWidth(double window, double available) =>
math.max(0, available - 1 - listDetailBodyWidth(window, available));
/// One body-priority policy for all destinations, derived from the full window
/// and actual available space after navigation. No fixed pixel pane widths.
///
/// Under the shell, the list keeps the shell's bar (narrowed to the list pane
/// through [ShellPaneSplit]) and the open item owns the rest of the top row:
/// the detail starts at the top edge with only the system inset as its top
/// padding, and its own tabs float at its top ([PageTabsEdge]) so they never
/// stack on the shell's tab bar at the bottom.
class ListDetailPanes extends StatelessWidget {
const ListDetailPanes({super.key, required this.list, required this.detail});
@@ -32,50 +58,57 @@ class ListDetailPanes extends StatelessWidget {
color: CupertinoColors.separator.resolveFrom(context),
)
: const VerticalDivider(width: 1);
return LayoutBuilder(
builder: (context, constraints) {
final window = MediaQuery.sizeOf(context).width;
// Target 60% of the full window. Keep at least half for the body while
// leaving a flexible share for native list controls on tighter windows.
final requestedMinimum = window * _bodyWindowMinimum;
final minimum = constraints.maxWidth > requestedMinimum
? requestedMinimum
: constraints.maxWidth * _bodyWindowMinimum;
final maximum = math.max(
minimum,
constraints.maxWidth * _bodyAvailableMaximum,
);
final bodyWidth = (window * _bodyWindowTarget).clamp(minimum, maximum);
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: SizedBox.expand(
key: const ValueKey('list-detail-list'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-list',
child: list,
final media = MediaQuery.of(context);
final split = ShellBar.available(context);
return ShellPaneSplit(
child: LayoutBuilder(
builder: (context, constraints) {
final bodyWidth = listDetailBodyWidth(
media.size.width,
constraints.maxWidth,
);
Widget body = detail;
if (split) {
// Beside the list the item is not under the shell's bar: it keeps
// only the system's own inset and draws its bar at the top edge.
body = MediaQuery(
data: media.copyWith(
padding: media.padding.copyWith(top: media.viewPadding.top),
),
child: PageTabsEdge(edge: FloatingBarEdge.top, child: body),
);
}
return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: SizedBox.expand(
key: const ValueKey('list-detail-list'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-list',
child: list,
),
),
),
),
divider,
SizedBox(
width: bodyWidth,
child: SizedBox.expand(
key: const ValueKey('list-detail-body'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-body',
child: detail,
divider,
SizedBox(
width: bodyWidth,
child: SizedBox.expand(
key: const ValueKey('list-detail-body'),
child: Semantics(
container: true,
explicitChildNodes: true,
identifier: 'list-detail-body',
child: body,
),
),
),
),
],
);
},
],
);
},
),
);
}
}
+95
View File
@@ -7,12 +7,27 @@ import 'destination.dart';
class ShellBarSpec {
const ShellBarSpec({
this.title,
this.subtitle,
this.subtitleIcon,
this.onTitlePressed,
this.titleSemanticLabel,
this.titleKey,
this.onBack,
this.actions = const [],
this.barless = false,
});
final String? title;
/// 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;
final IconData? subtitleIcon;
/// Makes the title pill a button; see `SegmentedBar.onTitlePressed`.
final VoidCallback? onTitlePressed;
final String? titleSemanticLabel;
final Key? titleKey;
final VoidCallback? onBack;
final List<Widget> actions;
@@ -26,6 +41,20 @@ class ShellBarRegistry extends ChangeNotifier {
final Map<AppDestination, (Object, ShellBarSpec)> _specs = {};
final Map<(AppDestination, ShellBadgeKind), int> _badges = {};
final Map<AppDestination, int> _splits = {};
/// Whether a tab's screen shows a list beside an open item right now
/// ([ShellPaneSplit]): the shell's bar then covers the list pane only, so
/// the item's own bar shares its top row.
bool split(AppDestination destination) => (_splits[destination] ?? 0) > 0;
void _setSplit(AppDestination destination, bool value) {
if (_disposed) return;
final before = split(destination);
_splits[destination] = (_splits[destination] ?? 0) + (value ? 1 : -1);
if (split(destination) != before) notifyListeners();
}
/// The count a tab's screen published for [kind], 0 when none.
int badge(AppDestination destination, ShellBadgeKind kind) =>
_badges[(destination, kind)] ?? 0;
@@ -92,6 +121,11 @@ class ShellBar extends StatefulWidget {
const ShellBar({
super.key,
this.title,
this.subtitle,
this.subtitleIcon,
this.onTitlePressed,
this.titleSemanticLabel,
this.titleKey,
this.onBack,
this.actions = const [],
this.active = true,
@@ -107,6 +141,13 @@ class ShellBar extends StatefulWidget {
final bool active;
final String? title;
/// See [ShellBarSpec.subtitle].
final String? subtitle;
final IconData? subtitleIcon;
final VoidCallback? onTitlePressed;
final String? titleSemanticLabel;
final Key? titleKey;
final VoidCallback? onBack;
final List<Widget> actions;
final Widget child;
@@ -141,6 +182,11 @@ class _ShellBarState extends State<ShellBar> {
}
final spec = ShellBarSpec(
title: widget.title,
subtitle: widget.subtitle,
subtitleIcon: widget.subtitleIcon,
onTitlePressed: widget.onTitlePressed,
titleSemanticLabel: widget.titleSemanticLabel,
titleKey: widget.titleKey,
onBack: widget.onBack,
actions: widget.actions,
barless: widget.barless,
@@ -169,6 +215,55 @@ class _ShellBarState extends State<ShellBar> {
}
}
/// Tells the shell, while mounted, that its tab shows a list beside an open
/// item (`ListDetailPanes`). The shell then narrows its own bar to the list
/// pane, so each pane owns its bar on one shared top row. Outside a shell it
/// does nothing.
class ShellPaneSplit extends StatefulWidget {
const ShellPaneSplit({super.key, required this.child});
final Widget child;
@override
State<ShellPaneSplit> createState() => _ShellPaneSplitState();
}
class _ShellPaneSplitState extends State<ShellPaneSplit> {
ShellBarScope? _scope;
@override
void didChangeDependencies() {
super.didChangeDependencies();
final scope = ShellBarScope.maybeOf(context);
if (scope == _scope) return;
_release();
_scope = scope;
if (scope != null) {
// The bar is above this screen; update it after this frame's build.
WidgetsBinding.instance.addPostFrameCallback(
(_) => scope.registry._setSplit(scope.destination, true),
);
}
}
void _release() {
final scope = _scope;
if (scope == null) return;
WidgetsBinding.instance.addPostFrameCallback(
(_) => scope.registry._setSplit(scope.destination, false),
);
}
@override
void dispose() {
_release();
super.dispose();
}
@override
Widget build(BuildContext context) => widget.child;
}
/// What a tab badge counts.
enum ShellBadgeKind {
/// Runs still executing.
+156 -37
View File
@@ -19,6 +19,77 @@ EdgeInsetsGeometry withFloatingBarClearance(
EdgeInsetsGeometry padding,
) => padding.add(EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom));
/// [padding] with the top bar's clearance added at the top.
///
/// A page whose top bar floats over its content (a `SegmentedBar` in a
/// scaffold with `extendBodyBehindAppBar`, a `SegmentedBarOverlay`, the
/// shell's bar) reads the bar's height as [MediaQuery.paddingOf] top. Adding
/// it to a list's own padding starts the first item below the bar at rest
/// while scrolled content passes behind the glass pieces. Lists without
/// explicit padding (`ListView`'s default) already do this themselves.
EdgeInsetsGeometry withTopBarClearance(
BuildContext context,
EdgeInsetsGeometry padding,
) => padding.add(EdgeInsets.only(top: MediaQuery.paddingOf(context).top));
/// [padding] with both the top bar's and the floating tab bar's clearance:
/// for a list that scrolls behind a bar at each edge.
EdgeInsetsGeometry withBarClearance(
BuildContext context,
EdgeInsetsGeometry padding,
) {
final media = MediaQuery.paddingOf(context);
return padding.add(EdgeInsets.only(top: media.top, bottom: media.bottom));
}
/// Empty space as tall as the top bar's clearance ([MediaQuery.paddingOf]
/// top), starting a scrolling column so its first item sits below the bar at
/// rest and scrolls behind it.
class TopBarClearance extends StatelessWidget {
const TopBarClearance({super.key});
@override
Widget build(BuildContext context) =>
SizedBox(height: MediaQuery.paddingOf(context).top);
}
/// [TopBarClearance] as the first sliver of a [CustomScrollView]: the first
/// item starts below the bar at rest and scrolls behind it.
///
/// The clearance stays pinned (it paints nothing and takes no taps), so a
/// pinned header further down (`PinnedHeaderSliver`, a sticky section title)
/// pins just below the bar rather than behind it.
class SliverTopBarClearance extends StatelessWidget {
const SliverTopBarClearance({super.key});
@override
Widget build(BuildContext context) =>
const PinnedHeaderSliver(child: TopBarClearance());
}
/// The top bar's height over the content at [context]: where a pinned
/// header must stop so it stays below the bar.
double topBarInset(BuildContext context) => MediaQuery.paddingOf(context).top;
/// Content that cannot scroll behind the top bar (a fixed header, a canvas
/// with its own overlay controls): it starts below the bar, and its subtree no
/// longer sees the bar's height as padding.
class BelowTopBar extends StatelessWidget {
const BelowTopBar({super.key, required this.child});
final Widget child;
@override
Widget build(BuildContext context) => Padding(
padding: EdgeInsets.only(top: MediaQuery.paddingOf(context).top),
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: child,
),
);
}
/// Empty space as tall as the floating bar's clearance
/// ([MediaQuery.paddingOf] bottom), ending a scrolling column so its last item
/// comes clear of the bar at rest.
@@ -39,49 +110,91 @@ class SliverFloatingBarClearance extends StatelessWidget {
const SliverToBoxAdapter(child: FloatingBarClearance());
}
/// Floats [bar] over the bottom of [child], the way a scaffold with
/// `extendBody` floats its bottom bar, for a bar that is not a scaffold's.
/// The edge a page's own floating tab bar sits at.
enum FloatingBarEdge {
/// Above the bottom safe area: a phone page, or a page covering the shell.
bottom,
/// Just below the page's top bar: a detail pane beside a list, where the
/// shell's own tab bar already floats at the bottom.
top,
}
/// Where the pages' own tab bars float in this subtree ([FloatingBarEdge]).
///
/// [child] fills the whole area and scrolls behind the bar; it learns the
/// bar's measured height (bottom safe area and margins included) as its
/// [MediaQuery.paddingOf] bottom, so a list can pad its last item clear of the
/// bar at rest (see [withFloatingBarClearance]). Taps the bar does not take,
/// such as beside a bar narrower than the area, reach [child].
/// A detail pane beside a list says [FloatingBarEdge.top], so an open item's
/// tabs never stack on the shell's tab bar; everywhere else they float at the
/// bottom.
class PageTabsEdge extends InheritedWidget {
const PageTabsEdge({super.key, required this.edge, required super.child});
final FloatingBarEdge edge;
static FloatingBarEdge of(BuildContext context) =>
context.dependOnInheritedWidgetOfExactType<PageTabsEdge>()?.edge ??
FloatingBarEdge.bottom;
@override
bool updateShouldNotify(PageTabsEdge oldWidget) => edge != oldWidget.edge;
}
/// Floats [bar] over [child] at [edge], the way a scaffold with `extendBody`
/// floats its bottom bar, for a bar that is not a scaffold's.
///
/// [child] fills the whole area and scrolls behind the bar. At the bottom it
/// learns the bar's measured height (bottom safe area and margins included)
/// as its [MediaQuery.paddingOf] bottom, so a list can pad its last item clear
/// of the bar at rest (see [withFloatingBarClearance]). At the top the bar
/// sits below the area's own top inset (the page's top bar) and the content's
/// top padding grows by the bar's height (see [withTopBarClearance]). Taps the
/// bar does not take, such as beside a bar narrower than the area, reach
/// [child].
class FloatingBarOverlay extends StatelessWidget {
const FloatingBarOverlay({super.key, required this.bar, required this.child});
const FloatingBarOverlay({
super.key,
required this.bar,
required this.child,
this.edge = FloatingBarEdge.bottom,
});
final Widget bar;
final Widget child;
final FloatingBarEdge edge;
@override
Widget build(BuildContext context) => CustomMultiChildLayout(
delegate: _OverlayLayout(),
children: [
// Painted first, so the bar draws (and takes taps) above it.
LayoutId(
id: _Slot.content,
child: LayoutBuilder(
builder: (context, constraints) {
final barHeight = constraints is _ContentConstraints
? constraints.barHeight
: 0.0;
final media = MediaQuery.of(context);
return MediaQuery(
data: media.copyWith(
padding: media.padding.copyWith(
bottom: barHeight > media.padding.bottom
? barHeight
: media.padding.bottom,
),
),
child: child,
);
},
Widget build(BuildContext context) {
final top = edge == FloatingBarEdge.top;
final inset = top ? MediaQuery.paddingOf(context).top : 0.0;
return CustomMultiChildLayout(
delegate: _OverlayLayout(top: top, inset: inset),
children: [
// Painted first, so the bar draws (and takes taps) above it.
LayoutId(
id: _Slot.content,
child: LayoutBuilder(
builder: (context, constraints) {
final barHeight = constraints is _ContentConstraints
? constraints.barHeight
: 0.0;
final media = MediaQuery.of(context);
final padding = top
? media.padding.copyWith(top: inset + barHeight)
: media.padding.copyWith(
bottom: barHeight > media.padding.bottom
? barHeight
: media.padding.bottom,
);
return MediaQuery(
data: media.copyWith(padding: padding),
child: child,
);
},
),
),
),
LayoutId(id: _Slot.bar, child: bar),
],
);
LayoutId(id: _Slot.bar, child: bar),
],
);
}
}
enum _Slot { content, bar }
@@ -110,6 +223,11 @@ class _ContentConstraints extends BoxConstraints {
}
class _OverlayLayout extends MultiChildLayoutDelegate {
_OverlayLayout({required this.top, required this.inset});
final bool top;
final double inset;
@override
void performLayout(Size size) {
final bar = layoutChild(
@@ -120,7 +238,7 @@ class _OverlayLayout extends MultiChildLayoutDelegate {
maxHeight: size.height,
),
);
positionChild(_Slot.bar, Offset(0, size.height - bar.height));
positionChild(_Slot.bar, Offset(0, top ? inset : size.height - bar.height));
layoutChild(
_Slot.content,
_ContentConstraints(size, barHeight: bar.height),
@@ -129,5 +247,6 @@ class _OverlayLayout extends MultiChildLayoutDelegate {
}
@override
bool shouldRelayout(_OverlayLayout oldDelegate) => false;
bool shouldRelayout(_OverlayLayout oldDelegate) =>
oldDelegate.top != top || oldDelegate.inset != inset;
}
@@ -28,9 +28,15 @@ class FloatingDestinationBar extends StatelessWidget {
required this.currentIndex,
required this.onTap,
required this.items,
this.edge = FloatingBarEdge.bottom,
});
final bool cupertino;
/// The edge the bar floats at. At [FloatingBarEdge.top] (an open item's
/// tabs under its pane's top bar) a wide bar sits at the leading edge, in
/// line with the bar's title, and keeps no bottom safe area.
final FloatingBarEdge edge;
final int currentIndex;
final ValueChanged<int> onTap;
final List<FloatingDestinationItem> items;
@@ -41,8 +47,61 @@ class FloatingDestinationBar extends StatelessWidget {
/// Height of the Cupertino bar inside the pill (the stock bar is 50).
static const double cupertinoHeight = 54;
/// The side margin at [FloatingBarEdge.top], matching the top bar's own.
static const double topMargin = 12;
@override
Widget build(BuildContext context) {
final top = edge == FloatingBarEdge.top;
final margins = 2 * (top ? topMargin : kFloatingBarMargin);
final bar = LayoutBuilder(
builder: (context, constraints) {
// Wide is judged on the space the bar is given, margins included,
// the way the shell and the pages judge their own layouts.
final available = constraints.maxWidth;
final wide = available + margins >= kFloatingBarWideWidth;
final width = wide
? math.min(available, _tabsWidth(context))
: available;
return Align(
// As tall as the pill, so a scaffold or overlay measures the bar
// and not the whole area it may grow into.
heightFactor: 1,
alignment: !wide
? Alignment.bottomCenter
: top
? AlignmentDirectional.topStart
: AlignmentDirectional.bottomEnd,
child: SizedBox(
width: math.max(0, width),
// The insets are handled around the pill. The host bars pad
// themselves by any media padding left over (a page's top bar,
// another floating bar below a pane), which would swell the pill.
child: MediaQuery.removePadding(
context: context,
removeTop: true,
removeBottom: true,
removeLeft: true,
removeRight: true,
child: GlassPill(
cupertino: cupertino,
child: cupertino
? _cupertinoBar(context)
: _materialBar(context),
),
),
),
);
},
);
if (top) {
// Under a top bar: no safe area to keep clear of, only the gap to the
// content below.
return Padding(
padding: const EdgeInsets.fromLTRB(topMargin, 0, topMargin, 8),
child: bar,
);
}
return SafeArea(
top: false,
minimum: const EdgeInsets.fromLTRB(
@@ -51,35 +110,7 @@ class FloatingDestinationBar extends StatelessWidget {
kFloatingBarMargin,
kFloatingBarMargin,
),
child: LayoutBuilder(
builder: (context, constraints) {
// Wide is judged on the space the bar is given, margins included,
// the way the shell and the pages judge their own layouts.
final available = constraints.maxWidth;
final wide =
available + 2 * kFloatingBarMargin >= kFloatingBarWideWidth;
final width = wide
? math.min(available, _tabsWidth(context))
: available;
return Align(
// As tall as the pill, so a scaffold or overlay measures the bar
// and not the whole area it may grow into.
heightFactor: 1,
alignment: wide
? AlignmentDirectional.bottomEnd
: Alignment.bottomCenter,
child: SizedBox(
width: math.max(0, width),
child: GlassPill(
cupertino: cupertino,
child: cupertino
? _cupertinoBar(context)
: _materialBar(context),
),
),
);
},
),
child: bar,
);
}
+47
View File
@@ -0,0 +1,47 @@
import 'package:flutter/widgets.dart';
/// Content that scrolls behind a floating top bar, with optional [notices]
/// (a connection banner, a refused refresh) that stay put above it.
///
/// Without notices [child] reaches the top edge and keeps the bar's height as
/// its [MediaQuery.paddingOf] top, so its list starts below the bar at rest
/// and scrolls behind it. With notices they sit below the bar and [child]
/// below them, no longer seeing the bar's height. [child] keeps its place in
/// the tree either way, so a banner coming or going never remounts it.
class TopBarNotices extends StatelessWidget {
const TopBarNotices({
super.key,
this.notices = const [],
required this.child,
});
final List<Widget> notices;
final Widget child;
@override
Widget build(BuildContext context) {
final media = MediaQuery.of(context);
final inset = media.padding.top;
final shown = notices.isNotEmpty;
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: EdgeInsets.only(top: shown ? inset : 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: notices,
),
),
Expanded(
child: MediaQuery(
data: media.copyWith(
padding: media.padding.copyWith(top: shown ? 0 : inset),
),
child: child,
),
),
],
);
}
}
+151
View File
@@ -0,0 +1,151 @@
# App chrome fixes (style review batch A: F1, F2, F3, F7, F15/F26, F19)
Follow-up to `notes/segmented-bar.md` and `notes/floating-tab-bars.md`, from
the independent review in `/tmp/app-style-review/report.md`.
## F1: content floats behind the top bar
Helpers (`lib/ui/adaptive/floating_bar_layout.dart`, next to
`withFloatingBarClearance`):
- `withTopBarClearance(context, padding)`, `withBarClearance` (top + bottom),
`TopBarClearance`, `topBarInset(context)`.
- `SliverTopBarClearance`: a *pinned*, empty, tap-through header, so the first
sliver starts below the bar and any later pinned header (sticky sections,
`StickyBar`) pins at the bar's inset instead of behind it.
- `BelowTopBar`: fixed content (a canvas, a header) starts below the bar and
its subtree no longer sees the bar's height.
- `lib/ui/adaptive/top_bar_notices.dart` `TopBarNotices(notices:, child:)`:
banners stay below the bar; without one the child reaches the top edge.
The child keeps its place, so a banner never remounts it.
Applied:
- Shell (`shell/adaptive_shell.dart`): no top `SafeArea` (Material body is the
destination stack directly; Cupertino `SafeArea(top: false, bottom: false)`).
Scaffold structure unchanged otherwise (the stack keeps its GlobalKey).
- `DetailPane` (`shell/detail_page.dart`): body `SafeArea(top: false, bottom:
false)`; passes the spec's subtitle / title press / title key to the bar.
- Runs list (`runs_list.dart`): the error notice and applied filters are the
first rows of the one `ListView` (default media padding), so they scroll
behind the bar; the empty state uses `BelowTopBar`.
- Pipelines list (`pipeline_list_panel.dart`): All/Scheduled, the clear-filter
button, banners and progress lead the list; empty/loading states keep them
below the bar.
- Pipeline detail: the tab body reaches the top edge; refresh/error notices
stay below the bar without remounting the tab. Source uses
`withBarClearance`; Graph is `BelowTopBar` (its overlay buttons).
- Run detail: the slim header (status + actions + notices) is padded by the
inset; tab bodies use `SliverTopBarClearance` / `withBarClearance` so they
also clear top tabs (below). Changes tab is `BelowTopBar` (fixed summary).
- Artifact gallery (`artifact_visit_list.dart`, page): `SliverTopBarClearance`
first, page `SafeArea(top: false, bottom: false)`.
- Stage definition page: list `withBarClearance`; the pipeline/version line
moved to the bar's subtitle (`StageDefinitionView(showIdentity: false)`).
- Templates (`templates_frame.dart`, `screen.dart`, `template_detail.dart`,
`application/templates_destination.dart`): page body floats; Refresh moves
into the page bar (the page hosts a `ShellBarScope`, the embedded frame
publishes through `ShellBar`); failure/connection banners use
`TopBarNotices`.
- Pipeline filter page, usage (`runs_stats_page.dart`): lists use
`withBarClearance`.
- Runs/Pipelines/Chat destinations: connection banner through `TopBarNotices`.
Left with a top inset (deliberately, with reason):
- Chat list (`features/chat/screen.dart` wraps it in `BelowTopBar`): the chat
lane owns its list padding; this keeps today's look until it pads itself.
Settings and Search keep their own `SafeArea`s (other lanes).
- `graph_expanded_view.dart`, `run_graph_preview.dart`: canvases with overlay
controls at their top and fit-to-viewport; floating them needs inset-aware
fit and controls (F12 lane).
- `file_diff_viewer.dart`, `run_changes_action.dart` (ChangesViewer),
`artifact_viewer_page.dart`: fixed headers/info strips above the scrolling
part; floating needs those headers inside the scroll (F13/F25 lanes touch
the same views).
- `application/schedules_destination.dart`: the search/refresh toolbar is a
pinned control row; the page keeps its top inset.
## F2/F3: one top row, no stacked bottom pills on wide windows
- `ListDetailPanes` (`shell/list_detail.dart`) publishes `ShellPaneSplit` to
the shell; the shell wraps its bar in `_ListPaneBar`, which narrows it to the
list pane width (`listDetailListWidth`, the same split math, now shared as
`listDetailBodyWidth`). The detail side gets only the system inset
(`viewPadding.top`) as its top padding, so its `DetailPane` bar sits on the
same row at the top edge.
- The detail side also gets `PageTabsEdge(edge: FloatingBarEdge.top)`. Run and
pipeline tabs read it: `FloatingBarOverlay(edge:)` and
`FloatingDestinationBar(edge:)` float the tabs just under the pane's bar /
header (sized to tabs, leading edge, 12 margins); the content's top padding
grows by the tabs' height. On phones and pushed pages nothing changes
(bottom).
- `FloatingDestinationBar` now strips leftover media padding inside the pill:
the host `NavigationBar` has its own `SafeArea` and swelled to ~130px when a
page's top padding (or the shell's bottom bar height) reached it.
- F3: wide pipeline detail is a `DetailPane` like runs and chat; the panel
itself publishes title, subtitle and actions through `ShellBar` (also on the
phone page, so `screen.dart` no longer wraps it).
## F7: pipeline detail
- Run/Runs FABs removed; they are the bar's actions (`pipelineBarAction`: a
`TextButton.icon` Runs and `FilledButton.icon` Run, Cupertino plain/filled
buttons; keys `pipeline-view-runs`, `run-pipeline-action` kept).
`RunPipelineAction(fab:)` became `inBar:`; `pipelineFab` is gone.
- No headline in the body: name in the title pill, `id · v · stages` as its
subtitle (Summary drops that line when in a bar,
`PipelineSummaryView(showIdentity:)`). A bare panel (no bar, tests) keeps a
header with the name and the actions row (`pipeline-detail-header`,
`pipeline-actions`).
## F15/F26: run detail title
- Title pill: the run's real title, subtitle `Run N · pipeline · vX`
(`detailSubtitle`). When the host can open pipelines the pill is the link
(`runPipelineLinkKey`, label `Open pipeline <name>`), replacing the body's
`Pipeline <name>` line.
- Body header: only the coloured status kicker beside the run actions, and the
notices. Title, `Run N`, pipeline line and the old `← Back to list` /
Cupertino Back row are gone; a run detail outside any bar draws the same
`SegmentedBar` (Back `run-detail-back`, title, subtitle, more menu) over
itself with `SegmentedBarOverlay`. (The loading/error placeholder keeps its
`Back to list` button: it has no bar content to show.)
## F19: one Runs badge
Attention outranks running: the running `ActivityBadge` count is 0 while the
attention count is positive; both stay in the tree (keys unchanged), so the
icon never remounts. The running badge moved to the same top corner.
## Tests
New: `test/ui/adaptive/top_bar_clearance_test.dart` (list reaches the top
edge, starts below the bar, scrolls behind it — Material and Cupertino; a
pinned header after `SliverTopBarClearance` pins at the inset;
`TopBarNotices` keeps the child mounted; top-edge tab bar position, height
and content padding), `test/shell/pane_bar_row_test.dart` (1200: shell bar
pieces stay within the list pane, pane bar on the same row, subtitle in the
pill, item tabs under the pane bar and far above the shell tabs, item list
below its tabs — both hosts; 390 page: tabs at bottom, content from the top
edge below the bar; one Runs badge).
Updated for intentional changes: `run_detail_finders.dart` (title is in the
pane/page bar), `runs_screen_test.dart` and `runs_destination_test.dart` (the
bar title arrives a frame later), `run_detail_widget_test.dart` (kicker below
the bar title), `run_detail_header_test.dart` (link label is the pill's),
`pipelines_screen_test.dart` (Run/Runs in the bar),
`pipeline_list_composition_test.dart` (no body headline), `widget_test.dart`
(a bare body is centred, bodies reach the top edge).
## Evidence
`/tmp/fix-a-evidence/` (headless Chrome via the reviewer's `shoot.mjs` with
its runs/pipelines loopback fixtures over a web build of `lib/main.dart`, and
static builds of `tool/floating_tabs_probe_entry.dart` and
`tool/run_detail_visit_probe.dart`): runs/run detail/pipelines/pipeline
detail at 560 and 1200 (light/dark, scrolled), chat list + thread at 1200,
settings/templates/schedules/search, floating-tabs probe (Cupertino; one
Runs badge), standalone run detail bar (`rv-standalone-*`).
Known gaps: no device run. A standalone `PipelinesScreen` (probe/tests only,
not the app) still shows its window-wide bar above the detail pane's bar.
+5 -4
View File
@@ -55,13 +55,14 @@ Cupertino sidebar are gone.
is `visitTabFor(section)`, so Input/Output highlight Summary.
- Pipeline detail (`features/pipelines/widgets/pipeline_tabs.dart`,
`pipeline_detail_panel.dart`): the same (it was a bottom bar on phones);
`pipeline-detail-tabs`, new `pipeline-detail-tab-<name>`. Run/Runs FABs sit
16 above the bar (`bottom: 16 + MediaQuery.paddingOf(context).bottom`).
`pipeline-detail-tabs`, new `pipeline-detail-tab-<name>`. Run/Runs are now
the top bar's actions, not FABs (`notes/app-chrome-fixes.md`).
- `DetailPane` (`shell/detail_page.dart`) no longer consumes the bottom inset;
its content (run detail, pipeline detail, chat thread with its own
`SafeArea` composer) handles it. Beside a list on a wide window the open
item's tabs therefore float just above the shell's bar (two stacked pills
at the right edge) and content scrolls behind both.
item's tabs float at the top of the pane instead (`PageTabsEdge`,
`FloatingBarEdge.top`), so they never stack on the shell's bar; see
`notes/app-chrome-fixes.md`.
- Not converted (judged not bottom tabs): the segmented filters/toggles at the
top of lists and viewers (`SegmentedButton` / `CupertinoSlidingSegmentedControl`
in markdown source view, artifact gallery mode, diff form, pipeline scope,
+5 -5
View File
@@ -44,11 +44,11 @@ pill on the page's own background) is now the app's only top bar.
the transcript with `SegmentedBarOverlay`; the list pads its first item by
the bar height, so at rest nothing is hidden and scrolled history passes
behind the glass pills.
- Other pages keep their content inset with `SafeArea` (bodies that used
`SafeArea(top: false)` now use the full `SafeArea`; the shell, chat list and
schedules bodies gained a top-only `SafeArea`). They show the new bar but
their content does not yet scroll behind it — each list has its own fixed
padding/headers and needs a per-screen change to consume the media padding.
- The shell, `DetailPane` and most pages now float their content too (top
`SafeArea` dropped; lists pad by `withTopBarClearance` / `withBarClearance` /
`SliverTopBarClearance`, fixed notices use `TopBarNotices` / `BelowTopBar`).
See `notes/app-chrome-fixes.md` for what was converted and what still keeps
a top inset (chat list, settings, search, schedules toolbar, canvases).
- Bottom tab bars float too: see `notes/floating-tab-bars.md`.
## Converted
@@ -8,6 +8,7 @@ import 'package:pipelines_app/application/runs_destination.dart';
import 'package:pipelines_app/application/server_endpoint.dart';
import 'package:pipelines_app/core/transport/pipelines_client.dart';
import 'package:pipelines_app/features/runs/screen.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
import '../core/transport/pipelines_client_test.dart' show FakeChannel;
import '../features/runs/ui/run_detail_finders.dart';
@@ -229,7 +230,8 @@ void main() {
}),
);
await tester.pump();
expect(runDetailText('Open run'), findsOneWidget);
// The detail is open; its title reaches the pane's bar a frame later.
expect(find.byType(RunDetailView), findsOneWidget);
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
first.incoming.addError(StateError('network drop'));
@@ -272,6 +274,7 @@ void main() {
}),
);
await tester.pump();
await tester.pump();
expect(runDetailText('Open run'), findsOneWidget);
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
},
@@ -5,6 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/pipelines/screen.dart';
import 'package:pipelines_app/shell/detail_page.dart';
import 'fixtures.dart';
import 'test_helpers.dart';
@@ -44,38 +45,34 @@ void main() {
expect(find.text('no runs recorded'), findsNothing);
});
testWidgets('the detail header is one identity line; Summary keeps facts', (
tester,
) async {
testWidgets('the pane bar names the pipeline and its identity; the body '
'repeats neither', (tester) async {
final fixture = PipelineFixture();
await pumpWide(tester, gatewayFor(fixture));
await tester.tap(find.byKey(const Key('pipeline-row-1')));
await tester.pumpAndSettle();
final pane = find.byType(DetailPane);
final detail = find.byKey(const Key('pipeline-detail'));
final header = find.byKey(const Key('pipeline-detail-header'));
expect(header, findsOneWidget);
expect(
find.descendant(of: header, matching: find.text('Alpha review')),
findsOneWidget,
// No headline in the body: the title pill holds the name over the
// recorded identity.
expect(find.byKey(const Key('pipeline-detail-header')), findsNothing);
final title = find.descendant(
of: pane,
matching: find.text('Alpha review'),
);
final identity = find.text('id 1 · v2 · 2 stages');
expect(title, findsOneWidget);
expect(identity, findsOneWidget);
expect(
find.descendant(of: header, matching: find.text('id 1 · v2 · 2 stages')),
find.descendant(of: detail, matching: find.text('Alpha review')),
findsNothing,
);
// The recorded identity now sits at the top of the Summary tab.
expect(find.text('id 1 · v2 · 2 stages'), findsOneWidget);
expect(find.descendant(of: detail, matching: identity), findsNothing);
// The identity is the pill's subtitle, under the name.
expect(
tester
.getTopLeft(
find.descendant(
of: header,
matching: find.text('Alpha review'),
),
)
.dx -
tester.getTopLeft(detail).dx,
12,
tester.getTopLeft(identity).dy,
greaterThan(tester.getTopLeft(title).dy),
);
});
@@ -106,14 +106,15 @@ void main() {
await tester.pumpAndSettle();
expect(find.bySemanticsLabel('View runs of Alpha review'), findsOneWidget);
// Run and Runs share one action row, as the web's pipeline actions.
// Run and Runs float at the bottom right, Runs above the primary Run.
// Run and Runs share the detail pane's actions pill at the top right,
// Runs before the primary Run; nothing floats over the content.
final runs = tester.getRect(find.byKey(const Key('pipeline-view-runs')));
final run = tester.getRect(find.byKey(runPipelineActionKey));
final screen = tester.view.physicalSize / tester.view.devicePixelRatio;
expect(runs.bottom, lessThanOrEqualTo(run.top));
expect(runs.right, lessThanOrEqualTo(run.left));
expect((runs.center.dy - run.center.dy).abs(), lessThan(1));
expect(run.right, greaterThan(screen.width - 40));
expect(run.bottom, greaterThan(screen.height - 120));
expect(run.bottom, lessThan(screen.height / 4));
await tester.tap(find.byKey(const Key('pipeline-view-runs')));
expect(opened, [1]);
});
@@ -1,10 +1,17 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
import 'package:pipelines_app/shell/detail_page.dart';
/// Wide screens deliberately repeat the selected title in the visible list.
Finder runDetailText(String text) =>
find.descendant(of: find.byType(RunDetailView), matching: find.text(text));
/// The run's title is in its top bar: the detail pane's (or page's) when the
/// detail sits in one, else the run detail's own.
Finder runDetailText(String text) => find.descendant(
of: find.byWidgetPredicate(
(widget) => widget is RunDetailView || widget is DetailPane,
),
matching: find.text(text),
);
/// Stage identity and visit coordinates are separate rendered fields now.
void expectVisitHeading(WidgetTester tester, String stage, num sequence) {
@@ -89,7 +89,11 @@ void main() {
await tester.tap(find.byKey(runPipelineLinkKey));
await tester.pump();
expect(opened, [(10, 3)]);
expect(find.bySemanticsLabel('Open pipeline nightly'), findsOneWidget);
// The run's title pill is the link, announced as opening the pipeline.
expect(
find.bySemanticsLabel(RegExp('Open pipeline nightly')),
findsOneWidget,
);
});
testWidgets('$host: a succeeded run offers no Retry', (tester) async {
@@ -147,11 +147,12 @@ void main() {
expect(tester.takeException(), isNull);
expect(find.text('Nightly build'), findsOneWidget);
expect(find.textContaining('Original prompt'), findsNothing);
// Both hosts lead with the web's status kicker above the title.
// The title is the top bar's; the status kicker leads the body below
// it, and the body does not repeat the title.
expect(find.byKey(const Key('run-status-kicker')), findsOneWidget);
expect(
tester.getTopLeft(find.byKey(const Key('run-status-kicker'))).dy,
lessThan(tester.getTopLeft(find.text('Nightly build')).dy),
greaterThan(tester.getBottomLeft(find.text('Nightly build')).dy),
);
// Input and Output are sticky collapsibles on both hosts.
expect(
@@ -119,6 +119,7 @@ void main() {
'input': {'prompt': 'initial prompt'},
});
await tester.pump();
await tester.pump();
expect(runDetailText('Alpha run'), findsOneWidget);
expect(find.text('Input'), findsOneWidget);
@@ -159,6 +160,7 @@ void main() {
expect(gateway.detailRequests[2], hasLength(1));
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
await tester.pump();
await tester.pump();
expect(runDetailText('Beta run'), findsOneWidget);
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
});
@@ -251,6 +253,7 @@ void main() {
expect(gateway.detailRequests[2], hasLength(1));
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
await tester.pump();
await tester.pump();
expect(runDetailText('Beta run'), findsOneWidget);
await tester.pumpWidget(_materialScreen(gateway, initialRunId: 1));
@@ -258,6 +261,7 @@ void main() {
expect(gateway.detailRequests[1], hasLength(1));
gateway.replyDetail(1, 0, {'id': 1, 'title': 'Alpha run'});
await tester.pump();
await tester.pump();
expect(runDetailText('Alpha run'), findsOneWidget);
await tester.pumpWidget(_materialScreen(gateway));
@@ -274,6 +278,7 @@ void main() {
await _mountList(tester, gateway);
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
await tester.pump();
await tester.pump();
expect(runDetailText('Beta run'), findsOneWidget);
await tester.pumpWidget(
@@ -291,6 +296,7 @@ void main() {
'status': 'succeeded',
});
await tester.pump();
await tester.pump();
expect(runDetailText('Beta run'), findsOneWidget);
expect(find.byKey(const ValueKey('run-row-1')), findsOneWidget);
});
+231
View File
@@ -0,0 +1,231 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/shell/destination.dart';
import 'package:pipelines_app/shell/detail_page.dart';
import 'package:pipelines_app/shell/list_detail.dart';
import 'package:pipelines_app/shell/shell_bar.dart';
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
/// Beside a list each pane owns its bar on one shared top row, and an open
/// item's tabs never stack on the shell's tab bar at the bottom.
void main() {
Future<void> setSize(WidgetTester tester, Size size) async {
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
}
Rect rectOf(Element element) {
final box = element.renderObject! as RenderBox;
return box.localToGlobal(Offset.zero) & box.size;
}
/// An open item: its title published to the pane's bar, its own tabs
/// floating where the pane says, and a list padded clear of both bars.
Widget item({bool cupertino = false}) => ShellBar(
title: 'Open item',
subtitle: 'Its context',
actions: const [Icon(Icons.more_vert, semanticLabel: 'More')],
child: Builder(
builder: (context) {
final edge = PageTabsEdge.of(context);
return FloatingBarOverlay(
edge: edge,
bar: KeyedSubtree(
key: const Key('item-tabs'),
child: FloatingDestinationBar(
cupertino: cupertino,
edge: edge,
currentIndex: 0,
onTap: (_) {},
items: const [
FloatingDestinationItem(icon: Icon(Icons.notes), label: 'One'),
FloatingDestinationItem(
icon: Icon(Icons.timeline),
label: 'Two',
),
],
),
),
child: Builder(
builder: (context) => ListView(
key: const Key('item-list'),
padding: withBarClearance(context, EdgeInsets.zero),
children: [
for (var index = 0; index < 30; index++)
SizedBox(height: 40, child: Text('item row $index')),
],
),
),
);
},
),
);
Widget shell({bool cupertino = false, int attention = 0}) {
final app = AdaptiveShell(
cupertino: cupertino,
attentionCount: attention,
destinationBodies: {
AppDestination.runs: (_) => ShellBadge(
kind: ShellBadgeKind.running,
count: 4,
child: ListDetailPanes(
list: ShellBar(
actions: [const Icon(Icons.sort, semanticLabel: 'Sort')],
child: ListView(
children: [
for (var index = 0; index < 30; index++)
SizedBox(height: 40, child: Text('list row $index')),
],
),
),
detail: DetailPane(
destination: AppDestination.runs,
implyBack: false,
builder: (_) => item(cupertino: cupertino),
),
),
),
},
destination: AppDestination.runs,
);
return cupertino ? CupertinoApp(home: app) : MaterialApp(home: app);
}
Finder shellBar() => find.byWidgetPredicate(
(widget) => widget is SegmentedBar && widget.title == 'Runs',
);
Finder paneBar() => find.descendant(
of: find.byType(DetailPane),
matching: find.byType(SegmentedBar),
);
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets('$host 1200: the shell bar covers the list pane and the '
'item\'s bar shares its row', (tester) async {
await setSize(tester, const Size(1200, 800));
await tester.pumpWidget(shell(cupertino: cupertino));
await tester.pump();
await tester.pump();
final list = tester.getRect(
find.byKey(const ValueKey('list-detail-list')),
);
final body = tester.getRect(
find.byKey(const ValueKey('list-detail-body')),
);
final shellPills = find.descendant(
of: shellBar(),
matching: find.byType(GlassPill),
);
for (final element in shellPills.evaluate()) {
expect(
rectOf(element).right,
lessThanOrEqualTo(list.right),
reason: 'no shell piece sits over the open item',
);
}
// Both titles on the same top row.
final shellTitle = tester.getRect(
find.descendant(of: shellBar(), matching: find.text('Runs')),
);
final paneTitle = tester.getRect(find.text('Open item'));
expect(paneTitle.left, greaterThanOrEqualTo(body.left));
final paneTop = tester.getRect(
find.descendant(of: paneBar(), matching: find.byType(GlassPill)).first,
);
final shellTop = tester.getRect(shellPills.first);
expect(paneTop.top, shellTop.top);
expect(paneTitle.top, lessThan(shellTitle.bottom));
// The title pill carries the item's context too.
expect(find.text('Its context'), findsOneWidget);
});
testWidgets('$host 1200: the item\'s tabs float under its bar, not on '
'the shell\'s tab bar', (tester) async {
await setSize(tester, const Size(1200, 800));
await tester.pumpWidget(shell(cupertino: cupertino));
await tester.pump();
await tester.pump();
final shellTabs = tester.getRect(
find.descendant(
of: find.byKey(const ValueKey('shell.destination.runs')).first,
matching: find.byType(Icon),
),
);
final itemTabs = tester.getRect(
find.descendant(
of: find.byKey(const Key('item-tabs')),
matching: find.byType(GlassPill),
),
);
final paneBarPill = tester.getRect(
find.descendant(of: paneBar(), matching: find.byType(GlassPill)).first,
);
expect(itemTabs.top, greaterThanOrEqualTo(paneBarPill.bottom));
expect(itemTabs.top, lessThan(200));
expect(itemTabs.bottom, lessThan(shellTabs.top - 100));
// The item's list starts below its tabs at rest.
expect(
tester.getTopLeft(find.text('item row 0')).dy,
greaterThanOrEqualTo(itemTabs.bottom),
);
});
}
testWidgets('390: an open item is its own page with its tabs at the bottom', (
tester,
) async {
await setSize(tester, const Size(390, 844));
await tester.pumpWidget(
MaterialApp(
home: DetailPane(
destination: AppDestination.runs,
builder: (_) => item(),
),
),
);
await tester.pump();
final tabs = tester.getRect(
find.descendant(
of: find.byKey(const Key('item-tabs')),
matching: find.byType(GlassPill),
),
);
expect(tabs.bottom, greaterThan(844 - 40));
// Content reaches the top edge and starts below the page's bar.
final bar = tester.getRect(
find.descendant(of: paneBar(), matching: find.byType(GlassPill)).first,
);
expect(tester.getTopLeft(find.byKey(const Key('item-list'))).dy, 0);
expect(
tester.getTopLeft(find.text('item row 0')).dy,
greaterThanOrEqualTo(bar.bottom),
);
});
testWidgets('the Runs tab shows one indicator: attention outranks running', (
tester,
) async {
await setSize(tester, const Size(1200, 800));
await tester.pumpWidget(shell(attention: 2));
await tester.pump();
await tester.pump();
expect(find.text('2'), findsOneWidget);
expect(find.text('4'), findsNothing);
await tester.pumpWidget(shell());
await tester.pump();
await tester.pump();
expect(find.text('4'), findsOneWidget);
});
}
@@ -0,0 +1,213 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/adaptive/floating_bar_layout.dart';
import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart';
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
import 'package:pipelines_app/ui/adaptive/top_bar_notices.dart';
/// Content floats behind the top bar: lists reach the top edge, start below
/// the bar at rest and scroll behind it; pinned headers pin under it.
void main() {
Future<void> setSize(WidgetTester tester, Size size) async {
tester.view.physicalSize = size;
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
}
Rect barRect(WidgetTester tester) => tester.getRect(
find.descendant(
of: find.byType(SegmentedBar),
matching: find.byType(GlassPill),
),
);
Widget page(Widget body, {bool cupertino = false}) {
final bar = SegmentedBar(cupertino: cupertino, title: 'Page');
if (cupertino) {
return CupertinoApp(
home: CupertinoPageScaffold(navigationBar: bar, child: body),
);
}
return MaterialApp(
home: Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body),
);
}
Widget rows() => Builder(
builder: (context) => ListView(
key: const Key('list'),
padding: withTopBarClearance(context, const EdgeInsets.all(16)),
children: [
for (var index = 0; index < 40; index++)
SizedBox(height: 48, child: Text('row $index')),
],
),
);
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets('$host: a list reaches the top edge, starts below the bar at '
'rest and scrolls behind it', (tester) async {
await setSize(tester, const Size(390, 844));
await tester.pumpWidget(page(rows(), cupertino: cupertino));
expect(tester.getTopLeft(find.byKey(const Key('list'))).dy, 0);
final bar = barRect(tester);
expect(
tester.getTopLeft(find.text('row 0')).dy,
greaterThanOrEqualTo(bar.bottom),
);
await tester.drag(find.byKey(const Key('list')), const Offset(0, -120));
await tester.pump();
// A row now passes behind the glass title pill.
final behind = find.byWidgetPredicate((widget) {
if (widget is! Text || !(widget.data ?? '').startsWith('row ')) {
return false;
}
return true;
});
final rects = behind.evaluate().map(
(element) => tester.getRect(find.byWidget(element.widget)),
);
expect(rects.any((rect) => rect.overlaps(bar)), isTrue);
});
}
testWidgets('a pinned header after SliverTopBarClearance pins below the '
'bar', (tester) async {
await setSize(tester, const Size(390, 844));
await tester.pumpWidget(
page(
CustomScrollView(
key: const Key('list'),
slivers: [
const SliverTopBarClearance(),
const SliverToBoxAdapter(child: SizedBox(height: 200)),
const PinnedHeaderSliver(
child: SizedBox(height: 40, child: Text('pinned')),
),
SliverList.list(
children: [
for (var index = 0; index < 40; index++)
SizedBox(height: 48, child: Text('row $index')),
],
),
],
),
),
);
final inset = barRect(tester).bottom;
await tester.drag(find.byKey(const Key('list')), const Offset(0, -600));
await tester.pump();
// The header pins at the bar's inset, not behind the bar.
expect(
tester.getTopLeft(find.text('pinned')).dy,
greaterThanOrEqualTo(inset),
);
expect(tester.getTopLeft(find.text('pinned')).dy, lessThan(inset + 16));
});
testWidgets('BelowTopBar and TopBarNotices keep fixed content below the bar '
'without remounting it', (tester) async {
await setSize(tester, const Size(390, 844));
var notice = false;
late StateSetter update;
await tester.pumpWidget(
page(
StatefulBuilder(
builder: (context, setState) {
update = setState;
return TopBarNotices(
notices: [if (notice) const Text('Offline')],
child: const _Probe(),
);
},
),
),
);
final bar = barRect(tester);
final probe = tester.state<_ProbeState>(find.byType(_Probe));
expect(probe.topPadding, greaterThanOrEqualTo(bar.bottom));
expect(tester.getTopLeft(find.byType(_Probe)).dy, 0);
update(() => notice = true);
await tester.pump();
expect(tester.state<_ProbeState>(find.byType(_Probe)), same(probe));
expect(
tester.getTopLeft(find.text('Offline')).dy,
greaterThanOrEqualTo(bar.bottom),
);
expect(probe.topPadding, 0);
expect(
tester.getTopLeft(find.byType(_Probe)).dy,
greaterThanOrEqualTo(tester.getBottomLeft(find.text('Offline')).dy),
);
});
testWidgets('a top-edge tab bar sits under the inset and pads the content '
'by both, without swelling over leftover padding', (tester) async {
await setSize(tester, const Size(800, 600));
late double contentTop;
await tester.pumpWidget(
MaterialApp(
home: MediaQuery(
data: const MediaQueryData(
size: Size(800, 600),
padding: EdgeInsets.only(top: 64, bottom: 96),
),
child: FloatingBarOverlay(
edge: FloatingBarEdge.top,
bar: FloatingDestinationBar(
cupertino: false,
edge: FloatingBarEdge.top,
currentIndex: 0,
onTap: (_) {},
items: const [
FloatingDestinationItem(icon: Icon(Icons.notes), label: 'One'),
FloatingDestinationItem(
icon: Icon(Icons.timeline),
label: 'Two',
),
],
),
child: Builder(
builder: (context) {
contentTop = MediaQuery.paddingOf(context).top;
return const SizedBox.expand();
},
),
),
),
),
);
final pill = tester.getRect(find.byType(GlassPill));
expect(pill.top, 64);
// The pill is the bar's own height: leftover media padding is not added.
expect(pill.height, FloatingDestinationBar.materialHeight);
// Wide: sized to its tabs at the leading edge, under the title.
expect(pill.left, FloatingDestinationBar.topMargin);
expect(pill.width, lessThan(400));
expect(contentTop, pill.bottom + 8);
});
}
class _Probe extends StatefulWidget {
const _Probe();
@override
State<_Probe> createState() => _ProbeState();
}
class _ProbeState extends State<_Probe> {
double topPadding = -1;
@override
Widget build(BuildContext context) {
topPadding = MediaQuery.paddingOf(context).top;
return const SizedBox.expand();
}
}
+8 -4
View File
@@ -87,10 +87,14 @@ void main() {
MaterialApp(
home: AdaptiveShell(
destinationBodies: {
AppDestination.pipelines: (_) => StatefulBuilder(
builder: (context, setState) => TextButton(
onPressed: () => setState(() => builds++),
child: Text('Builds: $builds'),
// Bodies reach the top edge under the floating bar; this one
// keeps its button clear of it.
AppDestination.pipelines: (_) => Center(
child: StatefulBuilder(
builder: (context, setState) => TextButton(
onPressed: () => setState(() => builds++),
child: Text('Builds: $builds'),
),
),
),
AppDestination.runs: (_) => const Text('Runs screen'),