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
@@ -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),
);
}