Remove Cupertino branches from runs UI

Keep the Material-only run detail implementation while preserving public parameters for callers. Narrow the corresponding widget tests to the supported Material host and remove unused Cupertino-only code.
This commit is contained in:
2026-11-11 05:11:26 +00:00
parent 591e1eec3a
commit 75929a0a41
26 changed files with 568 additions and 1121 deletions
@@ -1,9 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/segmented_bar.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../../changes/changes.dart';
/// The run detail's action and page label. The viewer itself owns the
@@ -46,23 +44,6 @@ class RunChangesButton extends StatelessWidget {
// failed run still keeps each visit's own recorded capture.
final summary = showRunChangesSummary(run['status']);
void open() => showRunChanges(context, steps: steps, showSummary: summary);
if (usesCupertinoHost(context)) {
return CupertinoButton.tinted(
key: runChangesButtonKey,
onPressed: open,
// The label keeps its intrinsic size until scaled text no longer fits
// the detail's narrowest pane; then it wraps inside the native button
// instead of overflowing the header row.
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(CupertinoIcons.doc_text),
SizedBox(width: 6),
Flexible(child: Text(runChangesLabel)),
],
),
);
}
return OutlinedButton.icon(
key: runChangesButtonKey,
onPressed: open,
@@ -85,23 +66,14 @@ Future<void> showRunChanges(
required bool showSummary,
String title = runChangesLabel,
}) {
final cupertino = usesCupertinoHost(context);
return Navigator.of(context).push<void>(
cupertino
? CupertinoPageRoute<void>(
builder: (_) => _CupertinoChangesPage(
steps: steps,
showSummary: showSummary,
title: title,
),
)
: MaterialPageRoute<void>(
builder: (_) => _MaterialChangesPage(
steps: steps,
showSummary: showSummary,
title: title,
),
),
MaterialPageRoute<void>(
builder: (_) => _MaterialChangesPage(
steps: steps,
showSummary: showSummary,
title: title,
),
),
);
}
@@ -149,21 +121,6 @@ class RunVisitChangesButton extends StatelessWidget {
Widget build(BuildContext context) {
void open() =>
showVisitChanges(context, stage: stage, sequence: sequence, step: step);
if (usesCupertinoHost(context)) {
return CupertinoButton(
key: runVisitChangesButtonKey,
padding: EdgeInsets.zero,
onPressed: open,
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(CupertinoIcons.doc_text),
SizedBox(width: 6),
Flexible(child: Text(runChangesLabel)),
],
),
);
}
return TextButton.icon(
key: runVisitChangesButtonKey,
onPressed: open,
@@ -191,26 +148,3 @@ class _MaterialChangesPage extends StatelessWidget {
body: ChangesViewer(steps: steps, showSummary: showSummary),
);
}
class _CupertinoChangesPage extends StatelessWidget {
const _CupertinoChangesPage({
required this.steps,
required this.showSummary,
required this.title,
});
final List<JsonMap> steps;
final bool showSummary;
final String title;
@override
Widget build(BuildContext context) => CupertinoPageScaffold(
navigationBar: SegmentedBar(cupertino: true, title: title),
child: Theme(
// A CupertinoApp supplies no Material theme; follow the host brightness
// so the viewer's Material-derived section text stays readable.
data: hostTextTheme(context),
child: ChangesViewer(steps: steps, showSummary: showSummary),
),
);
}
@@ -1,8 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/cupertino.dart' show CupertinoColors;
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../actions/decision_action.dart';
import '../actions/decision_wording.dart';
import '../domain/run_decisions.dart';
@@ -26,25 +25,16 @@ class RunDecisionNotice extends StatelessWidget {
// One full-width line of the header strip: the glyph in the waiting
// colour, the title over its meta line, and the action on the trailing
// edge. The strip is already the frame, so the banner draws no card,
// border or tint of its own. The same banner on both hosts.
final cupertino = usesCupertinoHost(context);
// border or tint of its own.
final color = CupertinoColors.systemTeal.resolveFrom(context);
final metaStyle = cupertino
? CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
color: CupertinoColors.secondaryLabel.resolveFrom(context),
)
: Theme.of(context).textTheme.bodySmall;
final metaStyle = Theme.of(context).textTheme.bodySmall;
return Container(
key: const Key('run-decision-banner'),
width: double.infinity,
padding: const EdgeInsets.only(top: 8, bottom: 4),
child: Row(
children: [
Icon(
cupertino ? CupertinoIcons.clock : Icons.schedule,
color: color,
size: 18,
),
Icon(Icons.schedule, color: color, size: 18),
const SizedBox(width: 12),
Expanded(
child: Column(
@@ -35,8 +35,8 @@ class RunDetailActions extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Every run action uses one native style, as the web's `.run-action`:
// outlined on Material, tinted on Cupertino; Cancel alone is tinted
// destructive. Standard native spacing keeps adjacent buttons distinct.
// outlined, with Cancel alone tinted destructive. Standard native spacing
// keeps adjacent buttons distinct.
// Only actions that render are included: a hidden zero-size child still
// consumes Wrap spacing and would double the visible gap.
Wrap(
@@ -1,75 +0,0 @@
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_tabs.dart';
/// The runs detail with standard Cupertino controls. It has no Material
/// 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,
required bool detailLoading,
required String? error,
required bool copying,
required String? copyStatus,
required VoidCallback onCopy,
required ApiGateway gateway,
required ValueChanged<JsonMap> onRunChanged,
required String configuredEndpoint,
String? initialStageKey,
int? initialVisit,
}) {
return RunDetailTabs(
run: run,
cupertino: true,
copying: copying,
copyStatus: copyStatus,
onCopy: onCopy,
gateway: gateway,
onRunChanged: onRunChanged,
configuredEndpoint: configuredEndpoint,
initialStageKey: initialStageKey,
initialVisit: initialVisit,
// A glass strip under the top bar: as wide as its content.
header: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsetsDirectional.fromSTEB(12, 4, 12, 4),
child: Wrap(
spacing: 12,
runSpacing: 4,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
RunStatusKicker(
state: runStateOf(run['status']),
label: runStatusLabel(run),
),
if (copying) const CupertinoActivityIndicator(),
headerActions,
],
),
),
if (detailLoading) const _CupertinoNotice('Refreshing run details…'),
if (error != null) _CupertinoNotice(error),
],
),
);
}
class _CupertinoNotice extends StatelessWidget {
const _CupertinoNotice(this.text);
final String text;
@override
Widget build(BuildContext context) => Padding(
padding: const EdgeInsetsDirectional.fromSTEB(12, 0, 12, 8),
child: Semantics(liveRegion: true, child: Text(text)),
);
}
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -6,7 +5,6 @@ import '../../../core/api_gateway.dart';
import 'run_detail_summary_fields.dart';
import 'run_detail_visit_facts.dart';
import 'run_field_body.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/layout/facts_grid.dart';
import '../../../ui/layout/warnings_section.dart';
import '../../../ui/layout/sticky_section.dart';
@@ -53,17 +51,15 @@ Widget runDetailSummaryTab({
const SliverTopBarClearance(),
if (graphPreview != null) SliverToBoxAdapter(child: graphPreview),
SliverToBoxAdapter(
child: cupertino
? _cupertinoIdentity(context, identity)
: Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: Text(
identity,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
child: Text(
identity,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
),
SliverToBoxAdapter(
child: WarningsSection(messages: warningMessages(run['warnings'])),
@@ -98,9 +94,7 @@ Widget runDetailSummaryTab({
_StickyField(
key: ValueKey('run-detail-summary-${_slug(row.label)}'),
title: row.label,
body: cupertino
? _cupertinoBlock(context, row)
: _materialBlock(context, row),
body: _materialBlock(context, row),
),
_StickyField(
key: const ValueKey('run-detail-summary-input'),
@@ -110,8 +104,7 @@ Widget runDetailSummaryTab({
body: RunFieldBody(
value: run['input'],
empty: visitEmptyInput,
cupertino: cupertino,
textBuilder: cupertino ? _CupertinoSelectableText.new : null,
cupertino: false,
),
),
_StickyField(
@@ -122,8 +115,7 @@ Widget runDetailSummaryTab({
body: RunFieldBody(
value: run['output'],
empty: visitEmptyOutput,
cupertino: cupertino,
textBuilder: cupertino ? _CupertinoSelectableText.new : null,
cupertino: false,
),
),
const SliverToBoxAdapter(child: SizedBox(height: 16)),
@@ -172,7 +164,6 @@ class _StickyFieldState extends State<_StickyField> {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final copyText = widget.copyText;
return ListenableBuilder(
listenable: _controller,
@@ -184,22 +175,11 @@ class _StickyFieldState extends State<_StickyField> {
: _controller.expand(),
trailing: [
if (copyText != null && copyText.isNotEmpty)
cupertino
? CupertinoButton(
padding: const EdgeInsets.symmetric(horizontal: 8),
onPressed: _copy,
child: Icon(
_copied
? CupertinoIcons.checkmark_alt
: CupertinoIcons.doc_on_doc,
semanticLabel: 'Copy ${widget.title}',
),
)
: IconButton(
tooltip: 'Copy ${widget.title}',
onPressed: _copy,
icon: Icon(_copied ? Icons.check : Icons.copy),
),
IconButton(
tooltip: 'Copy ${widget.title}',
onPressed: _copy,
icon: Icon(_copied ? Icons.check : Icons.copy),
),
],
body: Padding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 16),
@@ -218,12 +198,7 @@ Widget runDetailFieldTab({
required bool cupertino,
}) {
// The recorded fields by name, as values, never raw JSON.
final body = RunFieldBody(
value: value,
empty: empty,
cupertino: cupertino,
textBuilder: cupertino ? _CupertinoSelectableText.new : null,
);
final body = RunFieldBody(value: value, empty: empty, cupertino: false);
// Flat on the page on both hosts, like the Summary.
return Builder(
builder: (context) => ListView(
@@ -255,75 +230,4 @@ Widget _materialBlock(BuildContext context, DetailSummaryRow row) {
);
}
// --- Cupertino -------------------------------------------------------------
Widget _cupertinoIdentity(BuildContext context, String identity) {
final theme = CupertinoTheme.of(context);
return Padding(
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 8),
child: Text(
identity,
style: theme.textTheme.tabLabelTextStyle.copyWith(
color: CupertinoColors.secondaryLabel.resolveFrom(context),
),
),
);
}
/// A long recorded block (the Diagnostic) starts collapsed under its label.
Widget _cupertinoBlock(BuildContext context, DetailSummaryRow row) {
final theme = CupertinoTheme.of(context);
return Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: CupertinoColors.tertiarySystemFill.resolveFrom(context),
borderRadius: BorderRadius.circular(8),
),
child: Text(
row.value,
style: theme.textTheme.textStyle.copyWith(fontFamily: appMonospaceFamily),
),
);
}
String _slug(String label) => label.toLowerCase().replaceAll(' ', '-');
/// A read-only Cupertino text control: plain, selectable text without a
/// Material dependency, while keeping native selection and copy affordances.
class _CupertinoSelectableText extends StatefulWidget {
const _CupertinoSelectableText(this.text);
final String text;
@override
State<_CupertinoSelectableText> createState() =>
_CupertinoSelectableTextState();
}
class _CupertinoSelectableTextState extends State<_CupertinoSelectableText> {
late final TextEditingController _controller = TextEditingController(
text: widget.text,
);
@override
void didUpdateWidget(_CupertinoSelectableText oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.text != oldWidget.text) _controller.text = widget.text;
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => CupertinoTextField(
controller: _controller,
readOnly: true,
maxLines: null,
padding: EdgeInsets.zero,
decoration: const BoxDecoration(),
style: CupertinoTheme.of(context).textTheme.textStyle,
);
}
@@ -2,7 +2,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';
/// The tabs the strip renders, in the web's order: Summary first so it is the
@@ -43,12 +42,11 @@ class RunDetailTabStrip extends StatelessWidget {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final index = tabs.indexOf(selected);
return KeyedSubtree(
key: const Key('run-detail-tabs'),
child: FloatingDestinationBar(
cupertino: cupertino,
cupertino: false,
currentIndex: index < 0 ? 0 : index,
edge: edge,
onTap: (value) => onSelected(tabs[value]),
@@ -56,7 +54,7 @@ class RunDetailTabStrip extends StatelessWidget {
for (final tab in tabs)
FloatingDestinationItem(
key: ValueKey('run-detail-tab-${tab.name}'),
icon: Icon(cupertino ? tab.cupertinoIcon : tab.icon),
icon: Icon(tab.icon),
label: tab.label,
),
],
+14 -43
View File
@@ -6,7 +6,6 @@ import '../../../ui/adaptive/top_glass_strip.dart';
import '../../../ui/motion/fade_through_stack.dart';
import 'dart:math' as math;
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
@@ -271,24 +270,8 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
}
void _showSearchArtifactMissingNotice() {
final messenger = ScaffoldMessenger.maybeOf(context);
if (messenger != null) {
messenger.showSnackBar(
const SnackBar(content: Text('That artifact is no longer available.')),
);
return;
}
showCupertinoDialog<void>(
context: context,
builder: (context) => CupertinoAlertDialog(
content: const Text('That artifact is no longer available.'),
actions: [
CupertinoDialogAction(
onPressed: () => Navigator.of(context).pop(),
child: const Text('OK'),
),
],
),
ScaffoldMessenger.maybeOf(context)?.showSnackBar(
const SnackBar(content: Text('That artifact is no longer available.')),
);
}
@@ -331,7 +314,6 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
/// a visit still running keeps updating; leaving it returns to the timeline.
Future<void> _pushVisit(int index) async {
_shownVisit = index;
final cupertino = widget.cupertino;
Widget page(BuildContext pageContext) => ValueListenableBuilder<JsonMap>(
valueListenable: _liveRun,
builder: (context, run, _) {
@@ -347,7 +329,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
gateway: widget.gateway,
onRunChanged: widget.onRunChanged,
configuredEndpoint: widget.configuredEndpoint,
cupertino: cupertino,
cupertino: false,
onClose: () => Navigator.of(pageContext).pop(),
)
: const Center(child: Text('This visit is no longer recorded.'));
@@ -355,10 +337,10 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
// repeats neither; the sections scroll behind it.
final known = index < visits.length;
final bar = SegmentedBar(
cupertino: cupertino,
cupertino: false,
leading: SegmentedBackButton(
key: const Key('run-visit-back'),
cupertino: cupertino,
cupertino: false,
onPressed: () => Navigator.of(pageContext).pop(),
),
title: known ? visits[index].stage : detailTitle(run),
@@ -366,15 +348,10 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
subtitle: known ? runVisitSubtitle(run, visits[index]) : null,
);
final body = SafeArea(top: false, bottom: false, child: pane);
if (cupertino) {
return CupertinoPageScaffold(navigationBar: bar, child: body);
}
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body);
},
);
final route = cupertino
? CupertinoPageRoute<void>(builder: page)
: MaterialPageRoute<void>(builder: page);
final route = MaterialPageRoute<void>(builder: page);
_visitRoute = route;
await Navigator.of(context).push<void>(route);
// Only the page the operator left clears the selection; one replaced by
@@ -441,7 +418,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
return FloatingBarOverlay(
edge: FloatingBarEdge.top,
bar: RunDetailWideChrome(
cupertino: widget.cupertino,
cupertino: false,
tabs: tabStrip,
header: header,
),
@@ -460,7 +437,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
edge: FloatingBarEdge.top,
bar: TopGlassStrip(
key: const Key('run-detail-header'),
cupertino: widget.cupertino,
cupertino: false,
padding: const EdgeInsets.symmetric(vertical: 4),
child: header,
),
@@ -476,7 +453,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
return runDetailSummaryTab(
context: context,
run: widget.run,
cupertino: widget.cupertino,
cupertino: false,
copying: widget.copying,
copyStatus: widget.copyStatus,
onCopy: widget.onCopy,
@@ -505,14 +482,14 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
tabKey: 'input',
value: widget.run['input'],
empty: 'No input recorded.',
cupertino: widget.cupertino,
cupertino: false,
);
case RunDetailTab.output:
return runDetailFieldTab(
tabKey: 'output',
value: widget.run['output'],
empty: 'No output recorded.',
cupertino: widget.cupertino,
cupertino: false,
);
case RunDetailTab.artifacts:
return ArtifactGalleryPage(
@@ -533,14 +510,8 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
showSummary: true,
finalOnly: true,
);
// A CupertinoApp supplies no Material theme; follow the host so the
// 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,
);
// Its summary heads the tab, so the tab starts below a pane's top tabs.
return BelowTopBar(child: viewer);
case RunDetailTab.timeline:
final visits = detailTimeline(widget.run['steps']);
final index = _selectedVisit;
@@ -549,7 +520,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
selectedSequence: index != null && index >= 0 && index < visits.length
? visits[index].sequence
: null,
cupertino: widget.cupertino,
cupertino: false,
onSelected: _openVisit,
);
}
@@ -61,7 +61,7 @@ class RunTimelineList extends StatelessWidget {
),
visit: visits[index],
selected: visits[index].sequence == selectedSequence,
cupertino: cupertino,
cupertino: false,
divider: index < visits.length - 1,
palette: palette,
onTap: onSelected == null ? null : () => onSelected!(index),
@@ -140,7 +140,7 @@ class RunTimelineRow extends StatelessWidget {
// The outcome chip leads the second line, then where the visit went and
// the tokens it reported; the duration is the row's time.
return AppListRow(
cupertino: cupertino,
cupertino: false,
selected: selected,
divider: divider,
onTap: onTap,
+45 -87
View File
@@ -1,11 +1,9 @@
import '../../../core/servers/server_context.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
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';
@@ -13,7 +11,6 @@ import 'run_detail_actions.dart';
import 'run_more_menu.dart';
import 'run_pipeline_link.dart';
import 'run_detail_content.dart';
import 'run_detail_cupertino.dart';
import 'run_detail_material.dart';
import 'runs_controller.dart';
@@ -60,9 +57,8 @@ class _RunDetailViewState extends State<RunDetailView> {
Widget build(BuildContext context) => AnimatedBuilder(
animation: widget.controller,
builder: (context, _) {
final cupertino = usesCupertinoHost(context);
final run = widget.controller.detail;
if (run == null) return _placeholder(context, cupertino: cupertino);
if (run == null) return _placeholder(context);
final prompt = detailPrompt(run);
final endpoint = configuredGatewayEndpoint(widget.gateway);
final headerActions = RunDetailActions(
@@ -73,37 +69,21 @@ class _RunDetailViewState extends State<RunDetailView> {
retry: false,
);
final inShellBar = ShellBar.available(context);
final detail = cupertino
? buildCupertinoRunDetail(
context: context,
run: run,
headerActions: headerActions,
detailLoading: widget.controller.detailLoading,
error: widget.controller.error,
copying: _copying,
copyStatus: _copyStatus,
onCopy: () => _copyPrompt(prompt ?? '', cupertino: true),
gateway: widget.gateway,
onRunChanged: widget.controller.acceptRunDetail,
configuredEndpoint: endpoint,
initialStageKey: widget.initialStageKey,
initialVisit: widget.initialVisit,
)
: buildMaterialRunDetail(
context: context,
run: run,
headerActions: headerActions,
detailLoading: widget.controller.detailLoading,
error: widget.controller.error,
copying: _copying,
copyStatus: _copyStatus,
onCopy: () => _copyPrompt(prompt ?? '', cupertino: false),
gateway: widget.gateway,
onRunChanged: widget.controller.acceptRunDetail,
configuredEndpoint: endpoint,
initialStageKey: widget.initialStageKey,
initialVisit: widget.initialVisit,
);
final detail = buildMaterialRunDetail(
context: context,
run: run,
headerActions: headerActions,
detailLoading: widget.controller.detailLoading,
error: widget.controller.error,
copying: _copying,
copyStatus: _copyStatus,
onCopy: () => _copyPrompt(prompt ?? ''),
gateway: widget.gateway,
onRunChanged: widget.controller.acceptRunDetail,
configuredEndpoint: endpoint,
initialStageKey: widget.initialStageKey,
initialVisit: widget.initialVisit,
);
// 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.
@@ -114,37 +94,25 @@ class _RunDetailViewState extends State<RunDetailView> {
final pipelineName = detailPipeline(run);
final pipelineAction = openPipeline == null
? null
: (cupertino
? Semantics(
button: true,
label: 'Open pipeline $pipelineName',
child: CupertinoButton(
key: runPipelineLinkKey,
padding: EdgeInsets.zero,
minimumSize: Size.zero,
onPressed: openPipeline,
child: const Icon(CupertinoIcons.arrow_branch),
),
)
: Semantics(
button: true,
label: 'Open pipeline $pipelineName',
excludeSemantics: true,
child: GestureDetector(
key: runPipelineLinkKey,
behavior: HitTestBehavior.opaque,
onTap: openPipeline,
child: const Padding(
padding: EdgeInsets.all(12),
child: Icon(Icons.account_tree_outlined),
),
),
));
: Semantics(
button: true,
label: 'Open pipeline $pipelineName',
excludeSemantics: true,
child: GestureDetector(
key: runPipelineLinkKey,
behavior: HitTestBehavior.opaque,
onTap: openPipeline,
child: const Padding(
padding: EdgeInsets.all(12),
child: Icon(Icons.account_tree_outlined),
),
),
);
final more = RunMoreMenu(
run: run,
gateway: widget.gateway,
onRunChanged: widget.controller.acceptRunDetail,
cupertino: cupertino,
cupertino: false,
onRunOpened: widget.onRunOpened,
onDeleted: widget.controller.applyDeletion,
);
@@ -164,10 +132,10 @@ class _RunDetailViewState extends State<RunDetailView> {
// On its own the run draws the same bar over its content.
return SegmentedBarOverlay(
bar: SegmentedBar(
cupertino: cupertino,
cupertino: false,
leading: SegmentedBackButton(
key: const Key('run-detail-back'),
cupertino: cupertino,
cupertino: false,
onPressed: widget.onBack,
),
title: title,
@@ -193,7 +161,7 @@ class _RunDetailViewState extends State<RunDetailView> {
return () => open(id, version is num ? version.toInt() : 0);
}
Widget _placeholder(BuildContext context, {required bool cupertino}) {
Widget _placeholder(BuildContext context) {
final loading = widget.controller.detailLoading;
final message = loading
? 'Loading run details…'
@@ -203,20 +171,17 @@ class _RunDetailViewState extends State<RunDetailView> {
return ShellBar(
title: 'Run',
onBack: widget.onBack,
child: _placeholderBody(cupertino, loading, message),
child: _placeholderBody(loading, message),
);
}
Widget _placeholderBody(bool cupertino, bool loading, String message) {
Widget _placeholderBody(bool loading, String message) {
return Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (loading) ...[
if (cupertino)
const CupertinoActivityIndicator()
else
const CircularProgressIndicator(),
const CircularProgressIndicator(),
const SizedBox(height: 12),
],
Padding(
@@ -224,16 +189,10 @@ class _RunDetailViewState extends State<RunDetailView> {
child: Text(message, textAlign: TextAlign.center),
),
const SizedBox(height: 12),
if (cupertino)
CupertinoButton(
onPressed: widget.onBack,
child: const Text('Back to list'),
)
else
FilledButton(
onPressed: widget.onBack,
child: const Text('Back to list'),
),
FilledButton(
onPressed: widget.onBack,
child: const Text('Back to list'),
),
],
),
);
@@ -241,7 +200,7 @@ class _RunDetailViewState extends State<RunDetailView> {
/// Copies the stored prompt byte-for-byte. A refusal is surfaced, never
/// replaced by copying a title or the formatted detail.
Future<void> _copyPrompt(String prompt, {required bool cupertino}) async {
Future<void> _copyPrompt(String prompt) async {
if (_copying) return;
setState(() => _copying = true);
String message;
@@ -252,13 +211,12 @@ class _RunDetailViewState extends State<RunDetailView> {
message = 'Could not copy prompt to clipboard.';
}
if (!mounted) return;
final scaffold = cupertino ? null : Scaffold.maybeOf(context);
final inline = cupertino || scaffold == null;
final scaffold = Scaffold.maybeOf(context);
setState(() {
_copying = false;
_copyStatus = inline ? message : null;
_copyStatus = scaffold == null ? message : null;
});
if (!cupertino && scaffold != null) {
if (scaffold != null) {
ScaffoldMessenger.maybeOf(
context,
)?.showSnackBar(SnackBar(content: Text(message)));
@@ -88,7 +88,7 @@ class _RunVisitPaneState extends State<RunVisitPane> {
gateway: widget.gateway,
onRunChanged: widget.onRunChanged,
configuredEndpoint: widget.configuredEndpoint,
cupertino: widget.cupertino,
cupertino: false,
facts: RunVisitFactsView(step: widget.step),
),
],
@@ -1,8 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../../artifacts/domain/artifact_capture.dart';
import '../../artifacts/domain/artifact_document.dart';
import '../../artifacts/domain/artifact_groups.dart';
@@ -83,11 +81,9 @@ class RunVisitDocuments extends StatelessWidget {
selectedIdentity: artifactVisitIdentityOf(group, artifact),
configuredEndpoint: configuredEndpoint,
);
Navigator.of(context).push<void>(
usesCupertinoHost(context)
? CupertinoPageRoute<void>(builder: (_) => page)
: MaterialPageRoute<void>(builder: (_) => page),
);
Navigator.of(
context,
).push<void>(MaterialPageRoute<void>(builder: (_) => page));
}
return ArtifactDocumentSection(group: group, onSelected: select);
@@ -1,8 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart';
import '../../../ui/status/run_status_icon.dart';
import '../../graph/widgets/graph_stage_node.dart' show graphStatusState;
import 'run_detail_visit_facts.dart';
@@ -125,15 +123,6 @@ class _VisitStyle {
});
factory _VisitStyle.of(BuildContext context) {
if (usesCupertinoHost(context)) {
final theme = CupertinoTheme.of(context);
final secondary = CupertinoColors.secondaryLabel.resolveFrom(context);
return _VisitStyle(
value: theme.textTheme.textStyle,
muted: theme.textTheme.textStyle.copyWith(color: secondary),
heading: theme.textTheme.navTitleTextStyle,
);
}
final theme = Theme.of(context);
return _VisitStyle(
value: theme.textTheme.bodyMedium ?? const TextStyle(),