Merge commit '591e1eec3a69099d7ae95ddcdd07d727b4bdeb27' into pipelines/run-20261111-0432-cupertino-out-pipelines-56b8
This commit is contained in:
@@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/glass_bar.dart';
|
import '../../../ui/adaptive/glass_bar.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../domain/artifact_record.dart';
|
import '../domain/artifact_record.dart';
|
||||||
import '../domain/artifact_url.dart';
|
import '../domain/artifact_url.dart';
|
||||||
import '../ui/artifact_viewer_fetch.dart';
|
import '../ui/artifact_viewer_fetch.dart';
|
||||||
@@ -81,19 +80,15 @@ class _ArtifactFileActionsState extends State<ArtifactFileActions> {
|
|||||||
listenable: _controller,
|
listenable: _controller,
|
||||||
builder: (context, _) => widget.compact
|
builder: (context, _) => widget.compact
|
||||||
? _IconActions(controller: _controller)
|
? _IconActions(controller: _controller)
|
||||||
: _ActionBar(
|
: _ActionBar(controller: _controller),
|
||||||
controller: _controller,
|
|
||||||
cupertino: usesCupertinoHost(context),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ActionBar extends StatelessWidget {
|
class _ActionBar extends StatelessWidget {
|
||||||
const _ActionBar({required this.controller, required this.cupertino});
|
const _ActionBar({required this.controller});
|
||||||
|
|
||||||
final ArtifactFileActionsController controller;
|
final ArtifactFileActionsController controller;
|
||||||
final bool cupertino;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -142,14 +137,11 @@ class _ActionBar extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
if (cupertino)
|
const SizedBox(
|
||||||
const CupertinoActivityIndicator(radius: 8)
|
width: 14,
|
||||||
else
|
height: 14,
|
||||||
const SizedBox(
|
child: CircularProgressIndicator(strokeWidth: 2),
|
||||||
width: 14,
|
),
|
||||||
height: 14,
|
|
||||||
child: CircularProgressIndicator(strokeWidth: 2),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Flexible(child: Text(status)),
|
Flexible(child: Text(status)),
|
||||||
],
|
],
|
||||||
@@ -182,9 +174,6 @@ class _ActionBar extends StatelessWidget {
|
|||||||
required IconData icon,
|
required IconData icon,
|
||||||
required VoidCallback? onPressed,
|
required VoidCallback? onPressed,
|
||||||
}) {
|
}) {
|
||||||
if (cupertino) {
|
|
||||||
return CupertinoButton(onPressed: onPressed, child: Text(label));
|
|
||||||
}
|
|
||||||
return TextButton.icon(
|
return TextButton.icon(
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
icon: Icon(icon, size: 18),
|
icon: Icon(icon, size: 18),
|
||||||
@@ -241,28 +230,15 @@ class ArtifactIconAction extends StatelessWidget {
|
|||||||
|
|
||||||
final String label;
|
final String label;
|
||||||
final IconData icon;
|
final IconData icon;
|
||||||
|
|
||||||
|
/// Retained for callers that still pass the Cupertino glyph; the Material
|
||||||
|
/// action always draws [icon].
|
||||||
final IconData cupertinoIcon;
|
final IconData cupertinoIcon;
|
||||||
final VoidCallback? onPressed;
|
final VoidCallback? onPressed;
|
||||||
final bool busy;
|
final bool busy;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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(
|
return IconButton(
|
||||||
tooltip: label,
|
tooltip: label,
|
||||||
constraints: GlassBarMetrics.materialConstraints(),
|
constraints: GlassBarMetrics.materialConstraints(),
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.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
|
/// 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
|
/// 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.
|
/// a few seconds without use, so nothing needs scrolling to reach them.
|
||||||
@@ -55,14 +52,9 @@ class _ArtifactControlsOverlayState extends State<ArtifactControlsOverlay> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
final surface = Theme.of(
|
||||||
final surface = cupertino
|
context,
|
||||||
? CupertinoColors.systemBackground
|
).colorScheme.surfaceContainerHigh.withValues(alpha: 0.94);
|
||||||
.resolveFrom(context)
|
|
||||||
.withValues(alpha: 0.92)
|
|
||||||
: Theme.of(
|
|
||||||
context,
|
|
||||||
).colorScheme.surfaceContainerHigh.withValues(alpha: 0.94);
|
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
// Any touch on the content brings the controls back.
|
// 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 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../domain/artifact_document.dart';
|
import '../domain/artifact_document.dart';
|
||||||
import '../domain/artifact_groups.dart';
|
import '../domain/artifact_groups.dart';
|
||||||
import 'artifact_record_row.dart';
|
import 'artifact_record_row.dart';
|
||||||
@@ -50,23 +47,14 @@ class ArtifactDocumentSection extends StatelessWidget {
|
|||||||
children: rows,
|
children: rows,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Flat rows under a quiet label on both hosts: the section sits inside
|
// Flat rows under a quiet label: the section sits inside the visit's
|
||||||
// the visit's Session page, which is itself flat, so a Cupertino inset
|
// Session page, which is itself flat.
|
||||||
// group here would be a group nested in a group.
|
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
||||||
child: Semantics(
|
child: Semantics(container: true, header: true, child: Text(title)),
|
||||||
container: true,
|
|
||||||
header: true,
|
|
||||||
child: Text(
|
|
||||||
title,
|
|
||||||
style: cupertino ? SectionHeadingStyle.of(context).title : null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
...rows,
|
...rows,
|
||||||
],
|
],
|
||||||
@@ -98,42 +86,15 @@ class _AbsentDocumentRow extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (!usesCupertinoHost(context)) {
|
// The absence line is informational product content, so it keeps the
|
||||||
// The absence line is informational product content, so it keeps the
|
// theme's normal secondary label colour. A disabled tile would paint both
|
||||||
// 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`
|
||||||
// lines at the disabled colour (about 2.7:1 in light mode); no `onTap`
|
// keeps the row non-actionable without dimming it.
|
||||||
// keeps the row non-actionable without dimming it.
|
return ListTile(
|
||||||
return ListTile(
|
title: Text(document.name),
|
||||||
title: Text(document.name),
|
subtitle: Text(
|
||||||
subtitle: Text(
|
document.absence,
|
||||||
document.absence,
|
style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant),
|
||||||
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),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,13 @@ class ArtifactFullscreenScope extends InheritedWidget {
|
|||||||
/// The full-screen view's route, pushed on the root navigator so it covers
|
/// 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 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.
|
/// 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({
|
Route<void> artifactFullscreenRoute({
|
||||||
required bool cupertino,
|
required bool cupertino,
|
||||||
required WidgetBuilder builder,
|
required WidgetBuilder builder,
|
||||||
}) => cupertino
|
}) => MaterialPageRoute<void>(fullscreenDialog: true, builder: builder);
|
||||||
? CupertinoPageRoute<void>(fullscreenDialog: true, builder: builder)
|
|
||||||
: MaterialPageRoute<void>(fullscreenDialog: true, builder: builder);
|
|
||||||
|
|
||||||
/// The zoom factors Zoom in and Zoom out step through.
|
/// The zoom factors Zoom in and Zoom out step through.
|
||||||
const List<double> artifactHtmlZoomSteps = [
|
const List<double> artifactHtmlZoomSteps = [
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import 'artifact_fullscreen.dart';
|
import 'artifact_fullscreen.dart';
|
||||||
|
|
||||||
/// Lets a viewer page open its own content as the full-screen view.
|
/// 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;
|
if (_fullscreen != null) return;
|
||||||
htmlZoom.value = 1;
|
htmlZoom.value = 1;
|
||||||
final route = artifactFullscreenRoute(
|
final route = artifactFullscreenRoute(
|
||||||
cupertino: usesCupertinoHost(context),
|
cupertino: false,
|
||||||
builder: (_) => ArtifactFullscreenScope(
|
builder: (_) => ArtifactFullscreenScope(
|
||||||
htmlZoom: htmlZoom,
|
htmlZoom: htmlZoom,
|
||||||
child: ListenableBuilder(
|
child: ListenableBuilder(
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../core/transport/pipelines_client.dart';
|
import '../../../core/transport/pipelines_client.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import 'artifact_external_open.dart';
|
import 'artifact_external_open.dart';
|
||||||
import 'artifact_gallery_page.dart';
|
import 'artifact_gallery_page.dart';
|
||||||
|
|
||||||
@@ -58,14 +56,6 @@ class RunArtifactsButton extends StatelessWidget {
|
|||||||
executing: _runExecuting(run),
|
executing: _runExecuting(run),
|
||||||
configuredEndpoint: configuredGatewayEndpoint(gateway),
|
configuredEndpoint: configuredGatewayEndpoint(gateway),
|
||||||
);
|
);
|
||||||
if (usesCupertinoHost(context)) {
|
|
||||||
return CupertinoButton.tinted(
|
|
||||||
sizeStyle: CupertinoButtonSize.small,
|
|
||||||
key: runArtifactsButtonKey,
|
|
||||||
onPressed: open,
|
|
||||||
child: const Text(artifactGalleryTitle),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return OutlinedButton.icon(
|
return OutlinedButton.icon(
|
||||||
key: runArtifactsButtonKey,
|
key: runArtifactsButtonKey,
|
||||||
onPressed: open,
|
onPressed: open,
|
||||||
@@ -92,9 +82,7 @@ Future<void> showArtifactGallery(
|
|||||||
configuredEndpoint: configuredEndpoint,
|
configuredEndpoint: configuredEndpoint,
|
||||||
openExternal: openExternal,
|
openExternal: openExternal,
|
||||||
);
|
);
|
||||||
return Navigator.of(context).push<void>(
|
return Navigator.of(
|
||||||
usesCupertinoHost(context)
|
context,
|
||||||
? CupertinoPageRoute<void>(builder: (_) => page)
|
).push<void>(MaterialPageRoute<void>(builder: (_) => page));
|
||||||
: MaterialPageRoute<void>(builder: (_) => page),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import '../../../ui/adaptive/segmented_bar.dart';
|
import '../../../ui/adaptive/segmented_bar.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../chat/ui/transcript/chat_markdown_view.dart';
|
import '../../chat/ui/transcript/chat_markdown_view.dart';
|
||||||
import '../../graph/domain/stage_visits.dart';
|
import '../../graph/domain/stage_visits.dart';
|
||||||
import '../actions/artifact_file_actions.dart';
|
import '../actions/artifact_file_actions.dart';
|
||||||
@@ -289,29 +287,17 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
|||||||
];
|
];
|
||||||
final previousFocus = FocusManager.instance.primaryFocus;
|
final previousFocus = FocusManager.instance.primaryFocus;
|
||||||
await Navigator.of(context).push<void>(
|
await Navigator.of(context).push<void>(
|
||||||
usesCupertinoHost(context)
|
MaterialPageRoute<void>(
|
||||||
? CupertinoPageRoute<void>(
|
builder: (_) => ArtifactViewerPage(
|
||||||
builder: (_) => ArtifactViewerPage(
|
groups: viewerGroups,
|
||||||
groups: viewerGroups,
|
selectedIdentity: identity,
|
||||||
selectedIdentity: identity,
|
configuredEndpoint: widget.configuredEndpoint,
|
||||||
configuredEndpoint: widget.configuredEndpoint,
|
openExternal: widget.openExternal,
|
||||||
openExternal: widget.openExternal,
|
fetch: widget.fetch,
|
||||||
fetch: widget.fetch,
|
markdownBuilder: widget.markdownBuilder,
|
||||||
markdownBuilder: widget.markdownBuilder,
|
fileBridge: widget.fileBridge,
|
||||||
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 (!mounted) return;
|
||||||
if (previousFocus != null && previousFocus.canRequestFocus) {
|
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>(
|
return showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (dialogContext) => AlertDialog(
|
builder: (dialogContext) => AlertDialog(
|
||||||
@@ -509,17 +469,11 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
|||||||
/// one line per recorded fact, never clamped or shortened.
|
/// one line per recorded fact, never clamped or shortened.
|
||||||
Widget _header(BuildContext context, String summary, {Widget? action}) {
|
Widget _header(BuildContext context, String summary, {Widget? action}) {
|
||||||
final notes = _captureNotes();
|
final notes = _captureNotes();
|
||||||
final cupertino = usesCupertinoHost(context);
|
final textStyle =
|
||||||
final textStyle = cupertino
|
Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||||
? CupertinoTheme.of(context).textTheme.textStyle
|
final headingStyle = Theme.of(context).textTheme.titleSmall;
|
||||||
: Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
|
||||||
final headingStyle = cupertino
|
|
||||||
? textStyle.copyWith(fontWeight: FontWeight.w600)
|
|
||||||
: Theme.of(context).textTheme.titleSmall;
|
|
||||||
final noteStyle = textStyle.copyWith(
|
final noteStyle = textStyle.copyWith(
|
||||||
color: cupertino
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
);
|
);
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4),
|
||||||
@@ -557,33 +511,21 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
|||||||
Widget _debugToggle(BuildContext context) {
|
Widget _debugToggle(BuildContext context) {
|
||||||
final showing = _showTurnDocuments;
|
final showing = _showTurnDocuments;
|
||||||
final label = showing ? 'Hide debugging files' : 'Show debugging files';
|
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;
|
final icon = showing ? Icons.bug_report : Icons.bug_report_outlined;
|
||||||
void onPressed() => setState(() => _showTurnDocuments = !showing);
|
void onPressed() => setState(() => _showTurnDocuments = !showing);
|
||||||
final button = usesCupertinoHost(context)
|
final button = IconButton(
|
||||||
? CupertinoButton(
|
key: const Key('artifact-debug-toggle'),
|
||||||
key: const Key('artifact-debug-toggle'),
|
isSelected: showing,
|
||||||
padding: EdgeInsets.zero,
|
tooltip: label,
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
child: Icon(icon),
|
icon: Icon(icon),
|
||||||
)
|
);
|
||||||
: IconButton(
|
return Semantics(
|
||||||
key: const Key('artifact-debug-toggle'),
|
|
||||||
isSelected: showing,
|
|
||||||
tooltip: label,
|
|
||||||
onPressed: onPressed,
|
|
||||||
icon: Icon(icon),
|
|
||||||
);
|
|
||||||
final semanticButton = Semantics(
|
|
||||||
label: label,
|
label: label,
|
||||||
button: true,
|
button: true,
|
||||||
toggled: showing,
|
toggled: showing,
|
||||||
child: button,
|
child: button,
|
||||||
);
|
);
|
||||||
return usesCupertinoHost(context)
|
|
||||||
? Tooltip(message: label, child: semanticButton)
|
|
||||||
: semanticButton;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -617,18 +559,6 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
|||||||
onRevealed: _revealed,
|
onRevealed: _revealed,
|
||||||
);
|
);
|
||||||
if (widget.embedded) return body;
|
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(
|
return Scaffold(
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
appBar: SegmentedBar(
|
appBar: SegmentedBar(
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../domain/artifact_groups.dart';
|
import '../domain/artifact_groups.dart';
|
||||||
import '../domain/artifact_record.dart';
|
import '../domain/artifact_record.dart';
|
||||||
import 'artifact_row_labels.dart';
|
import 'artifact_row_labels.dart';
|
||||||
|
|
||||||
/// One recorded artifact row in a gallery section.
|
/// One recorded artifact row in a gallery section.
|
||||||
///
|
///
|
||||||
/// Material draws a standard [ListTile]; Cupertino draws the same content in a
|
/// Material draws a standard [ListTile]. The row only reports the selection; it
|
||||||
/// grouped-row button. The row only reports the selection; it never resolves a
|
/// never resolves a url, opens a preview, downloads, shares or filters.
|
||||||
/// url, opens a preview, downloads, shares or filters.
|
|
||||||
class ArtifactRecordRow extends StatelessWidget {
|
class ArtifactRecordRow extends StatelessWidget {
|
||||||
const ArtifactRecordRow({
|
const ArtifactRecordRow({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -31,58 +28,13 @@ class ArtifactRecordRow extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (!usesCupertinoHost(context)) {
|
return ListTile(
|
||||||
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,
|
|
||||||
selected: selected,
|
selected: selected,
|
||||||
child: SizedBox(
|
leading: leading,
|
||||||
width: double.infinity,
|
title: Text(artifactDisplayName(artifact)),
|
||||||
// A read-only row is not a button: a disabled CupertinoButton would
|
subtitle: Text(artifactFactsLabel(artifact)),
|
||||||
// still expose a button role to assistive technology.
|
trailing: selected ? const Icon(Icons.check) : null,
|
||||||
child: onSelected == null
|
onTap: onSelected == null ? null : () => onSelected!(group, artifact),
|
||||||
? Padding(
|
|
||||||
padding: kCupertinoButtonPadding[CupertinoButtonSize.large]!,
|
|
||||||
child: content,
|
|
||||||
)
|
|
||||||
: CupertinoButton(
|
|
||||||
alignment: AlignmentDirectional.centerStart,
|
|
||||||
onPressed: () => onSelected!(group, artifact),
|
|
||||||
child: content,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../core/api_gateway.dart';
|
import '../../../core/api_gateway.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../graph/domain/stage_visits.dart';
|
import '../../graph/domain/stage_visits.dart';
|
||||||
import '../domain/artifact_groups.dart';
|
import '../domain/artifact_groups.dart';
|
||||||
import '../domain/artifact_record.dart';
|
import '../domain/artifact_record.dart';
|
||||||
@@ -53,14 +51,10 @@ class ArtifactSelectionFacts extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final recordedStep = step;
|
final recordedStep = step;
|
||||||
final url = resolved;
|
final url = resolved;
|
||||||
final cupertino = usesCupertinoHost(context);
|
final primaryStyle =
|
||||||
final primaryStyle = cupertino
|
Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
||||||
? CupertinoTheme.of(context).textTheme.textStyle
|
|
||||||
: Theme.of(context).textTheme.bodyMedium ?? const TextStyle();
|
|
||||||
final secondaryStyle = primaryStyle.copyWith(
|
final secondaryStyle = primaryStyle.copyWith(
|
||||||
color: cupertino
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
);
|
);
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../domain/artifact_table.dart';
|
import '../domain/artifact_table.dart';
|
||||||
|
|
||||||
/// The truncation note for a capped table preview.
|
/// The truncation note for a capped table preview.
|
||||||
@@ -31,13 +29,8 @@ class ArtifactTableView extends StatelessWidget {
|
|||||||
child: Text('The table is empty.'),
|
child: Text('The table is empty.'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final cupertino = usesCupertinoHost(context);
|
final border = Theme.of(context).dividerColor;
|
||||||
final border = cupertino
|
final header = Theme.of(context).colorScheme.surfaceContainerHighest;
|
||||||
? CupertinoColors.separator.resolveFrom(context)
|
|
||||||
: Theme.of(context).dividerColor;
|
|
||||||
final header = cupertino
|
|
||||||
? CupertinoColors.secondarySystemFill.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.surfaceContainerHighest;
|
|
||||||
final columns = table.columnCount;
|
final columns = table.columnCount;
|
||||||
Widget cell(String value, {bool head = false}) => Padding(
|
Widget cell(String value, {bool head = false}) => Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../domain/artifact_groups.dart';
|
import '../domain/artifact_groups.dart';
|
||||||
import '../domain/artifact_kind.dart';
|
import '../domain/artifact_kind.dart';
|
||||||
import '../domain/artifact_record.dart';
|
import '../domain/artifact_record.dart';
|
||||||
@@ -37,21 +35,12 @@ class ArtifactTile extends StatefulWidget {
|
|||||||
class _ArtifactTileState extends State<ArtifactTile> {
|
class _ArtifactTileState extends State<ArtifactTile> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final artifact = widget.artifact;
|
final artifact = widget.artifact;
|
||||||
final secondary = cupertino
|
final secondary = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
final surface = Theme.of(context).colorScheme.surfaceContainerHighest;
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
|
||||||
final surface = cupertino
|
|
||||||
? CupertinoColors.tertiarySystemFill.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.surfaceContainerHighest;
|
|
||||||
final border = widget.selected
|
final border = widget.selected
|
||||||
? (cupertino
|
? Theme.of(context).colorScheme.primary
|
||||||
? CupertinoTheme.of(context).primaryColor
|
: Theme.of(context).colorScheme.outlineVariant;
|
||||||
: Theme.of(context).colorScheme.primary)
|
|
||||||
: (cupertino
|
|
||||||
? CupertinoColors.separator.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.outlineVariant);
|
|
||||||
final preview = ArtifactThumbnail(
|
final preview = ArtifactThumbnail(
|
||||||
artifact: artifact,
|
artifact: artifact,
|
||||||
configuredEndpoint: widget.configuredEndpoint,
|
configuredEndpoint: widget.configuredEndpoint,
|
||||||
@@ -102,20 +91,14 @@ class _ArtifactTileState extends State<ArtifactTile> {
|
|||||||
label: '$name, $facts',
|
label: '$name, $facts',
|
||||||
excludeSemantics: true,
|
excludeSemantics: true,
|
||||||
onTap: onSelected == null ? null : tap,
|
onTap: onSelected == null ? null : tap,
|
||||||
child: cupertino
|
child: Material(
|
||||||
? GestureDetector(
|
type: MaterialType.transparency,
|
||||||
behavior: HitTestBehavior.opaque,
|
child: InkWell(
|
||||||
onTap: onSelected == null ? null : tap,
|
borderRadius: BorderRadius.circular(12),
|
||||||
child: decorated,
|
onTap: onSelected == null ? null : tap,
|
||||||
)
|
child: decorated,
|
||||||
: 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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final icon = Icon(
|
final icon = Icon(
|
||||||
artifactKindIcon(widget.artifact, cupertino: cupertino),
|
artifactKindIcon(widget.artifact, cupertino: false),
|
||||||
size: widget.iconSize,
|
size: widget.iconSize,
|
||||||
color: cupertino
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
);
|
);
|
||||||
if (_image == null) return Center(child: icon);
|
if (_image == null) return Center(child: icon);
|
||||||
return FutureBuilder<ArtifactFetchResult>(
|
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.
|
/// 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}) {
|
IconData artifactKindIcon(ArtifactRecord artifact, {required bool cupertino}) {
|
||||||
final name = artifact.name.toLowerCase();
|
final name = artifact.name.toLowerCase();
|
||||||
final format = artifactPreviewFormat(artifact.contentType, artifact.name);
|
final format = artifactPreviewFormat(artifact.contentType, artifact.name);
|
||||||
if (name.endsWith('.zip') || name.endsWith('.tar') || name.endsWith('.gz')) {
|
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')) {
|
if (name.endsWith('.pdf')) {
|
||||||
return cupertino ? CupertinoIcons.doc_richtext : Icons.picture_as_pdf;
|
return Icons.picture_as_pdf;
|
||||||
}
|
}
|
||||||
return switch (format) {
|
return switch (format) {
|
||||||
ArtifactPreviewFormat.image =>
|
ArtifactPreviewFormat.image => Icons.image_outlined,
|
||||||
cupertino ? CupertinoIcons.photo : Icons.image_outlined,
|
ArtifactPreviewFormat.video => Icons.movie_outlined,
|
||||||
ArtifactPreviewFormat.video =>
|
ArtifactPreviewFormat.audio => Icons.audio_file_outlined,
|
||||||
cupertino ? CupertinoIcons.film : Icons.movie_outlined,
|
ArtifactPreviewFormat.markdown => Icons.article_outlined,
|
||||||
ArtifactPreviewFormat.audio =>
|
ArtifactPreviewFormat.text => Icons.description_outlined,
|
||||||
cupertino ? CupertinoIcons.music_note : Icons.audio_file_outlined,
|
ArtifactPreviewFormat.table => Icons.table_chart_outlined,
|
||||||
ArtifactPreviewFormat.markdown =>
|
ArtifactPreviewFormat.html => Icons.html,
|
||||||
cupertino ? CupertinoIcons.doc_text : Icons.article_outlined,
|
ArtifactPreviewFormat.none => Icons.insert_drive_file_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,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:video_player/video_player.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.
|
/// Creates the player for one media url; tests inject a fake controller.
|
||||||
typedef ArtifactVideoControllerFactory =
|
typedef ArtifactVideoControllerFactory =
|
||||||
VideoPlayerController Function(Uri uri);
|
VideoPlayerController Function(Uri uri);
|
||||||
@@ -84,7 +81,6 @@ class _ArtifactVideoPlayerState extends State<ArtifactVideoPlayer> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (_failed) return const Center(child: Text(artifactVideoError));
|
if (_failed) return const Center(child: Text(artifactVideoError));
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
return ValueListenableBuilder<VideoPlayerValue>(
|
return ValueListenableBuilder<VideoPlayerValue>(
|
||||||
valueListenable: _controller,
|
valueListenable: _controller,
|
||||||
builder: (context, value, _) {
|
builder: (context, value, _) {
|
||||||
@@ -92,20 +88,12 @@ class _ArtifactVideoPlayerState extends State<ArtifactVideoPlayer> {
|
|||||||
return const Center(child: Text(artifactVideoError));
|
return const Center(child: Text(artifactVideoError));
|
||||||
}
|
}
|
||||||
if (!value.isInitialized) {
|
if (!value.isInitialized) {
|
||||||
return Center(
|
return const Center(child: CircularProgressIndicator());
|
||||||
child: cupertino
|
|
||||||
? const CupertinoActivityIndicator()
|
|
||||||
: const CircularProgressIndicator(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
final label = value.isPlaying
|
final label = value.isPlaying
|
||||||
? (widget.audio ? artifactAudioPauseLabel : artifactVideoPauseLabel)
|
? (widget.audio ? artifactAudioPauseLabel : artifactVideoPauseLabel)
|
||||||
: (widget.audio ? artifactAudioPlayLabel : artifactVideoPlayLabel);
|
: (widget.audio ? artifactAudioPlayLabel : artifactVideoPlayLabel);
|
||||||
final icon = cupertino
|
final icon = value.isPlaying ? Icons.pause : Icons.play_arrow;
|
||||||
? (value.isPlaying
|
|
||||||
? CupertinoIcons.pause_fill
|
|
||||||
: CupertinoIcons.play_fill)
|
|
||||||
: (value.isPlaying ? Icons.pause : Icons.play_arrow);
|
|
||||||
return Column(
|
return Column(
|
||||||
key: Key(widget.audio ? 'artifact-audio' : 'artifact-video'),
|
key: Key(widget.audio ? 'artifact-audio' : 'artifact-video'),
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@@ -126,18 +114,12 @@ class _ArtifactVideoPlayerState extends State<ArtifactVideoPlayer> {
|
|||||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
cupertino
|
IconButton(
|
||||||
? CupertinoButton(
|
key: const Key('artifact-video-toggle'),
|
||||||
key: const Key('artifact-video-toggle'),
|
tooltip: label,
|
||||||
onPressed: _toggle,
|
onPressed: _toggle,
|
||||||
child: Icon(icon, semanticLabel: label),
|
icon: Icon(icon),
|
||||||
)
|
),
|
||||||
: IconButton(
|
|
||||||
key: const Key('artifact-video-toggle'),
|
|
||||||
tooltip: label,
|
|
||||||
onPressed: _toggle,
|
|
||||||
icon: Icon(icon),
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: VideoProgressIndicator(
|
child: VideoProgressIndicator(
|
||||||
_controller,
|
_controller,
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/glass_bar.dart';
|
import '../../../ui/adaptive/glass_bar.dart';
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/navigation/chevron_pager.dart';
|
import '../../../ui/navigation/chevron_pager.dart';
|
||||||
import '../actions/artifact_file_actions.dart';
|
import '../actions/artifact_file_actions.dart';
|
||||||
import '../actions/artifact_file_bridge.dart';
|
import '../actions/artifact_file_bridge.dart';
|
||||||
@@ -60,11 +59,8 @@ class ArtifactViewerBar extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final actions = _actions(resolved, onFullscreen);
|
final actions = _actions(resolved, onFullscreen);
|
||||||
final pagerMin = count > 1
|
final pagerMin = count > 1 ? 2 * GlassBarMetrics.controlExtent(false) : 0.0;
|
||||||
? 2 * GlassBarMetrics.controlExtent(cupertino)
|
|
||||||
: 0.0;
|
|
||||||
final pager = ChevronPager(
|
final pager = ChevronPager(
|
||||||
index: index,
|
index: index,
|
||||||
count: count,
|
count: count,
|
||||||
@@ -87,7 +83,7 @@ class ArtifactViewerBar extends StatelessWidget {
|
|||||||
alignment: AlignmentDirectional.centerStart,
|
alignment: AlignmentDirectional.centerStart,
|
||||||
heightFactor: 1,
|
heightFactor: 1,
|
||||||
child: GlassControlBar(
|
child: GlassControlBar(
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (context, constraints) => Row(
|
builder: (context, constraints) => Row(
|
||||||
key: const Key('artifact-viewer-actions'),
|
key: const Key('artifact-viewer-actions'),
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'dart:typed_data';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||||
import '../actions/artifact_file_actions.dart';
|
import '../actions/artifact_file_actions.dart';
|
||||||
import '../actions/artifact_file_bridge.dart';
|
import '../actions/artifact_file_bridge.dart';
|
||||||
@@ -170,20 +169,6 @@ class ArtifactViewerInfoAction extends StatelessWidget {
|
|||||||
final Widget facts;
|
final Widget facts;
|
||||||
|
|
||||||
void _show(BuildContext context) {
|
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>(
|
showModalBottomSheet<void>(
|
||||||
context: context,
|
context: context,
|
||||||
showDragHandle: true,
|
showDragHandle: true,
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
|
|
||||||
import '../domain/artifact_preview.dart';
|
import '../domain/artifact_preview.dart';
|
||||||
import 'artifact_html_view.dart';
|
import 'artifact_html_view.dart';
|
||||||
import 'artifact_table_view.dart';
|
import 'artifact_table_view.dart';
|
||||||
@@ -219,24 +216,12 @@ class _ZoomableImageState extends State<_ZoomableImage> {
|
|||||||
PositionedDirectional(
|
PositionedDirectional(
|
||||||
top: 8,
|
top: 8,
|
||||||
end: 8,
|
end: 8,
|
||||||
child: usesCupertinoHost(context)
|
child: IconButton(
|
||||||
? Tooltip(
|
key: const Key('artifact-image-reset-zoom'),
|
||||||
message: 'Reset image zoom',
|
tooltip: 'Reset image zoom',
|
||||||
child: CupertinoButton(
|
onPressed: _reset,
|
||||||
key: const Key('artifact-image-reset-zoom'),
|
icon: const Icon(Icons.zoom_out_map),
|
||||||
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),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@@ -272,7 +257,6 @@ class _Message extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final retry = onRetry;
|
final retry = onRetry;
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
return Center(
|
return Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
@@ -282,18 +266,11 @@ class _Message extends StatelessWidget {
|
|||||||
Text(message, textAlign: TextAlign.center),
|
Text(message, textAlign: TextAlign.center),
|
||||||
if (retry != null) ...[
|
if (retry != null) ...[
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
cupertino
|
FilledButton.tonal(
|
||||||
? CupertinoButton.tinted(
|
key: artifactPreviewRetryKey,
|
||||||
key: artifactPreviewRetryKey,
|
onPressed: retry,
|
||||||
sizeStyle: CupertinoButtonSize.small,
|
child: const Text('Retry'),
|
||||||
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 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../../../ui/adaptive/segmented_bar.dart';
|
import '../../../ui/adaptive/segmented_bar.dart';
|
||||||
import '../../../ui/theme/app_theme.dart';
|
|
||||||
|
|
||||||
/// The viewer's page structure on either host: its [SegmentedBar] (the
|
/// The viewer's page structure: its [SegmentedBar] (the platform's Back, or
|
||||||
/// platform's Back, or Close on the full-screen route) over [body].
|
/// Close on the full-screen route) over [body].
|
||||||
class ArtifactViewerScaffold extends StatelessWidget {
|
class ArtifactViewerScaffold extends StatelessWidget {
|
||||||
const ArtifactViewerScaffold({
|
const ArtifactViewerScaffold({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -23,20 +20,12 @@ class ArtifactViewerScaffold extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
|
||||||
final bar = SegmentedBar(
|
final bar = SegmentedBar(
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
title: title,
|
title: title,
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
actions: actions,
|
actions: actions,
|
||||||
);
|
);
|
||||||
if (cupertino) {
|
|
||||||
return CupertinoPageScaffold(
|
|
||||||
backgroundColor: AppColors.groupedBackground,
|
|
||||||
navigationBar: bar,
|
|
||||||
child: body,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body);
|
return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/host.dart';
|
|
||||||
import '../domain/artifact_groups.dart';
|
import '../domain/artifact_groups.dart';
|
||||||
import '../../../ui/layout/section_heading.dart';
|
import '../../../ui/layout/section_heading.dart';
|
||||||
import '../../../ui/layout/sticky_section.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
|
/// artifacts. When [showTurnDocuments] is on, its debugging documents follow
|
||||||
/// those artifacts in the same visit. Every recorded row shows its recorded
|
/// 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
|
/// 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
|
/// stays a non-actionable row with the exact absence wording. Rendering uses
|
||||||
/// own controls: Material list tiles under [MaterialApp] and grouped Cupertino
|
/// the host's own controls: Material list tiles under [MaterialApp]. An
|
||||||
/// list sections under [CupertinoApp]. An optional [header] leads the same
|
/// optional [header] leads the same scroll view. It never resolves a url,
|
||||||
/// scroll view. It never resolves a url, opens a preview, downloads, shares or
|
/// opens a preview, downloads, shares or filters.
|
||||||
/// filters.
|
|
||||||
/// How the gallery lays out each visit's artifacts.
|
/// How the gallery lays out each visit's artifacts.
|
||||||
enum ArtifactGalleryMode { grid, list }
|
enum ArtifactGalleryMode { grid, list }
|
||||||
|
|
||||||
@@ -257,43 +254,24 @@ class _ArtifactVisitListState extends State<ArtifactVisitList> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Widget _modeSwitch(BuildContext context) {
|
Widget _modeSwitch(BuildContext context) {
|
||||||
final cupertino = usesCupertinoHost(context);
|
final control = SegmentedButton<ArtifactGalleryMode>(
|
||||||
final control = cupertino
|
key: const Key('artifact-gallery-mode'),
|
||||||
? CupertinoSlidingSegmentedControl<ArtifactGalleryMode>(
|
showSelectedIcon: false,
|
||||||
key: const Key('artifact-gallery-mode'),
|
segments: const [
|
||||||
groupValue: _mode,
|
ButtonSegment(
|
||||||
onValueChanged: (mode) {
|
value: ArtifactGalleryMode.grid,
|
||||||
if (mode != null) _setMode(mode);
|
icon: Icon(Icons.grid_view),
|
||||||
},
|
tooltip: 'Grid',
|
||||||
children: const {
|
),
|
||||||
ArtifactGalleryMode.grid: Icon(
|
ButtonSegment(
|
||||||
CupertinoIcons.square_grid_2x2,
|
value: ArtifactGalleryMode.list,
|
||||||
semanticLabel: 'Grid',
|
icon: Icon(Icons.view_list),
|
||||||
),
|
tooltip: 'List',
|
||||||
ArtifactGalleryMode.list: Icon(
|
),
|
||||||
CupertinoIcons.list_bullet,
|
],
|
||||||
semanticLabel: 'List',
|
selected: {_mode},
|
||||||
),
|
onSelectionChanged: (mode) => _setMode(mode.single),
|
||||||
},
|
);
|
||||||
)
|
|
||||||
: 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(
|
return Padding(
|
||||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 4),
|
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 4),
|
||||||
child: Align(alignment: AlignmentDirectional.centerEnd, child: control),
|
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
|
/// Rows keep a Material surface for their ink, as the section body's own
|
||||||
/// surface was when it was one box around every row.
|
/// surface was when it was one box around every row.
|
||||||
Widget _inkSurface(BuildContext context, Widget child) =>
|
Widget _inkSurface(BuildContext context, Widget child) =>
|
||||||
usesCupertinoHost(context)
|
Material(type: MaterialType.transparency, child: child);
|
||||||
? child
|
|
||||||
: Material(type: MaterialType.transparency, child: child);
|
|
||||||
|
|
||||||
/// The list view: one row per artifact with a small thumbnail beside it.
|
/// The list view: one row per artifact with a small thumbnail beside it.
|
||||||
Widget _list(ArtifactGroup group) => SliverList.builder(
|
Widget _list(ArtifactGroup group) => SliverList.builder(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
@@ -76,7 +75,6 @@ class _ChatShellCardActionsState extends State<ChatShellCardActions> {
|
|||||||
key: const Key('chat-shell-run-stop'),
|
key: const Key('chat-shell-run-stop'),
|
||||||
label: stopping ? chatShellStoppingLabel : chatShellStopLabel,
|
label: stopping ? chatShellStoppingLabel : chatShellStopLabel,
|
||||||
material: Icons.stop,
|
material: Icons.stop,
|
||||||
cupertino: CupertinoIcons.stop_fill,
|
|
||||||
destructive: true,
|
destructive: true,
|
||||||
onPressed: stopping
|
onPressed: stopping
|
||||||
? null
|
? null
|
||||||
@@ -87,9 +85,6 @@ class _ChatShellCardActionsState extends State<ChatShellCardActions> {
|
|||||||
key: const Key('chat-shell-run-copy'),
|
key: const Key('chat-shell-run-copy'),
|
||||||
label: _copied ? chatShellCopiedLabel : chatShellCopyLabel,
|
label: _copied ? chatShellCopiedLabel : chatShellCopyLabel,
|
||||||
material: _copied ? Icons.check : Icons.copy_outlined,
|
material: _copied ? Icons.check : Icons.copy_outlined,
|
||||||
cupertino: _copied
|
|
||||||
? CupertinoIcons.checkmark
|
|
||||||
: CupertinoIcons.doc_on_doc,
|
|
||||||
onPressed: () => unawaited(_copy()),
|
onPressed: () => unawaited(_copy()),
|
||||||
),
|
),
|
||||||
if (!run.running)
|
if (!run.running)
|
||||||
@@ -103,9 +98,6 @@ class _ChatShellCardActionsState extends State<ChatShellCardActions> {
|
|||||||
material: share == ChatShellShareState.sent
|
material: share == ChatShellShareState.sent
|
||||||
? Icons.check
|
? Icons.check
|
||||||
: Icons.send_outlined,
|
: Icons.send_outlined,
|
||||||
cupertino: share == ChatShellShareState.sent
|
|
||||||
? CupertinoIcons.checkmark
|
|
||||||
: CupertinoIcons.paperplane,
|
|
||||||
onPressed: share == ChatShellShareState.idle
|
onPressed: share == ChatShellShareState.idle
|
||||||
? () => unawaited(controller.share(run.id))
|
? () => unawaited(controller.share(run.id))
|
||||||
: null,
|
: null,
|
||||||
@@ -115,7 +107,6 @@ class _ChatShellCardActionsState extends State<ChatShellCardActions> {
|
|||||||
key: const Key('chat-shell-run-expand'),
|
key: const Key('chat-shell-run-expand'),
|
||||||
label: chatShellFullScreenLabel,
|
label: chatShellFullScreenLabel,
|
||||||
material: Icons.fullscreen,
|
material: Icons.fullscreen,
|
||||||
cupertino: CupertinoIcons.fullscreen,
|
|
||||||
onPressed: widget.onFullScreen,
|
onPressed: widget.onFullScreen,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -126,33 +117,9 @@ class _ChatShellCardActionsState extends State<ChatShellCardActions> {
|
|||||||
required Key key,
|
required Key key,
|
||||||
required String label,
|
required String label,
|
||||||
required IconData material,
|
required IconData material,
|
||||||
required IconData cupertino,
|
|
||||||
required VoidCallback? onPressed,
|
required VoidCallback? onPressed,
|
||||||
bool destructive = false,
|
bool destructive = false,
|
||||||
}) {
|
}) {
|
||||||
if (widget.cupertino) {
|
|
||||||
final color = destructive
|
|
||||||
? CupertinoColors.systemRed.resolveFrom(context)
|
|
||||||
: null;
|
|
||||||
return CupertinoButton(
|
|
||||||
key: key,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
onPressed: onPressed,
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Icon(cupertino, color: onPressed == null ? null : color),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
Text(
|
|
||||||
label,
|
|
||||||
style: onPressed == null || color == null
|
|
||||||
? null
|
|
||||||
: TextStyle(color: color),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final style = destructive
|
final style = destructive
|
||||||
? TextButton.styleFrom(
|
? TextButton.styleFrom(
|
||||||
foregroundColor: Theme.of(context).colorScheme.error,
|
foregroundColor: Theme.of(context).colorScheme.error,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
import '../../../ui/adaptive/segmented_bar_overflow.dart';
|
||||||
@@ -22,24 +21,11 @@ class ChatShellDismissButton extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (!cupertino) {
|
return IconButton(
|
||||||
return IconButton(
|
key: const Key('chat-shell-run-dismiss'),
|
||||||
key: const Key('chat-shell-run-dismiss'),
|
tooltip: chatShellDismissLabel,
|
||||||
tooltip: chatShellDismissLabel,
|
icon: const Icon(Icons.close),
|
||||||
icon: const Icon(Icons.close),
|
onPressed: onPressed,
|
||||||
onPressed: onPressed,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Semantics(
|
|
||||||
label: chatShellDismissLabel,
|
|
||||||
button: true,
|
|
||||||
excludeSemantics: true,
|
|
||||||
child: CupertinoButton(
|
|
||||||
key: const Key('chat-shell-run-dismiss'),
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
onPressed: onPressed,
|
|
||||||
child: const Icon(CupertinoIcons.xmark),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import '../../../shell/windows/window_scope.dart';
|
import '../../../shell/windows/window_scope.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/adaptive/app_popups.dart';
|
import '../../../ui/adaptive/app_popups.dart';
|
||||||
import '../ui/sessions/chat_adaptive.dart';
|
|
||||||
import '../ui/transcript/chat_turn_chip.dart';
|
import '../ui/transcript/chat_turn_chip.dart';
|
||||||
import 'chat_shell_history.dart';
|
import 'chat_shell_history.dart';
|
||||||
import 'chat_shell_history_view.dart';
|
import 'chat_shell_history_view.dart';
|
||||||
@@ -26,20 +24,10 @@ class ChatShellHistoryChip extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino =
|
final color = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||||
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
|
|
||||||
final color = cupertino
|
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
|
||||||
return ChatTurnChip(
|
return ChatTurnChip(
|
||||||
chipKey: const Key('chat-shell-history-chip'),
|
chipKey: const Key('chat-shell-history-chip'),
|
||||||
leading: Icon(
|
leading: Icon(Icons.terminal, size: 14, color: color),
|
||||||
cupertino
|
|
||||||
? CupertinoIcons.chevron_left_slash_chevron_right
|
|
||||||
: Icons.terminal,
|
|
||||||
size: 14,
|
|
||||||
color: color,
|
|
||||||
),
|
|
||||||
label: chatShellHistoryLabel(runIds.length),
|
label: chatShellHistoryLabel(runIds.length),
|
||||||
color: color,
|
color: color,
|
||||||
semanticsLabel: chatShellHistorySemantics(runIds.length),
|
semanticsLabel: chatShellHistorySemantics(runIds.length),
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
@@ -25,11 +24,7 @@ Future<void> openChatShellHistoryOutput(
|
|||||||
runId: runId,
|
runId: runId,
|
||||||
cupertino: cupertino,
|
cupertino: cupertino,
|
||||||
);
|
);
|
||||||
return Navigator.of(context).push<void>(
|
return Navigator.push<void>(context, MaterialPageRoute<void>(builder: page));
|
||||||
cupertino
|
|
||||||
? CupertinoPageRoute<void>(builder: page)
|
|
||||||
: MaterialPageRoute<void>(builder: page),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// One dismissed command: everything the server kept of its output in the
|
/// One dismissed command: everything the server kept of its output in the
|
||||||
@@ -93,7 +88,6 @@ class _ChatShellHistoryOutputPageState
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino = widget.cupertino;
|
|
||||||
final held = widget.controller.dismissedRun(widget.runId);
|
final held = widget.controller.dismissedRun(widget.runId);
|
||||||
final title = Text(
|
final title = Text(
|
||||||
held == null ? 'Command' : '\$ ${held.command}',
|
held == null ? 'Command' : '\$ ${held.command}',
|
||||||
@@ -110,28 +104,18 @@ class _ChatShellHistoryOutputPageState
|
|||||||
if (snapshot.hasError) {
|
if (snapshot.hasError) {
|
||||||
return Text(
|
return Text(
|
||||||
"Couldn't read the output: ${snapshot.error}",
|
"Couldn't read the output: ${snapshot.error}",
|
||||||
style: chatCardSecondaryStyle(context, cupertino),
|
style: chatCardSecondaryStyle(context, false),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final full = snapshot.data;
|
final full = snapshot.data;
|
||||||
if (full == null) {
|
if (full == null) {
|
||||||
return Center(
|
return const Center(child: CircularProgressIndicator());
|
||||||
child: cupertino
|
|
||||||
? const CupertinoActivityIndicator()
|
|
||||||
: const CircularProgressIndicator(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return _content(context, full);
|
return _content(context, full);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (cupertino) {
|
|
||||||
return CupertinoPageScaffold(
|
|
||||||
navigationBar: CupertinoNavigationBar(middle: title),
|
|
||||||
child: body,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: title),
|
appBar: AppBar(title: title),
|
||||||
body: body,
|
body: body,
|
||||||
@@ -139,7 +123,6 @@ class _ChatShellHistoryOutputPageState
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _content(BuildContext context, ChatShellRun full) {
|
Widget _content(BuildContext context, ChatShellRun full) {
|
||||||
final cupertino = widget.cupertino;
|
|
||||||
final session = _session ??= ChatShellTerminalSession(
|
final session = _session ??= ChatShellTerminalSession(
|
||||||
full,
|
full,
|
||||||
onInput: (_) {},
|
onInput: (_) {},
|
||||||
@@ -155,11 +138,11 @@ class _ChatShellHistoryOutputPageState
|
|||||||
runSpacing: 4,
|
runSpacing: 4,
|
||||||
crossAxisAlignment: WrapCrossAlignment.center,
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ChatShellStatus(run: full, cupertino: cupertino),
|
ChatShellStatus(run: full, cupertino: false),
|
||||||
if (full.directory.isNotEmpty)
|
if (full.directory.isNotEmpty)
|
||||||
Text(
|
Text(
|
||||||
full.directory,
|
full.directory,
|
||||||
style: chatCardSecondaryStyle(context, cupertino),
|
style: chatCardSecondaryStyle(context, false),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -169,11 +152,11 @@ class _ChatShellHistoryOutputPageState
|
|||||||
? Text(
|
? Text(
|
||||||
'No output.',
|
'No output.',
|
||||||
key: const Key('chat-shell-output-empty'),
|
key: const Key('chat-shell-output-empty'),
|
||||||
style: chatCardSecondaryStyle(context, cupertino),
|
style: chatCardSecondaryStyle(context, false),
|
||||||
)
|
)
|
||||||
: ChatShellTerminalView(
|
: ChatShellTerminalView(
|
||||||
session: session,
|
session: session,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
fill: true,
|
fill: true,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -203,9 +186,6 @@ class _ChatShellHistoryOutputPageState
|
|||||||
key: const Key('chat-shell-history-copy'),
|
key: const Key('chat-shell-history-copy'),
|
||||||
label: _copied ? chatShellCopiedLabel : chatShellCopyLabel,
|
label: _copied ? chatShellCopiedLabel : chatShellCopyLabel,
|
||||||
material: _copied ? Icons.check : Icons.copy_outlined,
|
material: _copied ? Icons.check : Icons.copy_outlined,
|
||||||
cupertino: _copied
|
|
||||||
? CupertinoIcons.checkmark
|
|
||||||
: CupertinoIcons.doc_on_doc,
|
|
||||||
onPressed: () => unawaited(_copy(full)),
|
onPressed: () => unawaited(_copy(full)),
|
||||||
),
|
),
|
||||||
_button(
|
_button(
|
||||||
@@ -218,9 +198,6 @@ class _ChatShellHistoryOutputPageState
|
|||||||
material: share == ChatShellShareState.sent
|
material: share == ChatShellShareState.sent
|
||||||
? Icons.check
|
? Icons.check
|
||||||
: Icons.send_outlined,
|
: Icons.send_outlined,
|
||||||
cupertino: share == ChatShellShareState.sent
|
|
||||||
? CupertinoIcons.checkmark
|
|
||||||
: CupertinoIcons.paperplane,
|
|
||||||
onPressed: share == ChatShellShareState.idle
|
onPressed: share == ChatShellShareState.idle
|
||||||
? () => unawaited(controller.share(widget.runId))
|
? () => unawaited(controller.share(widget.runId))
|
||||||
: null,
|
: null,
|
||||||
@@ -229,7 +206,6 @@ class _ChatShellHistoryOutputPageState
|
|||||||
key: const Key('chat-shell-history-page-restore'),
|
key: const Key('chat-shell-history-page-restore'),
|
||||||
label: 'Restore',
|
label: 'Restore',
|
||||||
material: Icons.restore,
|
material: Icons.restore,
|
||||||
cupertino: CupertinoIcons.arrow_counterclockwise,
|
|
||||||
onPressed: () => unawaited(_restore()),
|
onPressed: () => unawaited(_restore()),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -241,8 +217,8 @@ class _ChatShellHistoryOutputPageState
|
|||||||
error,
|
error,
|
||||||
style: chatCardSecondaryStyle(
|
style: chatCardSecondaryStyle(
|
||||||
context,
|
context,
|
||||||
widget.cupertino,
|
false,
|
||||||
)?.copyWith(color: chatCardErrorColor(context, widget.cupertino)),
|
)?.copyWith(color: chatCardErrorColor(context, false)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -253,20 +229,8 @@ class _ChatShellHistoryOutputPageState
|
|||||||
required Key key,
|
required Key key,
|
||||||
required String label,
|
required String label,
|
||||||
required IconData material,
|
required IconData material,
|
||||||
required IconData cupertino,
|
|
||||||
required VoidCallback? onPressed,
|
required VoidCallback? onPressed,
|
||||||
}) {
|
}) {
|
||||||
if (widget.cupertino) {
|
|
||||||
return CupertinoButton(
|
|
||||||
key: key,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
onPressed: onPressed,
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [Icon(cupertino), const SizedBox(width: 6), Text(label)],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return TextButton.icon(
|
return TextButton.icon(
|
||||||
key: key,
|
key: key,
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/text/monospace.dart';
|
import '../../../ui/text/monospace.dart';
|
||||||
import '../conversation/chat_card_styles.dart';
|
import '../conversation/chat_card_styles.dart';
|
||||||
import '../ui/sessions/chat_adaptive.dart';
|
|
||||||
import 'chat_shell_history_output_page.dart';
|
import 'chat_shell_history_output_page.dart';
|
||||||
import 'chat_shell_run.dart';
|
import 'chat_shell_run.dart';
|
||||||
import 'chat_shell_runs_controller.dart';
|
import 'chat_shell_runs_controller.dart';
|
||||||
@@ -54,8 +52,6 @@ class _ChatShellHistoryViewState extends State<ChatShellHistoryView> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino =
|
|
||||||
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
|
|
||||||
final list = ListenableBuilder(
|
final list = ListenableBuilder(
|
||||||
listenable: widget.controller.membership,
|
listenable: widget.controller.membership,
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
@@ -80,18 +76,16 @@ class _ChatShellHistoryViewState extends State<ChatShellHistoryView> {
|
|||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Every command here was restored to the transcript.',
|
'Every command here was restored to the transcript.',
|
||||||
style: chatCardSecondaryStyle(context, cupertino),
|
style: chatCardSecondaryStyle(context, false),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
for (final run in runs) _entry(context, run, cupertino),
|
for (final run in runs) _entry(context, run),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
final style = cupertino
|
final style = Theme.of(context).textTheme.bodyMedium;
|
||||||
? CupertinoTheme.of(context).textTheme.textStyle
|
// Entries are Material list tiles inside the surface.
|
||||||
: Theme.of(context).textTheme.bodyMedium;
|
|
||||||
// Entries are Material list tiles inside a Cupertino surface too.
|
|
||||||
final content = Material(
|
final content = Material(
|
||||||
type: MaterialType.transparency,
|
type: MaterialType.transparency,
|
||||||
child: DefaultTextStyle.merge(style: style, child: list),
|
child: DefaultTextStyle.merge(style: style, child: list),
|
||||||
@@ -105,8 +99,8 @@ class _ChatShellHistoryViewState extends State<ChatShellHistoryView> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _entry(BuildContext context, ChatShellRun run, bool cupertino) {
|
Widget _entry(BuildContext context, ChatShellRun run) {
|
||||||
final secondary = chatCardSecondaryStyle(context, cupertino);
|
final secondary = chatCardSecondaryStyle(context, false);
|
||||||
final refusal = _refusals[run.id];
|
final refusal = _refusals[run.id];
|
||||||
final command = run.purged || run.command.isEmpty
|
final command = run.purged || run.command.isEmpty
|
||||||
? Text(chatShellCommandNotKept, style: secondary)
|
? Text(chatShellCommandNotKept, style: secondary)
|
||||||
@@ -124,7 +118,7 @@ class _ChatShellHistoryViewState extends State<ChatShellHistoryView> {
|
|||||||
runSpacing: 4,
|
runSpacing: 4,
|
||||||
crossAxisAlignment: WrapCrossAlignment.center,
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
ChatShellStatus(run: run, cupertino: cupertino),
|
ChatShellStatus(run: run, cupertino: false),
|
||||||
Text(chatShellRunTime(context, run.startedAt), style: secondary),
|
Text(chatShellRunTime(context, run.startedAt), style: secondary),
|
||||||
if (run.purged) Text(chatShellOutputNotKept, style: secondary),
|
if (run.purged) Text(chatShellOutputNotKept, style: secondary),
|
||||||
if (refusal != null)
|
if (refusal != null)
|
||||||
@@ -132,20 +126,13 @@ class _ChatShellHistoryViewState extends State<ChatShellHistoryView> {
|
|||||||
refusal,
|
refusal,
|
||||||
key: const Key('chat-shell-history-refusal'),
|
key: const Key('chat-shell-history-refusal'),
|
||||||
style: secondary?.copyWith(
|
style: secondary?.copyWith(
|
||||||
color: chatCardErrorColor(context, cupertino),
|
color: chatCardErrorColor(context, false),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
final restore = run.purged
|
final restore = run.purged
|
||||||
? null
|
? null
|
||||||
: cupertino
|
|
||||||
? CupertinoButton(
|
|
||||||
key: ValueKey<String>('chat-shell-history-restore-${run.id}'),
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
onPressed: () => unawaited(_restore(run.id)),
|
|
||||||
child: const Text(chatShellRestoreLabel),
|
|
||||||
)
|
|
||||||
: TextButton(
|
: TextButton(
|
||||||
key: ValueKey<String>('chat-shell-history-restore-${run.id}'),
|
key: ValueKey<String>('chat-shell-history-restore-${run.id}'),
|
||||||
onPressed: () => unawaited(_restore(run.id)),
|
onPressed: () => unawaited(_restore(run.id)),
|
||||||
@@ -164,7 +151,7 @@ class _ChatShellHistoryViewState extends State<ChatShellHistoryView> {
|
|||||||
context,
|
context,
|
||||||
controller: widget.controller,
|
controller: widget.controller,
|
||||||
runId: run.id,
|
runId: run.id,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../conversation/chat_card_styles.dart';
|
import '../conversation/chat_card_styles.dart';
|
||||||
@@ -13,10 +12,8 @@ class ChatShellModeIndicator extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final accent = cupertino
|
final accent = Theme.of(context).colorScheme.primary;
|
||||||
? CupertinoTheme.of(context).primaryColor
|
final label = (chatCardBodyStyle(context, false) ?? const TextStyle())
|
||||||
: Theme.of(context).colorScheme.primary;
|
|
||||||
final label = (chatCardBodyStyle(context, cupertino) ?? const TextStyle())
|
|
||||||
.copyWith(color: accent, fontWeight: FontWeight.w600);
|
.copyWith(color: accent, fontWeight: FontWeight.w600);
|
||||||
return Semantics(
|
return Semantics(
|
||||||
key: const Key('chat-composer-shell-mode'),
|
key: const Key('chat-composer-shell-mode'),
|
||||||
@@ -35,9 +32,7 @@ class ChatShellModeIndicator extends StatelessWidget {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Icon(
|
||||||
cupertino
|
Icons.terminal,
|
||||||
? CupertinoIcons.chevron_left_slash_chevron_right
|
|
||||||
: Icons.terminal,
|
|
||||||
color: accent,
|
color: accent,
|
||||||
size: MediaQuery.textScalerOf(
|
size: MediaQuery.textScalerOf(
|
||||||
context,
|
context,
|
||||||
@@ -49,7 +44,7 @@ class ChatShellModeIndicator extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
chatShellModeHint,
|
chatShellModeHint,
|
||||||
style: chatCardSecondaryStyle(context, cupertino),
|
style: chatCardSecondaryStyle(context, false),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class ChatShellOutputView extends StatelessWidget {
|
|||||||
return Text(
|
return Text(
|
||||||
'No output.',
|
'No output.',
|
||||||
key: const Key('chat-shell-output-empty'),
|
key: const Key('chat-shell-output-empty'),
|
||||||
style: chatCardSecondaryStyle(context, cupertino),
|
style: chatCardSecondaryStyle(context, false),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final session = controller.terminals.session(run);
|
final session = controller.terminals.session(run);
|
||||||
@@ -47,7 +47,7 @@ class ChatShellOutputView extends StatelessWidget {
|
|||||||
ChatShellTerminalView(
|
ChatShellTerminalView(
|
||||||
key: viewKey,
|
key: viewKey,
|
||||||
session: session,
|
session: session,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
autoResize: !fullScreen,
|
autoResize: !fullScreen,
|
||||||
),
|
),
|
||||||
if (session.live && !fullScreen)
|
if (session.live && !fullScreen)
|
||||||
@@ -55,7 +55,7 @@ class ChatShellOutputView extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.only(top: 8),
|
padding: const EdgeInsets.only(top: 8),
|
||||||
child: ChatShellTerminalKeys(
|
child: ChatShellTerminalKeys(
|
||||||
session: session,
|
session: session,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
field: chatShellTouchFirst(),
|
field: chatShellTouchFirst(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/text/monospace.dart';
|
import '../../../ui/text/monospace.dart';
|
||||||
import '../../../ui/theme/app_theme.dart';
|
|
||||||
import '../conversation/chat_card_styles.dart';
|
import '../conversation/chat_card_styles.dart';
|
||||||
import '../ui/sessions/chat_adaptive.dart';
|
|
||||||
import 'chat_shell_card_actions.dart';
|
import 'chat_shell_card_actions.dart';
|
||||||
import 'chat_shell_dismiss.dart';
|
import 'chat_shell_dismiss.dart';
|
||||||
import 'chat_shell_output_view.dart';
|
import 'chat_shell_output_view.dart';
|
||||||
@@ -43,13 +40,13 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
|||||||
bool _fullScreen = false;
|
bool _fullScreen = false;
|
||||||
int _viewGeneration = 0;
|
int _viewGeneration = 0;
|
||||||
|
|
||||||
Future<void> _openFullScreen(bool cupertino) async {
|
Future<void> _openFullScreen() async {
|
||||||
setState(() => _fullScreen = true);
|
setState(() => _fullScreen = true);
|
||||||
await openChatShellTerminalPage(
|
await openChatShellTerminalPage(
|
||||||
context,
|
context,
|
||||||
controller: widget.controller,
|
controller: widget.controller,
|
||||||
runId: widget.runId,
|
runId: widget.runId,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
);
|
);
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -60,41 +57,28 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final cupertino =
|
|
||||||
chatControlsStyleOf(context) == ChatControlsStyle.cupertino;
|
|
||||||
return ListenableBuilder(
|
return ListenableBuilder(
|
||||||
listenable: widget.controller,
|
listenable: widget.controller,
|
||||||
builder: (context, _) {
|
builder: (context, _) {
|
||||||
final run = widget.controller.run(widget.runId);
|
final run = widget.controller.run(widget.runId);
|
||||||
if (run == null) return const SizedBox.shrink();
|
if (run == null) return const SizedBox.shrink();
|
||||||
final body = _body(context, run, cupertino);
|
final body = _body(context, run);
|
||||||
return Semantics(
|
return Semantics(
|
||||||
identifier: 'chat-shell-run-card',
|
identifier: 'chat-shell-run-card',
|
||||||
container: true,
|
container: true,
|
||||||
child: cupertino
|
child: Card(
|
||||||
? CupertinoListSection.insetGrouped(
|
margin: const EdgeInsets.only(bottom: 12),
|
||||||
backgroundColor: AppColors.groupedBackground,
|
child: Padding(padding: const EdgeInsets.all(16), child: body),
|
||||||
margin: const EdgeInsets.only(bottom: 12),
|
),
|
||||||
children: [
|
|
||||||
Padding(padding: const EdgeInsets.all(16), child: body),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: Card(
|
|
||||||
margin: const EdgeInsets.only(bottom: 12),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16),
|
|
||||||
child: body,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _body(BuildContext context, ChatShellRun run, bool cupertino) {
|
Widget _body(BuildContext context, ChatShellRun run) {
|
||||||
final controller = widget.controller;
|
final controller = widget.controller;
|
||||||
final error = controller.errorFor(run.id);
|
final error = controller.errorFor(run.id);
|
||||||
final command = (chatCardBodyStyle(context, cupertino) ?? const TextStyle())
|
final command = (chatCardBodyStyle(context, false) ?? const TextStyle())
|
||||||
.copyWith(fontFamily: appMonospaceFamily, fontWeight: FontWeight.w600);
|
.copyWith(fontFamily: appMonospaceFamily, fontWeight: FontWeight.w600);
|
||||||
return Column(
|
return Column(
|
||||||
key: ValueKey<String>('chat-shell-run-${run.id}'),
|
key: ValueKey<String>('chat-shell-run-${run.id}'),
|
||||||
@@ -107,10 +91,8 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsetsDirectional.only(end: 12),
|
padding: const EdgeInsetsDirectional.only(end: 12),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
cupertino
|
Icons.terminal,
|
||||||
? CupertinoIcons.chevron_left_slash_chevron_right
|
color: chatCardSecondaryColor(context, false),
|
||||||
: Icons.terminal,
|
|
||||||
color: chatCardSecondaryColor(context, cupertino),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@@ -125,21 +107,21 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
|||||||
if (run.directory.isNotEmpty)
|
if (run.directory.isNotEmpty)
|
||||||
Text(
|
Text(
|
||||||
run.directory,
|
run.directory,
|
||||||
style: chatCardSecondaryStyle(context, cupertino),
|
style: chatCardSecondaryStyle(context, false),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
ChatShellStatus(run: run, cupertino: cupertino),
|
ChatShellStatus(run: run, cupertino: false),
|
||||||
if (!run.running)
|
if (!run.running)
|
||||||
ChatShellDismissButton(
|
ChatShellDismissButton(
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
onPressed: () => unawaited(
|
onPressed: () => unawaited(
|
||||||
// A refusal brings the card back with the server's reason.
|
// A refusal brings the card back with the server's reason.
|
||||||
dismissChatShellRuns(context, controller, [
|
dismissChatShellRuns(context, controller, [
|
||||||
run.id,
|
run.id,
|
||||||
], cupertino: cupertino),
|
], cupertino: false),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -148,7 +130,7 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
|||||||
ChatShellOutputView(
|
ChatShellOutputView(
|
||||||
run: run,
|
run: run,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
viewKey: ValueKey<int>(_viewGeneration),
|
viewKey: ValueKey<int>(_viewGeneration),
|
||||||
fullScreen: _fullScreen,
|
fullScreen: _fullScreen,
|
||||||
),
|
),
|
||||||
@@ -157,15 +139,15 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
|||||||
padding: const EdgeInsets.only(top: 8),
|
padding: const EdgeInsets.only(top: 8),
|
||||||
child: Text(
|
child: Text(
|
||||||
run.error,
|
run.error,
|
||||||
style: chatCardSecondaryStyle(context, cupertino),
|
style: chatCardSecondaryStyle(context, false),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
ChatShellCardActions(
|
ChatShellCardActions(
|
||||||
run: run,
|
run: run,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
onFullScreen: () => _openFullScreen(cupertino),
|
onFullScreen: () => _openFullScreen(),
|
||||||
),
|
),
|
||||||
if (error != null)
|
if (error != null)
|
||||||
Semantics(
|
Semantics(
|
||||||
@@ -173,9 +155,8 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
|||||||
child: Text(
|
child: Text(
|
||||||
error,
|
error,
|
||||||
key: const Key('chat-shell-run-error'),
|
key: const Key('chat-shell-run-error'),
|
||||||
style:
|
style: (chatCardBodyStyle(context, false) ?? const TextStyle())
|
||||||
(chatCardBodyStyle(context, cupertino) ?? const TextStyle())
|
.copyWith(color: chatCardErrorColor(context, false)),
|
||||||
.copyWith(color: chatCardErrorColor(context, cupertino)),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/text/monospace.dart';
|
import '../../../ui/text/monospace.dart';
|
||||||
@@ -9,16 +8,10 @@ import 'chat_shell_command.dart';
|
|||||||
Future<String?> showChatShellRunDialog(
|
Future<String?> showChatShellRunDialog(
|
||||||
BuildContext context, {
|
BuildContext context, {
|
||||||
required bool cupertino,
|
required bool cupertino,
|
||||||
}) => cupertino
|
}) => showDialog<String>(
|
||||||
? showCupertinoDialog<String>(
|
context: context,
|
||||||
context: context,
|
builder: (_) => const ChatShellRunDialog(cupertino: false),
|
||||||
barrierDismissible: true,
|
);
|
||||||
builder: (_) => const ChatShellRunDialog(cupertino: true),
|
|
||||||
)
|
|
||||||
: showDialog<String>(
|
|
||||||
context: context,
|
|
||||||
builder: (_) => const ChatShellRunDialog(cupertino: false),
|
|
||||||
);
|
|
||||||
|
|
||||||
class ChatShellRunDialog extends StatefulWidget {
|
class ChatShellRunDialog extends StatefulWidget {
|
||||||
const ChatShellRunDialog({super.key, required this.cupertino});
|
const ChatShellRunDialog({super.key, required this.cupertino});
|
||||||
@@ -48,37 +41,6 @@ class _ChatShellRunDialogState extends State<ChatShellRunDialog> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
const mono = TextStyle(fontFamily: appMonospaceFamily);
|
const mono = TextStyle(fontFamily: appMonospaceFamily);
|
||||||
if (widget.cupertino) {
|
|
||||||
return CupertinoAlertDialog(
|
|
||||||
title: const Text(chatShellRunDialogTitle),
|
|
||||||
content: Column(
|
|
||||||
children: [
|
|
||||||
const Text(chatShellModeHint),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
CupertinoTextField(
|
|
||||||
key: const Key('chat-shell-run-field'),
|
|
||||||
controller: _text,
|
|
||||||
autofocus: true,
|
|
||||||
placeholder: 'Command',
|
|
||||||
style: mono,
|
|
||||||
onSubmitted: (_) => _submit(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
CupertinoDialogAction(
|
|
||||||
onPressed: _cancel,
|
|
||||||
child: const Text('Cancel'),
|
|
||||||
),
|
|
||||||
CupertinoDialogAction(
|
|
||||||
key: const Key('chat-shell-run-confirm'),
|
|
||||||
isDefaultAction: true,
|
|
||||||
onPressed: _submit,
|
|
||||||
child: const Text(chatShellRunDialogConfirm),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text(chatShellRunDialogTitle),
|
title: const Text(chatShellRunDialogTitle),
|
||||||
content: Column(
|
content: Column(
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../conversation/chat_card_styles.dart';
|
import '../conversation/chat_card_styles.dart';
|
||||||
@@ -24,46 +23,26 @@ class ChatShellStatus extends StatelessWidget {
|
|||||||
return Semantics(
|
return Semantics(
|
||||||
key: const Key('chat-shell-run-running'),
|
key: const Key('chat-shell-run-running'),
|
||||||
label: chatShellStatusLabel(run),
|
label: chatShellStatusLabel(run),
|
||||||
child: cupertino
|
// As tall as the line of text beside it, at any text scale.
|
||||||
? const CupertinoActivityIndicator()
|
child: SizedBox.square(
|
||||||
// As tall as the line of text beside it, at any text scale.
|
dimension: MediaQuery.textScalerOf(context).scale(20),
|
||||||
: SizedBox.square(
|
child: const CircularProgressIndicator(strokeWidth: 2),
|
||||||
dimension: MediaQuery.textScalerOf(context).scale(20),
|
),
|
||||||
child: const CircularProgressIndicator(strokeWidth: 2),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
final label = run.durationMs > 0
|
final label = run.durationMs > 0
|
||||||
? '${chatShellStatusLabel(run)} · ${chatShellDuration(run.durationMs)}'
|
? '${chatShellStatusLabel(run)} · ${chatShellDuration(run.durationMs)}'
|
||||||
: chatShellStatusLabel(run);
|
: chatShellStatusLabel(run);
|
||||||
final color = switch (run.state) {
|
final color = switch (run.state) {
|
||||||
ChatShellRunState.succeeded =>
|
ChatShellRunState.succeeded => Theme.of(context).colorScheme.primary,
|
||||||
cupertino
|
ChatShellRunState.failed => chatCardErrorColor(context, false),
|
||||||
? CupertinoColors.systemGreen.resolveFrom(context)
|
_ => chatCardSecondaryColor(context, false),
|
||||||
: Theme.of(context).colorScheme.primary,
|
|
||||||
ChatShellRunState.failed => chatCardErrorColor(context, cupertino),
|
|
||||||
_ => chatCardSecondaryColor(context, cupertino),
|
|
||||||
};
|
};
|
||||||
final icon = switch (run.state) {
|
final icon = switch (run.state) {
|
||||||
ChatShellRunState.succeeded =>
|
ChatShellRunState.succeeded => Icons.check_circle_outline,
|
||||||
cupertino
|
ChatShellRunState.failed => Icons.error_outline,
|
||||||
? CupertinoIcons.checkmark_circle
|
_ => Icons.stop_circle_outlined,
|
||||||
: Icons.check_circle_outline,
|
|
||||||
ChatShellRunState.failed =>
|
|
||||||
cupertino ? CupertinoIcons.xmark_circle : Icons.error_outline,
|
|
||||||
_ => cupertino ? CupertinoIcons.stop_circle : Icons.stop_circle_outlined,
|
|
||||||
};
|
};
|
||||||
if (cupertino) {
|
|
||||||
return Row(
|
|
||||||
key: const Key('chat-shell-run-status'),
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Icon(icon, color: color, size: 18),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Text(label, style: chatCardSecondaryStyle(context, true)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Chip(
|
return Chip(
|
||||||
key: const Key('chat-shell-run-status'),
|
key: const Key('chat-shell-run-status'),
|
||||||
avatar: Icon(icon, color: color),
|
avatar: Icon(icon, color: color),
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:xterm/core.dart';
|
import 'package:xterm/core.dart';
|
||||||
|
|
||||||
import 'chat_shell_terminal_session.dart';
|
import 'chat_shell_terminal_session.dart';
|
||||||
|
|
||||||
/// One key of the terminal toolbar: its label, icons and what it sends.
|
/// One key of the terminal toolbar: its label, icon and what it sends.
|
||||||
typedef _Key = ({
|
typedef _Key = ({
|
||||||
String id,
|
String id,
|
||||||
String label,
|
String label,
|
||||||
IconData? material,
|
IconData? material,
|
||||||
IconData? cupertino,
|
|
||||||
void Function(Terminal terminal) send,
|
void Function(Terminal terminal) send,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -19,56 +17,48 @@ final List<_Key> _keys = [
|
|||||||
id: 'enter',
|
id: 'enter',
|
||||||
label: 'Enter',
|
label: 'Enter',
|
||||||
material: Icons.keyboard_return,
|
material: Icons.keyboard_return,
|
||||||
cupertino: CupertinoIcons.return_icon,
|
|
||||||
send: (t) => t.keyInput(TerminalKey.enter),
|
send: (t) => t.keyInput(TerminalKey.enter),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
id: 'ctrl-c',
|
id: 'ctrl-c',
|
||||||
label: 'Ctrl-C',
|
label: 'Ctrl-C',
|
||||||
material: null,
|
material: null,
|
||||||
cupertino: null,
|
|
||||||
send: (t) => t.textInput('\x03'),
|
send: (t) => t.textInput('\x03'),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
id: 'tab',
|
id: 'tab',
|
||||||
label: 'Tab',
|
label: 'Tab',
|
||||||
material: Icons.keyboard_tab,
|
material: Icons.keyboard_tab,
|
||||||
cupertino: CupertinoIcons.arrow_right_to_line,
|
|
||||||
send: (t) => t.keyInput(TerminalKey.tab),
|
send: (t) => t.keyInput(TerminalKey.tab),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
id: 'esc',
|
id: 'esc',
|
||||||
label: 'Esc',
|
label: 'Esc',
|
||||||
material: null,
|
material: null,
|
||||||
cupertino: null,
|
|
||||||
send: (t) => t.keyInput(TerminalKey.escape),
|
send: (t) => t.keyInput(TerminalKey.escape),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
id: 'left',
|
id: 'left',
|
||||||
label: 'Left',
|
label: 'Left',
|
||||||
material: Icons.keyboard_arrow_left,
|
material: Icons.keyboard_arrow_left,
|
||||||
cupertino: CupertinoIcons.arrow_left,
|
|
||||||
send: (t) => t.keyInput(TerminalKey.arrowLeft),
|
send: (t) => t.keyInput(TerminalKey.arrowLeft),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
id: 'up',
|
id: 'up',
|
||||||
label: 'Up',
|
label: 'Up',
|
||||||
material: Icons.keyboard_arrow_up,
|
material: Icons.keyboard_arrow_up,
|
||||||
cupertino: CupertinoIcons.arrow_up,
|
|
||||||
send: (t) => t.keyInput(TerminalKey.arrowUp),
|
send: (t) => t.keyInput(TerminalKey.arrowUp),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
id: 'down',
|
id: 'down',
|
||||||
label: 'Down',
|
label: 'Down',
|
||||||
material: Icons.keyboard_arrow_down,
|
material: Icons.keyboard_arrow_down,
|
||||||
cupertino: CupertinoIcons.arrow_down,
|
|
||||||
send: (t) => t.keyInput(TerminalKey.arrowDown),
|
send: (t) => t.keyInput(TerminalKey.arrowDown),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
id: 'right',
|
id: 'right',
|
||||||
label: 'Right',
|
label: 'Right',
|
||||||
material: Icons.keyboard_arrow_right,
|
material: Icons.keyboard_arrow_right,
|
||||||
cupertino: CupertinoIcons.arrow_right,
|
|
||||||
send: (t) => t.keyInput(TerminalKey.arrowRight),
|
send: (t) => t.keyInput(TerminalKey.arrowRight),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
@@ -127,21 +117,9 @@ class _ChatShellTerminalKeysState extends State<ChatShellTerminalKeys> {
|
|||||||
spacing: 4,
|
spacing: 4,
|
||||||
runSpacing: 4,
|
runSpacing: 4,
|
||||||
children: [
|
children: [
|
||||||
_button(
|
_button('paste', 'Paste', Icons.content_paste, _paste),
|
||||||
'paste',
|
|
||||||
'Paste',
|
|
||||||
Icons.content_paste,
|
|
||||||
CupertinoIcons.doc_on_clipboard,
|
|
||||||
_paste,
|
|
||||||
),
|
|
||||||
for (final key in _keys)
|
for (final key in _keys)
|
||||||
_button(
|
_button(key.id, key.label, key.material, () => key.send(_terminal)),
|
||||||
key.id,
|
|
||||||
key.label,
|
|
||||||
key.material,
|
|
||||||
key.cupertino,
|
|
||||||
() => key.send(_terminal),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
if (!widget.field) return keys;
|
if (!widget.field) return keys;
|
||||||
@@ -157,27 +135,6 @@ class _ChatShellTerminalKeysState extends State<ChatShellTerminalKeys> {
|
|||||||
|
|
||||||
Widget _field() {
|
Widget _field() {
|
||||||
final toggle = _hidden ? 'Show typing' : 'Hide typing';
|
final toggle = _hidden ? 'Show typing' : 'Hide typing';
|
||||||
if (widget.cupertino) {
|
|
||||||
return CupertinoTextField(
|
|
||||||
key: const Key('chat-shell-terminal-field'),
|
|
||||||
controller: _text,
|
|
||||||
placeholder: 'Type input, then Enter',
|
|
||||||
obscureText: _hidden,
|
|
||||||
autocorrect: false,
|
|
||||||
enableSuggestions: false,
|
|
||||||
textInputAction: TextInputAction.send,
|
|
||||||
onSubmitted: (_) => _submit(),
|
|
||||||
suffix: CupertinoButton(
|
|
||||||
key: const Key('chat-shell-terminal-hide'),
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
onPressed: () => setState(() => _hidden = !_hidden),
|
|
||||||
child: Icon(
|
|
||||||
_hidden ? CupertinoIcons.eye : CupertinoIcons.eye_slash,
|
|
||||||
semanticLabel: toggle,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return TextField(
|
return TextField(
|
||||||
key: const Key('chat-shell-terminal-field'),
|
key: const Key('chat-shell-terminal-field'),
|
||||||
controller: _text,
|
controller: _text,
|
||||||
@@ -202,20 +159,9 @@ class _ChatShellTerminalKeysState extends State<ChatShellTerminalKeys> {
|
|||||||
String id,
|
String id,
|
||||||
String label,
|
String label,
|
||||||
IconData? material,
|
IconData? material,
|
||||||
IconData? cupertino,
|
|
||||||
VoidCallback onPressed,
|
VoidCallback onPressed,
|
||||||
) {
|
) {
|
||||||
final key = Key('chat-shell-key-$id');
|
final key = Key('chat-shell-key-$id');
|
||||||
if (widget.cupertino) {
|
|
||||||
return CupertinoButton(
|
|
||||||
key: key,
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
onPressed: onPressed,
|
|
||||||
child: cupertino == null
|
|
||||||
? Text(label)
|
|
||||||
: Icon(cupertino, semanticLabel: label),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
return OutlinedButton(
|
return OutlinedButton(
|
||||||
key: key,
|
key: key,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../../../ui/text/monospace.dart';
|
import '../../../ui/text/monospace.dart';
|
||||||
@@ -20,11 +19,7 @@ Future<void> openChatShellTerminalPage(
|
|||||||
runId: runId,
|
runId: runId,
|
||||||
cupertino: cupertino,
|
cupertino: cupertino,
|
||||||
);
|
);
|
||||||
return Navigator.of(context).push<void>(
|
return Navigator.push<void>(context, MaterialPageRoute<void>(builder: page));
|
||||||
cupertino
|
|
||||||
? CupertinoPageRoute<void>(builder: page)
|
|
||||||
: MaterialPageRoute<void>(builder: page),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class ChatShellTerminalPage extends StatelessWidget {
|
class ChatShellTerminalPage extends StatelessWidget {
|
||||||
@@ -63,7 +58,7 @@ class ChatShellTerminalPage extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: ChatShellTerminalView(
|
child: ChatShellTerminalView(
|
||||||
session: session,
|
session: session,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
fill: true,
|
fill: true,
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
),
|
),
|
||||||
@@ -73,7 +68,7 @@ class ChatShellTerminalPage extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.only(top: 8),
|
padding: const EdgeInsets.only(top: 8),
|
||||||
child: ChatShellTerminalKeys(
|
child: ChatShellTerminalKeys(
|
||||||
session: session,
|
session: session,
|
||||||
cupertino: cupertino,
|
cupertino: false,
|
||||||
field: chatShellTouchFirst(),
|
field: chatShellTouchFirst(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -82,12 +77,6 @@ class ChatShellTerminalPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (cupertino) {
|
|
||||||
return CupertinoPageScaffold(
|
|
||||||
navigationBar: CupertinoNavigationBar(middle: title),
|
|
||||||
child: body,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: title),
|
appBar: AppBar(title: title),
|
||||||
body: body,
|
body: body,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:xterm/xterm.dart';
|
import 'package:xterm/xterm.dart';
|
||||||
|
|
||||||
@@ -12,17 +11,10 @@ import '../conversation/chat_card_styles.dart';
|
|||||||
/// selection. The sixteen ANSI colours are the emulator's standard palette,
|
/// selection. The sixteen ANSI colours are the emulator's standard palette,
|
||||||
/// darkened on a light surface so coloured output stays readable.
|
/// darkened on a light surface so coloured output stays readable.
|
||||||
TerminalTheme chatShellTerminalTheme(BuildContext context, bool cupertino) {
|
TerminalTheme chatShellTerminalTheme(BuildContext context, bool cupertino) {
|
||||||
final brightness = cupertino
|
final dark = Theme.of(context).brightness == Brightness.dark;
|
||||||
? CupertinoTheme.brightnessOf(context)
|
final background = chatCardFillColor(context, false);
|
||||||
: Theme.of(context).brightness;
|
final foreground = Theme.of(context).colorScheme.onSurface;
|
||||||
final dark = brightness == Brightness.dark;
|
final accent = Theme.of(context).colorScheme.primary;
|
||||||
final background = chatCardFillColor(context, cupertino);
|
|
||||||
final foreground = cupertino
|
|
||||||
? CupertinoColors.label.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.onSurface;
|
|
||||||
final accent = cupertino
|
|
||||||
? CupertinoTheme.of(context).primaryColor
|
|
||||||
: Theme.of(context).colorScheme.primary;
|
|
||||||
final base = TerminalThemes.defaultTheme;
|
final base = TerminalThemes.defaultTheme;
|
||||||
Color ansi(Color color) {
|
Color ansi(Color color) {
|
||||||
if (dark) return color;
|
if (dark) return color;
|
||||||
@@ -37,9 +29,7 @@ TerminalTheme chatShellTerminalTheme(BuildContext context, bool cupertino) {
|
|||||||
// Opaque: the emulator paints cells over its own background.
|
// Opaque: the emulator paints cells over its own background.
|
||||||
background: Color.alphaBlend(
|
background: Color.alphaBlend(
|
||||||
background,
|
background,
|
||||||
cupertino
|
Theme.of(context).colorScheme.surface,
|
||||||
? CupertinoColors.systemBackground.resolveFrom(context)
|
|
||||||
: Theme.of(context).colorScheme.surface,
|
|
||||||
),
|
),
|
||||||
black: dark ? base.black : foreground,
|
black: dark ? base.black : foreground,
|
||||||
red: ansi(base.red),
|
red: ansi(base.red),
|
||||||
@@ -65,7 +55,7 @@ TerminalTheme chatShellTerminalTheme(BuildContext context, bool cupertino) {
|
|||||||
|
|
||||||
/// The terminal's text: the host's monospace family at the card body size.
|
/// The terminal's text: the host's monospace family at the card body size.
|
||||||
TerminalStyle chatShellTerminalStyle(BuildContext context, bool cupertino) {
|
TerminalStyle chatShellTerminalStyle(BuildContext context, bool cupertino) {
|
||||||
final body = chatCardBodyStyle(context, cupertino) ?? const TextStyle();
|
final body = chatCardBodyStyle(context, false) ?? const TextStyle();
|
||||||
return TerminalStyle(
|
return TerminalStyle(
|
||||||
fontFamily: appMonospaceFamily,
|
fontFamily: appMonospaceFamily,
|
||||||
fontSize: (body.fontSize ?? 14) * 0.95,
|
fontSize: (body.fontSize ?? 14) * 0.95,
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class _ChatShellTerminalViewState extends State<ChatShellTerminalView> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final session = widget.session;
|
final session = widget.session;
|
||||||
final live = session.live;
|
final live = session.live;
|
||||||
final style = chatShellTerminalStyle(context, widget.cupertino);
|
final style = chatShellTerminalStyle(context, false);
|
||||||
const padding = EdgeInsets.all(8);
|
const padding = EdgeInsets.all(8);
|
||||||
Widget view = Semantics(
|
Widget view = Semantics(
|
||||||
identifier: 'chat-shell-terminal',
|
identifier: 'chat-shell-terminal',
|
||||||
@@ -168,7 +168,7 @@ class _ChatShellTerminalViewState extends State<ChatShellTerminalView> {
|
|||||||
focusNode: _focus,
|
focusNode: _focus,
|
||||||
autofocus: widget.autofocus && live,
|
autofocus: widget.autofocus && live,
|
||||||
autoResize: widget.autoResize,
|
autoResize: widget.autoResize,
|
||||||
theme: chatShellTerminalTheme(context, widget.cupertino),
|
theme: chatShellTerminalTheme(context, false),
|
||||||
textStyle: style,
|
textStyle: style,
|
||||||
padding: padding,
|
padding: padding,
|
||||||
readOnly: !live,
|
readOnly: !live,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/core/api_gateway.dart';
|
import 'package:pipelines_app/core/api_gateway.dart';
|
||||||
@@ -59,7 +58,6 @@ Future<ArtifactFetchResult> _fetch(Uri uri) async =>
|
|||||||
ArtifactFetchResult(status: 200, bytes: _bytes);
|
ArtifactFetchResult(status: 200, bytes: _bytes);
|
||||||
|
|
||||||
Widget _row({
|
Widget _row({
|
||||||
required bool cupertino,
|
|
||||||
ArtifactFileBridge? bridge,
|
ArtifactFileBridge? bridge,
|
||||||
ArtifactRecord? artifact,
|
ArtifactRecord? artifact,
|
||||||
ArtifactFetch? fetch,
|
ArtifactFetch? fetch,
|
||||||
@@ -70,19 +68,11 @@ Widget _row({
|
|||||||
fetch: fetch ?? _fetch,
|
fetch: fetch ?? _fetch,
|
||||||
bridge: bridge ?? _bridge(),
|
bridge: bridge ?? _bridge(),
|
||||||
);
|
);
|
||||||
return cupertino
|
return MaterialApp(
|
||||||
? CupertinoApp(
|
home: Scaffold(
|
||||||
home: CupertinoPageScaffold(
|
body: Padding(padding: const EdgeInsets.all(8), child: actions),
|
||||||
child: SafeArea(
|
),
|
||||||
child: Padding(padding: const EdgeInsets.all(8), child: actions),
|
);
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: MaterialApp(
|
|
||||||
home: Scaffold(
|
|
||||||
body: Padding(padding: const EdgeInsets.all(8), child: actions),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextButton _materialButton(WidgetTester tester, String label) =>
|
TextButton _materialButton(WidgetTester tester, String label) =>
|
||||||
@@ -92,24 +82,12 @@ TextButton _materialButton(WidgetTester tester, String label) =>
|
|||||||
.first,
|
.first,
|
||||||
);
|
);
|
||||||
|
|
||||||
CupertinoButton _cupertinoButton(WidgetTester tester, String label) =>
|
|
||||||
tester.widget<CupertinoButton>(
|
|
||||||
find
|
|
||||||
.ancestor(
|
|
||||||
of: find.text(label),
|
|
||||||
matching: find.byType(CupertinoButton),
|
|
||||||
)
|
|
||||||
.first,
|
|
||||||
);
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Download saves the exact named bytes and reports it', (
|
testWidgets('Download saves the exact named bytes and reports it', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
final saved = <ArtifactFile>[];
|
final saved = <ArtifactFile>[];
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(_row(bridge: _bridge(saved: saved)));
|
||||||
_row(cupertino: false, bridge: _bridge(saved: saved)),
|
|
||||||
);
|
|
||||||
|
|
||||||
await tester.tap(find.text('Download'));
|
await tester.tap(find.text('Download'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@@ -123,9 +101,7 @@ void main() {
|
|||||||
|
|
||||||
testWidgets('Share starts one file transfer, not a link', (tester) async {
|
testWidgets('Share starts one file transfer, not a link', (tester) async {
|
||||||
final shared = <ArtifactFile>[];
|
final shared = <ArtifactFile>[];
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(_row(bridge: _bridge(shared: shared)));
|
||||||
_row(cupertino: false, bridge: _bridge(shared: shared)),
|
|
||||||
);
|
|
||||||
|
|
||||||
await tester.tap(find.text('Share'));
|
await tester.tap(find.text('Share'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@@ -140,10 +116,7 @@ void main() {
|
|||||||
) async {
|
) async {
|
||||||
final saved = <ArtifactFile>[];
|
final saved = <ArtifactFile>[];
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
_row(
|
_row(bridge: _bridge(saved: saved, shareSupported: false)),
|
||||||
cupertino: false,
|
|
||||||
bridge: _bridge(saved: saved, shareSupported: false),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(find.text('No share on this host.'), findsOneWidget);
|
expect(find.text('No share on this host.'), findsOneWidget);
|
||||||
@@ -160,7 +133,6 @@ void main() {
|
|||||||
) async {
|
) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
_row(
|
_row(
|
||||||
cupertino: false,
|
|
||||||
bridge: _bridge(),
|
bridge: _bridge(),
|
||||||
fetch: (_) => Future<ArtifactFetchResult>.delayed(
|
fetch: (_) => Future<ArtifactFetchResult>.delayed(
|
||||||
const Duration(seconds: 30),
|
const Duration(seconds: 30),
|
||||||
@@ -183,9 +155,7 @@ void main() {
|
|||||||
await tester.pump(const Duration(seconds: 31));
|
await tester.pump(const Duration(seconds: 31));
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('both hosts keep the file actions whole at 320/2x dark', (
|
testWidgets('the file actions stay whole at 320/2x dark', (tester) async {
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
tester.view.physicalSize = const Size(640, 1200);
|
tester.view.physicalSize = const Size(640, 1200);
|
||||||
tester.view.devicePixelRatio = 2;
|
tester.view.devicePixelRatio = 2;
|
||||||
tester.platformDispatcher.textScaleFactorTestValue = 2;
|
tester.platformDispatcher.textScaleFactorTestValue = 2;
|
||||||
@@ -195,20 +165,12 @@ void main() {
|
|||||||
addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
|
addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
|
||||||
addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue);
|
addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue);
|
||||||
|
|
||||||
for (final cupertino in <bool>[false, true]) {
|
await tester.pumpWidget(_row());
|
||||||
await tester.pumpWidget(_row(cupertino: cupertino));
|
await tester.pumpAndSettle();
|
||||||
await tester.pumpAndSettle();
|
expect(tester.takeException(), isNull);
|
||||||
expect(tester.takeException(), isNull);
|
expect(find.text('Download'), findsOneWidget);
|
||||||
expect(find.text('Download'), findsOneWidget);
|
expect(find.text('Share'), findsOneWidget);
|
||||||
expect(find.text('Share'), findsOneWidget);
|
expect(_materialButton(tester, 'Download').onPressed, isNotNull);
|
||||||
if (cupertino) {
|
|
||||||
expect(_cupertinoButton(tester, 'Download').onPressed, isNotNull);
|
|
||||||
expect(find.byType(TextButton), findsNothing);
|
|
||||||
} else {
|
|
||||||
expect(_materialButton(tester, 'Download').onPressed, isNotNull);
|
|
||||||
expect(find.byType(CupertinoButton), findsNothing);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('the gallery selection offers both file actions in its dialog', (
|
testWidgets('the gallery selection offers both file actions in its dialog', (
|
||||||
@@ -315,44 +277,27 @@ void main() {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
for (final cupertino in <bool>[false, true]) {
|
await tester.pumpWidget(
|
||||||
await tester.pumpWidget(
|
MaterialApp(
|
||||||
cupertino
|
theme: ThemeData(brightness: Brightness.dark),
|
||||||
? CupertinoApp(
|
home: ArtifactGalleryPage(
|
||||||
theme: const CupertinoThemeData(brightness: Brightness.dark),
|
steps: steps,
|
||||||
home: ArtifactGalleryPage(
|
configuredEndpoint: _endpoint,
|
||||||
steps: steps,
|
fetch: _fetch,
|
||||||
configuredEndpoint: _endpoint,
|
fileBridge: _bridge(),
|
||||||
fetch: _fetch,
|
),
|
||||||
fileBridge: _bridge(),
|
),
|
||||||
),
|
);
|
||||||
)
|
await tester.pumpAndSettle();
|
||||||
: MaterialApp(
|
await tester.tap(find.text('report.zip'));
|
||||||
theme: ThemeData(brightness: Brightness.dark),
|
await tester.pumpAndSettle();
|
||||||
home: ArtifactGalleryPage(
|
|
||||||
steps: steps,
|
|
||||||
configuredEndpoint: _endpoint,
|
|
||||||
fetch: _fetch,
|
|
||||||
fileBridge: _bridge(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
await tester.tap(find.text('report.zip'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
expect(tester.takeException(), isNull);
|
expect(tester.takeException(), isNull);
|
||||||
expect(find.text('Download'), findsOneWidget);
|
expect(find.text('Download'), findsOneWidget);
|
||||||
expect(find.text('Share'), findsOneWidget);
|
expect(find.text('Share'), findsOneWidget);
|
||||||
expect(
|
expect(find.byType(AlertDialog), findsOneWidget);
|
||||||
cupertino
|
await tester.tap(find.text('Close'));
|
||||||
? find.byType(CupertinoAlertDialog)
|
await tester.pumpAndSettle();
|
||||||
: find.byType(AlertDialog),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
await tester.tap(find.text('Close'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets(
|
testWidgets(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
@@ -33,9 +32,8 @@ final ArtifactGroup _group = visitGroup(artifacts: [_report, _log]);
|
|||||||
typedef _Rendered = List<(String, bool)>;
|
typedef _Rendered = List<(String, bool)>;
|
||||||
|
|
||||||
Future<({_Rendered rendered, List<Uri> opened})> _pump(
|
Future<({_Rendered rendered, List<Uri> opened})> _pump(
|
||||||
WidgetTester tester, {
|
WidgetTester tester,
|
||||||
bool cupertino = false,
|
) async {
|
||||||
}) async {
|
|
||||||
final rendered = <(String, bool)>[];
|
final rendered = <(String, bool)>[];
|
||||||
final opened = <Uri>[];
|
final opened = <Uri>[];
|
||||||
final page = ArtifactViewerPage(
|
final page = ArtifactViewerPage(
|
||||||
@@ -61,17 +59,13 @@ Future<({_Rendered rendered, List<Uri> opened})> _pump(
|
|||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Navigator(
|
child: Navigator(
|
||||||
onGenerateRoute: (_) => cupertino
|
onGenerateRoute: (_) => MaterialPageRoute<void>(builder: (_) => page),
|
||||||
? CupertinoPageRoute<void>(builder: (_) => page)
|
|
||||||
: MaterialPageRoute<void>(builder: (_) => page),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(key: _shellBar, height: 56, child: Text('Tabs')),
|
const SizedBox(key: _shellBar, height: 56, child: Text('Tabs')),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(MaterialApp(home: shell));
|
||||||
cupertino ? CupertinoApp(home: shell) : MaterialApp(home: shell),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
return (rendered: rendered, opened: opened);
|
return (rendered: rendered, opened: opened);
|
||||||
}
|
}
|
||||||
@@ -81,61 +75,53 @@ Future<void> _enter(WidgetTester tester) async {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A bar control by its accessible name: the Material button's tooltip, the
|
/// A bar control by its Material tooltip.
|
||||||
/// Cupertino button's semantics label.
|
Finder _named(String name) => find.byTooltip(name);
|
||||||
Finder _named(bool cupertino, String name) =>
|
|
||||||
cupertino ? find.bySemanticsLabel(name) : find.byTooltip(name);
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final cupertino in [false, true]) {
|
testWidgets('the bottom actions offer Full screen', (tester) async {
|
||||||
final host = cupertino ? 'Cupertino' : 'Material';
|
final result = await _pump(tester);
|
||||||
|
final bar = find.byKey(const Key('artifact-viewer-actions'));
|
||||||
|
expect(
|
||||||
|
find.descendant(of: bar, matching: find.byKey(artifactFullscreenKey)),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
expect(_named('Full screen'), findsOneWidget);
|
||||||
|
expect(result.rendered.single, ('<h1>Hi</h1>', false));
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('$host: the bottom actions offer Full screen', (tester) async {
|
testWidgets('full screen covers the shell, keeps the actions and '
|
||||||
final result = await _pump(tester, cupertino: cupertino);
|
'renders the fetched document in the app', (tester) async {
|
||||||
final bar = find.byKey(const Key('artifact-viewer-actions'));
|
final result = await _pump(tester);
|
||||||
expect(
|
await _enter(tester);
|
||||||
find.descendant(of: bar, matching: find.byKey(artifactFullscreenKey)),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(_named(cupertino, 'Full screen'), findsOneWidget);
|
|
||||||
expect(result.rendered.single, ('<h1>Hi</h1>', false));
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('$host: full screen covers the shell, keeps the actions and '
|
expect(find.byKey(_shellBar), findsNothing);
|
||||||
'renders the fetched document in the app', (tester) async {
|
// The same document, fetched once with the app's session, now in the
|
||||||
final result = await _pump(tester, cupertino: cupertino);
|
// full-screen scope; nothing was handed to the system browser.
|
||||||
await _enter(tester);
|
expect(result.rendered.last, ('<h1>Hi</h1>', true));
|
||||||
|
expect(result.opened, isEmpty);
|
||||||
|
final bar = find.byKey(const Key('artifact-viewer-actions'));
|
||||||
|
expect(bar, findsOneWidget);
|
||||||
|
for (final key in const [
|
||||||
|
Key('artifact-open'),
|
||||||
|
Key('artifact-copy-link'),
|
||||||
|
artifactPreviousKey,
|
||||||
|
artifactNextKey,
|
||||||
|
]) {
|
||||||
|
expect(find.descendant(of: bar, matching: find.byKey(key)), findsOne);
|
||||||
|
}
|
||||||
|
expect(_named('Exit full screen'), findsOneWidget);
|
||||||
|
expect(_named('Open in browser'), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
expect(find.byKey(_shellBar), findsNothing);
|
testWidgets('Exit full screen returns to the viewer', (tester) async {
|
||||||
// The same document, fetched once with the app's session, now in the
|
await _pump(tester);
|
||||||
// full-screen scope; nothing was handed to the system browser.
|
await _enter(tester);
|
||||||
expect(result.rendered.last, ('<h1>Hi</h1>', true));
|
await tester.tap(find.byKey(artifactFullscreenKey));
|
||||||
expect(result.opened, isEmpty);
|
await tester.pumpAndSettle();
|
||||||
final bar = find.byKey(const Key('artifact-viewer-actions'));
|
expect(find.byKey(_shellBar), findsOneWidget);
|
||||||
expect(bar, findsOneWidget);
|
expect(_named('Full screen'), findsOneWidget);
|
||||||
for (final key in const [
|
});
|
||||||
Key('artifact-open'),
|
|
||||||
Key('artifact-copy-link'),
|
|
||||||
artifactPreviousKey,
|
|
||||||
artifactNextKey,
|
|
||||||
]) {
|
|
||||||
expect(find.descendant(of: bar, matching: find.byKey(key)), findsOne);
|
|
||||||
}
|
|
||||||
expect(_named(cupertino, 'Exit full screen'), findsOneWidget);
|
|
||||||
expect(_named(cupertino, 'Open in browser'), findsOneWidget);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('$host: Exit full screen returns to the viewer', (
|
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
await _pump(tester, cupertino: cupertino);
|
|
||||||
await _enter(tester);
|
|
||||||
await tester.tap(find.byKey(artifactFullscreenKey));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.byKey(_shellBar), findsOneWidget);
|
|
||||||
expect(_named(cupertino, 'Full screen'), findsOneWidget);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
testWidgets('Escape and the system back leave full screen', (tester) async {
|
testWidgets('Escape and the system back leave full screen', (tester) async {
|
||||||
await _pump(tester);
|
await _pump(tester);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/core/api_gateway.dart';
|
import 'package:pipelines_app/core/api_gateway.dart';
|
||||||
@@ -9,8 +8,6 @@ import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_fetch.dart';
|
|||||||
|
|
||||||
import '../domain/artifact_fixtures.dart';
|
import '../domain/artifact_fixtures.dart';
|
||||||
|
|
||||||
enum _Platform { material, cupertino }
|
|
||||||
|
|
||||||
JsonMap _file(String name, String group) => artifact(
|
JsonMap _file(String name, String group) => artifact(
|
||||||
name,
|
name,
|
||||||
contentType: 'text/markdown',
|
contentType: 'text/markdown',
|
||||||
@@ -36,7 +33,7 @@ List<JsonMap> _steps() => <JsonMap>[
|
|||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
Future<void> _pump(WidgetTester tester, _Platform platform) async {
|
Future<void> _pump(WidgetTester tester) async {
|
||||||
tester.view.physicalSize = const Size(900, 2600);
|
tester.view.physicalSize = const Size(900, 2600);
|
||||||
tester.view.devicePixelRatio = 1;
|
tester.view.devicePixelRatio = 1;
|
||||||
addTearDown(tester.view.resetPhysicalSize);
|
addTearDown(tester.view.resetPhysicalSize);
|
||||||
@@ -49,43 +46,37 @@ Future<void> _pump(WidgetTester tester, _Platform platform) async {
|
|||||||
ArtifactFetchResult(status: 200, bytes: Uint8List.fromList([35])),
|
ArtifactFetchResult(status: 200, bytes: Uint8List.fromList([35])),
|
||||||
markdownBuilder: (context, value) => Text(value),
|
markdownBuilder: (context, value) => Text(value),
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(MaterialApp(home: page));
|
||||||
platform == _Platform.material
|
|
||||||
? MaterialApp(home: page)
|
|
||||||
: CupertinoApp(home: page),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final platform in _Platform.values) {
|
testWidgets('only deliverables show until Debugging '
|
||||||
testWidgets('${platform.name}: only deliverables show until Debugging '
|
'files is revealed', (tester) async {
|
||||||
'files is revealed', (tester) async {
|
await _pump(tester);
|
||||||
await _pump(tester, platform);
|
expect(find.text('public/report.md'), findsOneWidget);
|
||||||
expect(find.text('public/report.md'), findsOneWidget);
|
for (final name in [
|
||||||
for (final name in [
|
'history.md',
|
||||||
'history.md',
|
'memory.md',
|
||||||
'memory.md',
|
'input.md',
|
||||||
'input.md',
|
'private/scratch.md',
|
||||||
'private/scratch.md',
|
]) {
|
||||||
]) {
|
expect(find.text(name), findsNothing, reason: name);
|
||||||
expect(find.text(name), findsNothing, reason: name);
|
}
|
||||||
}
|
expect(find.text('Debugging files'), findsNothing);
|
||||||
expect(find.text('Debugging files'), findsNothing);
|
|
||||||
|
|
||||||
await tester.tap(find.byKey(const Key('artifact-debug-toggle')));
|
await tester.tap(find.byKey(const Key('artifact-debug-toggle')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(find.text('Debugging files'), findsOneWidget);
|
expect(find.text('Debugging files'), findsOneWidget);
|
||||||
for (final name in [
|
for (final name in [
|
||||||
'history.md',
|
'history.md',
|
||||||
'memory.md',
|
'memory.md',
|
||||||
'input.md',
|
'input.md',
|
||||||
'output.md',
|
'output.md',
|
||||||
'private/scratch.md',
|
'private/scratch.md',
|
||||||
]) {
|
]) {
|
||||||
expect(find.text(name), findsOneWidget, reason: name);
|
expect(find.text(name), findsOneWidget, reason: name);
|
||||||
}
|
}
|
||||||
expect(find.text('public/report.md'), findsOneWidget);
|
expect(find.text('public/report.md'), findsOneWidget);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/core/api_gateway.dart';
|
import 'package:pipelines_app/core/api_gateway.dart';
|
||||||
@@ -11,8 +10,6 @@ import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_page.dart';
|
|||||||
|
|
||||||
import '../domain/artifact_fixtures.dart';
|
import '../domain/artifact_fixtures.dart';
|
||||||
|
|
||||||
enum _Platform { material, cupertino }
|
|
||||||
|
|
||||||
const String _endpoint = 'ws://127.0.0.1:8081/connect';
|
const String _endpoint = 'ws://127.0.0.1:8081/connect';
|
||||||
|
|
||||||
JsonMap _recorded(
|
JsonMap _recorded(
|
||||||
@@ -48,8 +45,7 @@ List<JsonMap> _steps() => <JsonMap>[
|
|||||||
];
|
];
|
||||||
|
|
||||||
Future<void> _pump(
|
Future<void> _pump(
|
||||||
WidgetTester tester,
|
WidgetTester tester, {
|
||||||
_Platform platform, {
|
|
||||||
List<JsonMap>? steps,
|
List<JsonMap>? steps,
|
||||||
ArtifactFetch? fetch,
|
ArtifactFetch? fetch,
|
||||||
ArtifactExternalOpen? openExternal,
|
ArtifactExternalOpen? openExternal,
|
||||||
@@ -72,11 +68,7 @@ Future<void> _pump(
|
|||||||
),
|
),
|
||||||
markdownBuilder: (context, value) => Text(value),
|
markdownBuilder: (context, value) => Text(value),
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(MaterialApp(home: page));
|
||||||
platform == _Platform.material
|
|
||||||
? MaterialApp(home: page)
|
|
||||||
: CupertinoApp(home: page),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,230 +77,194 @@ Future<void> _showTurnDocuments(WidgetTester tester) async {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
Finder _dialog(_Platform platform, String text) => find.descendant(
|
Finder _dialog(String text) =>
|
||||||
of: find.byType(
|
find.descendant(of: find.byType(AlertDialog), matching: find.text(text));
|
||||||
platform == _Platform.material ? AlertDialog : CupertinoAlertDialog,
|
|
||||||
),
|
|
||||||
matching: find.text(text),
|
|
||||||
);
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final platform in _Platform.values) {
|
testWidgets('debug hides documents by default and shows '
|
||||||
testWidgets('${platform.name}: debug hides documents by default and shows '
|
'each visit when enabled', (tester) async {
|
||||||
'each visit when enabled', (tester) async {
|
await _pump(tester);
|
||||||
await _pump(tester, platform);
|
expect(find.text('input.md'), findsNothing);
|
||||||
expect(find.text('input.md'), findsNothing);
|
expect(find.textContaining('Turn documents'), findsNothing);
|
||||||
expect(find.textContaining('Turn documents'), findsNothing);
|
expect(find.byTooltip('Show debugging files'), findsOneWidget);
|
||||||
expect(find.byTooltip('Show debugging files'), findsOneWidget);
|
await _showTurnDocuments(tester);
|
||||||
await _showTurnDocuments(tester);
|
expect(find.byTooltip('Hide debugging files'), findsOneWidget);
|
||||||
expect(find.byTooltip('Hide debugging files'), findsOneWidget);
|
expect(find.text('input.md'), findsNWidgets(2));
|
||||||
expect(find.text('input.md'), findsNWidgets(2));
|
expect(find.text('output.md'), findsNWidgets(2));
|
||||||
expect(find.text('output.md'), findsNWidgets(2));
|
expect(find.text('session.html'), findsNWidgets(2));
|
||||||
expect(find.text('session.html'), findsNWidgets(2));
|
expect(find.text('memory.md'), findsNWidgets(2));
|
||||||
expect(find.text('memory.md'), findsNWidgets(2));
|
expect(find.text('text/markdown · 120\u00a0B'), findsOneWidget);
|
||||||
expect(find.text('text/markdown · 120\u00a0B'), findsOneWidget);
|
expect(find.text('text/plain · 512\u00a0B'), findsOneWidget);
|
||||||
expect(find.text('text/plain · 512\u00a0B'), findsOneWidget);
|
});
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('${platform.name}: missing documents show exact wording', (
|
testWidgets('missing documents show exact wording', (tester) async {
|
||||||
|
await _pump(tester);
|
||||||
|
await _showTurnDocuments(tester);
|
||||||
|
expect(find.text('No memory recorded for this visit.'), findsOneWidget);
|
||||||
|
expect(find.text('No output recorded.'), findsOneWidget);
|
||||||
|
expect(find.text('This visit has no harness session.'), findsOneWidget);
|
||||||
|
expect(find.text('No input recorded.'), findsNothing);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('markdown opens the existing renderer', (tester) async {
|
||||||
|
await _pump(tester);
|
||||||
|
await _showTurnDocuments(tester);
|
||||||
|
await tester.tap(find.text('input.md').first);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||||
|
expect(find.text('# Recorded input'), findsOneWidget);
|
||||||
|
await tester.tap(find.byKey(const Key('artifact-info')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.text('review · visit 1'), findsOneWidget);
|
||||||
|
expect(find.text('text/markdown · 120\u00a0B'), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('absent rows are informational, not controls', (tester) async {
|
||||||
|
await _pump(tester);
|
||||||
|
await _showTurnDocuments(tester);
|
||||||
|
final absence = find.text('No output recorded.');
|
||||||
|
expect(absence, findsOneWidget);
|
||||||
|
// Not disabled: the absence line is content, not a skipped action, and
|
||||||
|
// is painted with the normal secondary label colour.
|
||||||
|
final tile = tester.widget<ListTile>(
|
||||||
|
find.ancestor(of: absence, matching: find.byType(ListTile)),
|
||||||
|
);
|
||||||
|
expect(tile.enabled, isTrue);
|
||||||
|
expect(tile.onTap, isNull);
|
||||||
|
expect(
|
||||||
|
tester.widget<Text>(absence).style?.color,
|
||||||
|
Theme.of(tester.element(absence)).colorScheme.onSurfaceVariant,
|
||||||
|
);
|
||||||
|
await tester.tap(absence);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byType(ArtifactViewerPage), findsNothing);
|
||||||
|
expect(find.byType(AlertDialog), findsNothing);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('session.html stays external-only', (tester) async {
|
||||||
|
final opened = <Uri>[];
|
||||||
|
await _pump(
|
||||||
tester,
|
tester,
|
||||||
) async {
|
openExternal: (uri) async {
|
||||||
await _pump(tester, platform);
|
opened.add(uri);
|
||||||
await _showTurnDocuments(tester);
|
return true;
|
||||||
expect(find.text('No memory recorded for this visit.'), findsOneWidget);
|
|
||||||
expect(find.text('No output recorded.'), findsOneWidget);
|
|
||||||
expect(find.text('This visit has no harness session.'), findsOneWidget);
|
|
||||||
expect(find.text('No input recorded.'), findsNothing);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('${platform.name}: markdown opens the existing renderer', (
|
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
await _pump(tester, platform);
|
|
||||||
await _showTurnDocuments(tester);
|
|
||||||
await tester.tap(find.text('input.md').first);
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
|
||||||
expect(find.text('# Recorded input'), findsOneWidget);
|
|
||||||
await tester.tap(find.byKey(const Key('artifact-info')));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.text('review · visit 1'), findsOneWidget);
|
|
||||||
expect(find.text('text/markdown · 120\u00a0B'), findsOneWidget);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets(
|
|
||||||
'${platform.name}: absent rows are informational, not controls',
|
|
||||||
(tester) async {
|
|
||||||
await _pump(tester, platform);
|
|
||||||
await _showTurnDocuments(tester);
|
|
||||||
final absence = find.text('No output recorded.');
|
|
||||||
expect(absence, findsOneWidget);
|
|
||||||
if (platform == _Platform.material) {
|
|
||||||
// Not disabled: the absence line is content, not a skipped action, and
|
|
||||||
// is painted with the normal secondary label colour.
|
|
||||||
final tile = tester.widget<ListTile>(
|
|
||||||
find.ancestor(of: absence, matching: find.byType(ListTile)),
|
|
||||||
);
|
|
||||||
expect(tile.enabled, isTrue);
|
|
||||||
expect(tile.onTap, isNull);
|
|
||||||
expect(
|
|
||||||
tester.widget<Text>(absence).style?.color,
|
|
||||||
Theme.of(tester.element(absence)).colorScheme.onSurfaceVariant,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
expect(
|
|
||||||
find.ancestor(of: absence, matching: find.byType(CupertinoButton)),
|
|
||||||
findsNothing,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
await tester.tap(absence);
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.byType(ArtifactViewerPage), findsNothing);
|
|
||||||
expect(find.byType(AlertDialog), findsNothing);
|
|
||||||
expect(find.byType(CupertinoAlertDialog), findsNothing);
|
|
||||||
},
|
},
|
||||||
|
fetch: (_) async => throw StateError('x'),
|
||||||
|
);
|
||||||
|
await _showTurnDocuments(tester);
|
||||||
|
await tester.tap(find.text('session.html').first);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byType(ArtifactViewerPage), findsNothing);
|
||||||
|
expect(_dialog('session.html'), findsOneWidget);
|
||||||
|
expect(_dialog('text/plain · 512\u00a0B'), findsOneWidget);
|
||||||
|
await tester.tap(_dialog('Open in browser'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byType(ArtifactViewerPage), findsNothing);
|
||||||
|
expect(opened, [
|
||||||
|
Uri.parse('http://127.0.0.1:8081/artifacts/1/1/session.html'),
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('a stage artifact pages only through stage '
|
||||||
|
'artifacts while Debug is off', (tester) async {
|
||||||
|
await _pump(tester);
|
||||||
|
|
||||||
|
// report.csv (visit 1) and notes.md (visit 2) are the only stage
|
||||||
|
// artifacts; the visits' turn documents stay out of the viewer.
|
||||||
|
await tester.tap(find.text('report.csv'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||||
|
expect(find.text('1 of 2 · text/csv'), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('with Debug on, a stage artifact pages '
|
||||||
|
'through turn documents too', (tester) async {
|
||||||
|
await _pump(tester);
|
||||||
|
await _showTurnDocuments(tester);
|
||||||
|
|
||||||
|
await tester.tap(find.text('report.csv'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||||
|
// Both stage artifacts plus the recorded viewer documents
|
||||||
|
// (session.html opens externally only).
|
||||||
|
expect(find.text('1 of 6 · text/csv'), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('documents do not count as artifacts and '
|
||||||
|
'viewer paging stays within documents', (tester) async {
|
||||||
|
await _pump(
|
||||||
|
tester,
|
||||||
|
steps: [
|
||||||
|
step(
|
||||||
|
stage: 'review',
|
||||||
|
visit: 1,
|
||||||
|
artifacts: [
|
||||||
|
_recorded('report.csv', contentType: 'text/csv', sizeBytes: 23),
|
||||||
|
_recorded('input.md', contentType: 'text/markdown', sizeBytes: 1),
|
||||||
|
_recorded('output.md', contentType: 'text/markdown', sizeBytes: 1),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
testWidgets('${platform.name}: session.html stays external-only', (
|
expect(find.text('Artifact · 1 recorded'), findsOneWidget);
|
||||||
|
expect(find.text('report.csv'), findsOneWidget);
|
||||||
|
expect(find.text('input.md'), findsNothing);
|
||||||
|
await _showTurnDocuments(tester);
|
||||||
|
await tester.tap(find.text('input.md'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||||
|
expect(find.text('1 of 2 · text/markdown'), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('document-only visits retain an honest empty '
|
||||||
|
'artifact state', (tester) async {
|
||||||
|
await _pump(
|
||||||
tester,
|
tester,
|
||||||
) async {
|
steps: [
|
||||||
final opened = <Uri>[];
|
step(
|
||||||
await _pump(
|
stage: 'review',
|
||||||
tester,
|
visit: 1,
|
||||||
platform,
|
artifacts: [
|
||||||
openExternal: (uri) async {
|
_recorded('input.md', contentType: 'text/markdown', sizeBytes: 1),
|
||||||
opened.add(uri);
|
],
|
||||||
return true;
|
),
|
||||||
},
|
],
|
||||||
fetch: (_) async => throw StateError('x'),
|
);
|
||||||
);
|
|
||||||
await _showTurnDocuments(tester);
|
|
||||||
await tester.tap(find.text('session.html').first);
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.byType(ArtifactViewerPage), findsNothing);
|
|
||||||
expect(_dialog(platform, 'session.html'), findsOneWidget);
|
|
||||||
expect(_dialog(platform, 'text/plain · 512\u00a0B'), findsOneWidget);
|
|
||||||
await tester.tap(_dialog(platform, 'Open in browser'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.byType(ArtifactViewerPage), findsNothing);
|
|
||||||
expect(opened, [
|
|
||||||
Uri.parse('http://127.0.0.1:8081/artifacts/1/1/session.html'),
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('${platform.name}: a stage artifact pages only through stage '
|
expect(find.text('No artifacts recorded for this run.'), findsOneWidget);
|
||||||
'artifacts while Debug is off', (tester) async {
|
expect(find.text('input.md'), findsNothing);
|
||||||
await _pump(tester, platform);
|
await _showTurnDocuments(tester);
|
||||||
|
expect(find.text('input.md'), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
// report.csv (visit 1) and notes.md (visit 2) are the only stage
|
testWidgets('focused document-only visits retain turn '
|
||||||
// artifacts; the visits' turn documents stay out of the viewer.
|
'documents', (tester) async {
|
||||||
await tester.tap(find.text('report.csv'));
|
await _pump(
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
|
||||||
expect(find.text('1 of 2 · text/csv'), findsOneWidget);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('${platform.name}: with Debug on, a stage artifact pages '
|
|
||||||
'through turn documents too', (tester) async {
|
|
||||||
await _pump(tester, platform);
|
|
||||||
await _showTurnDocuments(tester);
|
|
||||||
|
|
||||||
await tester.tap(find.text('report.csv'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
|
||||||
// Both stage artifacts plus the recorded viewer documents
|
|
||||||
// (session.html opens externally only).
|
|
||||||
expect(find.text('1 of 6 · text/csv'), findsOneWidget);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('${platform.name}: documents do not count as artifacts and '
|
|
||||||
'viewer paging stays within documents', (tester) async {
|
|
||||||
await _pump(
|
|
||||||
tester,
|
|
||||||
platform,
|
|
||||||
steps: [
|
|
||||||
step(
|
|
||||||
stage: 'review',
|
|
||||||
visit: 1,
|
|
||||||
artifacts: [
|
|
||||||
_recorded('report.csv', contentType: 'text/csv', sizeBytes: 23),
|
|
||||||
_recorded('input.md', contentType: 'text/markdown', sizeBytes: 1),
|
|
||||||
_recorded(
|
|
||||||
'output.md',
|
|
||||||
contentType: 'text/markdown',
|
|
||||||
sizeBytes: 1,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(find.text('Artifact · 1 recorded'), findsOneWidget);
|
|
||||||
expect(find.text('report.csv'), findsOneWidget);
|
|
||||||
expect(find.text('input.md'), findsNothing);
|
|
||||||
await _showTurnDocuments(tester);
|
|
||||||
await tester.tap(find.text('input.md'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
|
||||||
expect(find.text('1 of 2 · text/markdown'), findsOneWidget);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('${platform.name}: document-only visits retain an honest empty '
|
|
||||||
'artifact state', (tester) async {
|
|
||||||
await _pump(
|
|
||||||
tester,
|
|
||||||
platform,
|
|
||||||
steps: [
|
|
||||||
step(
|
|
||||||
stage: 'review',
|
|
||||||
visit: 1,
|
|
||||||
artifacts: [
|
|
||||||
_recorded('input.md', contentType: 'text/markdown', sizeBytes: 1),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(find.text('No artifacts recorded for this run.'), findsOneWidget);
|
|
||||||
expect(find.text('input.md'), findsNothing);
|
|
||||||
await _showTurnDocuments(tester);
|
|
||||||
expect(find.text('input.md'), findsOneWidget);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('${platform.name}: focused document-only visits retain turn '
|
|
||||||
'documents', (tester) async {
|
|
||||||
await _pump(
|
|
||||||
tester,
|
|
||||||
platform,
|
|
||||||
focusIndex: 0,
|
|
||||||
steps: [
|
|
||||||
step(
|
|
||||||
stage: 'review',
|
|
||||||
visit: 1,
|
|
||||||
artifacts: [
|
|
||||||
_recorded('input.md', contentType: 'text/markdown', sizeBytes: 1),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
find.text('No artifacts recorded for this visit.'),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(find.text('input.md'), findsNothing);
|
|
||||||
await _showTurnDocuments(tester);
|
|
||||||
expect(find.text('input.md'), findsOneWidget);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('${platform.name}: focused visits retain session documents', (
|
|
||||||
tester,
|
tester,
|
||||||
) async {
|
focusIndex: 0,
|
||||||
await _pump(tester, platform, focusIndex: 0);
|
steps: [
|
||||||
|
step(
|
||||||
|
stage: 'review',
|
||||||
|
visit: 1,
|
||||||
|
artifacts: [
|
||||||
|
_recorded('input.md', contentType: 'text/markdown', sizeBytes: 1),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
expect(find.text('session.html'), findsNothing);
|
expect(find.text('No artifacts recorded for this visit.'), findsOneWidget);
|
||||||
await _showTurnDocuments(tester);
|
expect(find.text('input.md'), findsNothing);
|
||||||
expect(find.text('session.html'), findsOneWidget);
|
await _showTurnDocuments(tester);
|
||||||
});
|
expect(find.text('input.md'), findsOneWidget);
|
||||||
}
|
});
|
||||||
|
|
||||||
|
testWidgets('focused visits retain session documents', (tester) async {
|
||||||
|
await _pump(tester, focusIndex: 0);
|
||||||
|
|
||||||
|
expect(find.text('session.html'), findsNothing);
|
||||||
|
await _showTurnDocuments(tester);
|
||||||
|
expect(find.text('session.html'), findsOneWidget);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
@@ -9,8 +8,6 @@ import 'package:pipelines_app/features/artifacts/ui/artifact_visit_list.dart';
|
|||||||
|
|
||||||
import '../domain/artifact_fixtures.dart';
|
import '../domain/artifact_fixtures.dart';
|
||||||
|
|
||||||
enum _Platform { material, cupertino }
|
|
||||||
|
|
||||||
JsonMap _recorded(
|
JsonMap _recorded(
|
||||||
String name, {
|
String name, {
|
||||||
String url = '',
|
String url = '',
|
||||||
@@ -51,7 +48,6 @@ List<JsonMap> _steps() => <JsonMap>[
|
|||||||
|
|
||||||
Future<void> _pumpGallery(
|
Future<void> _pumpGallery(
|
||||||
WidgetTester tester,
|
WidgetTester tester,
|
||||||
_Platform platform,
|
|
||||||
List<JsonMap> steps, {
|
List<JsonMap> steps, {
|
||||||
int? focusIndex,
|
int? focusIndex,
|
||||||
String configuredEndpoint = '',
|
String configuredEndpoint = '',
|
||||||
@@ -77,65 +73,53 @@ Future<void> _pumpGallery(
|
|||||||
size: surface,
|
size: surface,
|
||||||
textScaler: TextScaler.linear(textScale),
|
textScaler: TextScaler.linear(textScale),
|
||||||
),
|
),
|
||||||
child: platform == _Platform.material
|
child: MaterialApp(home: page),
|
||||||
? MaterialApp(home: page)
|
|
||||||
: CupertinoApp(home: page),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
Finder _inDialog(_Platform platform, String text) => find.descendant(
|
Finder _inDialog(String text) =>
|
||||||
of: find.byType(
|
find.descendant(of: find.byType(AlertDialog), matching: find.text(text));
|
||||||
platform == _Platform.material ? AlertDialog : CupertinoAlertDialog,
|
|
||||||
),
|
|
||||||
matching: find.text(text),
|
|
||||||
);
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final platform in _Platform.values) {
|
testWidgets('lists recorded groups and rows', (tester) async {
|
||||||
testWidgets('${platform.name}: lists recorded groups and rows', (
|
await _pumpGallery(tester, _steps());
|
||||||
tester,
|
expect(find.text('Artifacts · 4 recorded'), findsOneWidget);
|
||||||
) async {
|
expect(find.text('build · visit 1'), findsOneWidget);
|
||||||
await _pumpGallery(tester, platform, _steps());
|
expect(find.text('review · visit 1'), findsOneWidget);
|
||||||
expect(find.text('Artifacts · 4 recorded'), findsOneWidget);
|
expect(find.text('review · visit 2'), findsOneWidget);
|
||||||
expect(find.text('build · visit 1'), findsOneWidget);
|
expect(find.text('result.zip'), findsNWidgets(2));
|
||||||
expect(find.text('review · visit 1'), findsOneWidget);
|
expect(find.text('notes.md'), findsOneWidget);
|
||||||
expect(find.text('review · visit 2'), findsOneWidget);
|
expect(find.text('text/markdown · 2.0\u00a0KiB'), findsOneWidget);
|
||||||
expect(find.text('result.zip'), findsNWidgets(2));
|
});
|
||||||
expect(find.text('notes.md'), findsOneWidget);
|
|
||||||
expect(find.text('text/markdown · 2.0\u00a0KiB'), findsOneWidget);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('${platform.name}: duplicate filename stays visit distinct', (
|
testWidgets('duplicate filename stays visit distinct', (tester) async {
|
||||||
tester,
|
final steps = _steps();
|
||||||
) async {
|
await _pumpGallery(tester, steps);
|
||||||
final steps = _steps();
|
await tester.tap(find.text('result.zip').at(1));
|
||||||
await _pumpGallery(tester, platform, steps);
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(find.text('result.zip').at(1));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
final groups = artifactGroups(steps);
|
final groups = artifactGroups(steps);
|
||||||
final visitTwo = groups.firstWhere(
|
final visitTwo = groups.firstWhere(
|
||||||
(group) => group.stageKey == 'review' && group.visit == 2,
|
(group) => group.stageKey == 'review' && group.visit == 2,
|
||||||
);
|
);
|
||||||
final list = tester.widget<ArtifactVisitList>(
|
final list = tester.widget<ArtifactVisitList>(
|
||||||
find.byType(ArtifactVisitList),
|
find.byType(ArtifactVisitList),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
list.selectedIdentity,
|
list.selectedIdentity,
|
||||||
artifactVisitIdentity(visitTwo, visitTwo.artifacts.single),
|
artifactVisitIdentity(visitTwo, visitTwo.artifacts.single),
|
||||||
);
|
);
|
||||||
expect(_inDialog(platform, 'review · visit 2'), findsOneWidget);
|
expect(_inDialog('review · visit 2'), findsOneWidget);
|
||||||
expect(_inDialog(platform, 'review · visit 1'), findsNothing);
|
expect(_inDialog('review · visit 1'), findsNothing);
|
||||||
expect(_inDialog(platform, 'Artifacts · 1 recorded'), findsOneWidget);
|
expect(_inDialog('Artifacts · 1 recorded'), findsOneWidget);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
testWidgets('capture notes and partial label come from the visit step', (
|
testWidgets('capture notes and partial label come from the visit step', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await _pumpGallery(tester, _Platform.material, [
|
await _pumpGallery(tester, [
|
||||||
step(
|
step(
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
visit: 1,
|
visit: 1,
|
||||||
@@ -151,18 +135,15 @@ void main() {
|
|||||||
await tester.tap(find.text('result.zip'));
|
await tester.tap(find.text('result.zip'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(
|
expect(
|
||||||
_inDialog(_Platform.material, 'Artifacts · 2 recorded · partial capture'),
|
_inDialog('Artifacts · 2 recorded · partial capture'),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
_inDialog(_Platform.material, '2 files excluded from artifact capture.'),
|
_inDialog('2 files excluded from artifact capture.'),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
_inDialog(
|
_inDialog('3 files omitted by artifact capture limits.'),
|
||||||
_Platform.material,
|
|
||||||
'3 files omitted by artifact capture limits.',
|
|
||||||
),
|
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -170,7 +151,7 @@ void main() {
|
|||||||
testWidgets('an unavailable capture never claims nothing was recorded', (
|
testWidgets('an unavailable capture never claims nothing was recorded', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await _pumpGallery(tester, _Platform.material, [
|
await _pumpGallery(tester, [
|
||||||
step(stage: 'review', visit: 1, includeArtifacts: false),
|
step(stage: 'review', visit: 1, includeArtifacts: false),
|
||||||
]);
|
]);
|
||||||
expect(find.text('Artifacts · capture unavailable'), findsOneWidget);
|
expect(find.text('Artifacts · capture unavailable'), findsOneWidget);
|
||||||
@@ -180,7 +161,7 @@ void main() {
|
|||||||
testWidgets('a recorded empty capture says nothing was recorded', (
|
testWidgets('a recorded empty capture says nothing was recorded', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await _pumpGallery(tester, _Platform.material, [
|
await _pumpGallery(tester, [
|
||||||
step(stage: 'review', visit: 1, artifacts: const []),
|
step(stage: 'review', visit: 1, artifacts: const []),
|
||||||
]);
|
]);
|
||||||
expect(find.text('No artifacts recorded for this run.'), findsOneWidget);
|
expect(find.text('No artifacts recorded for this run.'), findsOneWidget);
|
||||||
@@ -188,7 +169,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('a page with no steps says so explicitly', (tester) async {
|
testWidgets('a page with no steps says so explicitly', (tester) async {
|
||||||
await _pumpGallery(tester, _Platform.material, const []);
|
await _pumpGallery(tester, const []);
|
||||||
expect(find.text('No steps recorded for this run.'), findsOneWidget);
|
expect(find.text('No steps recorded for this run.'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -196,7 +177,6 @@ void main() {
|
|||||||
final opened = <Uri>[];
|
final opened = <Uri>[];
|
||||||
await _pumpGallery(
|
await _pumpGallery(
|
||||||
tester,
|
tester,
|
||||||
_Platform.material,
|
|
||||||
[
|
[
|
||||||
step(
|
step(
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
@@ -214,7 +194,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.tap(find.text('result.zip'));
|
await tester.tap(find.text('result.zip'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(_inDialog(_Platform.material, 'Open in browser'));
|
await tester.tap(_inDialog('Open in browser'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(opened, [
|
expect(opened, [
|
||||||
@@ -227,7 +207,7 @@ void main() {
|
|||||||
testWidgets('an unsafe recorded url offers no open or copy action', (
|
testWidgets('an unsafe recorded url offers no open or copy action', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await _pumpGallery(tester, _Platform.material, [
|
await _pumpGallery(tester, [
|
||||||
step(
|
step(
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
visit: 1,
|
visit: 1,
|
||||||
@@ -237,20 +217,17 @@ void main() {
|
|||||||
await tester.tap(find.text('result.zip'));
|
await tester.tap(find.text('result.zip'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(
|
expect(
|
||||||
_inDialog(
|
_inDialog('The recorded artifact URL cannot be opened safely.'),
|
||||||
_Platform.material,
|
|
||||||
'The recorded artifact URL cannot be opened safely.',
|
|
||||||
),
|
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
expect(_inDialog(_Platform.material, 'Open in browser'), findsNothing);
|
expect(_inDialog('Open in browser'), findsNothing);
|
||||||
expect(_inDialog(_Platform.material, 'Copy link'), findsNothing);
|
expect(_inDialog('Copy link'), findsNothing);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('a record with no url is explicit and offers no action', (
|
testWidgets('a record with no url is explicit and offers no action', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await _pumpGallery(tester, _Platform.material, [
|
await _pumpGallery(tester, [
|
||||||
step(
|
step(
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
visit: 1,
|
visit: 1,
|
||||||
@@ -266,11 +243,8 @@ void main() {
|
|||||||
]);
|
]);
|
||||||
await tester.tap(find.text('result.zip'));
|
await tester.tap(find.text('result.zip'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(
|
expect(_inDialog('No artifact URL recorded.'), findsOneWidget);
|
||||||
_inDialog(_Platform.material, 'No artifact URL recorded.'),
|
expect(_inDialog('Open in browser'), findsNothing);
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(_inDialog(_Platform.material, 'Open in browser'), findsNothing);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Copy link copies the resolved url, separate from Open', (
|
testWidgets('Copy link copies the resolved url, separate from Open', (
|
||||||
@@ -295,7 +269,6 @@ void main() {
|
|||||||
final opened = <Uri>[];
|
final opened = <Uri>[];
|
||||||
await _pumpGallery(
|
await _pumpGallery(
|
||||||
tester,
|
tester,
|
||||||
_Platform.material,
|
|
||||||
[
|
[
|
||||||
step(
|
step(
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
@@ -313,7 +286,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.tap(find.text('result.zip'));
|
await tester.tap(find.text('result.zip'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(_inDialog(_Platform.material, 'Copy link'));
|
await tester.tap(_inDialog('Copy link'));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(copied, ['http://127.0.0.1:8081/artifacts/1/1/result.zip']);
|
expect(copied, ['http://127.0.0.1:8081/artifacts/1/1/result.zip']);
|
||||||
@@ -322,7 +295,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('an executing run says capture pending', (tester) async {
|
testWidgets('an executing run says capture pending', (tester) async {
|
||||||
await _pumpGallery(tester, _Platform.material, [
|
await _pumpGallery(tester, [
|
||||||
step(
|
step(
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
visit: 1,
|
visit: 1,
|
||||||
@@ -336,7 +309,7 @@ void main() {
|
|||||||
testWidgets('the run header names the visit each capture note belongs to', (
|
testWidgets('the run header names the visit each capture note belongs to', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await _pumpGallery(tester, _Platform.material, [
|
await _pumpGallery(tester, [
|
||||||
step(
|
step(
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
visit: 1,
|
visit: 1,
|
||||||
@@ -368,7 +341,7 @@ void main() {
|
|||||||
testWidgets('a focused visit header states its own notes without a prefix', (
|
testWidgets('a focused visit header states its own notes without a prefix', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await _pumpGallery(tester, _Platform.material, [
|
await _pumpGallery(tester, [
|
||||||
step(
|
step(
|
||||||
stage: 'review',
|
stage: 'review',
|
||||||
visit: 1,
|
visit: 1,
|
||||||
@@ -400,7 +373,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('a complete capture adds no header notes', (tester) async {
|
testWidgets('a complete capture adds no header notes', (tester) async {
|
||||||
await _pumpGallery(tester, _Platform.material, [
|
await _pumpGallery(tester, [
|
||||||
step(stage: 'review', visit: 1, artifacts: [_recorded('result.zip')]),
|
step(stage: 'review', visit: 1, artifacts: [_recorded('result.zip')]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -409,103 +382,93 @@ void main() {
|
|||||||
expect(find.textContaining('files omitted'), findsNothing);
|
expect(find.textContaining('files omitted'), findsNothing);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (final platform in _Platform.values) {
|
testWidgets('a long run header scrolls with the gallery rows', (
|
||||||
testWidgets(
|
tester,
|
||||||
'${platform.name}: a long run header scrolls with the gallery rows',
|
) async {
|
||||||
(tester) async {
|
// Ten partial visits at a phone surface: the header is taller than the
|
||||||
// Ten partial visits at a phone surface: the header is taller than the
|
// free space a fixed sibling could get without taking the list's.
|
||||||
// free space a fixed sibling could get without taking the list's.
|
await _pumpGallery(tester, <JsonMap>[
|
||||||
await _pumpGallery(tester, platform, <JsonMap>[
|
for (var visit = 1; visit <= 10; visit += 1)
|
||||||
for (var visit = 1; visit <= 10; visit += 1)
|
step(
|
||||||
step(
|
stage: 'review',
|
||||||
stage: 'review',
|
sequence: visit,
|
||||||
sequence: visit,
|
visit: visit,
|
||||||
visit: visit,
|
artifacts: [_recorded('file$visit.zip')],
|
||||||
artifacts: [_recorded('file$visit.zip')],
|
skipped: 1,
|
||||||
skipped: 1,
|
),
|
||||||
),
|
], surface: const Size(360, 640));
|
||||||
], surface: const Size(360, 640));
|
|
||||||
|
|
||||||
expect(tester.takeException(), isNull);
|
expect(tester.takeException(), isNull);
|
||||||
final list = find.byType(CustomScrollView);
|
final list = find.byType(CustomScrollView);
|
||||||
expect(tester.getSize(list).height, greaterThan(0));
|
expect(tester.getSize(list).height, greaterThan(0));
|
||||||
// The header belongs to that scroll view, so it scrolls away instead of
|
// The header belongs to that scroll view, so it scrolls away instead of
|
||||||
// shrinking the list.
|
// shrinking the list.
|
||||||
expect(
|
expect(
|
||||||
find.descendant(
|
find.descendant(
|
||||||
of: list,
|
of: list,
|
||||||
matching: find.text('Artifacts · 10 recorded · partial capture'),
|
matching: find.text('Artifacts · 10 recorded · partial capture'),
|
||||||
),
|
),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
|
||||||
await tester.scrollUntilVisible(find.text('file10.zip'), 200);
|
|
||||||
expect(find.text('file10.zip'), findsOneWidget);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
await tester.scrollUntilVisible(find.text('file10.zip'), 200);
|
||||||
|
expect(find.text('file10.zip'), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets(
|
testWidgets('focused notes at 2x text keep the artifact list', (
|
||||||
'${platform.name}: focused notes at 2x text keep the artifact list',
|
tester,
|
||||||
(tester) async {
|
) async {
|
||||||
await _pumpGallery(
|
await _pumpGallery(
|
||||||
tester,
|
tester,
|
||||||
platform,
|
[
|
||||||
[
|
step(
|
||||||
step(
|
stage: 'review',
|
||||||
stage: 'review',
|
visit: 1,
|
||||||
visit: 1,
|
artifacts: [
|
||||||
artifacts: [
|
_recorded('result.zip', url: '/artifacts/1/1/result.zip'),
|
||||||
_recorded('result.zip', url: '/artifacts/1/1/result.zip'),
|
|
||||||
],
|
|
||||||
skipped: 12,
|
|
||||||
truncated: 34,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
focusIndex: 0,
|
skipped: 12,
|
||||||
surface: const Size(320, 568),
|
truncated: 34,
|
||||||
textScale: 2,
|
),
|
||||||
);
|
],
|
||||||
|
focusIndex: 0,
|
||||||
expect(tester.takeException(), isNull);
|
surface: const Size(320, 568),
|
||||||
expect(
|
textScale: 2,
|
||||||
tester.getSize(find.byType(CustomScrollView)).height,
|
|
||||||
greaterThan(0),
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
find.text('12 files excluded from artifact capture.'),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
find.text('34 files omitted by artifact capture limits.'),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
await tester.scrollUntilVisible(find.text('result.zip'), 200);
|
|
||||||
expect(find.text('result.zip'), findsOneWidget);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
testWidgets(
|
expect(tester.takeException(), isNull);
|
||||||
'${platform.name}: sheet actions keep Close, Copy, Open order',
|
expect(
|
||||||
(tester) async {
|
tester.getSize(find.byType(CustomScrollView)).height,
|
||||||
await _pumpGallery(tester, platform, [
|
greaterThan(0),
|
||||||
step(
|
|
||||||
stage: 'review',
|
|
||||||
visit: 1,
|
|
||||||
artifacts: [
|
|
||||||
_recorded('result.zip', url: '/artifacts/1/1/result.zip'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
], configuredEndpoint: 'ws://127.0.0.1:8081/connect');
|
|
||||||
await tester.tap(find.text('result.zip'));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
double orderOf(String label) {
|
|
||||||
final offset = tester.getTopLeft(_inDialog(platform, label));
|
|
||||||
return platform == _Platform.material ? offset.dx : offset.dy;
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(orderOf('Close'), lessThan(orderOf('Copy link')));
|
|
||||||
expect(orderOf('Copy link'), lessThan(orderOf('Open in browser')));
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
expect(
|
||||||
|
find.text('12 files excluded from artifact capture.'),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
expect(
|
||||||
|
find.text('34 files omitted by artifact capture limits.'),
|
||||||
|
findsOneWidget,
|
||||||
|
);
|
||||||
|
await tester.scrollUntilVisible(find.text('result.zip'), 200);
|
||||||
|
expect(find.text('result.zip'), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('sheet actions keep Close, Copy, Open order', (tester) async {
|
||||||
|
await _pumpGallery(tester, [
|
||||||
|
step(
|
||||||
|
stage: 'review',
|
||||||
|
visit: 1,
|
||||||
|
artifacts: [_recorded('result.zip', url: '/artifacts/1/1/result.zip')],
|
||||||
|
),
|
||||||
|
], configuredEndpoint: 'ws://127.0.0.1:8081/connect');
|
||||||
|
await tester.tap(find.text('result.zip'));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
double orderOf(String label) {
|
||||||
|
final offset = tester.getTopLeft(_inDialog(label));
|
||||||
|
return offset.dx;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(orderOf('Close'), lessThan(orderOf('Copy link')));
|
||||||
|
expect(orderOf('Copy link'), lessThan(orderOf('Open in browser')));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/core/api_gateway.dart';
|
import 'package:pipelines_app/core/api_gateway.dart';
|
||||||
@@ -21,7 +20,7 @@ ArtifactGroup _group() => ArtifactGroup(
|
|||||||
artifacts: [ArtifactRecord.fromJson(_recorded())],
|
artifacts: [ArtifactRecord.fromJson(_recorded())],
|
||||||
);
|
);
|
||||||
|
|
||||||
Future<void> _pump(WidgetTester tester, {required bool cupertino}) async {
|
Future<void> _pump(WidgetTester tester) async {
|
||||||
final group = _group();
|
final group = _group();
|
||||||
final facts = Padding(
|
final facts = Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
@@ -37,50 +36,36 @@ Future<void> _pump(WidgetTester tester, {required bool cupertino}) async {
|
|||||||
resolved: null,
|
resolved: null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(MaterialApp(home: Scaffold(body: facts)));
|
||||||
cupertino
|
|
||||||
? CupertinoApp(
|
|
||||||
home: CupertinoPageScaffold(
|
|
||||||
backgroundColor: CupertinoColors.systemGroupedBackground,
|
|
||||||
child: facts,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: MaterialApp(home: Scaffold(body: facts)),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final cupertino in <bool>[false, true]) {
|
testWidgets('facts lead with metadata, then the visit, then its capture', (
|
||||||
testWidgets(
|
tester,
|
||||||
'${cupertino ? 'cupertino' : 'material'}: facts lead with metadata, then the visit, then its capture',
|
) async {
|
||||||
(tester) async {
|
await _pump(tester);
|
||||||
await _pump(tester, cupertino: cupertino);
|
|
||||||
|
|
||||||
const metadata = 'text/csv · 2.0\u00a0KiB';
|
const metadata = 'text/csv · 2.0\u00a0KiB';
|
||||||
const visit = 'review · visit 1';
|
const visit = 'review · visit 1';
|
||||||
const summary = 'Artifacts · 1 recorded · partial capture';
|
const summary = 'Artifacts · 1 recorded · partial capture';
|
||||||
const note = '2 files excluded from artifact capture.';
|
const note = '2 files excluded from artifact capture.';
|
||||||
const urlState = 'The recorded artifact URL cannot be opened safely.';
|
const urlState = 'The recorded artifact URL cannot be opened safely.';
|
||||||
|
|
||||||
double topOf(String text) => tester.getTopLeft(find.text(text)).dy;
|
double topOf(String text) => tester.getTopLeft(find.text(text)).dy;
|
||||||
|
|
||||||
expect(topOf(metadata), lessThan(topOf(visit)));
|
expect(topOf(metadata), lessThan(topOf(visit)));
|
||||||
expect(topOf(visit), lessThan(topOf(summary)));
|
expect(topOf(visit), lessThan(topOf(summary)));
|
||||||
expect(topOf(summary), lessThan(topOf(note)));
|
expect(topOf(summary), lessThan(topOf(note)));
|
||||||
expect(topOf(note), lessThan(topOf(urlState)));
|
expect(topOf(note), lessThan(topOf(urlState)));
|
||||||
|
|
||||||
final context = tester.element(find.text(metadata));
|
final context = tester.element(find.text(metadata));
|
||||||
final secondary = cupertino
|
final secondary = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||||
? CupertinoColors.secondaryLabel.resolveFrom(context)
|
final metadataStyle = tester.widget<Text>(find.text(metadata)).style;
|
||||||
: Theme.of(context).colorScheme.onSurfaceVariant;
|
final visitStyle = tester.widget<Text>(find.text(visit)).style;
|
||||||
final metadataStyle = tester.widget<Text>(find.text(metadata)).style;
|
final summaryStyle = tester.widget<Text>(find.text(summary)).style;
|
||||||
final visitStyle = tester.widget<Text>(find.text(visit)).style;
|
|
||||||
final summaryStyle = tester.widget<Text>(find.text(summary)).style;
|
|
||||||
|
|
||||||
expect(metadataStyle?.color, secondary);
|
expect(metadataStyle?.color, secondary);
|
||||||
expect(visitStyle?.color, secondary);
|
expect(visitStyle?.color, secondary);
|
||||||
expect(summaryStyle?.color, isNot(secondary));
|
expect(summaryStyle?.color, isNot(secondary));
|
||||||
},
|
});
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
@@ -42,7 +41,6 @@ Future<void> _pumpViewer(
|
|||||||
WidgetTester tester, {
|
WidgetTester tester, {
|
||||||
required List<ArtifactGroup> groups,
|
required List<ArtifactGroup> groups,
|
||||||
required String selected,
|
required String selected,
|
||||||
bool cupertino = false,
|
|
||||||
ArtifactFetch? fetch,
|
ArtifactFetch? fetch,
|
||||||
Widget Function(BuildContext, String)? markdownBuilder,
|
Widget Function(BuildContext, String)? markdownBuilder,
|
||||||
ArtifactExternalOpen? openExternal,
|
ArtifactExternalOpen? openExternal,
|
||||||
@@ -61,11 +59,7 @@ Future<void> _pumpViewer(
|
|||||||
data: MediaQueryData(padding: EdgeInsets.only(bottom: bottomClearance)),
|
data: MediaQueryData(padding: EdgeInsets.only(bottom: bottomClearance)),
|
||||||
child: page,
|
child: page,
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(MaterialApp(home: Scaffold(body: child)));
|
||||||
cupertino
|
|
||||||
? CupertinoApp(home: child)
|
|
||||||
: MaterialApp(home: Scaffold(body: child)),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +80,6 @@ const String _markdownBody =
|
|||||||
/// viewer exactly as the run detail does.
|
/// viewer exactly as the run detail does.
|
||||||
Future<void> _openMarkdownFromGallery(
|
Future<void> _openMarkdownFromGallery(
|
||||||
WidgetTester tester, {
|
WidgetTester tester, {
|
||||||
required bool cupertino,
|
|
||||||
String name = 'notes.md',
|
String name = 'notes.md',
|
||||||
String contentType = 'text/markdown',
|
String contentType = 'text/markdown',
|
||||||
}) async {
|
}) async {
|
||||||
@@ -109,9 +102,7 @@ Future<void> _openMarkdownFromGallery(
|
|||||||
fetch: (_) async =>
|
fetch: (_) async =>
|
||||||
ArtifactFetchResult(status: 200, bytes: utf8.encode(_markdownBody)),
|
ArtifactFetchResult(status: 200, bytes: utf8.encode(_markdownBody)),
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(MaterialApp(home: page));
|
||||||
cupertino ? CupertinoApp(home: page) : MaterialApp(home: page),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(find.text(name));
|
await tester.tap(find.text(name));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
@@ -533,33 +524,10 @@ void main() {
|
|||||||
expect(find.byKey(artifactPreviewRetryKey), findsOneWidget);
|
expect(find.byKey(artifactPreviewRetryKey), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Cupertino draws the same text preview and controls', (
|
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
final text = recordedArtifact(
|
|
||||||
'notes.txt',
|
|
||||||
url: '/artifacts/1/1/notes.txt',
|
|
||||||
contentType: 'text/plain',
|
|
||||||
);
|
|
||||||
final group = _group([text]);
|
|
||||||
await _pumpViewer(
|
|
||||||
tester,
|
|
||||||
cupertino: true,
|
|
||||||
groups: [group],
|
|
||||||
selected: artifactVisitIdentity(group, text),
|
|
||||||
fetch: (_) async => ArtifactFetchResult(
|
|
||||||
status: 200,
|
|
||||||
bytes: utf8.encode('cupertino text'),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(find.text('cupertino text'), findsOneWidget);
|
|
||||||
expect(find.byType(CupertinoButton), findsWidgets);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('the gallery previews markdown through the chat renderer', (
|
testWidgets('the gallery previews markdown through the chat renderer', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
await _openMarkdownFromGallery(tester, cupertino: false);
|
await _openMarkdownFromGallery(tester);
|
||||||
|
|
||||||
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
expect(find.byType(ArtifactViewerPage), findsOneWidget);
|
||||||
expect(find.byType(ChatMarkdownView), findsOneWidget);
|
expect(find.byType(ChatMarkdownView), findsOneWidget);
|
||||||
@@ -583,7 +551,6 @@ void main() {
|
|||||||
) async {
|
) async {
|
||||||
await _openMarkdownFromGallery(
|
await _openMarkdownFromGallery(
|
||||||
tester,
|
tester,
|
||||||
cupertino: false,
|
|
||||||
name: 'notes.markdown',
|
name: 'notes.markdown',
|
||||||
contentType: '',
|
contentType: '',
|
||||||
);
|
);
|
||||||
@@ -597,29 +564,6 @@ void main() {
|
|||||||
expect(find.text('type not recorded · 4.0\u00a0KiB'), findsOneWidget);
|
expect(find.text('type not recorded · 4.0\u00a0KiB'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Cupertino markdown preview is native at 320px and 2x text', (
|
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
tester.view.physicalSize = const Size(640, 1200);
|
|
||||||
tester.view.devicePixelRatio = 2;
|
|
||||||
tester.platformDispatcher.textScaleFactorTestValue = 2;
|
|
||||||
tester.platformDispatcher.platformBrightnessTestValue = Brightness.dark;
|
|
||||||
addTearDown(tester.view.resetPhysicalSize);
|
|
||||||
addTearDown(tester.view.resetDevicePixelRatio);
|
|
||||||
addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue);
|
|
||||||
addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue);
|
|
||||||
|
|
||||||
await _openMarkdownFromGallery(tester, cupertino: true);
|
|
||||||
|
|
||||||
expect(tester.takeException(), isNull);
|
|
||||||
expect(find.byType(ChatMarkdownView), findsOneWidget);
|
|
||||||
expect(find.text('Report'), findsOneWidget);
|
|
||||||
expect(find.text('dart'), findsOneWidget);
|
|
||||||
expect(find.text('1 of 1 · text/markdown'), findsOneWidget);
|
|
||||||
// The viewer and its markdown add no Material control to a Cupertino host.
|
|
||||||
expect(find.byType(Material), findsNothing);
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('a swipe moves to the next and previous artifact', (
|
testWidgets('a swipe moves to the next and previous artifact', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
@@ -651,83 +595,71 @@ void main() {
|
|||||||
expect(find.textContaining('1 of 2'), findsWidgets);
|
expect(find.textContaining('1 of 2'), findsWidgets);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (final cupertino in [false, true]) {
|
testWidgets('pinch owns image pan and native reset', (tester) async {
|
||||||
testWidgets(
|
final first = recordedArtifact(
|
||||||
'pinch owns image pan and native reset (Cupertino=$cupertino)',
|
'a.png',
|
||||||
(tester) async {
|
url: '/artifacts/1/1/a.png',
|
||||||
final first = recordedArtifact(
|
contentType: 'image/png',
|
||||||
'a.png',
|
|
||||||
url: '/artifacts/1/1/a.png',
|
|
||||||
contentType: 'image/png',
|
|
||||||
);
|
|
||||||
final second = recordedArtifact(
|
|
||||||
'b.png',
|
|
||||||
url: '/artifacts/1/2/b.png',
|
|
||||||
contentType: 'image/png',
|
|
||||||
);
|
|
||||||
final groups = [
|
|
||||||
_group([first], visit: 1),
|
|
||||||
_group([second], visit: 2),
|
|
||||||
];
|
|
||||||
await _pumpViewer(
|
|
||||||
tester,
|
|
||||||
groups: groups,
|
|
||||||
cupertino: cupertino,
|
|
||||||
selected: artifactVisitIdentity(groups[0], first),
|
|
||||||
);
|
|
||||||
|
|
||||||
final viewport = tester.getRect(
|
|
||||||
find.byKey(const Key('artifact-image-zoom')),
|
|
||||||
);
|
|
||||||
final center = viewport.center;
|
|
||||||
final one = await tester.startGesture(
|
|
||||||
center + const Offset(-30, 0),
|
|
||||||
pointer: 1,
|
|
||||||
);
|
|
||||||
final two = await tester.startGesture(
|
|
||||||
center + const Offset(30, 0),
|
|
||||||
pointer: 2,
|
|
||||||
);
|
|
||||||
await one.moveTo(center + const Offset(-110, 0));
|
|
||||||
await two.moveTo(center + const Offset(110, 0));
|
|
||||||
await tester.pump();
|
|
||||||
await one.up();
|
|
||||||
await two.up();
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
expect(
|
|
||||||
find.byKey(const Key('artifact-image-reset-zoom')),
|
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
tester.widget(find.byKey(const Key('artifact-image-reset-zoom'))),
|
|
||||||
cupertino ? isA<CupertinoButton>() : isA<IconButton>(),
|
|
||||||
);
|
|
||||||
// A one-finger drag now belongs to the zoomed image, not the gallery.
|
|
||||||
await tester.fling(
|
|
||||||
find.byKey(const Key('artifact-image-zoom')),
|
|
||||||
const Offset(-300, 0),
|
|
||||||
1000,
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.textContaining('1 of 2'), findsWidgets);
|
|
||||||
|
|
||||||
await tester.tap(find.byKey(const Key('artifact-image-reset-zoom')));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(
|
|
||||||
find.byKey(const Key('artifact-image-reset-zoom')),
|
|
||||||
findsNothing,
|
|
||||||
);
|
|
||||||
await tester.fling(
|
|
||||||
find.byKey(const Key('artifact-viewer-swipe')),
|
|
||||||
const Offset(-300, 0),
|
|
||||||
1000,
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.textContaining('2 of 2'), findsWidgets);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
final second = recordedArtifact(
|
||||||
|
'b.png',
|
||||||
|
url: '/artifacts/1/2/b.png',
|
||||||
|
contentType: 'image/png',
|
||||||
|
);
|
||||||
|
final groups = [
|
||||||
|
_group([first], visit: 1),
|
||||||
|
_group([second], visit: 2),
|
||||||
|
];
|
||||||
|
await _pumpViewer(
|
||||||
|
tester,
|
||||||
|
groups: groups,
|
||||||
|
selected: artifactVisitIdentity(groups[0], first),
|
||||||
|
);
|
||||||
|
|
||||||
|
final viewport = tester.getRect(
|
||||||
|
find.byKey(const Key('artifact-image-zoom')),
|
||||||
|
);
|
||||||
|
final center = viewport.center;
|
||||||
|
final one = await tester.startGesture(
|
||||||
|
center + const Offset(-30, 0),
|
||||||
|
pointer: 1,
|
||||||
|
);
|
||||||
|
final two = await tester.startGesture(
|
||||||
|
center + const Offset(30, 0),
|
||||||
|
pointer: 2,
|
||||||
|
);
|
||||||
|
await one.moveTo(center + const Offset(-110, 0));
|
||||||
|
await two.moveTo(center + const Offset(110, 0));
|
||||||
|
await tester.pump();
|
||||||
|
await one.up();
|
||||||
|
await two.up();
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
expect(find.byKey(const Key('artifact-image-reset-zoom')), findsOneWidget);
|
||||||
|
expect(
|
||||||
|
tester.widget(find.byKey(const Key('artifact-image-reset-zoom'))),
|
||||||
|
isA<IconButton>(),
|
||||||
|
);
|
||||||
|
// A one-finger drag now belongs to the zoomed image, not the gallery.
|
||||||
|
await tester.fling(
|
||||||
|
find.byKey(const Key('artifact-image-zoom')),
|
||||||
|
const Offset(-300, 0),
|
||||||
|
1000,
|
||||||
|
);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.textContaining('1 of 2'), findsWidgets);
|
||||||
|
|
||||||
|
await tester.tap(find.byKey(const Key('artifact-image-reset-zoom')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byKey(const Key('artifact-image-reset-zoom')), findsNothing);
|
||||||
|
await tester.fling(
|
||||||
|
find.byKey(const Key('artifact-viewer-swipe')),
|
||||||
|
const Offset(-300, 0),
|
||||||
|
1000,
|
||||||
|
);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.textContaining('2 of 2'), findsWidgets);
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('Material paging stays inside 320px at 2x text', (tester) async {
|
testWidgets('Material paging stays inside 320px at 2x text', (tester) async {
|
||||||
tester.view.physicalSize = const Size(640, 1200);
|
tester.view.physicalSize = const Size(640, 1200);
|
||||||
@@ -770,57 +702,49 @@ void main() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (final cupertino in [false, true]) {
|
for (final size in [
|
||||||
for (final size in [
|
const Size(390, 844),
|
||||||
const Size(390, 844),
|
const Size(880, 1000),
|
||||||
const Size(880, 1000),
|
const Size(1100, 800),
|
||||||
const Size(1100, 800),
|
]) {
|
||||||
]) {
|
testWidgets('pager clears stacked bar at $size', (tester) async {
|
||||||
testWidgets(
|
tester.view.physicalSize = size;
|
||||||
'${cupertino ? 'Cupertino' : 'Material'} pager clears stacked bar at $size',
|
tester.view.devicePixelRatio = 1;
|
||||||
(tester) async {
|
addTearDown(tester.view.reset);
|
||||||
tester.view.physicalSize = size;
|
final first = recordedArtifact(
|
||||||
tester.view.devicePixelRatio = 1;
|
'a.png',
|
||||||
addTearDown(tester.view.reset);
|
url: '/artifacts/1/1/a.png',
|
||||||
final first = recordedArtifact(
|
contentType: 'image/png',
|
||||||
'a.png',
|
|
||||||
url: '/artifacts/1/1/a.png',
|
|
||||||
contentType: 'image/png',
|
|
||||||
);
|
|
||||||
final second = recordedArtifact(
|
|
||||||
'b.png',
|
|
||||||
url: '/artifacts/1/2/b.png',
|
|
||||||
contentType: 'image/png',
|
|
||||||
);
|
|
||||||
final groups = [
|
|
||||||
_group([first], visit: 1),
|
|
||||||
_group([second], visit: 2),
|
|
||||||
];
|
|
||||||
await _pumpViewer(
|
|
||||||
tester,
|
|
||||||
groups: groups,
|
|
||||||
selected: artifactVisitIdentity(groups[0], first),
|
|
||||||
cupertino: cupertino,
|
|
||||||
bottomClearance: 120,
|
|
||||||
);
|
|
||||||
final pager = tester.getRect(find.byKey(artifactNextKey));
|
|
||||||
expect(pager.bottom, lessThanOrEqualTo(size.height - 120));
|
|
||||||
// Right above the stacked bar, not lifted by its clearance twice
|
|
||||||
// (the bar is one 56 px pill above the inset plus its margin).
|
|
||||||
expect(pager.bottom, greaterThanOrEqualTo(size.height - 120 - 56));
|
|
||||||
// The preview sits between the bars, never behind either.
|
|
||||||
final preview = tester.getRect(
|
|
||||||
find.byType(ArtifactPreviewBody).first,
|
|
||||||
);
|
|
||||||
final actions = tester.getRect(
|
|
||||||
find.byKey(const Key('artifact-viewer-actions')),
|
|
||||||
);
|
|
||||||
final topBar = tester.getRect(find.byType(SegmentedBar).first);
|
|
||||||
expect(preview.bottom, lessThanOrEqualTo(actions.top));
|
|
||||||
expect(preview.top, greaterThanOrEqualTo(topBar.bottom - 1));
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
final second = recordedArtifact(
|
||||||
|
'b.png',
|
||||||
|
url: '/artifacts/1/2/b.png',
|
||||||
|
contentType: 'image/png',
|
||||||
|
);
|
||||||
|
final groups = [
|
||||||
|
_group([first], visit: 1),
|
||||||
|
_group([second], visit: 2),
|
||||||
|
];
|
||||||
|
await _pumpViewer(
|
||||||
|
tester,
|
||||||
|
groups: groups,
|
||||||
|
selected: artifactVisitIdentity(groups[0], first),
|
||||||
|
bottomClearance: 120,
|
||||||
|
);
|
||||||
|
final pager = tester.getRect(find.byKey(artifactNextKey));
|
||||||
|
expect(pager.bottom, lessThanOrEqualTo(size.height - 120));
|
||||||
|
// Right above the stacked bar, not lifted by its clearance twice
|
||||||
|
// (the bar is one 56 px pill above the inset plus its margin).
|
||||||
|
expect(pager.bottom, greaterThanOrEqualTo(size.height - 120 - 56));
|
||||||
|
// The preview sits between the bars, never behind either.
|
||||||
|
final preview = tester.getRect(find.byType(ArtifactPreviewBody).first);
|
||||||
|
final actions = tester.getRect(
|
||||||
|
find.byKey(const Key('artifact-viewer-actions')),
|
||||||
|
);
|
||||||
|
final topBar = tester.getRect(find.byType(SegmentedBar).first);
|
||||||
|
expect(preview.bottom, lessThanOrEqualTo(actions.top));
|
||||||
|
expect(preview.top, greaterThanOrEqualTo(topBar.bottom - 1));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
testWidgets('Escape closes the viewer back to the gallery', (tester) async {
|
testWidgets('Escape closes the viewer back to the gallery', (tester) async {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart';
|
import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart';
|
||||||
import 'package:pipelines_app/features/artifacts/domain/artifact_record.dart';
|
import 'package:pipelines_app/features/artifacts/domain/artifact_record.dart';
|
||||||
@@ -52,10 +51,9 @@ ArtifactGroup visitGroup({
|
|||||||
return ArtifactGroup(stageKey: stageKey, visit: visit, artifacts: artifacts);
|
return ArtifactGroup(stageKey: stageKey, visit: visit, artifacts: artifacts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The list under the native host it is composed into, with the optional
|
/// The list under the Material host it is composed into, with the optional
|
||||||
/// grouped page colour a gallery must supply.
|
/// grouped page colour a gallery must supply.
|
||||||
Widget artifactListHost({
|
Widget artifactListHost({
|
||||||
required bool cupertino,
|
|
||||||
required List<ArtifactGroup> groups,
|
required List<ArtifactGroup> groups,
|
||||||
String? selectedIdentity,
|
String? selectedIdentity,
|
||||||
ArtifactSelected? onSelected,
|
ArtifactSelected? onSelected,
|
||||||
@@ -73,16 +71,8 @@ Widget artifactListHost({
|
|||||||
).copyWith(textScaler: TextScaler.linear(textScale)),
|
).copyWith(textScaler: TextScaler.linear(textScale)),
|
||||||
child: child ?? const SizedBox.shrink(),
|
child: child ?? const SizedBox.shrink(),
|
||||||
);
|
);
|
||||||
return cupertino
|
return MaterialApp(
|
||||||
? CupertinoApp(
|
builder: scaled,
|
||||||
builder: scaled,
|
home: Scaffold(body: list),
|
||||||
home: CupertinoPageScaffold(
|
);
|
||||||
backgroundColor: CupertinoColors.systemGroupedBackground,
|
|
||||||
child: list,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: MaterialApp(
|
|
||||||
builder: scaled,
|
|
||||||
home: Scaffold(body: list),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,35 +32,25 @@ List<ArtifactGroup> _threeGroups() => [
|
|||||||
];
|
];
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('every group heading is a header node under both hosts', (
|
testWidgets('every group heading is a header node', (tester) async {
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
final handle = tester.ensureSemantics();
|
final handle = tester.ensureSemantics();
|
||||||
|
|
||||||
for (final cupertino in <bool>[false, true]) {
|
await tester.pumpWidget(artifactListHost(groups: _threeGroups()));
|
||||||
await tester.pumpWidget(
|
for (final label in <String>[
|
||||||
artifactListHost(cupertino: cupertino, groups: _threeGroups()),
|
'build · visit 1',
|
||||||
|
'review · visit 1',
|
||||||
|
'review · visit 2',
|
||||||
|
]) {
|
||||||
|
expect(
|
||||||
|
tester.getSemantics(find.text(label)),
|
||||||
|
isSemantics(label: label, isHeader: true),
|
||||||
|
reason: '$label must be exposed as a heading',
|
||||||
);
|
);
|
||||||
for (final label in <String>[
|
|
||||||
'build · visit 1',
|
|
||||||
'review · visit 1',
|
|
||||||
'review · visit 2',
|
|
||||||
]) {
|
|
||||||
expect(
|
|
||||||
tester.getSemantics(find.text(label)),
|
|
||||||
isSemantics(label: label, isHeader: true),
|
|
||||||
reason:
|
|
||||||
'${cupertino ? 'Cupertino' : 'Material'} must expose $label as a '
|
|
||||||
'heading',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
handle.dispose();
|
handle.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('a Cupertino heading stays separate from its single row', (
|
testWidgets('a heading stays separate from its single row', (tester) async {
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
final handle = tester.ensureSemantics();
|
final handle = tester.ensureSemantics();
|
||||||
final group = visitGroup(
|
final group = visitGroup(
|
||||||
visit: 2,
|
visit: 2,
|
||||||
@@ -74,7 +64,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
artifactListHost(cupertino: true, groups: [group], onSelected: (_, _) {}),
|
artifactListHost(groups: [group], onSelected: (_, _) {}),
|
||||||
);
|
);
|
||||||
|
|
||||||
final heading = tester.getSemantics(find.text('review · visit 2'));
|
final heading = tester.getSemantics(find.text('review · visit 2'));
|
||||||
@@ -105,9 +95,7 @@ void main() {
|
|||||||
handle.dispose();
|
handle.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('rows without a callback expose no tap action under both hosts', (
|
testWidgets('rows without a callback expose no tap action', (tester) async {
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
final handle = tester.ensureSemantics();
|
final handle = tester.ensureSemantics();
|
||||||
final group = visitGroup(
|
final group = visitGroup(
|
||||||
artifacts: [
|
artifacts: [
|
||||||
@@ -115,24 +103,20 @@ void main() {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
for (final cupertino in <bool>[false, true]) {
|
await tester.pumpWidget(artifactListHost(groups: [group]));
|
||||||
await tester.pumpWidget(
|
final row = tester.getSemantics(find.text('result.csv'));
|
||||||
artifactListHost(cupertino: cupertino, groups: [group]),
|
expect(
|
||||||
);
|
row.getSemanticsData().hasAction(SemanticsAction.tap),
|
||||||
final row = tester.getSemantics(find.text('result.csv'));
|
isFalse,
|
||||||
expect(
|
reason: 'without onSelected the row is read-only',
|
||||||
row.getSemanticsData().hasAction(SemanticsAction.tap),
|
);
|
||||||
isFalse,
|
expect(
|
||||||
reason: 'without onSelected the row is read-only',
|
row,
|
||||||
);
|
isSemantics(isButton: false),
|
||||||
expect(
|
reason: 'a read-only row must not expose a button role',
|
||||||
row,
|
);
|
||||||
isSemantics(isButton: false),
|
await tester.tap(find.text('result.csv'));
|
||||||
reason: 'a read-only row must not expose a button role',
|
expect(tester.takeException(), isNull);
|
||||||
);
|
|
||||||
await tester.tap(find.text('result.csv'));
|
|
||||||
expect(tester.takeException(), isNull);
|
|
||||||
}
|
|
||||||
handle.dispose();
|
handle.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -150,7 +134,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
artifactListHost(
|
artifactListHost(
|
||||||
cupertino: true,
|
|
||||||
groups: [first, second],
|
groups: [first, second],
|
||||||
selectedIdentity: artifactVisitIdentity(
|
selectedIdentity: artifactVisitIdentity(
|
||||||
second,
|
second,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/features/artifacts/ui/artifact_tile.dart';
|
import 'package:pipelines_app/features/artifacts/ui/artifact_tile.dart';
|
||||||
@@ -10,31 +9,20 @@ import 'package:pipelines_app/ui/layout/sticky_section.dart';
|
|||||||
import 'artifact_visit_list_fixture.dart';
|
import 'artifact_visit_list_fixture.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final cupertino in [false, true]) {
|
testWidgets('artifact groups start collapsed and expand', (tester) async {
|
||||||
testWidgets(
|
final group = visitGroup(artifacts: [recordedArtifact('result.csv')]);
|
||||||
'${cupertino ? 'Cupertino' : 'Material'} artifact groups start collapsed and expand',
|
await tester.pumpWidget(
|
||||||
(tester) async {
|
MaterialApp(
|
||||||
final group = visitGroup(artifacts: [recordedArtifact('result.csv')]);
|
home: Scaffold(body: ArtifactVisitList(groups: [group])),
|
||||||
await tester.pumpWidget(
|
),
|
||||||
cupertino
|
|
||||||
? CupertinoApp(
|
|
||||||
home: CupertinoPageScaffold(
|
|
||||||
child: ArtifactVisitList(groups: [group]),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: MaterialApp(
|
|
||||||
home: Scaffold(body: ArtifactVisitList(groups: [group])),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(find.byType(ArtifactTile), findsNothing);
|
|
||||||
expect(find.bySemanticsLabel('review · visit 1'), findsOneWidget);
|
|
||||||
|
|
||||||
await tester.tap(find.byType(StickySectionTitle));
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
expect(find.byType(ArtifactTile), findsOneWidget);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
}
|
expect(find.byType(ArtifactTile), findsNothing);
|
||||||
|
expect(find.bySemanticsLabel('review · visit 1'), findsOneWidget);
|
||||||
|
|
||||||
|
await tester.tap(find.byType(StickySectionTitle));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byType(ArtifactTile), findsOneWidget);
|
||||||
|
});
|
||||||
|
|
||||||
test('a shared filename in two visits has distinct identities', () {
|
test('a shared filename in two visits has distinct identities', () {
|
||||||
const url = '/artifacts/7/result.csv';
|
const url = '/artifacts/7/result.csv';
|
||||||
@@ -112,7 +100,6 @@ void main() {
|
|||||||
ArtifactRecord? pickedArtifact;
|
ArtifactRecord? pickedArtifact;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
artifactListHost(
|
artifactListHost(
|
||||||
cupertino: false,
|
|
||||||
groups: [first, second],
|
groups: [first, second],
|
||||||
selectedIdentity: artifactVisitIdentity(
|
selectedIdentity: artifactVisitIdentity(
|
||||||
second,
|
second,
|
||||||
@@ -147,48 +134,7 @@ void main() {
|
|||||||
expect(pickedArtifact!.url, '/artifacts/7/2/result.csv');
|
expect(pickedArtifact!.url, '/artifacts/7/2/result.csv');
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('Cupertino shows a grid of tiles and selects per visit', (
|
testWidgets('long names fit their tile at 2x', (tester) async {
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
final first = visitGroup(
|
|
||||||
visit: 1,
|
|
||||||
artifacts: [
|
|
||||||
recordedArtifact('result.csv', url: '/artifacts/7/1/result.csv'),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
final second = visitGroup(
|
|
||||||
visit: 2,
|
|
||||||
artifacts: [
|
|
||||||
recordedArtifact('result.csv', url: '/artifacts/7/2/result.csv'),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
ArtifactGroup? pickedGroup;
|
|
||||||
await tester.pumpWidget(
|
|
||||||
artifactListHost(
|
|
||||||
cupertino: true,
|
|
||||||
groups: [first, second],
|
|
||||||
selectedIdentity: artifactVisitIdentity(first, first.artifacts.single),
|
|
||||||
onSelected: (selectedGroup, _) => pickedGroup = selectedGroup,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
// A grid tile per artifact, no Material list tiles.
|
|
||||||
expect(find.byType(ArtifactTile), findsNWidgets(2));
|
|
||||||
expect(find.byType(ListTile), findsNothing);
|
|
||||||
expect(
|
|
||||||
tester
|
|
||||||
.widgetList<ArtifactTile>(find.byType(ArtifactTile))
|
|
||||||
.where((tile) => tile.selected),
|
|
||||||
hasLength(1),
|
|
||||||
);
|
|
||||||
|
|
||||||
await tester.tap(find.text('result.csv').last);
|
|
||||||
expect(pickedGroup, same(second));
|
|
||||||
});
|
|
||||||
|
|
||||||
testWidgets('long names fit their tile at 2x under both native hosts', (
|
|
||||||
tester,
|
|
||||||
) async {
|
|
||||||
tester.view.devicePixelRatio = 2;
|
tester.view.devicePixelRatio = 2;
|
||||||
tester.view.physicalSize = const Size(780, 1560);
|
tester.view.physicalSize = const Size(780, 1560);
|
||||||
addTearDown(tester.view.resetPhysicalSize);
|
addTearDown(tester.view.resetPhysicalSize);
|
||||||
@@ -206,22 +152,19 @@ void main() {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
for (final cupertino in <bool>[false, true]) {
|
await tester.pumpWidget(
|
||||||
await tester.pumpWidget(
|
artifactListHost(
|
||||||
artifactListHost(
|
groups: [withLongName],
|
||||||
cupertino: cupertino,
|
textScale: 2,
|
||||||
groups: [withLongName],
|
onSelected: (_, _) {},
|
||||||
textScale: 2,
|
),
|
||||||
onSelected: (_, _) {},
|
);
|
||||||
),
|
expect(tester.takeException(), isNull);
|
||||||
);
|
// A tile shows one line of the name; its accessible name is whole.
|
||||||
expect(tester.takeException(), isNull);
|
expect(
|
||||||
// A tile shows one line of the name; its accessible name is whole.
|
find.bySemanticsLabel(RegExp(RegExp.escape(longArtifactName))),
|
||||||
expect(
|
findsOneWidget,
|
||||||
find.bySemanticsLabel(RegExp(RegExp.escape(longArtifactName))),
|
);
|
||||||
findsOneWidget,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('a missing name and content type stay explicit', (tester) async {
|
testWidgets('a missing name and content type stay explicit', (tester) async {
|
||||||
@@ -236,9 +179,7 @@ void main() {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(artifactListHost(groups: [group]));
|
||||||
artifactListHost(cupertino: false, groups: [group]),
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(find.text('(unnamed artifact)'), findsOneWidget);
|
expect(find.text('(unnamed artifact)'), findsOneWidget);
|
||||||
expect(
|
expect(
|
||||||
@@ -254,9 +195,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('empty groups keep the honest empty wording', (tester) async {
|
testWidgets('empty groups keep the honest empty wording', (tester) async {
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(artifactListHost(groups: const <ArtifactGroup>[]));
|
||||||
artifactListHost(cupertino: false, groups: const <ArtifactGroup>[]),
|
|
||||||
);
|
|
||||||
expect(find.text('No stage artifacts recorded.'), findsOneWidget);
|
expect(find.text('No stage artifacts recorded.'), findsOneWidget);
|
||||||
expect(find.byType(ListTile), findsNothing);
|
expect(find.byType(ListTile), findsNothing);
|
||||||
});
|
});
|
||||||
@@ -319,11 +258,7 @@ void main() {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
artifactListHost(
|
artifactListHost(groups: [group], onSelected: (_, _) {}),
|
||||||
cupertino: false,
|
|
||||||
groups: [group],
|
|
||||||
onSelected: (_, _) {},
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
expect(find.byType(ArtifactTile), findsNWidgets(2));
|
expect(find.byType(ArtifactTile), findsNWidgets(2));
|
||||||
|
|
||||||
|
|||||||
@@ -25,39 +25,30 @@ void main() {
|
|||||||
durationMs: 50,
|
durationMs: 50,
|
||||||
);
|
);
|
||||||
|
|
||||||
for (final cupertino in [false, true]) {
|
testWidgets('Dismiss removes a finished card without a notice', (
|
||||||
final host = cupertino ? 'Cupertino' : 'Material';
|
tester,
|
||||||
|
) async {
|
||||||
|
gateway.runs = [finished('run_done'), shellRecord('run_live')];
|
||||||
|
await tester.pumpWidget(shellThread(gateway));
|
||||||
|
await tester.pump();
|
||||||
|
|
||||||
testWidgets('$host: Dismiss removes a finished card without a notice', (
|
expect(card(), findsNWidgets(2));
|
||||||
tester,
|
// Only the finished card offers Dismiss; a running one must stop first.
|
||||||
) async {
|
expect(dismiss, findsOneWidget);
|
||||||
gateway.runs = [finished('run_done'), shellRecord('run_live')];
|
expect(find.byTooltip('Dismiss'), findsOneWidget);
|
||||||
await tester.pumpWidget(shellThread(gateway, cupertino: cupertino));
|
|
||||||
await tester.pump();
|
|
||||||
|
|
||||||
expect(card(), findsNWidgets(2));
|
await tester.tap(dismiss);
|
||||||
// Only the finished card offers Dismiss; a running one must stop first.
|
await tester.pump();
|
||||||
expect(dismiss, findsOneWidget);
|
await tester.pump(const Duration(milliseconds: 300));
|
||||||
expect(
|
expect(gateway.bodies('chat_shell_dismiss').single['run_ids'], [
|
||||||
cupertino
|
'run_done',
|
||||||
? find.bySemanticsLabel('Dismiss')
|
]);
|
||||||
: find.byTooltip('Dismiss'),
|
expect(card(), findsOneWidget);
|
||||||
findsOneWidget,
|
expect(find.text('\$ true'), findsNothing);
|
||||||
);
|
expect(notice, findsNothing);
|
||||||
|
expect(find.text('Command dismissed'), findsNothing);
|
||||||
await tester.tap(dismiss);
|
expect(find.text('Undo'), findsNothing);
|
||||||
await tester.pump();
|
});
|
||||||
await tester.pump(const Duration(milliseconds: 300));
|
|
||||||
expect(gateway.bodies('chat_shell_dismiss').single['run_ids'], [
|
|
||||||
'run_done',
|
|
||||||
]);
|
|
||||||
expect(card(), findsOneWidget);
|
|
||||||
expect(find.text('\$ true'), findsNothing);
|
|
||||||
expect(notice, findsNothing);
|
|
||||||
expect(find.text('Command dismissed'), findsNothing);
|
|
||||||
expect(find.text('Undo'), findsNothing);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
testWidgets('a refused dismissal brings the card back with the reason', (
|
testWidgets('a refused dismissal brings the card back with the reason', (
|
||||||
tester,
|
tester,
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/core/api_gateway.dart';
|
import 'package:pipelines_app/core/api_gateway.dart';
|
||||||
@@ -168,7 +167,7 @@ String terminalText(WidgetTester tester, {int index = 0}) {
|
|||||||
return lines.join('\n');
|
return lines.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget shellThread(ShellGateway gateway, {bool cupertino = false}) {
|
Widget shellThread(ShellGateway gateway) {
|
||||||
final thread = ChatThreadView(
|
final thread = ChatThreadView(
|
||||||
gateway: gateway,
|
gateway: gateway,
|
||||||
sessionId: 's',
|
sessionId: 's',
|
||||||
@@ -176,7 +175,5 @@ Widget shellThread(ShellGateway gateway, {bool cupertino = false}) {
|
|||||||
onBack: () {},
|
onBack: () {},
|
||||||
drafts: MemoryChatDraftStore(),
|
drafts: MemoryChatDraftStore(),
|
||||||
);
|
);
|
||||||
return cupertino
|
return MaterialApp(home: Scaffold(body: thread));
|
||||||
? CupertinoApp(home: CupertinoPageScaffold(child: thread))
|
|
||||||
: MaterialApp(home: Scaffold(body: thread));
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,89 +14,79 @@ void main() {
|
|||||||
|
|
||||||
Finder card() => find.bySemanticsIdentifier('chat-shell-run-card');
|
Finder card() => find.bySemanticsIdentifier('chat-shell-run-card');
|
||||||
|
|
||||||
for (final cupertino in [false, true]) {
|
testWidgets('a running command streams output and stops', (tester) async {
|
||||||
final host = cupertino ? 'Cupertino' : 'Material';
|
gateway.runs = [shellRecord('run_a', output: 'line 1\n')];
|
||||||
|
await tester.pumpWidget(shellThread(gateway));
|
||||||
|
await tester.pump();
|
||||||
|
|
||||||
testWidgets('$host: a running command streams output and stops', (
|
expect(card(), findsOneWidget);
|
||||||
tester,
|
expect(find.text('\$ make test'), findsOneWidget);
|
||||||
) async {
|
expect(find.byKey(const Key('chat-shell-run-running')), findsOneWidget);
|
||||||
gateway.runs = [shellRecord('run_a', output: 'line 1\n')];
|
gateway.emitOutput('run_a', 'line 2\n', 7);
|
||||||
await tester.pumpWidget(shellThread(gateway, cupertino: cupertino));
|
await tester.pump();
|
||||||
await tester.pump();
|
expect(terminalText(tester), 'line 1\nline 2');
|
||||||
|
expect(find.byKey(const Key('chat-shell-run-share')), findsNothing);
|
||||||
|
|
||||||
expect(card(), findsOneWidget);
|
await tester.tap(find.byKey(const Key('chat-shell-run-stop')));
|
||||||
expect(find.text('\$ make test'), findsOneWidget);
|
await tester.pump();
|
||||||
expect(find.byKey(const Key('chat-shell-run-running')), findsOneWidget);
|
expect(gateway.bodies('chat_shell_stop').single['run_id'], 'run_a');
|
||||||
gateway.emitOutput('run_a', 'line 2\n', 7);
|
expect(find.text('Stopping…'), findsOneWidget);
|
||||||
await tester.pump();
|
|
||||||
expect(terminalText(tester), 'line 1\nline 2');
|
|
||||||
expect(find.byKey(const Key('chat-shell-run-share')), findsNothing);
|
|
||||||
|
|
||||||
await tester.tap(find.byKey(const Key('chat-shell-run-stop')));
|
gateway.emitRun(shellRecord('run_a', status: 'stopped', durationMs: 2400));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(gateway.bodies('chat_shell_stop').single['run_id'], 'run_a');
|
expect(find.byKey(const Key('chat-shell-run-running')), findsNothing);
|
||||||
expect(find.text('Stopping…'), findsOneWidget);
|
expect(find.text('Stopped · 2.4 s'), findsOneWidget);
|
||||||
|
expect(find.byKey(const Key('chat-shell-run-stop')), findsNothing);
|
||||||
|
// The streamed output stays after the lifecycle frame.
|
||||||
|
expect(terminalText(tester), 'line 1\nline 2');
|
||||||
|
});
|
||||||
|
|
||||||
gateway.emitRun(
|
testWidgets('finished commands show their exit status', (tester) async {
|
||||||
shellRecord('run_a', status: 'stopped', durationMs: 2400),
|
gateway.runs = [
|
||||||
);
|
shellRecord(
|
||||||
await tester.pump();
|
'run_ok',
|
||||||
expect(find.byKey(const Key('chat-shell-run-running')), findsNothing);
|
command: 'true',
|
||||||
expect(find.text('Stopped · 2.4 s'), findsOneWidget);
|
status: 'exited',
|
||||||
expect(find.byKey(const Key('chat-shell-run-stop')), findsNothing);
|
exitCode: 0,
|
||||||
// The streamed output stays after the lifecycle frame.
|
output: 'fine\n',
|
||||||
expect(terminalText(tester), 'line 1\nline 2');
|
durationMs: 120,
|
||||||
});
|
),
|
||||||
|
shellRecord(
|
||||||
|
'run_bad',
|
||||||
|
command: 'false',
|
||||||
|
status: 'exited',
|
||||||
|
exitCode: 1,
|
||||||
|
output: 'broken\n',
|
||||||
|
durationMs: 3000,
|
||||||
|
),
|
||||||
|
];
|
||||||
|
await tester.pumpWidget(shellThread(gateway));
|
||||||
|
await tester.pump();
|
||||||
|
// Finished terminals shrink to their output after their first frame.
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
testWidgets('$host: finished commands show their exit status', (
|
expect(card(), findsNWidgets(2));
|
||||||
tester,
|
expect(find.text('Exit 0 · 120 ms'), findsOneWidget);
|
||||||
) async {
|
expect(find.text('Exit 1 · 3.0 s'), findsOneWidget);
|
||||||
gateway.runs = [
|
expect(find.byKey(const Key('chat-shell-run-copy')), findsNWidgets(2));
|
||||||
shellRecord(
|
});
|
||||||
'run_ok',
|
|
||||||
command: 'true',
|
|
||||||
status: 'exited',
|
|
||||||
exitCode: 0,
|
|
||||||
output: 'fine\n',
|
|
||||||
durationMs: 120,
|
|
||||||
),
|
|
||||||
shellRecord(
|
|
||||||
'run_bad',
|
|
||||||
command: 'false',
|
|
||||||
status: 'exited',
|
|
||||||
exitCode: 1,
|
|
||||||
output: 'broken\n',
|
|
||||||
durationMs: 3000,
|
|
||||||
),
|
|
||||||
];
|
|
||||||
await tester.pumpWidget(shellThread(gateway, cupertino: cupertino));
|
|
||||||
await tester.pump();
|
|
||||||
// Finished terminals shrink to their output after their first frame.
|
|
||||||
await tester.pumpAndSettle();
|
|
||||||
|
|
||||||
expect(card(), findsNWidgets(2));
|
testWidgets('Send to agent shares the run once', (tester) async {
|
||||||
expect(find.text('Exit 0 · 120 ms'), findsOneWidget);
|
gateway.runs = [
|
||||||
expect(find.text('Exit 1 · 3.0 s'), findsOneWidget);
|
shellRecord('run_a', status: 'exited', exitCode: 0, output: 'ok\n'),
|
||||||
expect(find.byKey(const Key('chat-shell-run-copy')), findsNWidgets(2));
|
];
|
||||||
});
|
await tester.pumpWidget(shellThread(gateway));
|
||||||
|
await tester.pump();
|
||||||
|
|
||||||
testWidgets('$host: Send to agent shares the run once', (tester) async {
|
expect(gateway.calls.where((c) => c.type == 'chat_prompt'), isEmpty);
|
||||||
gateway.runs = [
|
await tester.tap(find.byKey(const Key('chat-shell-run-share')));
|
||||||
shellRecord('run_a', status: 'exited', exitCode: 0, output: 'ok\n'),
|
await tester.pump();
|
||||||
];
|
expect(gateway.bodies('chat_shell_share').single['run_id'], 'run_a');
|
||||||
await tester.pumpWidget(shellThread(gateway, cupertino: cupertino));
|
expect(find.text('Sent to agent'), findsOneWidget);
|
||||||
await tester.pump();
|
await tester.tap(find.byKey(const Key('chat-shell-run-share')));
|
||||||
|
await tester.pump();
|
||||||
expect(gateway.calls.where((c) => c.type == 'chat_prompt'), isEmpty);
|
expect(gateway.bodies('chat_shell_share'), hasLength(1));
|
||||||
await tester.tap(find.byKey(const Key('chat-shell-run-share')));
|
});
|
||||||
await tester.pump();
|
|
||||||
expect(gateway.bodies('chat_shell_share').single['run_id'], 'run_a');
|
|
||||||
expect(find.text('Sent to agent'), findsOneWidget);
|
|
||||||
await tester.tap(find.byKey(const Key('chat-shell-run-share')));
|
|
||||||
await tester.pump();
|
|
||||||
expect(gateway.bodies('chat_shell_share'), hasLength(1));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
testWidgets('Copy output copies the plain-text rendering', (tester) async {
|
testWidgets('Copy output copies the plain-text rendering', (tester) async {
|
||||||
final copied = <String>[];
|
final copied = <String>[];
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/core/api_gateway.dart';
|
import 'package:pipelines_app/core/api_gateway.dart';
|
||||||
@@ -8,8 +7,6 @@ import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
|||||||
|
|
||||||
import '../../artifacts/domain/artifact_fixtures.dart';
|
import '../../artifacts/domain/artifact_fixtures.dart';
|
||||||
|
|
||||||
enum _Platform { material, cupertino }
|
|
||||||
|
|
||||||
class _FakeGateway implements ApiGateway {
|
class _FakeGateway implements ApiGateway {
|
||||||
_FakeGateway(this.detail);
|
_FakeGateway(this.detail);
|
||||||
final JsonMap detail;
|
final JsonMap detail;
|
||||||
@@ -34,7 +31,6 @@ JsonMap _run({required List<JsonMap> steps}) => <String, dynamic>{
|
|||||||
|
|
||||||
Future<void> _pumpDetail(
|
Future<void> _pumpDetail(
|
||||||
WidgetTester tester,
|
WidgetTester tester,
|
||||||
_Platform platform,
|
|
||||||
RunsController controller,
|
RunsController controller,
|
||||||
ApiGateway gateway,
|
ApiGateway gateway,
|
||||||
) async {
|
) async {
|
||||||
@@ -46,17 +42,7 @@ Future<void> _pumpDetail(
|
|||||||
gateway: gateway,
|
gateway: gateway,
|
||||||
onBack: () {},
|
onBack: () {},
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(MaterialApp(home: Scaffold(body: view)));
|
||||||
platform == _Platform.material
|
|
||||||
? MaterialApp(home: Scaffold(body: view))
|
|
||||||
: CupertinoApp(
|
|
||||||
builder: (context, app) => Theme(
|
|
||||||
data: ThemeData(platform: TargetPlatform.iOS),
|
|
||||||
child: app!,
|
|
||||||
),
|
|
||||||
home: CupertinoPageScaffold(child: view),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,61 +53,49 @@ Future<RunsController> _loaded(ApiGateway gateway) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final platform in _Platform.values) {
|
testWidgets('the action opens the recorded groups', (tester) async {
|
||||||
testWidgets('${platform.name}: the action opens the recorded groups', (
|
final gateway = _FakeGateway(
|
||||||
tester,
|
_run(
|
||||||
) async {
|
steps: [
|
||||||
final gateway = _FakeGateway(
|
step(
|
||||||
_run(
|
stage: 'implementer',
|
||||||
steps: [
|
sequence: 1,
|
||||||
step(
|
artifacts: [
|
||||||
stage: 'implementer',
|
artifact('build.log', contentType: 'text/plain', sizeBytes: 2337),
|
||||||
sequence: 1,
|
],
|
||||||
artifacts: [
|
),
|
||||||
artifact(
|
step(
|
||||||
'build.log',
|
stage: 'reviewer',
|
||||||
contentType: 'text/plain',
|
sequence: 2,
|
||||||
sizeBytes: 2337,
|
artifacts: [
|
||||||
),
|
artifact('shot.png', contentType: 'image/png', sizeBytes: 80544),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
step(
|
],
|
||||||
stage: 'reviewer',
|
),
|
||||||
sequence: 2,
|
);
|
||||||
artifacts: [
|
final controller = await _loaded(gateway);
|
||||||
artifact(
|
addTearDown(controller.dispose);
|
||||||
'shot.png',
|
await _pumpDetail(tester, controller, gateway);
|
||||||
contentType: 'image/png',
|
|
||||||
sizeBytes: 80544,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
final controller = await _loaded(gateway);
|
|
||||||
addTearDown(controller.dispose);
|
|
||||||
await _pumpDetail(tester, platform, controller, gateway);
|
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
||||||
findsOneWidget,
|
findsOneWidget,
|
||||||
);
|
);
|
||||||
await tester.ensureVisible(
|
await tester.ensureVisible(
|
||||||
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
||||||
);
|
);
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts')));
|
await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
// Artifact groups start open: the files show without a tap.
|
// Artifact groups start open: the files show without a tap.
|
||||||
|
|
||||||
expect(find.text('Artifacts · 2 recorded'), findsOneWidget);
|
expect(find.text('Artifacts · 2 recorded'), findsOneWidget);
|
||||||
expect(find.text('build.log'), findsOneWidget);
|
expect(find.text('build.log'), findsOneWidget);
|
||||||
expect(find.text('shot.png'), findsOneWidget);
|
expect(find.text('shot.png'), findsOneWidget);
|
||||||
expect(find.text('implementer · visit 1'), findsOneWidget);
|
expect(find.text('implementer · visit 1'), findsOneWidget);
|
||||||
expect(find.text('reviewer · visit 1'), findsOneWidget);
|
expect(find.text('reviewer · visit 1'), findsOneWidget);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
testWidgets('the action is offered only when the detail has steps', (
|
testWidgets('the action is offered only when the detail has steps', (
|
||||||
tester,
|
tester,
|
||||||
@@ -129,7 +103,7 @@ void main() {
|
|||||||
final gateway = _FakeGateway(_run(steps: const []));
|
final gateway = _FakeGateway(_run(steps: const []));
|
||||||
final controller = await _loaded(gateway);
|
final controller = await _loaded(gateway);
|
||||||
addTearDown(controller.dispose);
|
addTearDown(controller.dispose);
|
||||||
await _pumpDetail(tester, _Platform.material, controller, gateway);
|
await _pumpDetail(tester, controller, gateway);
|
||||||
expect(
|
expect(
|
||||||
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
||||||
findsNothing,
|
findsNothing,
|
||||||
@@ -146,7 +120,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
final controller = await _loaded(gateway);
|
final controller = await _loaded(gateway);
|
||||||
addTearDown(controller.dispose);
|
addTearDown(controller.dispose);
|
||||||
await _pumpDetail(tester, _Platform.material, controller, gateway);
|
await _pumpDetail(tester, controller, gateway);
|
||||||
|
|
||||||
await tester.ensureVisible(
|
await tester.ensureVisible(
|
||||||
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
||||||
@@ -167,7 +141,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
final controller = await _loaded(gateway);
|
final controller = await _loaded(gateway);
|
||||||
addTearDown(controller.dispose);
|
addTearDown(controller.dispose);
|
||||||
await _pumpDetail(tester, _Platform.material, controller, gateway);
|
await _pumpDetail(tester, controller, gateway);
|
||||||
|
|
||||||
await tester.ensureVisible(
|
await tester.ensureVisible(
|
||||||
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
find.byKey(const ValueKey('run-detail-tab-artifacts')),
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ void main() {
|
|||||||
)
|
)
|
||||||
.position;
|
.position;
|
||||||
|
|
||||||
for (final platform in RunDetailTestPlatform.values) {
|
for (final platform in const [RunDetailTestPlatform.material]) {
|
||||||
testWidgets('${platform.name} run header floats under the bar and the '
|
testWidgets('${platform.name} run header floats under the bar and the '
|
||||||
'tab scrolls behind both', (tester) async {
|
'tab scrolls behind both', (tester) async {
|
||||||
await pumpRunDetail(tester, platform, size: const Size(390, 520));
|
await pumpRunDetail(tester, platform, size: const Size(390, 520));
|
||||||
|
|||||||
@@ -26,13 +26,15 @@ void main() {
|
|||||||
expect(tester.takeException(), isNull);
|
expect(tester.takeException(), isNull);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWidgets('${platform.name} the stage Session nests no group in a '
|
if (platform == RunDetailTestPlatform.material) {
|
||||||
'group', (tester) async {
|
testWidgets('${platform.name} the stage Session nests no group in a '
|
||||||
await openVisit(tester, platform);
|
'group', (tester) async {
|
||||||
await openVisitTab(tester, RunVisitSection.session);
|
await openVisit(tester, platform);
|
||||||
expect(find.text('Turn documents'), findsOneWidget);
|
await openVisitTab(tester, RunVisitSection.session);
|
||||||
expect(find.byType(CupertinoListSection), findsNothing);
|
expect(find.text('Turn documents'), findsOneWidget);
|
||||||
});
|
expect(find.byType(CupertinoListSection), findsNothing);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
testWidgets('${platform.name} beside a list the tabs and the header '
|
testWidgets('${platform.name} beside a list the tabs and the header '
|
||||||
'share one row', (tester) async {
|
'share one row', (tester) async {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
@@ -20,7 +19,7 @@ JsonMap document(String name, int sequence, {String? url}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final platform in RunDetailTestPlatform.values) {
|
for (final platform in const [RunDetailTestPlatform.material]) {
|
||||||
testWidgets(
|
testWidgets(
|
||||||
'${platform.name} Session exposes exact repeated visit documents',
|
'${platform.name} Session exposes exact repeated visit documents',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
@@ -87,11 +86,7 @@ void main() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
await tester.pumpWidget(const SizedBox.shrink());
|
await tester.pumpWidget(const SizedBox.shrink());
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(MaterialApp(home: preview));
|
||||||
platform == RunDetailTestPlatform.cupertino
|
|
||||||
? CupertinoApp(home: preview)
|
|
||||||
: MaterialApp(home: preview),
|
|
||||||
);
|
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
expect(fetched.single.path, '/artifacts/3/$name');
|
expect(fetched.single.path, '/artifacts/3/$name');
|
||||||
expect(find.text('Raw $name visit 3'), findsOneWidget);
|
expect(find.text('Raw $name visit 3'), findsOneWidget);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ Future<void> _showTurnDocuments(WidgetTester tester) async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final platform in RunDetailTestPlatform.values) {
|
for (final platform in const [RunDetailTestPlatform.material]) {
|
||||||
testWidgets('${platform.name} stage tabs sit at the bottom with one Back', (
|
testWidgets('${platform.name} stage tabs sit at the bottom with one Back', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
@@ -221,7 +221,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final platform in RunDetailTestPlatform.values) {
|
for (final platform in const [RunDetailTestPlatform.material]) {
|
||||||
for (final size in const [
|
for (final size in const [
|
||||||
Size(390, 844),
|
Size(390, 844),
|
||||||
Size(884, 832),
|
Size(884, 832),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import 'run_detail_graph_support.dart';
|
|||||||
import 'run_detail_visit_support.dart';
|
import 'run_detail_visit_support.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final platform in RunDetailTestPlatform.values) {
|
for (final platform in const [RunDetailTestPlatform.material]) {
|
||||||
testWidgets('${platform.name} legacy session.html stays openable', (
|
testWidgets('${platform.name} legacy session.html stays openable', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import 'run_detail_graph_support.dart';
|
|||||||
import 'run_detail_visit_support.dart';
|
import 'run_detail_visit_support.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final platform in RunDetailTestPlatform.values) {
|
for (final platform in const [RunDetailTestPlatform.material]) {
|
||||||
testWidgets('${platform.name} visit shows only its recorded facts', (
|
testWidgets('${platform.name} visit shows only its recorded facts', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ void _expectSummarySection(RunSearchTarget target, RunSummarySection? section) {
|
|||||||
const _origin = 'http://127.0.0.1:8096';
|
const _origin = 'http://127.0.0.1:8096';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final platform in RunDetailTestPlatform.values) {
|
for (final platform in const [RunDetailTestPlatform.material]) {
|
||||||
testWidgets('${platform.name} artifact hit opens its recorded visit', (
|
testWidgets('${platform.name} artifact hit opens its recorded visit', (
|
||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
@@ -145,7 +145,7 @@ void main() {
|
|||||||
return {...run, 'steps': steps};
|
return {...run, 'steps': steps};
|
||||||
}
|
}
|
||||||
|
|
||||||
for (final platform in RunDetailTestPlatform.values) {
|
for (final platform in const [RunDetailTestPlatform.material]) {
|
||||||
testWidgets('${platform.name} artifact hit opens that artifact over the '
|
testWidgets('${platform.name} artifact hit opens that artifact over the '
|
||||||
'Artifacts tab, and the timeline keeps working afterwards', (
|
'Artifacts tab, and the timeline keeps working afterwards', (
|
||||||
tester,
|
tester,
|
||||||
|
|||||||
Reference in New Issue
Block a user