Merge commit '544cd8128d5b360a0c8a552fe0987024a311a22a' into pipelines/run-20261111-0449-cupertino-out-settings-part-1-c39d
This commit is contained in:
@@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/glass_bar.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_record.dart';
|
||||
import '../domain/artifact_url.dart';
|
||||
import '../ui/artifact_viewer_fetch.dart';
|
||||
@@ -81,19 +80,15 @@ class _ArtifactFileActionsState extends State<ArtifactFileActions> {
|
||||
listenable: _controller,
|
||||
builder: (context, _) => widget.compact
|
||||
? _IconActions(controller: _controller)
|
||||
: _ActionBar(
|
||||
controller: _controller,
|
||||
cupertino: usesCupertinoHost(context),
|
||||
),
|
||||
: _ActionBar(controller: _controller),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ActionBar extends StatelessWidget {
|
||||
const _ActionBar({required this.controller, required this.cupertino});
|
||||
const _ActionBar({required this.controller});
|
||||
|
||||
final ArtifactFileActionsController controller;
|
||||
final bool cupertino;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -142,14 +137,11 @@ class _ActionBar extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (cupertino)
|
||||
const CupertinoActivityIndicator(radius: 8)
|
||||
else
|
||||
const SizedBox(
|
||||
width: 14,
|
||||
height: 14,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 14,
|
||||
height: 14,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Flexible(child: Text(status)),
|
||||
],
|
||||
@@ -182,9 +174,6 @@ class _ActionBar extends StatelessWidget {
|
||||
required IconData icon,
|
||||
required VoidCallback? onPressed,
|
||||
}) {
|
||||
if (cupertino) {
|
||||
return CupertinoButton(onPressed: onPressed, child: Text(label));
|
||||
}
|
||||
return TextButton.icon(
|
||||
onPressed: onPressed,
|
||||
icon: Icon(icon, size: 18),
|
||||
@@ -241,28 +230,15 @@ class ArtifactIconAction extends StatelessWidget {
|
||||
|
||||
final String label;
|
||||
final IconData icon;
|
||||
|
||||
/// Retained for callers that still pass the Cupertino glyph; the Material
|
||||
/// action always draws [icon].
|
||||
final IconData cupertinoIcon;
|
||||
final VoidCallback? onPressed;
|
||||
final bool busy;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (usesCupertinoHost(context)) {
|
||||
return Semantics(
|
||||
button: true,
|
||||
label: label,
|
||||
child: CupertinoButton(
|
||||
// One square touch target, like the top bar's other actions, so a
|
||||
// round pill is centred on it and a glass bar's edge gaps hold.
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: GlassBarMetrics.cupertinoMinimumSize(),
|
||||
onPressed: onPressed,
|
||||
child: busy
|
||||
? const CupertinoActivityIndicator(radius: 9)
|
||||
: Icon(cupertinoIcon, size: GlassBarMetrics.iconSize(true)),
|
||||
),
|
||||
);
|
||||
}
|
||||
return IconButton(
|
||||
tooltip: label,
|
||||
constraints: GlassBarMetrics.materialConstraints(),
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
|
||||
/// Open, Copy and the file actions float over the top of the content: shown
|
||||
/// when the page opens and whenever the content is touched, hidden again after
|
||||
/// a few seconds without use, so nothing needs scrolling to reach them.
|
||||
@@ -55,14 +52,9 @@ class _ArtifactControlsOverlayState extends State<ArtifactControlsOverlay> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final surface = cupertino
|
||||
? CupertinoColors.systemBackground
|
||||
.resolveFrom(context)
|
||||
.withValues(alpha: 0.92)
|
||||
: Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerHigh.withValues(alpha: 0.94);
|
||||
final surface = Theme.of(
|
||||
context,
|
||||
).colorScheme.surfaceContainerHigh.withValues(alpha: 0.94);
|
||||
return Stack(
|
||||
children: [
|
||||
// Any touch on the content brings the controls back.
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import '../../../ui/layout/section_heading.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_document.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import 'artifact_record_row.dart';
|
||||
@@ -50,23 +47,14 @@ class ArtifactDocumentSection extends StatelessWidget {
|
||||
children: rows,
|
||||
);
|
||||
}
|
||||
// Flat rows under a quiet label on both hosts: the section sits inside
|
||||
// the visit's Session page, which is itself flat, so a Cupertino inset
|
||||
// group here would be a group nested in a group.
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
// Flat rows under a quiet label: the section sits inside the visit's
|
||||
// Session page, which is itself flat.
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
||||
child: Semantics(
|
||||
container: true,
|
||||
header: true,
|
||||
child: Text(
|
||||
title,
|
||||
style: cupertino ? SectionHeadingStyle.of(context).title : null,
|
||||
),
|
||||
),
|
||||
child: Semantics(container: true, header: true, child: Text(title)),
|
||||
),
|
||||
...rows,
|
||||
],
|
||||
@@ -98,42 +86,15 @@ class _AbsentDocumentRow extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!usesCupertinoHost(context)) {
|
||||
// The absence line is informational product content, so it keeps the
|
||||
// theme's normal secondary label colour. A disabled tile would paint both
|
||||
// lines at the disabled colour (about 2.7:1 in light mode); no `onTap`
|
||||
// keeps the row non-actionable without dimming it.
|
||||
return ListTile(
|
||||
title: Text(document.name),
|
||||
subtitle: Text(
|
||||
document.absence,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
final textTheme = CupertinoTheme.of(context).textTheme;
|
||||
final absenceStyle = textTheme.textStyle.copyWith(
|
||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
||||
);
|
||||
return Semantics(
|
||||
container: true,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: kCupertinoButtonPadding[CupertinoButtonSize.large]!,
|
||||
child: DefaultTextStyle.merge(
|
||||
style: textTheme.textStyle,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(document.name),
|
||||
Text(document.absence, style: absenceStyle),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// The absence line is informational product content, so it keeps the
|
||||
// theme's normal secondary label colour. A disabled tile would paint both
|
||||
// lines at the disabled colour (about 2.7:1 in light mode); no `onTap`
|
||||
// keeps the row non-actionable without dimming it.
|
||||
return ListTile(
|
||||
title: Text(document.name),
|
||||
subtitle: Text(
|
||||
document.absence,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -30,12 +30,13 @@ class ArtifactFullscreenScope extends InheritedWidget {
|
||||
/// The full-screen view's route, pushed on the root navigator so it covers
|
||||
/// the shell's bars and list pane. A full-screen dialog route: its bar shows
|
||||
/// the platform's Close, and the system back gesture leaves it.
|
||||
///
|
||||
/// [cupertino] is retained for callers that still pass it; the route is always
|
||||
/// the Material one.
|
||||
Route<void> artifactFullscreenRoute({
|
||||
required bool cupertino,
|
||||
required WidgetBuilder builder,
|
||||
}) => cupertino
|
||||
? CupertinoPageRoute<void>(fullscreenDialog: true, builder: builder)
|
||||
: MaterialPageRoute<void>(fullscreenDialog: true, builder: builder);
|
||||
}) => MaterialPageRoute<void>(fullscreenDialog: true, builder: builder);
|
||||
|
||||
/// The zoom factors Zoom in and Zoom out step through.
|
||||
const List<double> artifactHtmlZoomSteps = [
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import 'artifact_fullscreen.dart';
|
||||
|
||||
/// Lets a viewer page open its own content as the full-screen view.
|
||||
@@ -42,7 +41,7 @@ mixin ArtifactFullscreenHost<T extends StatefulWidget> on State<T> {
|
||||
if (_fullscreen != null) return;
|
||||
htmlZoom.value = 1;
|
||||
final route = artifactFullscreenRoute(
|
||||
cupertino: usesCupertinoHost(context),
|
||||
cupertino: false,
|
||||
builder: (_) => ArtifactFullscreenScope(
|
||||
htmlZoom: htmlZoom,
|
||||
child: ListenableBuilder(
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../core/transport/pipelines_client.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import 'artifact_external_open.dart';
|
||||
import 'artifact_gallery_page.dart';
|
||||
|
||||
@@ -58,14 +56,6 @@ class RunArtifactsButton extends StatelessWidget {
|
||||
executing: _runExecuting(run),
|
||||
configuredEndpoint: configuredGatewayEndpoint(gateway),
|
||||
);
|
||||
if (usesCupertinoHost(context)) {
|
||||
return CupertinoButton.tinted(
|
||||
sizeStyle: CupertinoButtonSize.small,
|
||||
key: runArtifactsButtonKey,
|
||||
onPressed: open,
|
||||
child: const Text(artifactGalleryTitle),
|
||||
);
|
||||
}
|
||||
return OutlinedButton.icon(
|
||||
key: runArtifactsButtonKey,
|
||||
onPressed: open,
|
||||
@@ -92,9 +82,7 @@ Future<void> showArtifactGallery(
|
||||
configuredEndpoint: configuredEndpoint,
|
||||
openExternal: openExternal,
|
||||
);
|
||||
return Navigator.of(context).push<void>(
|
||||
usesCupertinoHost(context)
|
||||
? CupertinoPageRoute<void>(builder: (_) => page)
|
||||
: MaterialPageRoute<void>(builder: (_) => page),
|
||||
);
|
||||
return Navigator.of(
|
||||
context,
|
||||
).push<void>(MaterialPageRoute<void>(builder: (_) => page));
|
||||
}
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../chat/ui/transcript/chat_markdown_view.dart';
|
||||
import '../../graph/domain/stage_visits.dart';
|
||||
import '../actions/artifact_file_actions.dart';
|
||||
@@ -289,29 +287,17 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
];
|
||||
final previousFocus = FocusManager.instance.primaryFocus;
|
||||
await Navigator.of(context).push<void>(
|
||||
usesCupertinoHost(context)
|
||||
? CupertinoPageRoute<void>(
|
||||
builder: (_) => ArtifactViewerPage(
|
||||
groups: viewerGroups,
|
||||
selectedIdentity: identity,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
openExternal: widget.openExternal,
|
||||
fetch: widget.fetch,
|
||||
markdownBuilder: widget.markdownBuilder,
|
||||
fileBridge: widget.fileBridge,
|
||||
),
|
||||
)
|
||||
: MaterialPageRoute<void>(
|
||||
builder: (_) => ArtifactViewerPage(
|
||||
groups: viewerGroups,
|
||||
selectedIdentity: identity,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
openExternal: widget.openExternal,
|
||||
fetch: widget.fetch,
|
||||
markdownBuilder: widget.markdownBuilder,
|
||||
fileBridge: widget.fileBridge,
|
||||
),
|
||||
),
|
||||
MaterialPageRoute<void>(
|
||||
builder: (_) => ArtifactViewerPage(
|
||||
groups: viewerGroups,
|
||||
selectedIdentity: identity,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
openExternal: widget.openExternal,
|
||||
fetch: widget.fetch,
|
||||
markdownBuilder: widget.markdownBuilder,
|
||||
fileBridge: widget.fileBridge,
|
||||
),
|
||||
),
|
||||
);
|
||||
if (!mounted) return;
|
||||
if (previousFocus != null && previousFocus.canRequestFocus) {
|
||||
@@ -350,32 +336,6 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
],
|
||||
],
|
||||
);
|
||||
if (usesCupertinoHost(context)) {
|
||||
return showCupertinoDialog<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) => CupertinoAlertDialog(
|
||||
title: Text(artifactDisplayName(artifact)),
|
||||
content: content,
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
onPressed: () => Navigator.of(dialogContext).pop(),
|
||||
child: const Text('Close'),
|
||||
),
|
||||
if (resolved != null)
|
||||
CupertinoDialogAction(
|
||||
onPressed: () => _copyLink(resolved, dialogContext),
|
||||
child: const Text('Copy link'),
|
||||
),
|
||||
if (resolved != null)
|
||||
CupertinoDialogAction(
|
||||
isDefaultAction: true,
|
||||
onPressed: () => _open(resolved, dialogContext),
|
||||
child: const Text('Open in browser'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
builder: (dialogContext) => AlertDialog(
|
||||
@@ -509,17 +469,11 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
/// one line per recorded fact, never clamped or shortened.
|
||||
Widget _header(BuildContext context, String summary, {Widget? action}) {
|
||||
final notes = _captureNotes();
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final textStyle = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final headingStyle = cupertino
|
||||
? textStyle.copyWith(fontWeight: FontWeight.w600)
|
||||
: Theme.of(context).textTheme.titleSmall;
|
||||
final textStyle =
|
||||
Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final headingStyle = Theme.of(context).textTheme.titleSmall;
|
||||
final noteStyle = textStyle.copyWith(
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
||||
@@ -557,33 +511,21 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
Widget _debugToggle(BuildContext context) {
|
||||
final showing = _showTurnDocuments;
|
||||
final label = showing ? 'Hide debugging files' : 'Show debugging files';
|
||||
// Cupertino's bundled icon font has no bug glyph; retain the universally
|
||||
// recognisable Material bug icon inside its native Cupertino button.
|
||||
final icon = showing ? Icons.bug_report : Icons.bug_report_outlined;
|
||||
void onPressed() => setState(() => _showTurnDocuments = !showing);
|
||||
final button = usesCupertinoHost(context)
|
||||
? CupertinoButton(
|
||||
key: const Key('artifact-debug-toggle'),
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onPressed,
|
||||
child: Icon(icon),
|
||||
)
|
||||
: IconButton(
|
||||
key: const Key('artifact-debug-toggle'),
|
||||
isSelected: showing,
|
||||
tooltip: label,
|
||||
onPressed: onPressed,
|
||||
icon: Icon(icon),
|
||||
);
|
||||
final semanticButton = Semantics(
|
||||
final button = IconButton(
|
||||
key: const Key('artifact-debug-toggle'),
|
||||
isSelected: showing,
|
||||
tooltip: label,
|
||||
onPressed: onPressed,
|
||||
icon: Icon(icon),
|
||||
);
|
||||
return Semantics(
|
||||
label: label,
|
||||
button: true,
|
||||
toggled: showing,
|
||||
child: button,
|
||||
);
|
||||
return usesCupertinoHost(context)
|
||||
? Tooltip(message: label, child: semanticButton)
|
||||
: semanticButton;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -617,18 +559,6 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
||||
onRevealed: _revealed,
|
||||
);
|
||||
if (widget.embedded) return body;
|
||||
if (usesCupertinoHost(context)) {
|
||||
// Flat sections on the page colour, as in the run and stage details;
|
||||
// their pinned headings take the same colour.
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
title: artifactGalleryTitle,
|
||||
actions: [_debugToggle(context)],
|
||||
),
|
||||
child: SafeArea(top: false, bottom: false, child: body),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import '../domain/artifact_record.dart';
|
||||
import 'artifact_row_labels.dart';
|
||||
|
||||
/// One recorded artifact row in a gallery section.
|
||||
///
|
||||
/// Material draws a standard [ListTile]; Cupertino draws the same content in a
|
||||
/// grouped-row button. The row only reports the selection; it never resolves a
|
||||
/// url, opens a preview, downloads, shares or filters.
|
||||
/// Material draws a standard [ListTile]. The row only reports the selection; it
|
||||
/// never resolves a url, opens a preview, downloads, shares or filters.
|
||||
class ArtifactRecordRow extends StatelessWidget {
|
||||
const ArtifactRecordRow({
|
||||
super.key,
|
||||
@@ -31,58 +28,13 @@ class ArtifactRecordRow extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!usesCupertinoHost(context)) {
|
||||
return ListTile(
|
||||
selected: selected,
|
||||
leading: leading,
|
||||
title: Text(artifactDisplayName(artifact)),
|
||||
subtitle: Text(artifactFactsLabel(artifact)),
|
||||
trailing: selected ? const Icon(Icons.check) : null,
|
||||
onTap: onSelected == null ? null : () => onSelected!(group, artifact),
|
||||
);
|
||||
}
|
||||
final textTheme = CupertinoTheme.of(context).textTheme;
|
||||
final factsStyle = textTheme.textStyle.copyWith(
|
||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
||||
);
|
||||
final content = DefaultTextStyle.merge(
|
||||
style: textTheme.textStyle,
|
||||
child: Row(
|
||||
children: [
|
||||
if (leading != null) ...[leading!, const SizedBox(width: 12)],
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(artifactDisplayName(artifact)),
|
||||
Text(artifactFactsLabel(artifact), style: factsStyle),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (selected) const Icon(CupertinoIcons.check_mark),
|
||||
],
|
||||
),
|
||||
);
|
||||
// `container` makes this row its own semantics node, so the section
|
||||
// heading stays a separate header node and never covers the row.
|
||||
return Semantics(
|
||||
container: true,
|
||||
return ListTile(
|
||||
selected: selected,
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
// A read-only row is not a button: a disabled CupertinoButton would
|
||||
// still expose a button role to assistive technology.
|
||||
child: onSelected == null
|
||||
? Padding(
|
||||
padding: kCupertinoButtonPadding[CupertinoButtonSize.large]!,
|
||||
child: content,
|
||||
)
|
||||
: CupertinoButton(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
onPressed: () => onSelected!(group, artifact),
|
||||
child: content,
|
||||
),
|
||||
),
|
||||
leading: leading,
|
||||
title: Text(artifactDisplayName(artifact)),
|
||||
subtitle: Text(artifactFactsLabel(artifact)),
|
||||
trailing: selected ? const Icon(Icons.check) : null,
|
||||
onTap: onSelected == null ? null : () => onSelected!(group, artifact),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 '../../graph/domain/stage_visits.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import '../domain/artifact_record.dart';
|
||||
@@ -53,14 +51,10 @@ class ArtifactSelectionFacts extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final recordedStep = step;
|
||||
final url = resolved;
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final primaryStyle = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final primaryStyle =
|
||||
Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||
final secondaryStyle = primaryStyle.copyWith(
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_table.dart';
|
||||
|
||||
/// The truncation note for a capped table preview.
|
||||
@@ -31,13 +29,8 @@ class ArtifactTableView extends StatelessWidget {
|
||||
child: Text('The table is empty.'),
|
||||
);
|
||||
}
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final border = cupertino
|
||||
? CupertinoColors.separator.resolveFrom(context)
|
||||
: Theme.of(context).dividerColor;
|
||||
final header = cupertino
|
||||
? CupertinoColors.secondarySystemFill.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.surfaceContainerHighest;
|
||||
final border = Theme.of(context).dividerColor;
|
||||
final header = Theme.of(context).colorScheme.surfaceContainerHighest;
|
||||
final columns = table.columnCount;
|
||||
Widget cell(String value, {bool head = false}) => Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import '../domain/artifact_kind.dart';
|
||||
import '../domain/artifact_record.dart';
|
||||
@@ -37,21 +35,12 @@ class ArtifactTile extends StatefulWidget {
|
||||
class _ArtifactTileState extends State<ArtifactTile> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final artifact = widget.artifact;
|
||||
final secondary = cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final surface = cupertino
|
||||
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.surfaceContainerHighest;
|
||||
final secondary = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final surface = Theme.of(context).colorScheme.surfaceContainerHighest;
|
||||
final border = widget.selected
|
||||
? (cupertino
|
||||
? CupertinoTheme.of(context).primaryColor
|
||||
: Theme.of(context).colorScheme.primary)
|
||||
: (cupertino
|
||||
? CupertinoColors.separator.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.outlineVariant);
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Theme.of(context).colorScheme.outlineVariant;
|
||||
final preview = ArtifactThumbnail(
|
||||
artifact: artifact,
|
||||
configuredEndpoint: widget.configuredEndpoint,
|
||||
@@ -102,20 +91,14 @@ class _ArtifactTileState extends State<ArtifactTile> {
|
||||
label: '$name, $facts',
|
||||
excludeSemantics: true,
|
||||
onTap: onSelected == null ? null : tap,
|
||||
child: cupertino
|
||||
? GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: onSelected == null ? null : tap,
|
||||
child: decorated,
|
||||
)
|
||||
: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
onTap: onSelected == null ? null : tap,
|
||||
child: decorated,
|
||||
),
|
||||
),
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
onTap: onSelected == null ? null : tap,
|
||||
child: decorated,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -168,13 +151,10 @@ class _ArtifactThumbnailState extends State<ArtifactThumbnail>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final icon = Icon(
|
||||
artifactKindIcon(widget.artifact, cupertino: cupertino),
|
||||
artifactKindIcon(widget.artifact, cupertino: false),
|
||||
size: widget.iconSize,
|
||||
color: cupertino
|
||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
if (_image == null) return Center(child: icon);
|
||||
return FutureBuilder<ArtifactFetchResult>(
|
||||
@@ -210,30 +190,26 @@ class _ArtifactThumbnailState extends State<ArtifactThumbnail>
|
||||
}
|
||||
|
||||
/// The icon for an artifact's kind of file, when it has no thumbnail.
|
||||
///
|
||||
/// [cupertino] is retained for callers that still pass it; the icon is always
|
||||
/// the Material glyph the app draws.
|
||||
IconData artifactKindIcon(ArtifactRecord artifact, {required bool cupertino}) {
|
||||
final name = artifact.name.toLowerCase();
|
||||
final format = artifactPreviewFormat(artifact.contentType, artifact.name);
|
||||
if (name.endsWith('.zip') || name.endsWith('.tar') || name.endsWith('.gz')) {
|
||||
return cupertino ? CupertinoIcons.archivebox : Icons.folder_zip_outlined;
|
||||
return Icons.folder_zip_outlined;
|
||||
}
|
||||
if (name.endsWith('.pdf')) {
|
||||
return cupertino ? CupertinoIcons.doc_richtext : Icons.picture_as_pdf;
|
||||
return Icons.picture_as_pdf;
|
||||
}
|
||||
return switch (format) {
|
||||
ArtifactPreviewFormat.image =>
|
||||
cupertino ? CupertinoIcons.photo : Icons.image_outlined,
|
||||
ArtifactPreviewFormat.video =>
|
||||
cupertino ? CupertinoIcons.film : Icons.movie_outlined,
|
||||
ArtifactPreviewFormat.audio =>
|
||||
cupertino ? CupertinoIcons.music_note : Icons.audio_file_outlined,
|
||||
ArtifactPreviewFormat.markdown =>
|
||||
cupertino ? CupertinoIcons.doc_text : Icons.article_outlined,
|
||||
ArtifactPreviewFormat.text =>
|
||||
cupertino ? CupertinoIcons.doc_plaintext : Icons.description_outlined,
|
||||
ArtifactPreviewFormat.table =>
|
||||
cupertino ? CupertinoIcons.table : Icons.table_chart_outlined,
|
||||
ArtifactPreviewFormat.html => cupertino ? CupertinoIcons.globe : Icons.html,
|
||||
ArtifactPreviewFormat.none =>
|
||||
cupertino ? CupertinoIcons.doc : Icons.insert_drive_file_outlined,
|
||||
ArtifactPreviewFormat.image => Icons.image_outlined,
|
||||
ArtifactPreviewFormat.video => Icons.movie_outlined,
|
||||
ArtifactPreviewFormat.audio => Icons.audio_file_outlined,
|
||||
ArtifactPreviewFormat.markdown => Icons.article_outlined,
|
||||
ArtifactPreviewFormat.text => Icons.description_outlined,
|
||||
ArtifactPreviewFormat.table => Icons.table_chart_outlined,
|
||||
ArtifactPreviewFormat.html => Icons.html,
|
||||
ArtifactPreviewFormat.none => Icons.insert_drive_file_outlined,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
|
||||
/// Creates the player for one media url; tests inject a fake controller.
|
||||
typedef ArtifactVideoControllerFactory =
|
||||
VideoPlayerController Function(Uri uri);
|
||||
@@ -84,7 +81,6 @@ class _ArtifactVideoPlayerState extends State<ArtifactVideoPlayer> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_failed) return const Center(child: Text(artifactVideoError));
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
return ValueListenableBuilder<VideoPlayerValue>(
|
||||
valueListenable: _controller,
|
||||
builder: (context, value, _) {
|
||||
@@ -92,20 +88,12 @@ class _ArtifactVideoPlayerState extends State<ArtifactVideoPlayer> {
|
||||
return const Center(child: Text(artifactVideoError));
|
||||
}
|
||||
if (!value.isInitialized) {
|
||||
return Center(
|
||||
child: cupertino
|
||||
? const CupertinoActivityIndicator()
|
||||
: const CircularProgressIndicator(),
|
||||
);
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
final label = value.isPlaying
|
||||
? (widget.audio ? artifactAudioPauseLabel : artifactVideoPauseLabel)
|
||||
: (widget.audio ? artifactAudioPlayLabel : artifactVideoPlayLabel);
|
||||
final icon = cupertino
|
||||
? (value.isPlaying
|
||||
? CupertinoIcons.pause_fill
|
||||
: CupertinoIcons.play_fill)
|
||||
: (value.isPlaying ? Icons.pause : Icons.play_arrow);
|
||||
final icon = value.isPlaying ? Icons.pause : Icons.play_arrow;
|
||||
return Column(
|
||||
key: Key(widget.audio ? 'artifact-audio' : 'artifact-video'),
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -126,18 +114,12 @@ class _ArtifactVideoPlayerState extends State<ArtifactVideoPlayer> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
cupertino
|
||||
? CupertinoButton(
|
||||
key: const Key('artifact-video-toggle'),
|
||||
onPressed: _toggle,
|
||||
child: Icon(icon, semanticLabel: label),
|
||||
)
|
||||
: IconButton(
|
||||
key: const Key('artifact-video-toggle'),
|
||||
tooltip: label,
|
||||
onPressed: _toggle,
|
||||
icon: Icon(icon),
|
||||
),
|
||||
IconButton(
|
||||
key: const Key('artifact-video-toggle'),
|
||||
tooltip: label,
|
||||
onPressed: _toggle,
|
||||
icon: Icon(icon),
|
||||
),
|
||||
Expanded(
|
||||
child: VideoProgressIndicator(
|
||||
_controller,
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/glass_bar.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/navigation/chevron_pager.dart';
|
||||
import '../actions/artifact_file_actions.dart';
|
||||
import '../actions/artifact_file_bridge.dart';
|
||||
@@ -60,11 +59,8 @@ class ArtifactViewerBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final actions = _actions(resolved, onFullscreen);
|
||||
final pagerMin = count > 1
|
||||
? 2 * GlassBarMetrics.controlExtent(cupertino)
|
||||
: 0.0;
|
||||
final pagerMin = count > 1 ? 2 * GlassBarMetrics.controlExtent(false) : 0.0;
|
||||
final pager = ChevronPager(
|
||||
index: index,
|
||||
count: count,
|
||||
@@ -87,7 +83,7 @@ class ArtifactViewerBar extends StatelessWidget {
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
heightFactor: 1,
|
||||
child: GlassControlBar(
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => Row(
|
||||
key: const Key('artifact-viewer-actions'),
|
||||
|
||||
@@ -3,7 +3,6 @@ import 'dart:typed_data';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
import '../actions/artifact_file_actions.dart';
|
||||
import '../actions/artifact_file_bridge.dart';
|
||||
@@ -170,20 +169,6 @@ class ArtifactViewerInfoAction extends StatelessWidget {
|
||||
final Widget facts;
|
||||
|
||||
void _show(BuildContext context) {
|
||||
if (usesCupertinoHost(context)) {
|
||||
showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
builder: (context) => CupertinoPopupSurface(
|
||||
child: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: facts,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
showDragHandle: true,
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
|
||||
import '../domain/artifact_preview.dart';
|
||||
import 'artifact_html_view.dart';
|
||||
import 'artifact_table_view.dart';
|
||||
@@ -219,24 +216,12 @@ class _ZoomableImageState extends State<_ZoomableImage> {
|
||||
PositionedDirectional(
|
||||
top: 8,
|
||||
end: 8,
|
||||
child: usesCupertinoHost(context)
|
||||
? Tooltip(
|
||||
message: 'Reset image zoom',
|
||||
child: CupertinoButton(
|
||||
key: const Key('artifact-image-reset-zoom'),
|
||||
sizeStyle: CupertinoButtonSize.small,
|
||||
onPressed: _reset,
|
||||
child: const Icon(
|
||||
CupertinoIcons.arrow_down_right_arrow_up_left,
|
||||
),
|
||||
),
|
||||
)
|
||||
: IconButton(
|
||||
key: const Key('artifact-image-reset-zoom'),
|
||||
tooltip: 'Reset image zoom',
|
||||
onPressed: _reset,
|
||||
icon: const Icon(Icons.zoom_out_map),
|
||||
),
|
||||
child: IconButton(
|
||||
key: const Key('artifact-image-reset-zoom'),
|
||||
tooltip: 'Reset image zoom',
|
||||
onPressed: _reset,
|
||||
icon: const Icon(Icons.zoom_out_map),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -272,7 +257,6 @@ class _Message extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final retry = onRetry;
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -282,18 +266,11 @@ class _Message extends StatelessWidget {
|
||||
Text(message, textAlign: TextAlign.center),
|
||||
if (retry != null) ...[
|
||||
const SizedBox(height: 12),
|
||||
cupertino
|
||||
? CupertinoButton.tinted(
|
||||
key: artifactPreviewRetryKey,
|
||||
sizeStyle: CupertinoButtonSize.small,
|
||||
onPressed: retry,
|
||||
child: const Text('Retry'),
|
||||
)
|
||||
: FilledButton.tonal(
|
||||
key: artifactPreviewRetryKey,
|
||||
onPressed: retry,
|
||||
child: const Text('Retry'),
|
||||
),
|
||||
FilledButton.tonal(
|
||||
key: artifactPreviewRetryKey,
|
||||
onPressed: retry,
|
||||
child: const Text('Retry'),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import '../../../ui/theme/app_theme.dart';
|
||||
|
||||
/// The viewer's page structure on either host: its [SegmentedBar] (the
|
||||
/// platform's Back, or Close on the full-screen route) over [body].
|
||||
/// The viewer's page structure: its [SegmentedBar] (the platform's Back, or
|
||||
/// Close on the full-screen route) over [body].
|
||||
class ArtifactViewerScaffold extends StatelessWidget {
|
||||
const ArtifactViewerScaffold({
|
||||
super.key,
|
||||
@@ -23,20 +20,12 @@ class ArtifactViewerScaffold extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final bar = SegmentedBar(
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
title: title,
|
||||
subtitle: subtitle,
|
||||
actions: actions,
|
||||
);
|
||||
if (cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
backgroundColor: AppColors.groupedBackground,
|
||||
navigationBar: bar,
|
||||
child: body,
|
||||
);
|
||||
}
|
||||
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/artifact_groups.dart';
|
||||
import '../../../ui/layout/section_heading.dart';
|
||||
import '../../../ui/layout/sticky_section.dart';
|
||||
@@ -29,11 +27,10 @@ export 'artifact_row_labels.dart'
|
||||
/// artifacts. When [showTurnDocuments] is on, its debugging documents follow
|
||||
/// those artifacts in the same visit. Every recorded row shows its recorded
|
||||
/// filename, content type and size; a turn document the visit did not record
|
||||
/// stays a non-actionable row with the exact absence wording. Rendering uses the host's
|
||||
/// own controls: Material list tiles under [MaterialApp] and grouped Cupertino
|
||||
/// list sections under [CupertinoApp]. An optional [header] leads the same
|
||||
/// scroll view. It never resolves a url, opens a preview, downloads, shares or
|
||||
/// filters.
|
||||
/// stays a non-actionable row with the exact absence wording. Rendering uses
|
||||
/// the host's own controls: Material list tiles under [MaterialApp]. An
|
||||
/// optional [header] leads the same scroll view. It never resolves a url,
|
||||
/// opens a preview, downloads, shares or filters.
|
||||
/// How the gallery lays out each visit's artifacts.
|
||||
enum ArtifactGalleryMode { grid, list }
|
||||
|
||||
@@ -257,43 +254,24 @@ class _ArtifactVisitListState extends State<ArtifactVisitList> {
|
||||
);
|
||||
|
||||
Widget _modeSwitch(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
final control = cupertino
|
||||
? CupertinoSlidingSegmentedControl<ArtifactGalleryMode>(
|
||||
key: const Key('artifact-gallery-mode'),
|
||||
groupValue: _mode,
|
||||
onValueChanged: (mode) {
|
||||
if (mode != null) _setMode(mode);
|
||||
},
|
||||
children: const {
|
||||
ArtifactGalleryMode.grid: Icon(
|
||||
CupertinoIcons.square_grid_2x2,
|
||||
semanticLabel: 'Grid',
|
||||
),
|
||||
ArtifactGalleryMode.list: Icon(
|
||||
CupertinoIcons.list_bullet,
|
||||
semanticLabel: 'List',
|
||||
),
|
||||
},
|
||||
)
|
||||
: SegmentedButton<ArtifactGalleryMode>(
|
||||
key: const Key('artifact-gallery-mode'),
|
||||
showSelectedIcon: false,
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: ArtifactGalleryMode.grid,
|
||||
icon: Icon(Icons.grid_view),
|
||||
tooltip: 'Grid',
|
||||
),
|
||||
ButtonSegment(
|
||||
value: ArtifactGalleryMode.list,
|
||||
icon: Icon(Icons.view_list),
|
||||
tooltip: 'List',
|
||||
),
|
||||
],
|
||||
selected: {_mode},
|
||||
onSelectionChanged: (mode) => _setMode(mode.single),
|
||||
);
|
||||
final control = SegmentedButton<ArtifactGalleryMode>(
|
||||
key: const Key('artifact-gallery-mode'),
|
||||
showSelectedIcon: false,
|
||||
segments: const [
|
||||
ButtonSegment(
|
||||
value: ArtifactGalleryMode.grid,
|
||||
icon: Icon(Icons.grid_view),
|
||||
tooltip: 'Grid',
|
||||
),
|
||||
ButtonSegment(
|
||||
value: ArtifactGalleryMode.list,
|
||||
icon: Icon(Icons.view_list),
|
||||
tooltip: 'List',
|
||||
),
|
||||
],
|
||||
selected: {_mode},
|
||||
onSelectionChanged: (mode) => _setMode(mode.single),
|
||||
);
|
||||
return Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 4),
|
||||
child: Align(alignment: AlignmentDirectional.centerEnd, child: control),
|
||||
@@ -303,9 +281,7 @@ class _ArtifactVisitListState extends State<ArtifactVisitList> {
|
||||
/// Rows keep a Material surface for their ink, as the section body's own
|
||||
/// surface was when it was one box around every row.
|
||||
Widget _inkSurface(BuildContext context, Widget child) =>
|
||||
usesCupertinoHost(context)
|
||||
? child
|
||||
: Material(type: MaterialType.transparency, child: child);
|
||||
Material(type: MaterialType.transparency, child: child);
|
||||
|
||||
/// The list view: one row per artifact with a small thumbnail beside it.
|
||||
Widget _list(ArtifactGroup group) => SliverList.builder(
|
||||
|
||||
@@ -13,7 +13,6 @@ import 'pipeline_repository.dart';
|
||||
import 'pipelines_controller.dart';
|
||||
import 'pending_run_store.dart';
|
||||
import 'widgets/pipeline_bar_buttons.dart';
|
||||
import 'widgets/pipeline_controls.dart';
|
||||
import 'widgets/pipeline_detail_panel.dart';
|
||||
import 'widgets/pipeline_list_panel.dart';
|
||||
|
||||
@@ -273,9 +272,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
},
|
||||
);
|
||||
if (widget.embedded) return _embeddedBody(context, body);
|
||||
return useCupertinoControls(context)
|
||||
? _cupertinoShell(context, body)
|
||||
: _materialShell(context, body);
|
||||
return _materialShell(context, body);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -352,20 +349,4 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
||||
body: SafeArea(top: false, child: body),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _cupertinoShell(BuildContext context, Widget body) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
title: 'Pipelines',
|
||||
actions: [
|
||||
...pipelineListActions(context, _controller),
|
||||
if (widget.onOpenSchedules != null) _schedulesButton(context),
|
||||
_refreshButton(context),
|
||||
if (widget.onOpenSettings != null) _settingsButton(context),
|
||||
],
|
||||
),
|
||||
child: SafeArea(top: false, child: body),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import '../pipeline_models.dart';
|
||||
import '../pipelines_controller.dart';
|
||||
import '../run_pipeline_intent.dart';
|
||||
import '../widgets/pipeline_bar_buttons.dart';
|
||||
import '../widgets/pipeline_controls.dart';
|
||||
import 'run_pipeline_dialog.dart';
|
||||
import 'run_pipeline_wording.dart';
|
||||
|
||||
@@ -181,13 +180,6 @@ class _RunPipelineActionState extends State<RunPipelineAction> {
|
||||
onPressed: _open,
|
||||
);
|
||||
}
|
||||
if (useCupertinoControls(context)) {
|
||||
return CupertinoButton.filled(
|
||||
key: runPipelineActionKey,
|
||||
onPressed: _open,
|
||||
child: label,
|
||||
);
|
||||
}
|
||||
return FilledButton(
|
||||
key: runPipelineActionKey,
|
||||
onPressed: _open,
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import '../../schedules/data/schedules_repository.dart';
|
||||
import '../../schedules/domain/editor/schedule_draft.dart';
|
||||
import '../../schedules/ui/pipeline/schedule_pipeline_editor.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../core/servers/server_scope.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../settings/settings_store.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../pipeline_models.dart';
|
||||
import '../run_pipeline_intent.dart';
|
||||
import 'run_pipeline_fields.dart';
|
||||
@@ -45,23 +43,16 @@ Future<void> showRunPipelineDialog({
|
||||
detail: detail,
|
||||
gateway: gateway,
|
||||
pending: pending,
|
||||
cupertino: usesCupertinoHost(context),
|
||||
onSubmit: onSubmit,
|
||||
onPendingChanged: onPendingChanged,
|
||||
onAccepted: onAccepted,
|
||||
onSchedule: schedule,
|
||||
);
|
||||
return dialog.cupertino
|
||||
? showCupertinoDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (_) => dialog,
|
||||
)
|
||||
: showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (_) => dialog,
|
||||
);
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (_) => dialog,
|
||||
);
|
||||
}
|
||||
|
||||
class _RunPipelineDialog extends StatefulWidget {
|
||||
@@ -69,7 +60,6 @@ class _RunPipelineDialog extends StatefulWidget {
|
||||
required this.detail,
|
||||
required this.gateway,
|
||||
required this.pending,
|
||||
required this.cupertino,
|
||||
required this.onSubmit,
|
||||
required this.onPendingChanged,
|
||||
required this.onAccepted,
|
||||
@@ -81,7 +71,6 @@ class _RunPipelineDialog extends StatefulWidget {
|
||||
final PipelineDetail detail;
|
||||
final ApiGateway gateway;
|
||||
final RunPipelineIntent? pending;
|
||||
final bool cupertino;
|
||||
final Future<RunPipelineOutcome> Function(RunPipelineIntent intent) onSubmit;
|
||||
final ValueChanged<RunPipelineIntent?> onPendingChanged;
|
||||
final ValueChanged<JsonMap> onAccepted;
|
||||
@@ -219,8 +208,7 @@ class _RunPipelineDialogState extends State<_RunPipelineDialog> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final dialog = widget.cupertino ? _cupertino(context) : _material(context);
|
||||
return PopScope(canPop: !_sending, child: dialog);
|
||||
return PopScope(canPop: !_sending, child: _material(context));
|
||||
}
|
||||
|
||||
Widget _material(BuildContext context) {
|
||||
@@ -248,31 +236,6 @@ class _RunPipelineDialogState extends State<_RunPipelineDialog> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _cupertino(BuildContext context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text(runPipelineDialogTitle(widget.detail.name)),
|
||||
content: _content(context),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
key: runPipelineCancelKey,
|
||||
onPressed: _sending ? null : _cancel,
|
||||
child: const Text(runPipelineCancelLabel),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
key: const Key('run-pipeline-schedule'),
|
||||
onPressed: _sending ? null : _schedule,
|
||||
child: const Text('Schedule…'),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
key: runPipelineConfirmKey,
|
||||
isDefaultAction: true,
|
||||
onPressed: _sending ? null : _confirm,
|
||||
child: Text(_confirmLabel),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// Leaves the dialog for the schedule editor with the typed prompt,
|
||||
/// workspace and the pinned version.
|
||||
void _schedule() {
|
||||
@@ -294,9 +257,7 @@ class _RunPipelineDialogState extends State<_RunPipelineDialog> {
|
||||
}
|
||||
|
||||
Widget _content(BuildContext context) {
|
||||
final errorStyle = widget.cupertino
|
||||
? TextStyle(color: CupertinoColors.systemRed.resolveFrom(context))
|
||||
: TextStyle(color: Theme.of(context).colorScheme.error);
|
||||
final errorStyle = TextStyle(color: Theme.of(context).colorScheme.error);
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
@@ -305,7 +266,7 @@ class _RunPipelineDialogState extends State<_RunPipelineDialog> {
|
||||
prompt: _prompt,
|
||||
workspace: _workspace,
|
||||
directories: _directories,
|
||||
cupertino: widget.cupertino,
|
||||
cupertino: false,
|
||||
onChooseDirectory: _chooseDirectory,
|
||||
notifyMode: _notify,
|
||||
outputFormat: _outputFormat,
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../run_pipeline_intent.dart';
|
||||
import 'run_pipeline_wording.dart';
|
||||
|
||||
/// The dialog's three web fields, in the host's native controls.
|
||||
/// The dialog's three web fields in standard Material controls.
|
||||
///
|
||||
/// A confirmed launch locks every field: the request is immutable until its
|
||||
/// admission is known, exactly like the browser's disabled inputs.
|
||||
@@ -27,7 +25,10 @@ class RunPipelineFields extends StatelessWidget {
|
||||
final TextEditingController prompt;
|
||||
final TextEditingController workspace;
|
||||
final List<String> directories;
|
||||
|
||||
/// Retained for callers; the fields are Material on every host.
|
||||
final bool cupertino;
|
||||
|
||||
final ValueChanged<String> onChooseDirectory;
|
||||
final RunNotifyMode notifyMode;
|
||||
final RunOutputFormat outputFormat;
|
||||
@@ -37,44 +38,28 @@ class RunPipelineFields extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = usesCupertinoHost(context);
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_FieldLabel(runPipelinePromptLabel, cupertino: cupertino),
|
||||
_promptField(context, cupertino),
|
||||
const _FieldLabel(runPipelinePromptLabel),
|
||||
_promptField(),
|
||||
const SizedBox(height: 12),
|
||||
_FieldLabel(runPipelineWorkspaceLabel, cupertino: cupertino),
|
||||
_workspaceField(context, cupertino),
|
||||
_helper(context, runPipelineWorkspaceHelper, cupertino),
|
||||
const _FieldLabel(runPipelineWorkspaceLabel),
|
||||
_workspaceField(),
|
||||
_helper(context, runPipelineWorkspaceHelper),
|
||||
const SizedBox(height: 12),
|
||||
_FieldLabel(runPipelineNotifyLabel, cupertino: cupertino),
|
||||
_notifyField(context, cupertino),
|
||||
const _FieldLabel(runPipelineNotifyLabel),
|
||||
_notifyField(),
|
||||
const SizedBox(height: 12),
|
||||
_FieldLabel(runPipelineOutputFormatLabel, cupertino: cupertino),
|
||||
_outputFormatField(context, cupertino),
|
||||
_helper(context, runPipelineOutputFormatHelper, cupertino),
|
||||
const _FieldLabel(runPipelineOutputFormatLabel),
|
||||
_outputFormatField(),
|
||||
_helper(context, runPipelineOutputFormatHelper),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _promptField(BuildContext context, bool cupertino) {
|
||||
if (cupertino) {
|
||||
return CupertinoTextField(
|
||||
key: runPipelinePromptKey,
|
||||
controller: prompt,
|
||||
placeholder: runPipelinePromptPlaceholder,
|
||||
placeholderStyle: _cupertinoPlaceholder(context),
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
minLines: 3,
|
||||
maxLines: 5,
|
||||
enabled: !locked,
|
||||
autofocus: !locked,
|
||||
padding: const EdgeInsets.all(8),
|
||||
textCapitalization: TextCapitalization.sentences,
|
||||
);
|
||||
}
|
||||
Widget _promptField() {
|
||||
return TextField(
|
||||
key: runPipelinePromptKey,
|
||||
controller: prompt,
|
||||
@@ -90,51 +75,26 @@ class RunPipelineFields extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _workspaceField(BuildContext context, bool cupertino) {
|
||||
final field = cupertino
|
||||
? _cupertinoWorkspace(context)
|
||||
: _materialWorkspace();
|
||||
Widget _workspaceField() {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: field),
|
||||
Expanded(child: _materialWorkspace()),
|
||||
if (directories.isNotEmpty)
|
||||
cupertino
|
||||
? CupertinoButton(
|
||||
key: runPipelineWorkspaceSuggestionsKey,
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: locked
|
||||
? null
|
||||
: () => _chooseCupertinoDirectory(context),
|
||||
child: const Icon(CupertinoIcons.folder),
|
||||
)
|
||||
: PopupMenuButton<String>(
|
||||
key: runPipelineWorkspaceSuggestionsKey,
|
||||
tooltip: runPipelineWorkspaceLabel,
|
||||
enabled: !locked,
|
||||
onSelected: onChooseDirectory,
|
||||
itemBuilder: (_) => [
|
||||
for (final path in directories)
|
||||
PopupMenuItem(value: path, child: Text(path)),
|
||||
],
|
||||
),
|
||||
PopupMenuButton<String>(
|
||||
key: runPipelineWorkspaceSuggestionsKey,
|
||||
tooltip: runPipelineWorkspaceLabel,
|
||||
enabled: !locked,
|
||||
onSelected: onChooseDirectory,
|
||||
itemBuilder: (_) => [
|
||||
for (final path in directories)
|
||||
PopupMenuItem(value: path, child: Text(path)),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _cupertinoWorkspace(BuildContext context) {
|
||||
return CupertinoTextField(
|
||||
key: runPipelineWorkspaceKey,
|
||||
controller: workspace,
|
||||
placeholder: runPipelineWorkspacePlaceholder,
|
||||
placeholderStyle: _cupertinoPlaceholder(context),
|
||||
style: CupertinoTheme.of(context).textTheme.textStyle,
|
||||
enabled: !locked,
|
||||
autocorrect: false,
|
||||
padding: const EdgeInsets.all(8),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _materialWorkspace() {
|
||||
return TextField(
|
||||
key: runPipelineWorkspaceKey,
|
||||
@@ -148,44 +108,7 @@ class RunPipelineFields extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _chooseCupertinoDirectory(BuildContext context) async {
|
||||
final chosen = await showCupertinoModalPopup<String>(
|
||||
context: context,
|
||||
builder: (sheetContext) => CupertinoActionSheet(
|
||||
title: const Text(runPipelineWorkspaceLabel),
|
||||
actions: [
|
||||
for (final path in directories)
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () => Navigator.of(sheetContext).pop(path),
|
||||
child: Text(path),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
onPressed: () => Navigator.of(sheetContext).pop(),
|
||||
child: const Text(runPipelineCancelLabel),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (chosen != null) onChooseDirectory(chosen);
|
||||
}
|
||||
|
||||
Widget _notifyField(BuildContext context, bool cupertino) {
|
||||
if (cupertino) {
|
||||
return CupertinoButton(
|
||||
key: runPipelineNotifyKey,
|
||||
padding: EdgeInsets.zero,
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
onPressed: locked ? null : () => _chooseNotify(context),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(child: Text(notifyMode.label)),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(CupertinoIcons.chevron_down, size: 14),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Widget _notifyField() {
|
||||
return DropdownButtonFormField<RunNotifyMode>(
|
||||
key: runPipelineNotifyKey,
|
||||
initialValue: notifyMode,
|
||||
@@ -202,45 +125,7 @@ class RunPipelineFields extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _chooseNotify(BuildContext context) async {
|
||||
final chosen = await showCupertinoModalPopup<RunNotifyMode>(
|
||||
context: context,
|
||||
builder: (sheetContext) => CupertinoActionSheet(
|
||||
title: const Text(runPipelineNotifyLabel),
|
||||
actions: [
|
||||
for (final mode in RunNotifyMode.values)
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () => Navigator.of(sheetContext).pop(mode),
|
||||
child: Text(mode.label),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
isDefaultAction: true,
|
||||
onPressed: () => Navigator.of(sheetContext).pop(),
|
||||
child: const Text(runPipelineCancelLabel),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (chosen != null) onNotifyChanged(chosen);
|
||||
}
|
||||
|
||||
Widget _outputFormatField(BuildContext context, bool cupertino) {
|
||||
if (cupertino) {
|
||||
return CupertinoButton(
|
||||
key: runPipelineOutputFormatKey,
|
||||
padding: EdgeInsets.zero,
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
onPressed: locked ? null : () => _chooseOutputFormat(context),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(child: Text(outputFormat.label)),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(CupertinoIcons.chevron_down, size: 14),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Widget _outputFormatField() {
|
||||
return DropdownButtonFormField<RunOutputFormat>(
|
||||
key: runPipelineOutputFormatKey,
|
||||
initialValue: outputFormat,
|
||||
@@ -257,75 +142,34 @@ class RunPipelineFields extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _chooseOutputFormat(BuildContext context) async {
|
||||
final chosen = await showCupertinoModalPopup<RunOutputFormat>(
|
||||
context: context,
|
||||
builder: (sheetContext) => CupertinoActionSheet(
|
||||
title: const Text(runPipelineOutputFormatLabel),
|
||||
actions: [
|
||||
for (final format in RunOutputFormat.values)
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () => Navigator.of(sheetContext).pop(format),
|
||||
child: Text(format.label),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
isDefaultAction: true,
|
||||
onPressed: () => Navigator.of(sheetContext).pop(),
|
||||
child: const Text(runPipelineCancelLabel),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (chosen != null) onOutputFormatChanged(chosen);
|
||||
}
|
||||
|
||||
TextStyle _cupertinoPlaceholder(BuildContext context) {
|
||||
// The host's own dynamic placeholder colour (light and dark), resolved for
|
||||
// the dialog's inherited Cupertino brightness.
|
||||
return TextStyle(
|
||||
color: CupertinoColors.placeholderText.resolveFrom(context),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _helper(BuildContext context, String text, bool cupertino) {
|
||||
Widget _helper(BuildContext context, String text) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: Text(text, style: _secondaryStyle(context, cupertino)),
|
||||
child: Text(text, style: _secondaryStyle(context)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Secondary copy under a field: the host's own secondary role, never a
|
||||
/// borrowed palette or invented point size.
|
||||
TextStyle _secondaryStyle(BuildContext context, bool cupertino) {
|
||||
if (cupertino) {
|
||||
return CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
|
||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
||||
);
|
||||
}
|
||||
/// Secondary copy under a field: the theme's secondary role, never a borrowed
|
||||
/// palette or invented point size.
|
||||
TextStyle? _secondaryStyle(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return (theme.textTheme.bodySmall ?? const TextStyle()).copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
);
|
||||
}
|
||||
|
||||
/// The label above each native field, using the web's exact words.
|
||||
/// The label above each field, using the web's exact words.
|
||||
class _FieldLabel extends StatelessWidget {
|
||||
const _FieldLabel(this.text, {required this.cupertino});
|
||||
const _FieldLabel(this.text);
|
||||
|
||||
final String text;
|
||||
final bool cupertino;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// A theme label role with the primary label colour, matching the app's
|
||||
// Cupertino form pattern; secondaryLabel is for helper copy only.
|
||||
final style = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.labelLarge;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 4),
|
||||
child: Text(text, style: style),
|
||||
child: Text(text, style: Theme.of(context).textTheme.labelLarge),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||
@@ -28,9 +27,7 @@ Widget pipelineActionsMenu(
|
||||
return SegmentedOverflowAction(
|
||||
overflowEntry: SegmentedOverflowEntry(
|
||||
label: archived ? 'Unarchive pipeline' : 'Archive pipeline…',
|
||||
icon: useCupertinoControls(context)
|
||||
? CupertinoIcons.archivebox
|
||||
: Icons.archive_outlined,
|
||||
icon: Icons.archive_outlined,
|
||||
onPressed: () => run(context),
|
||||
),
|
||||
child: AppOverflowMenu<bool>(
|
||||
@@ -104,64 +101,28 @@ class PipelineArchivedNotice extends StatelessWidget {
|
||||
Future<bool> _confirmArchive(BuildContext context, String name) async {
|
||||
final title = Text('Archive $name?');
|
||||
final body = Text(archiveConfirmation(name));
|
||||
final confirmed = useCupertinoControls(context)
|
||||
? await showCupertinoDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: title,
|
||||
content: body,
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
key: const Key('pipeline-archive-confirm'),
|
||||
isDefaultAction: true,
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: const Text('Archive'),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: title,
|
||||
content: body,
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
FilledButton(
|
||||
key: const Key('pipeline-archive-confirm'),
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: const Text('Archive'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: title,
|
||||
content: body,
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
FilledButton(
|
||||
key: const Key('pipeline-archive-confirm'),
|
||||
onPressed: () => Navigator.pop(context, true),
|
||||
child: const Text('Archive'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
return confirmed == true;
|
||||
}
|
||||
|
||||
Future<void> _showRefusal(BuildContext context, String title, String message) {
|
||||
if (useCupertinoControls(context)) {
|
||||
return showCupertinoDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => CupertinoAlertDialog(
|
||||
title: Text(title),
|
||||
content: Text(message),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
isDefaultAction: true,
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('OK'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
|
||||
@@ -2,11 +2,12 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||
import 'pipeline_controls.dart';
|
||||
|
||||
/// One icon action in the Pipelines bar's actions pill: a Material
|
||||
/// [IconButton] with its tooltip, or a Cupertino button named for
|
||||
/// accessibility. A narrow bar moves it into its More menu.
|
||||
/// [IconButton] with its tooltip. A narrow bar moves it into its More menu.
|
||||
///
|
||||
/// [cupertinoIcon] is retained in the signature for callers that still pass
|
||||
/// it; the Material icon is drawn.
|
||||
Widget pipelineBarIconButton(
|
||||
BuildContext context, {
|
||||
required Key key,
|
||||
@@ -15,33 +16,23 @@ Widget pipelineBarIconButton(
|
||||
required IconData cupertinoIcon,
|
||||
required VoidCallback? onPressed,
|
||||
}) {
|
||||
final Widget button;
|
||||
final cupertino = useCupertinoControls(context);
|
||||
if (cupertino) {
|
||||
button = CupertinoButton(
|
||||
key: key,
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onPressed,
|
||||
child: Icon(cupertinoIcon),
|
||||
);
|
||||
} else {
|
||||
button = IconButton(
|
||||
key: key,
|
||||
tooltip: label,
|
||||
onPressed: onPressed,
|
||||
icon: Icon(icon),
|
||||
);
|
||||
}
|
||||
return SegmentedOverflowAction(
|
||||
overflowEntry: SegmentedOverflowEntry(
|
||||
label: label,
|
||||
icon: cupertino ? cupertinoIcon : icon,
|
||||
icon: icon,
|
||||
onPressed: onPressed,
|
||||
),
|
||||
child: Semantics(
|
||||
button: true,
|
||||
label: label,
|
||||
child: ExcludeSemantics(child: button),
|
||||
child: ExcludeSemantics(
|
||||
child: IconButton(
|
||||
key: key,
|
||||
tooltip: label,
|
||||
onPressed: onPressed,
|
||||
icon: Icon(icon),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
import '../../../ui/adaptive/app_menu_anchor.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
|
||||
import '../pipeline_query.dart';
|
||||
|
||||
/// The one control-family decision for this feature: Cupertino only under an
|
||||
/// explicit Cupertino host, Material on every platform otherwise.
|
||||
bool useCupertinoControls(BuildContext context) => usesCupertinoHost(context);
|
||||
|
||||
/// Standard platform activity indicator with an accessible status label.
|
||||
/// Standard Material activity indicator with an accessible status label.
|
||||
class PipelineProgress extends StatelessWidget {
|
||||
const PipelineProgress({super.key, this.label = 'Loading'});
|
||||
|
||||
@@ -22,14 +16,12 @@ class PipelineProgress extends StatelessWidget {
|
||||
return Semantics(
|
||||
label: label,
|
||||
liveRegion: true,
|
||||
child: useCupertinoControls(context)
|
||||
? const CupertinoActivityIndicator()
|
||||
: const CircularProgressIndicator(),
|
||||
child: const CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A standard text action in the current platform's style.
|
||||
/// A standard Material text action.
|
||||
class PipelineTextButton extends StatelessWidget {
|
||||
const PipelineTextButton({
|
||||
super.key,
|
||||
@@ -42,18 +34,11 @@ class PipelineTextButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (useCupertinoControls(context)) {
|
||||
return CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onPressed,
|
||||
child: Text(label),
|
||||
);
|
||||
}
|
||||
return TextButton(onPressed: onPressed, child: Text(label));
|
||||
}
|
||||
}
|
||||
|
||||
/// Native back affordance used by the narrow list/detail layout.
|
||||
/// Back affordance used by the narrow list/detail layout.
|
||||
class PipelineBackButton extends StatelessWidget {
|
||||
const PipelineBackButton({super.key, required this.onPressed});
|
||||
|
||||
@@ -62,19 +47,18 @@ class PipelineBackButton extends StatelessWidget {
|
||||
/// The same round Back as every page's segmented bar.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = useCupertinoControls(context);
|
||||
return Semantics(
|
||||
label: 'Back to pipelines',
|
||||
child: SegmentedPill(
|
||||
cupertino: cupertino,
|
||||
child: SegmentedBackButton(cupertino: cupertino, onPressed: onPressed),
|
||||
cupertino: false,
|
||||
child: SegmentedBackButton(cupertino: false, onPressed: onPressed),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The list's sort control: a Material menu on Android/desktop, an action
|
||||
/// sheet on iOS. The label is the current choice, exactly as on web.
|
||||
/// The list's sort control: a Material menu. The label is the current choice,
|
||||
/// exactly as on web.
|
||||
class PipelineSortButton extends StatelessWidget {
|
||||
const PipelineSortButton({
|
||||
super.key,
|
||||
@@ -92,23 +76,6 @@ class PipelineSortButton extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final label = 'Sort: ${sort.label}';
|
||||
if (useCupertinoControls(context)) {
|
||||
return Semantics(
|
||||
button: true,
|
||||
label: icon ? 'Sort pipelines: ${sort.label}' : null,
|
||||
excludeSemantics: icon,
|
||||
child: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: icon
|
||||
? const Size.square(kMinInteractiveDimensionCupertino)
|
||||
: null,
|
||||
onPressed: () => _showCupertinoSheet(context),
|
||||
child: icon
|
||||
? const Icon(CupertinoIcons.arrow_up_arrow_down)
|
||||
: Text(label),
|
||||
),
|
||||
);
|
||||
}
|
||||
return AppMenuAnchor(
|
||||
menuChildren: [
|
||||
for (final option in PipelineSort.values)
|
||||
@@ -129,30 +96,6 @@ class PipelineSortButton extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _showCupertinoSheet(BuildContext context) {
|
||||
return showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
builder: (sheetContext) => CupertinoActionSheet(
|
||||
title: const Text('Sort pipelines'),
|
||||
actions: [
|
||||
for (final option in PipelineSort.values)
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
Navigator.of(sheetContext).pop();
|
||||
onSelected(option);
|
||||
},
|
||||
child: Text(option.label),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
isDefaultAction: true,
|
||||
onPressed: () => Navigator.of(sheetContext).pop(),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A truthful, non-blocking error line with an optional retry action.
|
||||
@@ -170,10 +113,7 @@ class PipelineErrorBanner extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = useCupertinoControls(context);
|
||||
final color = cupertino
|
||||
? CupertinoColors.systemRed.resolveFrom(context)
|
||||
: Theme.of(context).colorScheme.error;
|
||||
final color = Theme.of(context).colorScheme.error;
|
||||
return Semantics(
|
||||
liveRegion: true,
|
||||
child: Padding(
|
||||
|
||||
@@ -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/layout/warnings_section.dart';
|
||||
|
||||
// The gateway bounds this cache to one server connection. Retain at most sixteen
|
||||
@@ -100,15 +98,10 @@ class _PipelineDefinitionValidationState
|
||||
if (snapshot.hasError || !validReply)
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: usesCupertinoHost(context)
|
||||
? CupertinoButton(
|
||||
onPressed: () => setState(() => _load(retry: true)),
|
||||
child: const Text('Retry validation'),
|
||||
)
|
||||
: TextButton(
|
||||
onPressed: () => setState(() => _load(retry: true)),
|
||||
child: const Text('Retry validation'),
|
||||
),
|
||||
child: TextButton(
|
||||
onPressed: () => setState(() => _load(retry: true)),
|
||||
child: const Text('Retry validation'),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1,35 +1,19 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'pipeline_controls.dart';
|
||||
|
||||
TextStyle? pipelineTitleStyle(BuildContext context) =>
|
||||
useCupertinoControls(context)
|
||||
? CupertinoTheme.of(context).textTheme.navLargeTitleTextStyle
|
||||
: Theme.of(context).textTheme.headlineSmall;
|
||||
Theme.of(context).textTheme.headlineSmall;
|
||||
|
||||
TextStyle? pipelineSectionStyle(BuildContext context) =>
|
||||
useCupertinoControls(context)
|
||||
? CupertinoTheme.of(context).textTheme.navTitleTextStyle
|
||||
: Theme.of(context).textTheme.titleMedium;
|
||||
Theme.of(context).textTheme.titleMedium;
|
||||
|
||||
TextStyle? pipelineValueStyle(BuildContext context, {bool monospace = false}) {
|
||||
final base = useCupertinoControls(context)
|
||||
// SelectableText requires an explicit baseline when it inherits no style;
|
||||
// merge the Cupertino system style with the ambient text style.
|
||||
? CupertinoTheme.of(context).textTheme.textStyle.copyWith(inherit: true)
|
||||
: Theme.of(context).textTheme.bodyMedium;
|
||||
final base = Theme.of(context).textTheme.bodyMedium;
|
||||
// Metadata can identify code-like values, but the user requested native
|
||||
// typography even for source/hash surfaces; do not replace the host font.
|
||||
return base;
|
||||
}
|
||||
|
||||
TextStyle? pipelineMutedStyle(BuildContext context) {
|
||||
if (useCupertinoControls(context)) {
|
||||
return CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
|
||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
||||
);
|
||||
}
|
||||
final theme = Theme.of(context);
|
||||
return theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
|
||||
@@ -14,5 +14,7 @@ enum PipelineDetailTab {
|
||||
/// The tab's glyph, the only thing the bottom bar draws (the label is its
|
||||
/// accessible name); distinct from the shell's Pipelines tab beneath it.
|
||||
final IconData icon;
|
||||
|
||||
/// Retained for callers; the Material [icon] is drawn.
|
||||
final IconData cupertinoIcon;
|
||||
}
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
import '../../../ui/theme/app_theme.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import '../pipeline_filter.dart';
|
||||
|
||||
/// Cupertino filter form using native grouped lists and checkboxes.
|
||||
class PipelineFilterCupertinoBody extends StatelessWidget {
|
||||
const PipelineFilterCupertinoBody({
|
||||
super.key,
|
||||
required this.filters,
|
||||
required this.name,
|
||||
required this.hasUnclassified,
|
||||
required this.onChanged,
|
||||
required this.onClear,
|
||||
});
|
||||
|
||||
final PipelineFilters filters;
|
||||
final TextEditingController name;
|
||||
final bool hasUnclassified;
|
||||
final ValueChanged<PipelineFilters> onChanged;
|
||||
final VoidCallback onClear;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: CupertinoTextField(
|
||||
controller: name,
|
||||
placeholder: 'Pipeline name contains',
|
||||
),
|
||||
),
|
||||
CupertinoListSection.insetGrouped(
|
||||
backgroundColor: AppColors.groupedBackground,
|
||||
header: const Text('RUNS'),
|
||||
children: [
|
||||
for (final presence in RunPresence.values)
|
||||
_choice(
|
||||
label: presence.label,
|
||||
selected: filters.presence == presence,
|
||||
onTap: () => onChanged(filters.copyWith(presence: presence)),
|
||||
),
|
||||
],
|
||||
),
|
||||
CupertinoListSection.insetGrouped(
|
||||
backgroundColor: AppColors.groupedBackground,
|
||||
header: const Text('LAST RUN STATUS'),
|
||||
children: [
|
||||
for (final status in runStatusFilters)
|
||||
_check(
|
||||
label: status,
|
||||
checked: filters.lastRunStatuses.contains(status),
|
||||
onChanged: (checked) {
|
||||
final next = {...filters.lastRunStatuses};
|
||||
if (checked) {
|
||||
next.add(status);
|
||||
} else {
|
||||
next.remove(status);
|
||||
}
|
||||
onChanged(filters.copyWith(lastRunStatuses: next));
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
CupertinoListSection.insetGrouped(
|
||||
backgroundColor: AppColors.groupedBackground,
|
||||
header: const Text('SCHEDULING'),
|
||||
footer: const Text('Configured schedules, including paused.'),
|
||||
children: [
|
||||
for (final schedule in ScheduleFilter.values)
|
||||
_choice(
|
||||
label: schedule.label,
|
||||
selected: filters.schedule == schedule,
|
||||
onTap: () => onChanged(filters.copyWith(schedule: schedule)),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (hasUnclassified)
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(bottom: 12),
|
||||
child: Text(
|
||||
'Some records have no scheduling metadata; they stay unclassified.',
|
||||
),
|
||||
),
|
||||
CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onClear,
|
||||
child: const Text('Clear filters'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _choice({
|
||||
required String label,
|
||||
required bool selected,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return CupertinoListTile(
|
||||
title: Text(label),
|
||||
trailing: CupertinoCheckbox(value: selected, onChanged: (_) => onTap()),
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _check({
|
||||
required String label,
|
||||
required bool checked,
|
||||
required ValueChanged<bool> onChanged,
|
||||
}) {
|
||||
return CupertinoListTile(
|
||||
title: Text(label),
|
||||
trailing: CupertinoCheckbox(
|
||||
value: checked,
|
||||
onChanged: (value) => onChanged(value ?? false),
|
||||
),
|
||||
onTap: () => onChanged(!checked),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +1,27 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/segmented_bar.dart';
|
||||
import '../pipeline_filter.dart';
|
||||
import 'pipeline_controls.dart';
|
||||
import 'pipeline_filter_cupertino_body.dart';
|
||||
import 'pipeline_filter_material_body.dart';
|
||||
|
||||
/// Opens the platform's native full-screen filter editor.
|
||||
/// Opens the full-screen filter editor.
|
||||
Future<void> openPipelineFilters(
|
||||
BuildContext context, {
|
||||
required PipelineFilters initial,
|
||||
required bool hasUnclassified,
|
||||
required ValueChanged<PipelineFilters> onApply,
|
||||
}) {
|
||||
final cupertino = useCupertinoControls(context);
|
||||
final route = cupertino
|
||||
? CupertinoPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => PipelineFilterPage(
|
||||
initial: initial,
|
||||
hasUnclassified: hasUnclassified,
|
||||
onApply: onApply,
|
||||
cupertino: true,
|
||||
),
|
||||
)
|
||||
: MaterialPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => PipelineFilterPage(
|
||||
initial: initial,
|
||||
hasUnclassified: hasUnclassified,
|
||||
onApply: onApply,
|
||||
cupertino: false,
|
||||
),
|
||||
);
|
||||
return Navigator.of(context).push(route);
|
||||
return Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) => PipelineFilterPage(
|
||||
initial: initial,
|
||||
hasUnclassified: hasUnclassified,
|
||||
onApply: onApply,
|
||||
cupertino: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// A draft copy of the filters. Changes take effect on Done; leaving the page
|
||||
@@ -51,6 +38,8 @@ class PipelineFilterPage extends StatefulWidget {
|
||||
final PipelineFilters initial;
|
||||
final bool hasUnclassified;
|
||||
final ValueChanged<PipelineFilters> onApply;
|
||||
|
||||
/// Retained for callers; the page is Material on every host.
|
||||
final bool cupertino;
|
||||
|
||||
@override
|
||||
@@ -83,37 +72,6 @@ class _PipelineFilterPageState extends State<PipelineFilterPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final body = widget.cupertino
|
||||
? PipelineFilterCupertinoBody(
|
||||
filters: _draft,
|
||||
name: _name,
|
||||
hasUnclassified: widget.hasUnclassified,
|
||||
onChanged: (filters) => setState(() => _draft = filters),
|
||||
onClear: _clear,
|
||||
)
|
||||
: PipelineFilterMaterialBody(
|
||||
filters: _draft,
|
||||
name: _name,
|
||||
hasUnclassified: widget.hasUnclassified,
|
||||
onChanged: (filters) => setState(() => _draft = filters),
|
||||
onClear: _clear,
|
||||
);
|
||||
if (widget.cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
title: 'Filter pipelines',
|
||||
actions: [
|
||||
CupertinoButton(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
onPressed: _apply,
|
||||
child: const Text('Done'),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SafeArea(top: false, bottom: false, child: body),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
@@ -121,7 +79,17 @@ class _PipelineFilterPageState extends State<PipelineFilterPage> {
|
||||
title: 'Filter pipelines',
|
||||
actions: [TextButton(onPressed: _apply, child: const Text('Done'))],
|
||||
),
|
||||
body: SafeArea(top: false, bottom: false, child: body),
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
bottom: false,
|
||||
child: PipelineFilterMaterialBody(
|
||||
filters: _draft,
|
||||
name: _name,
|
||||
hasUnclassified: widget.hasUnclassified,
|
||||
onChanged: (filters) => setState(() => _draft = filters),
|
||||
onClear: _clear,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../graph/widgets/definition_graph_view.dart';
|
||||
import '../pipeline_models.dart';
|
||||
import 'pipeline_controls.dart';
|
||||
import 'pipeline_detail_styles.dart';
|
||||
|
||||
/// The Graph tab's guidance note. Gestures stay the host's own: wheel or pinch
|
||||
@@ -207,14 +205,6 @@ class _GraphGuidanceNoteState extends State<_GraphGuidanceNote> {
|
||||
/// The host's own scrollbar: visible whenever the note is clipped, and
|
||||
/// draggable with the pointer, so the rest is discoverable without a wheel.
|
||||
Widget _scrollbar(Widget child) {
|
||||
if (useCupertinoControls(context)) {
|
||||
return CupertinoScrollbar(
|
||||
key: const Key('pipeline-graph-note-scrollbar'),
|
||||
controller: _scrollController,
|
||||
thumbVisibility: true,
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return Scrollbar(
|
||||
key: const Key('pipeline-graph-note-scrollbar'),
|
||||
controller: _scrollController,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import '../../../core/servers/server_context.dart';
|
||||
import '../../../ui/layout/app_list_avatar.dart';
|
||||
import '../../../ui/layout/app_list_row.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../shell/shell_list_shortcuts.dart';
|
||||
@@ -213,7 +212,6 @@ class PipelineListPanel extends StatelessWidget {
|
||||
List<PipelineSummary> items,
|
||||
) {
|
||||
final now = DateTime.now();
|
||||
final cupertino = useCupertinoControls(context);
|
||||
// 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.builder(
|
||||
@@ -228,12 +226,12 @@ class PipelineListPanel extends StatelessWidget {
|
||||
final badge = run == null ? null : runBadge(run, now);
|
||||
return AppListRow(
|
||||
key: Key('pipeline-row-${pipeline.id}'),
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
selected: controller.selectedId == pipeline.id,
|
||||
divider: index < header.length + items.length - 1,
|
||||
onTap: () =>
|
||||
controller.openPipeline(pipeline.id, version: pipeline.version),
|
||||
leading: _pipelineIdentityIcon(context, pipeline, cupertino),
|
||||
leading: _pipelineIdentityIcon(context, pipeline),
|
||||
title: Text(pipeline.displayName),
|
||||
time: badge?.ranAgo,
|
||||
subtitleLeading: badge == null
|
||||
@@ -274,11 +272,6 @@ class PipelineListPanel extends StatelessWidget {
|
||||
}
|
||||
|
||||
TextStyle? _mutedStyle(BuildContext context) {
|
||||
if (useCupertinoControls(context)) {
|
||||
return CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith(
|
||||
color: CupertinoColors.secondaryLabel.resolveFrom(context),
|
||||
);
|
||||
}
|
||||
final theme = Theme.of(context);
|
||||
return theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
@@ -290,19 +283,9 @@ class PipelineListPanel extends StatelessWidget {
|
||||
Widget _pipelineIdentityIcon(
|
||||
BuildContext context,
|
||||
PipelineSummary pipeline,
|
||||
bool cupertino,
|
||||
) {
|
||||
final List<Color> colors;
|
||||
if (cupertino) {
|
||||
colors = [
|
||||
CupertinoTheme.of(context).primaryColor,
|
||||
CupertinoColors.systemIndigo.resolveFrom(context),
|
||||
CupertinoColors.systemTeal.resolveFrom(context),
|
||||
];
|
||||
} else {
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
colors = [scheme.primary, scheme.secondary, scheme.tertiary];
|
||||
}
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final colors = [scheme.primary, scheme.secondary, scheme.tertiary];
|
||||
return Semantics(
|
||||
label: 'Pipeline ${pipeline.displayName}',
|
||||
child: ExcludeSemantics(
|
||||
@@ -334,34 +317,17 @@ List<Widget> pipelineListActions(
|
||||
final label = filters.count == 0
|
||||
? 'Filter pipelines'
|
||||
: '${filters.count} active ${filters.count == 1 ? 'filter' : 'filters'}';
|
||||
final cupertino = useCupertinoControls(context);
|
||||
final filterIcon = cupertino
|
||||
? (filters.count > 0
|
||||
? CupertinoIcons.line_horizontal_3_decrease_circle_fill
|
||||
: CupertinoIcons.line_horizontal_3_decrease_circle)
|
||||
: (filters.count > 0 ? Icons.filter_alt : Icons.filter_alt_outlined);
|
||||
final filter = cupertino
|
||||
? Semantics(
|
||||
button: true,
|
||||
label: label,
|
||||
excludeSemantics: true,
|
||||
child: CupertinoButton(
|
||||
key: const Key('pipeline-filter'),
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: const Size.square(kMinInteractiveDimensionCupertino),
|
||||
onPressed: openFilters,
|
||||
child: Icon(filterIcon),
|
||||
),
|
||||
)
|
||||
: IconButton(
|
||||
key: const Key('pipeline-filter'),
|
||||
tooltip: label,
|
||||
isSelected: filters.count > 0,
|
||||
onPressed: openFilters,
|
||||
icon: Icon(filterIcon),
|
||||
);
|
||||
// A narrow bar moves either into its More menu; sorting is then a
|
||||
// submenu (Material) or a second action sheet (Cupertino).
|
||||
final filterIcon = filters.count > 0
|
||||
? Icons.filter_alt
|
||||
: Icons.filter_alt_outlined;
|
||||
final filter = IconButton(
|
||||
key: const Key('pipeline-filter'),
|
||||
tooltip: label,
|
||||
isSelected: filters.count > 0,
|
||||
onPressed: openFilters,
|
||||
icon: Icon(filterIcon),
|
||||
);
|
||||
// A narrow bar moves either into its More menu; sorting is then a submenu.
|
||||
return [
|
||||
SegmentedOverflowAction(
|
||||
overflowEntry: SegmentedOverflowEntry(
|
||||
@@ -374,7 +340,7 @@ List<Widget> pipelineListActions(
|
||||
SegmentedOverflowAction(
|
||||
overflowEntry: SegmentedOverflowEntry(
|
||||
label: 'Sort pipelines: ${controller.sort.label}',
|
||||
icon: cupertino ? CupertinoIcons.arrow_up_arrow_down : Icons.sort,
|
||||
icon: Icons.sort,
|
||||
choices: [
|
||||
for (final option in PipelineSort.values)
|
||||
SegmentedMenuChoice(
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'pipeline_controls.dart';
|
||||
|
||||
/// The list's scope: every active pipeline, only scheduled ones, or the
|
||||
/// archived pipelines (which the other two never show).
|
||||
enum PipelineScope {
|
||||
@@ -15,7 +12,7 @@ enum PipelineScope {
|
||||
final String label;
|
||||
}
|
||||
|
||||
/// Uses a native picker when the segmented labels cannot fit at the user's
|
||||
/// Uses a standard dropdown when the segmented labels cannot fit at the user's
|
||||
/// text scale. The decision is content-measured, not a fixed pane width.
|
||||
class PipelineScopeControl extends StatelessWidget {
|
||||
const PipelineScopeControl({
|
||||
@@ -32,10 +29,7 @@ class PipelineScopeControl extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = useCupertinoControls(context);
|
||||
final style = cupertino
|
||||
? CupertinoTheme.of(context).textTheme.textStyle
|
||||
: Theme.of(context).textTheme.labelLarge;
|
||||
final style = Theme.of(context).textTheme.labelLarge;
|
||||
var requiredWidth = kMinInteractiveDimension * labels.length;
|
||||
for (final label in labels.values) {
|
||||
final painter = TextPainter(
|
||||
@@ -49,84 +43,35 @@ class PipelineScopeControl extends StatelessWidget {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
if (constraints.maxWidth >= requiredWidth) {
|
||||
return cupertino
|
||||
? CupertinoSlidingSegmentedControl<PipelineScope>(
|
||||
key: const Key('pipeline-scope'),
|
||||
groupValue: scope,
|
||||
onValueChanged: (value) =>
|
||||
onSelected(value ?? PipelineScope.all),
|
||||
children: {
|
||||
for (final entry in labels.entries)
|
||||
entry.key: Text(entry.value),
|
||||
},
|
||||
)
|
||||
: SegmentedButton<PipelineScope>(
|
||||
key: const Key('pipeline-scope'),
|
||||
showSelectedIcon: false,
|
||||
segments: [
|
||||
for (final entry in labels.entries)
|
||||
ButtonSegment(value: entry.key, label: Text(entry.value)),
|
||||
],
|
||||
selected: {scope},
|
||||
onSelectionChanged: (value) => onSelected(value.single),
|
||||
);
|
||||
}
|
||||
if (!cupertino) {
|
||||
return DropdownButton<PipelineScope>(
|
||||
return SegmentedButton<PipelineScope>(
|
||||
key: const Key('pipeline-scope'),
|
||||
value: scope,
|
||||
isExpanded: true,
|
||||
items: [
|
||||
showSelectedIcon: false,
|
||||
segments: [
|
||||
for (final entry in labels.entries)
|
||||
DropdownMenuItem(
|
||||
value: entry.key,
|
||||
child: Text(
|
||||
entry.value,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
ButtonSegment(value: entry.key, label: Text(entry.value)),
|
||||
],
|
||||
onChanged: (value) {
|
||||
if (value != null) onSelected(value);
|
||||
},
|
||||
selected: {scope},
|
||||
onSelectionChanged: (value) => onSelected(value.single),
|
||||
);
|
||||
}
|
||||
return CupertinoButton(
|
||||
return DropdownButton<PipelineScope>(
|
||||
key: const Key('pipeline-scope'),
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: () => showCupertinoModalPopup<void>(
|
||||
context: context,
|
||||
builder: (sheetContext) => CupertinoActionSheet(
|
||||
title: const Text('Pipeline scope'),
|
||||
actions: [
|
||||
for (final entry in labels.entries)
|
||||
CupertinoActionSheetAction(
|
||||
onPressed: () {
|
||||
Navigator.of(sheetContext).pop();
|
||||
if (context.mounted) onSelected(entry.key);
|
||||
},
|
||||
child: Text(entry.value),
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(
|
||||
onPressed: () => Navigator.of(sheetContext).pop(),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
value: scope,
|
||||
isExpanded: true,
|
||||
items: [
|
||||
for (final entry in labels.entries)
|
||||
DropdownMenuItem(
|
||||
value: entry.key,
|
||||
child: Text(
|
||||
labels[scope]!,
|
||||
entry.value,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
const Icon(CupertinoIcons.chevron_down),
|
||||
],
|
||||
),
|
||||
],
|
||||
onChanged: (value) {
|
||||
if (value != null) onSelected(value);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
@@ -10,7 +9,6 @@ import '../pipeline_format.dart';
|
||||
import '../pipeline_models.dart';
|
||||
import '../pipeline_query.dart';
|
||||
import '../pipelines_controller.dart';
|
||||
import 'pipeline_controls.dart';
|
||||
import 'pipeline_definition_validation.dart';
|
||||
import 'pipeline_detail_styles.dart';
|
||||
|
||||
@@ -85,7 +83,7 @@ class PipelineSummaryView extends StatelessWidget {
|
||||
if (fields.isEmpty) return const SizedBox.shrink();
|
||||
return FactsGrid(
|
||||
key: pipelineSummaryFactsKey,
|
||||
cupertino: useCupertinoControls(context),
|
||||
cupertino: false,
|
||||
items: [
|
||||
for (final field in fields)
|
||||
FactsGridItem(
|
||||
@@ -101,7 +99,6 @@ class PipelineSummaryView extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _versions(BuildContext context) {
|
||||
final cupertino = useCupertinoControls(context);
|
||||
final effective = detail.resolvedVersion;
|
||||
final showingLatest = effective == detail.latestVersion;
|
||||
final versions = detail.versions;
|
||||
@@ -109,7 +106,7 @@ class PipelineSummaryView extends StatelessWidget {
|
||||
if (!showingLatest)
|
||||
AppListRow(
|
||||
key: const Key('pipeline-latest-version'),
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
title: Text('View latest v${detail.latestVersion}'),
|
||||
subtitle: const Text('Return to the latest version'),
|
||||
divider: versions.isNotEmpty,
|
||||
@@ -118,7 +115,7 @@ class PipelineSummaryView extends StatelessWidget {
|
||||
for (var index = 0; index < versions.length; index += 1)
|
||||
AppListRow(
|
||||
key: Key('pipeline-version-${versions[index].version}'),
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
selected: versions[index].version == effective,
|
||||
title: Text('v${versions[index].version}'),
|
||||
time: formatLocalTimestamp(versions[index].createdAt),
|
||||
|
||||
@@ -2,7 +2,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';
|
||||
|
||||
export 'pipeline_detail_tab.dart';
|
||||
@@ -30,12 +29,11 @@ class PipelineDetailTabs extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cupertino = useCupertinoControls(context);
|
||||
const tabs = PipelineDetailTab.values;
|
||||
return KeyedSubtree(
|
||||
key: const Key('pipeline-detail-tabs'),
|
||||
child: FloatingDestinationBar(
|
||||
cupertino: cupertino,
|
||||
cupertino: false,
|
||||
currentIndex: tabs.indexOf(selected),
|
||||
edge: edge,
|
||||
onTap: (value) => onSelected(tabs[value]),
|
||||
@@ -43,7 +41,7 @@ class PipelineDetailTabs extends StatelessWidget {
|
||||
for (final tab in tabs)
|
||||
FloatingDestinationItem(
|
||||
key: ValueKey('pipeline-detail-tab-${tab.name}'),
|
||||
icon: Icon(cupertino ? tab.cupertinoIcon : tab.icon),
|
||||
icon: Icon(tab.icon),
|
||||
label: tab.label,
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user