diff --git a/app/lib/features/artifacts/actions/artifact_file_actions.dart b/app/lib/features/artifacts/actions/artifact_file_actions.dart index ee24e616..ea54b0dc 100644 --- a/app/lib/features/artifacts/actions/artifact_file_actions.dart +++ b/app/lib/features/artifacts/actions/artifact_file_actions.dart @@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/glass_bar.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_record.dart'; import '../domain/artifact_url.dart'; import '../ui/artifact_viewer_fetch.dart'; @@ -81,19 +80,15 @@ class _ArtifactFileActionsState extends State { listenable: _controller, builder: (context, _) => widget.compact ? _IconActions(controller: _controller) - : _ActionBar( - controller: _controller, - cupertino: usesCupertinoHost(context), - ), + : _ActionBar(controller: _controller), ); } } class _ActionBar extends StatelessWidget { - const _ActionBar({required this.controller, required this.cupertino}); + const _ActionBar({required this.controller}); final ArtifactFileActionsController controller; - final bool cupertino; @override Widget build(BuildContext context) { @@ -142,14 +137,11 @@ class _ActionBar extends StatelessWidget { child: Row( mainAxisSize: MainAxisSize.min, children: [ - if (cupertino) - const CupertinoActivityIndicator(radius: 8) - else - const SizedBox( - width: 14, - height: 14, - child: CircularProgressIndicator(strokeWidth: 2), - ), + const SizedBox( + width: 14, + height: 14, + child: CircularProgressIndicator(strokeWidth: 2), + ), const SizedBox(width: 8), Flexible(child: Text(status)), ], @@ -182,9 +174,6 @@ class _ActionBar extends StatelessWidget { required IconData icon, required VoidCallback? onPressed, }) { - if (cupertino) { - return CupertinoButton(onPressed: onPressed, child: Text(label)); - } return TextButton.icon( onPressed: onPressed, icon: Icon(icon, size: 18), @@ -241,28 +230,15 @@ class ArtifactIconAction extends StatelessWidget { final String label; final IconData icon; + + /// Retained for callers that still pass the Cupertino glyph; the Material + /// action always draws [icon]. final IconData cupertinoIcon; final VoidCallback? onPressed; final bool busy; @override Widget build(BuildContext context) { - if (usesCupertinoHost(context)) { - return Semantics( - button: true, - label: label, - child: CupertinoButton( - // One square touch target, like the top bar's other actions, so a - // round pill is centred on it and a glass bar's edge gaps hold. - padding: EdgeInsets.zero, - minimumSize: GlassBarMetrics.cupertinoMinimumSize(), - onPressed: onPressed, - child: busy - ? const CupertinoActivityIndicator(radius: 9) - : Icon(cupertinoIcon, size: GlassBarMetrics.iconSize(true)), - ), - ); - } return IconButton( tooltip: label, constraints: GlassBarMetrics.materialConstraints(), diff --git a/app/lib/features/artifacts/ui/artifact_controls_overlay.dart b/app/lib/features/artifacts/ui/artifact_controls_overlay.dart index bc58f4c4..f0c8bf5d 100644 --- a/app/lib/features/artifacts/ui/artifact_controls_overlay.dart +++ b/app/lib/features/artifacts/ui/artifact_controls_overlay.dart @@ -1,10 +1,7 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; - /// Open, Copy and the file actions float over the top of the content: shown /// when the page opens and whenever the content is touched, hidden again after /// a few seconds without use, so nothing needs scrolling to reach them. @@ -55,14 +52,9 @@ class _ArtifactControlsOverlayState extends State { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); - final surface = cupertino - ? CupertinoColors.systemBackground - .resolveFrom(context) - .withValues(alpha: 0.92) - : Theme.of( - context, - ).colorScheme.surfaceContainerHigh.withValues(alpha: 0.94); + final surface = Theme.of( + context, + ).colorScheme.surfaceContainerHigh.withValues(alpha: 0.94); return Stack( children: [ // Any touch on the content brings the controls back. diff --git a/app/lib/features/artifacts/ui/artifact_document_section.dart b/app/lib/features/artifacts/ui/artifact_document_section.dart index bb5a4631..631000f8 100644 --- a/app/lib/features/artifacts/ui/artifact_document_section.dart +++ b/app/lib/features/artifacts/ui/artifact_document_section.dart @@ -1,8 +1,5 @@ -import '../../../ui/layout/section_heading.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_document.dart'; import '../domain/artifact_groups.dart'; import 'artifact_record_row.dart'; @@ -50,23 +47,14 @@ class ArtifactDocumentSection extends StatelessWidget { children: rows, ); } - // Flat rows under a quiet label on both hosts: the section sits inside - // the visit's Session page, which is itself flat, so a Cupertino inset - // group here would be a group nested in a group. - final cupertino = usesCupertinoHost(context); + // Flat rows under a quiet label: the section sits inside the visit's + // Session page, which is itself flat. return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Padding( padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4), - child: Semantics( - container: true, - header: true, - child: Text( - title, - style: cupertino ? SectionHeadingStyle.of(context).title : null, - ), - ), + child: Semantics(container: true, header: true, child: Text(title)), ), ...rows, ], @@ -98,42 +86,15 @@ class _AbsentDocumentRow extends StatelessWidget { @override Widget build(BuildContext context) { - if (!usesCupertinoHost(context)) { - // The absence line is informational product content, so it keeps the - // theme's normal secondary label colour. A disabled tile would paint both - // lines at the disabled colour (about 2.7:1 in light mode); no `onTap` - // keeps the row non-actionable without dimming it. - return ListTile( - title: Text(document.name), - subtitle: Text( - document.absence, - style: TextStyle( - color: Theme.of(context).colorScheme.onSurfaceVariant, - ), - ), - ); - } - final textTheme = CupertinoTheme.of(context).textTheme; - final absenceStyle = textTheme.textStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ); - return Semantics( - container: true, - child: SizedBox( - width: double.infinity, - child: Padding( - padding: kCupertinoButtonPadding[CupertinoButtonSize.large]!, - child: DefaultTextStyle.merge( - style: textTheme.textStyle, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(document.name), - Text(document.absence, style: absenceStyle), - ], - ), - ), - ), + // The absence line is informational product content, so it keeps the + // theme's normal secondary label colour. A disabled tile would paint both + // lines at the disabled colour (about 2.7:1 in light mode); no `onTap` + // keeps the row non-actionable without dimming it. + return ListTile( + title: Text(document.name), + subtitle: Text( + document.absence, + style: TextStyle(color: Theme.of(context).colorScheme.onSurfaceVariant), ), ); } diff --git a/app/lib/features/artifacts/ui/artifact_fullscreen.dart b/app/lib/features/artifacts/ui/artifact_fullscreen.dart index dd31aa15..3ac2d334 100644 --- a/app/lib/features/artifacts/ui/artifact_fullscreen.dart +++ b/app/lib/features/artifacts/ui/artifact_fullscreen.dart @@ -30,12 +30,13 @@ class ArtifactFullscreenScope extends InheritedWidget { /// The full-screen view's route, pushed on the root navigator so it covers /// the shell's bars and list pane. A full-screen dialog route: its bar shows /// the platform's Close, and the system back gesture leaves it. +/// +/// [cupertino] is retained for callers that still pass it; the route is always +/// the Material one. Route artifactFullscreenRoute({ required bool cupertino, required WidgetBuilder builder, -}) => cupertino - ? CupertinoPageRoute(fullscreenDialog: true, builder: builder) - : MaterialPageRoute(fullscreenDialog: true, builder: builder); +}) => MaterialPageRoute(fullscreenDialog: true, builder: builder); /// The zoom factors Zoom in and Zoom out step through. const List artifactHtmlZoomSteps = [ diff --git a/app/lib/features/artifacts/ui/artifact_fullscreen_host.dart b/app/lib/features/artifacts/ui/artifact_fullscreen_host.dart index 5593e8a7..48aea5d9 100644 --- a/app/lib/features/artifacts/ui/artifact_fullscreen_host.dart +++ b/app/lib/features/artifacts/ui/artifact_fullscreen_host.dart @@ -1,6 +1,5 @@ import 'package:flutter/widgets.dart'; -import '../../../ui/adaptive/host.dart'; import 'artifact_fullscreen.dart'; /// Lets a viewer page open its own content as the full-screen view. @@ -42,7 +41,7 @@ mixin ArtifactFullscreenHost on State { if (_fullscreen != null) return; htmlZoom.value = 1; final route = artifactFullscreenRoute( - cupertino: usesCupertinoHost(context), + cupertino: false, builder: (_) => ArtifactFullscreenScope( htmlZoom: htmlZoom, child: ListenableBuilder( diff --git a/app/lib/features/artifacts/ui/artifact_gallery_action.dart b/app/lib/features/artifacts/ui/artifact_gallery_action.dart index 0cd7ebc6..49ee0983 100644 --- a/app/lib/features/artifacts/ui/artifact_gallery_action.dart +++ b/app/lib/features/artifacts/ui/artifact_gallery_action.dart @@ -1,9 +1,7 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; import '../../../core/transport/pipelines_client.dart'; -import '../../../ui/adaptive/host.dart'; import 'artifact_external_open.dart'; import 'artifact_gallery_page.dart'; @@ -58,14 +56,6 @@ class RunArtifactsButton extends StatelessWidget { executing: _runExecuting(run), configuredEndpoint: configuredGatewayEndpoint(gateway), ); - if (usesCupertinoHost(context)) { - return CupertinoButton.tinted( - sizeStyle: CupertinoButtonSize.small, - key: runArtifactsButtonKey, - onPressed: open, - child: const Text(artifactGalleryTitle), - ); - } return OutlinedButton.icon( key: runArtifactsButtonKey, onPressed: open, @@ -92,9 +82,7 @@ Future showArtifactGallery( configuredEndpoint: configuredEndpoint, openExternal: openExternal, ); - return Navigator.of(context).push( - usesCupertinoHost(context) - ? CupertinoPageRoute(builder: (_) => page) - : MaterialPageRoute(builder: (_) => page), - ); + return Navigator.of( + context, + ).push(MaterialPageRoute(builder: (_) => page)); } diff --git a/app/lib/features/artifacts/ui/artifact_gallery_page.dart b/app/lib/features/artifacts/ui/artifact_gallery_page.dart index 99b400db..adb1dd8c 100644 --- a/app/lib/features/artifacts/ui/artifact_gallery_page.dart +++ b/app/lib/features/artifacts/ui/artifact_gallery_page.dart @@ -1,10 +1,8 @@ import '../../../ui/adaptive/segmented_bar.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../../../core/api_gateway.dart'; -import '../../../ui/adaptive/host.dart'; import '../../chat/ui/transcript/chat_markdown_view.dart'; import '../../graph/domain/stage_visits.dart'; import '../actions/artifact_file_actions.dart'; @@ -289,29 +287,17 @@ class _ArtifactGalleryPageState extends State { ]; final previousFocus = FocusManager.instance.primaryFocus; await Navigator.of(context).push( - usesCupertinoHost(context) - ? CupertinoPageRoute( - builder: (_) => ArtifactViewerPage( - groups: viewerGroups, - selectedIdentity: identity, - configuredEndpoint: widget.configuredEndpoint, - openExternal: widget.openExternal, - fetch: widget.fetch, - markdownBuilder: widget.markdownBuilder, - fileBridge: widget.fileBridge, - ), - ) - : MaterialPageRoute( - builder: (_) => ArtifactViewerPage( - groups: viewerGroups, - selectedIdentity: identity, - configuredEndpoint: widget.configuredEndpoint, - openExternal: widget.openExternal, - fetch: widget.fetch, - markdownBuilder: widget.markdownBuilder, - fileBridge: widget.fileBridge, - ), - ), + MaterialPageRoute( + builder: (_) => ArtifactViewerPage( + groups: viewerGroups, + selectedIdentity: identity, + configuredEndpoint: widget.configuredEndpoint, + openExternal: widget.openExternal, + fetch: widget.fetch, + markdownBuilder: widget.markdownBuilder, + fileBridge: widget.fileBridge, + ), + ), ); if (!mounted) return; if (previousFocus != null && previousFocus.canRequestFocus) { @@ -350,32 +336,6 @@ class _ArtifactGalleryPageState extends State { ], ], ); - if (usesCupertinoHost(context)) { - return showCupertinoDialog( - 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( context: context, builder: (dialogContext) => AlertDialog( @@ -509,17 +469,11 @@ class _ArtifactGalleryPageState extends State { /// one line per recorded fact, never clamped or shortened. Widget _header(BuildContext context, String summary, {Widget? action}) { final notes = _captureNotes(); - final cupertino = usesCupertinoHost(context); - final textStyle = cupertino - ? CupertinoTheme.of(context).textTheme.textStyle - : Theme.of(context).textTheme.bodyMedium ?? const TextStyle(); - final headingStyle = cupertino - ? textStyle.copyWith(fontWeight: FontWeight.w600) - : Theme.of(context).textTheme.titleSmall; + final textStyle = + Theme.of(context).textTheme.bodyMedium ?? const TextStyle(); + final headingStyle = Theme.of(context).textTheme.titleSmall; final noteStyle = textStyle.copyWith( - color: cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of(context).colorScheme.onSurfaceVariant, ); return Padding( padding: const EdgeInsetsDirectional.fromSTEB(16, 12, 16, 4), @@ -557,33 +511,21 @@ class _ArtifactGalleryPageState extends State { Widget _debugToggle(BuildContext context) { final showing = _showTurnDocuments; final label = showing ? 'Hide debugging files' : 'Show debugging files'; - // Cupertino's bundled icon font has no bug glyph; retain the universally - // recognisable Material bug icon inside its native Cupertino button. final icon = showing ? Icons.bug_report : Icons.bug_report_outlined; void onPressed() => setState(() => _showTurnDocuments = !showing); - final button = usesCupertinoHost(context) - ? CupertinoButton( - key: const Key('artifact-debug-toggle'), - padding: EdgeInsets.zero, - onPressed: onPressed, - child: Icon(icon), - ) - : IconButton( - key: const Key('artifact-debug-toggle'), - isSelected: showing, - tooltip: label, - onPressed: onPressed, - icon: Icon(icon), - ); - final semanticButton = Semantics( + final button = IconButton( + key: const Key('artifact-debug-toggle'), + isSelected: showing, + tooltip: label, + onPressed: onPressed, + icon: Icon(icon), + ); + return Semantics( label: label, button: true, toggled: showing, child: button, ); - return usesCupertinoHost(context) - ? Tooltip(message: label, child: semanticButton) - : semanticButton; } @override @@ -617,18 +559,6 @@ class _ArtifactGalleryPageState extends State { onRevealed: _revealed, ); if (widget.embedded) return body; - if (usesCupertinoHost(context)) { - // Flat sections on the page colour, as in the run and stage details; - // their pinned headings take the same colour. - return CupertinoPageScaffold( - navigationBar: SegmentedBar( - cupertino: true, - title: artifactGalleryTitle, - actions: [_debugToggle(context)], - ), - child: SafeArea(top: false, bottom: false, child: body), - ); - } return Scaffold( extendBodyBehindAppBar: true, appBar: SegmentedBar( diff --git a/app/lib/features/artifacts/ui/artifact_record_row.dart b/app/lib/features/artifacts/ui/artifact_record_row.dart index a3181228..d1838524 100644 --- a/app/lib/features/artifacts/ui/artifact_record_row.dart +++ b/app/lib/features/artifacts/ui/artifact_record_row.dart @@ -1,16 +1,13 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_groups.dart'; import '../domain/artifact_record.dart'; import 'artifact_row_labels.dart'; /// One recorded artifact row in a gallery section. /// -/// Material draws a standard [ListTile]; Cupertino draws the same content in a -/// grouped-row button. The row only reports the selection; it never resolves a -/// url, opens a preview, downloads, shares or filters. +/// Material draws a standard [ListTile]. The row only reports the selection; it +/// never resolves a url, opens a preview, downloads, shares or filters. class ArtifactRecordRow extends StatelessWidget { const ArtifactRecordRow({ super.key, @@ -31,58 +28,13 @@ class ArtifactRecordRow extends StatelessWidget { @override Widget build(BuildContext context) { - if (!usesCupertinoHost(context)) { - return ListTile( - selected: selected, - leading: leading, - title: Text(artifactDisplayName(artifact)), - subtitle: Text(artifactFactsLabel(artifact)), - trailing: selected ? const Icon(Icons.check) : null, - onTap: onSelected == null ? null : () => onSelected!(group, artifact), - ); - } - final textTheme = CupertinoTheme.of(context).textTheme; - final factsStyle = textTheme.textStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ); - final content = DefaultTextStyle.merge( - style: textTheme.textStyle, - child: Row( - children: [ - if (leading != null) ...[leading!, const SizedBox(width: 12)], - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(artifactDisplayName(artifact)), - Text(artifactFactsLabel(artifact), style: factsStyle), - ], - ), - ), - if (selected) const Icon(CupertinoIcons.check_mark), - ], - ), - ); - // `container` makes this row its own semantics node, so the section - // heading stays a separate header node and never covers the row. - return Semantics( - container: true, + return ListTile( selected: selected, - child: SizedBox( - width: double.infinity, - // A read-only row is not a button: a disabled CupertinoButton would - // still expose a button role to assistive technology. - child: onSelected == null - ? Padding( - padding: kCupertinoButtonPadding[CupertinoButtonSize.large]!, - child: content, - ) - : CupertinoButton( - alignment: AlignmentDirectional.centerStart, - onPressed: () => onSelected!(group, artifact), - child: content, - ), - ), + leading: leading, + title: Text(artifactDisplayName(artifact)), + subtitle: Text(artifactFactsLabel(artifact)), + trailing: selected ? const Icon(Icons.check) : null, + onTap: onSelected == null ? null : () => onSelected!(group, artifact), ); } } diff --git a/app/lib/features/artifacts/ui/artifact_selection_facts.dart b/app/lib/features/artifacts/ui/artifact_selection_facts.dart index 4b191f9a..ba947e05 100644 --- a/app/lib/features/artifacts/ui/artifact_selection_facts.dart +++ b/app/lib/features/artifacts/ui/artifact_selection_facts.dart @@ -1,8 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; -import '../../../ui/adaptive/host.dart'; import '../../graph/domain/stage_visits.dart'; import '../domain/artifact_groups.dart'; import '../domain/artifact_record.dart'; @@ -53,14 +51,10 @@ class ArtifactSelectionFacts extends StatelessWidget { Widget build(BuildContext context) { final recordedStep = step; final url = resolved; - final cupertino = usesCupertinoHost(context); - final primaryStyle = cupertino - ? CupertinoTheme.of(context).textTheme.textStyle - : Theme.of(context).textTheme.bodyMedium ?? const TextStyle(); + final primaryStyle = + Theme.of(context).textTheme.bodyMedium ?? const TextStyle(); final secondaryStyle = primaryStyle.copyWith( - color: cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of(context).colorScheme.onSurfaceVariant, ); return Column( crossAxisAlignment: CrossAxisAlignment.start, diff --git a/app/lib/features/artifacts/ui/artifact_table_view.dart b/app/lib/features/artifacts/ui/artifact_table_view.dart index 38d028ee..300adbb5 100644 --- a/app/lib/features/artifacts/ui/artifact_table_view.dart +++ b/app/lib/features/artifacts/ui/artifact_table_view.dart @@ -1,7 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_table.dart'; /// The truncation note for a capped table preview. @@ -31,13 +29,8 @@ class ArtifactTableView extends StatelessWidget { child: Text('The table is empty.'), ); } - final cupertino = usesCupertinoHost(context); - final border = cupertino - ? CupertinoColors.separator.resolveFrom(context) - : Theme.of(context).dividerColor; - final header = cupertino - ? CupertinoColors.secondarySystemFill.resolveFrom(context) - : Theme.of(context).colorScheme.surfaceContainerHighest; + final border = Theme.of(context).dividerColor; + final header = Theme.of(context).colorScheme.surfaceContainerHighest; final columns = table.columnCount; Widget cell(String value, {bool head = false}) => Padding( padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6), diff --git a/app/lib/features/artifacts/ui/artifact_tile.dart b/app/lib/features/artifacts/ui/artifact_tile.dart index 20ff6dcd..b0f06421 100644 --- a/app/lib/features/artifacts/ui/artifact_tile.dart +++ b/app/lib/features/artifacts/ui/artifact_tile.dart @@ -1,7 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_groups.dart'; import '../domain/artifact_kind.dart'; import '../domain/artifact_record.dart'; @@ -37,21 +35,12 @@ class ArtifactTile extends StatefulWidget { class _ArtifactTileState extends State { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); final artifact = widget.artifact; - final secondary = cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant; - final surface = cupertino - ? CupertinoColors.tertiarySystemFill.resolveFrom(context) - : Theme.of(context).colorScheme.surfaceContainerHighest; + final secondary = Theme.of(context).colorScheme.onSurfaceVariant; + final surface = Theme.of(context).colorScheme.surfaceContainerHighest; final border = widget.selected - ? (cupertino - ? CupertinoTheme.of(context).primaryColor - : Theme.of(context).colorScheme.primary) - : (cupertino - ? CupertinoColors.separator.resolveFrom(context) - : Theme.of(context).colorScheme.outlineVariant); + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.outlineVariant; final preview = ArtifactThumbnail( artifact: artifact, configuredEndpoint: widget.configuredEndpoint, @@ -102,20 +91,14 @@ class _ArtifactTileState extends State { label: '$name, $facts', excludeSemantics: true, onTap: onSelected == null ? null : tap, - child: cupertino - ? GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: onSelected == null ? null : tap, - child: decorated, - ) - : Material( - type: MaterialType.transparency, - child: InkWell( - borderRadius: BorderRadius.circular(12), - onTap: onSelected == null ? null : tap, - child: decorated, - ), - ), + child: Material( + type: MaterialType.transparency, + child: InkWell( + borderRadius: BorderRadius.circular(12), + onTap: onSelected == null ? null : tap, + child: decorated, + ), + ), ); } } @@ -168,13 +151,10 @@ class _ArtifactThumbnailState extends State @override Widget build(BuildContext context) { super.build(context); - final cupertino = usesCupertinoHost(context); final icon = Icon( - artifactKindIcon(widget.artifact, cupertino: cupertino), + artifactKindIcon(widget.artifact, cupertino: false), size: widget.iconSize, - color: cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant, + color: Theme.of(context).colorScheme.onSurfaceVariant, ); if (_image == null) return Center(child: icon); return FutureBuilder( @@ -210,30 +190,26 @@ class _ArtifactThumbnailState extends State } /// The icon for an artifact's kind of file, when it has no thumbnail. +/// +/// [cupertino] is retained for callers that still pass it; the icon is always +/// the Material glyph the app draws. IconData artifactKindIcon(ArtifactRecord artifact, {required bool cupertino}) { final name = artifact.name.toLowerCase(); final format = artifactPreviewFormat(artifact.contentType, artifact.name); if (name.endsWith('.zip') || name.endsWith('.tar') || name.endsWith('.gz')) { - return cupertino ? CupertinoIcons.archivebox : Icons.folder_zip_outlined; + return Icons.folder_zip_outlined; } if (name.endsWith('.pdf')) { - return cupertino ? CupertinoIcons.doc_richtext : Icons.picture_as_pdf; + return Icons.picture_as_pdf; } return switch (format) { - ArtifactPreviewFormat.image => - cupertino ? CupertinoIcons.photo : Icons.image_outlined, - ArtifactPreviewFormat.video => - cupertino ? CupertinoIcons.film : Icons.movie_outlined, - ArtifactPreviewFormat.audio => - cupertino ? CupertinoIcons.music_note : Icons.audio_file_outlined, - ArtifactPreviewFormat.markdown => - cupertino ? CupertinoIcons.doc_text : Icons.article_outlined, - ArtifactPreviewFormat.text => - cupertino ? CupertinoIcons.doc_plaintext : Icons.description_outlined, - ArtifactPreviewFormat.table => - cupertino ? CupertinoIcons.table : Icons.table_chart_outlined, - ArtifactPreviewFormat.html => cupertino ? CupertinoIcons.globe : Icons.html, - ArtifactPreviewFormat.none => - cupertino ? CupertinoIcons.doc : Icons.insert_drive_file_outlined, + ArtifactPreviewFormat.image => Icons.image_outlined, + ArtifactPreviewFormat.video => Icons.movie_outlined, + ArtifactPreviewFormat.audio => Icons.audio_file_outlined, + ArtifactPreviewFormat.markdown => Icons.article_outlined, + ArtifactPreviewFormat.text => Icons.description_outlined, + ArtifactPreviewFormat.table => Icons.table_chart_outlined, + ArtifactPreviewFormat.html => Icons.html, + ArtifactPreviewFormat.none => Icons.insert_drive_file_outlined, }; } diff --git a/app/lib/features/artifacts/ui/artifact_video_player.dart b/app/lib/features/artifacts/ui/artifact_video_player.dart index 526087c2..b679430d 100644 --- a/app/lib/features/artifacts/ui/artifact_video_player.dart +++ b/app/lib/features/artifacts/ui/artifact_video_player.dart @@ -1,9 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:video_player/video_player.dart'; -import '../../../ui/adaptive/host.dart'; - /// Creates the player for one media url; tests inject a fake controller. typedef ArtifactVideoControllerFactory = VideoPlayerController Function(Uri uri); @@ -84,7 +81,6 @@ class _ArtifactVideoPlayerState extends State { @override Widget build(BuildContext context) { if (_failed) return const Center(child: Text(artifactVideoError)); - final cupertino = usesCupertinoHost(context); return ValueListenableBuilder( valueListenable: _controller, builder: (context, value, _) { @@ -92,20 +88,12 @@ class _ArtifactVideoPlayerState extends State { return const Center(child: Text(artifactVideoError)); } if (!value.isInitialized) { - return Center( - child: cupertino - ? const CupertinoActivityIndicator() - : const CircularProgressIndicator(), - ); + return const Center(child: CircularProgressIndicator()); } final label = value.isPlaying ? (widget.audio ? artifactAudioPauseLabel : artifactVideoPauseLabel) : (widget.audio ? artifactAudioPlayLabel : artifactVideoPlayLabel); - final icon = cupertino - ? (value.isPlaying - ? CupertinoIcons.pause_fill - : CupertinoIcons.play_fill) - : (value.isPlaying ? Icons.pause : Icons.play_arrow); + final icon = value.isPlaying ? Icons.pause : Icons.play_arrow; return Column( key: Key(widget.audio ? 'artifact-audio' : 'artifact-video'), mainAxisSize: MainAxisSize.min, @@ -126,18 +114,12 @@ class _ArtifactVideoPlayerState extends State { padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), child: Row( children: [ - cupertino - ? CupertinoButton( - key: const Key('artifact-video-toggle'), - onPressed: _toggle, - child: Icon(icon, semanticLabel: label), - ) - : IconButton( - key: const Key('artifact-video-toggle'), - tooltip: label, - onPressed: _toggle, - icon: Icon(icon), - ), + IconButton( + key: const Key('artifact-video-toggle'), + tooltip: label, + onPressed: _toggle, + icon: Icon(icon), + ), Expanded( child: VideoProgressIndicator( _controller, diff --git a/app/lib/features/artifacts/ui/artifact_viewer_bar.dart b/app/lib/features/artifacts/ui/artifact_viewer_bar.dart index b82adb2e..fa6a7c61 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_bar.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_bar.dart @@ -4,7 +4,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/glass_bar.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/navigation/chevron_pager.dart'; import '../actions/artifact_file_actions.dart'; import '../actions/artifact_file_bridge.dart'; @@ -60,11 +59,8 @@ class ArtifactViewerBar extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); final actions = _actions(resolved, onFullscreen); - final pagerMin = count > 1 - ? 2 * GlassBarMetrics.controlExtent(cupertino) - : 0.0; + final pagerMin = count > 1 ? 2 * GlassBarMetrics.controlExtent(false) : 0.0; final pager = ChevronPager( index: index, count: count, @@ -87,7 +83,7 @@ class ArtifactViewerBar extends StatelessWidget { alignment: AlignmentDirectional.centerStart, heightFactor: 1, child: GlassControlBar( - cupertino: cupertino, + cupertino: false, child: LayoutBuilder( builder: (context, constraints) => Row( key: const Key('artifact-viewer-actions'), diff --git a/app/lib/features/artifacts/ui/artifact_viewer_body.dart b/app/lib/features/artifacts/ui/artifact_viewer_body.dart index 4c711c98..c890866d 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_body.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_body.dart @@ -3,7 +3,6 @@ import 'dart:typed_data'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/floating_bar_layout.dart'; import '../actions/artifact_file_actions.dart'; import '../actions/artifact_file_bridge.dart'; @@ -170,20 +169,6 @@ class ArtifactViewerInfoAction extends StatelessWidget { final Widget facts; void _show(BuildContext context) { - if (usesCupertinoHost(context)) { - showCupertinoModalPopup( - context: context, - builder: (context) => CupertinoPopupSurface( - child: SafeArea( - child: SingleChildScrollView( - padding: const EdgeInsets.all(16), - child: facts, - ), - ), - ), - ); - return; - } showModalBottomSheet( context: context, showDragHandle: true, diff --git a/app/lib/features/artifacts/ui/artifact_viewer_content.dart b/app/lib/features/artifacts/ui/artifact_viewer_content.dart index b7aba945..64d27932 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_content.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_content.dart @@ -1,10 +1,7 @@ import 'dart:typed_data'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; - import '../domain/artifact_preview.dart'; import 'artifact_html_view.dart'; import 'artifact_table_view.dart'; @@ -219,24 +216,12 @@ class _ZoomableImageState extends State<_ZoomableImage> { PositionedDirectional( top: 8, end: 8, - child: usesCupertinoHost(context) - ? Tooltip( - message: 'Reset image zoom', - child: CupertinoButton( - key: const Key('artifact-image-reset-zoom'), - sizeStyle: CupertinoButtonSize.small, - onPressed: _reset, - child: const Icon( - CupertinoIcons.arrow_down_right_arrow_up_left, - ), - ), - ) - : IconButton( - key: const Key('artifact-image-reset-zoom'), - tooltip: 'Reset image zoom', - onPressed: _reset, - icon: const Icon(Icons.zoom_out_map), - ), + child: IconButton( + key: const Key('artifact-image-reset-zoom'), + tooltip: 'Reset image zoom', + onPressed: _reset, + icon: const Icon(Icons.zoom_out_map), + ), ), ], ); @@ -272,7 +257,6 @@ class _Message extends StatelessWidget { @override Widget build(BuildContext context) { final retry = onRetry; - final cupertino = usesCupertinoHost(context); return Center( child: Padding( padding: const EdgeInsets.all(16), @@ -282,18 +266,11 @@ class _Message extends StatelessWidget { Text(message, textAlign: TextAlign.center), if (retry != null) ...[ const SizedBox(height: 12), - cupertino - ? CupertinoButton.tinted( - key: artifactPreviewRetryKey, - sizeStyle: CupertinoButtonSize.small, - onPressed: retry, - child: const Text('Retry'), - ) - : FilledButton.tonal( - key: artifactPreviewRetryKey, - onPressed: retry, - child: const Text('Retry'), - ), + FilledButton.tonal( + key: artifactPreviewRetryKey, + onPressed: retry, + child: const Text('Retry'), + ), ], ], ), diff --git a/app/lib/features/artifacts/ui/artifact_viewer_scaffold.dart b/app/lib/features/artifacts/ui/artifact_viewer_scaffold.dart index e1a17a3b..d26b47d0 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_scaffold.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_scaffold.dart @@ -1,12 +1,9 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/segmented_bar.dart'; -import '../../../ui/theme/app_theme.dart'; -/// The viewer's page structure on either host: its [SegmentedBar] (the -/// platform's Back, or Close on the full-screen route) over [body]. +/// The viewer's page structure: its [SegmentedBar] (the platform's Back, or +/// Close on the full-screen route) over [body]. class ArtifactViewerScaffold extends StatelessWidget { const ArtifactViewerScaffold({ super.key, @@ -23,20 +20,12 @@ class ArtifactViewerScaffold extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); final bar = SegmentedBar( - cupertino: cupertino, + cupertino: false, title: title, subtitle: subtitle, actions: actions, ); - if (cupertino) { - return CupertinoPageScaffold( - backgroundColor: AppColors.groupedBackground, - navigationBar: bar, - child: body, - ); - } return Scaffold(extendBodyBehindAppBar: true, appBar: bar, body: body); } } diff --git a/app/lib/features/artifacts/ui/artifact_visit_list.dart b/app/lib/features/artifacts/ui/artifact_visit_list.dart index f9bb2199..6aef1c5e 100644 --- a/app/lib/features/artifacts/ui/artifact_visit_list.dart +++ b/app/lib/features/artifacts/ui/artifact_visit_list.dart @@ -1,9 +1,7 @@ import 'dart:math' as math; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../domain/artifact_groups.dart'; import '../../../ui/layout/section_heading.dart'; import '../../../ui/layout/sticky_section.dart'; @@ -29,11 +27,10 @@ export 'artifact_row_labels.dart' /// artifacts. When [showTurnDocuments] is on, its debugging documents follow /// those artifacts in the same visit. Every recorded row shows its recorded /// filename, content type and size; a turn document the visit did not record -/// stays a non-actionable row with the exact absence wording. Rendering uses the host's -/// own controls: Material list tiles under [MaterialApp] and grouped Cupertino -/// list sections under [CupertinoApp]. An optional [header] leads the same -/// scroll view. It never resolves a url, opens a preview, downloads, shares or -/// filters. +/// stays a non-actionable row with the exact absence wording. Rendering uses +/// the host's own controls: Material list tiles under [MaterialApp]. An +/// optional [header] leads the same scroll view. It never resolves a url, +/// opens a preview, downloads, shares or filters. /// How the gallery lays out each visit's artifacts. enum ArtifactGalleryMode { grid, list } @@ -257,43 +254,24 @@ class _ArtifactVisitListState extends State { ); Widget _modeSwitch(BuildContext context) { - final cupertino = usesCupertinoHost(context); - final control = cupertino - ? CupertinoSlidingSegmentedControl( - key: const Key('artifact-gallery-mode'), - groupValue: _mode, - onValueChanged: (mode) { - if (mode != null) _setMode(mode); - }, - children: const { - ArtifactGalleryMode.grid: Icon( - CupertinoIcons.square_grid_2x2, - semanticLabel: 'Grid', - ), - ArtifactGalleryMode.list: Icon( - CupertinoIcons.list_bullet, - semanticLabel: 'List', - ), - }, - ) - : SegmentedButton( - key: const Key('artifact-gallery-mode'), - showSelectedIcon: false, - segments: const [ - ButtonSegment( - value: ArtifactGalleryMode.grid, - icon: Icon(Icons.grid_view), - tooltip: 'Grid', - ), - ButtonSegment( - value: ArtifactGalleryMode.list, - icon: Icon(Icons.view_list), - tooltip: 'List', - ), - ], - selected: {_mode}, - onSelectionChanged: (mode) => _setMode(mode.single), - ); + final control = SegmentedButton( + key: const Key('artifact-gallery-mode'), + showSelectedIcon: false, + segments: const [ + ButtonSegment( + value: ArtifactGalleryMode.grid, + icon: Icon(Icons.grid_view), + tooltip: 'Grid', + ), + ButtonSegment( + value: ArtifactGalleryMode.list, + icon: Icon(Icons.view_list), + tooltip: 'List', + ), + ], + selected: {_mode}, + onSelectionChanged: (mode) => _setMode(mode.single), + ); return Padding( padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 4), child: Align(alignment: AlignmentDirectional.centerEnd, child: control), @@ -303,9 +281,7 @@ class _ArtifactVisitListState extends State { /// Rows keep a Material surface for their ink, as the section body's own /// surface was when it was one box around every row. Widget _inkSurface(BuildContext context, Widget child) => - usesCupertinoHost(context) - ? child - : Material(type: MaterialType.transparency, child: child); + Material(type: MaterialType.transparency, child: child); /// The list view: one row per artifact with a small thumbnail beside it. Widget _list(ArtifactGroup group) => SliverList.builder( diff --git a/app/lib/features/pipelines/screen.dart b/app/lib/features/pipelines/screen.dart index b445dad9..91c4e666 100644 --- a/app/lib/features/pipelines/screen.dart +++ b/app/lib/features/pipelines/screen.dart @@ -13,7 +13,6 @@ import 'pipeline_repository.dart'; import 'pipelines_controller.dart'; import 'pending_run_store.dart'; import 'widgets/pipeline_bar_buttons.dart'; -import 'widgets/pipeline_controls.dart'; import 'widgets/pipeline_detail_panel.dart'; import 'widgets/pipeline_list_panel.dart'; @@ -273,9 +272,7 @@ class _PipelinesScreenState extends State { }, ); if (widget.embedded) return _embeddedBody(context, body); - return useCupertinoControls(context) - ? _cupertinoShell(context, body) - : _materialShell(context, body); + return _materialShell(context, body); }, ); } @@ -352,20 +349,4 @@ class _PipelinesScreenState extends State { body: SafeArea(top: false, child: body), ); } - - Widget _cupertinoShell(BuildContext context, Widget body) { - return CupertinoPageScaffold( - navigationBar: SegmentedBar( - cupertino: true, - title: 'Pipelines', - actions: [ - ...pipelineListActions(context, _controller), - if (widget.onOpenSchedules != null) _schedulesButton(context), - _refreshButton(context), - if (widget.onOpenSettings != null) _settingsButton(context), - ], - ), - child: SafeArea(top: false, child: body), - ); - } } diff --git a/app/lib/features/pipelines/ui/run_pipeline_action.dart b/app/lib/features/pipelines/ui/run_pipeline_action.dart index 64040ed8..34535e2c 100644 --- a/app/lib/features/pipelines/ui/run_pipeline_action.dart +++ b/app/lib/features/pipelines/ui/run_pipeline_action.dart @@ -8,7 +8,6 @@ import '../pipeline_models.dart'; import '../pipelines_controller.dart'; import '../run_pipeline_intent.dart'; import '../widgets/pipeline_bar_buttons.dart'; -import '../widgets/pipeline_controls.dart'; import 'run_pipeline_dialog.dart'; import 'run_pipeline_wording.dart'; @@ -181,13 +180,6 @@ class _RunPipelineActionState extends State { onPressed: _open, ); } - if (useCupertinoControls(context)) { - return CupertinoButton.filled( - key: runPipelineActionKey, - onPressed: _open, - child: label, - ); - } return FilledButton( key: runPipelineActionKey, onPressed: _open, diff --git a/app/lib/features/pipelines/ui/run_pipeline_dialog.dart b/app/lib/features/pipelines/ui/run_pipeline_dialog.dart index b13fb001..3155f854 100644 --- a/app/lib/features/pipelines/ui/run_pipeline_dialog.dart +++ b/app/lib/features/pipelines/ui/run_pipeline_dialog.dart @@ -1,13 +1,11 @@ import '../../schedules/data/schedules_repository.dart'; import '../../schedules/domain/editor/schedule_draft.dart'; import '../../schedules/ui/pipeline/schedule_pipeline_editor.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/servers/server_scope.dart'; import '../../../core/api_gateway.dart'; import '../../settings/settings_store.dart'; -import '../../../ui/adaptive/host.dart'; import '../pipeline_models.dart'; import '../run_pipeline_intent.dart'; import 'run_pipeline_fields.dart'; @@ -45,23 +43,16 @@ Future showRunPipelineDialog({ detail: detail, gateway: gateway, pending: pending, - cupertino: usesCupertinoHost(context), onSubmit: onSubmit, onPendingChanged: onPendingChanged, onAccepted: onAccepted, onSchedule: schedule, ); - return dialog.cupertino - ? showCupertinoDialog( - context: context, - barrierDismissible: false, - builder: (_) => dialog, - ) - : showDialog( - context: context, - barrierDismissible: false, - builder: (_) => dialog, - ); + return showDialog( + context: context, + barrierDismissible: false, + builder: (_) => dialog, + ); } class _RunPipelineDialog extends StatefulWidget { @@ -69,7 +60,6 @@ class _RunPipelineDialog extends StatefulWidget { required this.detail, required this.gateway, required this.pending, - required this.cupertino, required this.onSubmit, required this.onPendingChanged, required this.onAccepted, @@ -81,7 +71,6 @@ class _RunPipelineDialog extends StatefulWidget { final PipelineDetail detail; final ApiGateway gateway; final RunPipelineIntent? pending; - final bool cupertino; final Future Function(RunPipelineIntent intent) onSubmit; final ValueChanged onPendingChanged; final ValueChanged onAccepted; @@ -219,8 +208,7 @@ class _RunPipelineDialogState extends State<_RunPipelineDialog> { @override Widget build(BuildContext context) { - final dialog = widget.cupertino ? _cupertino(context) : _material(context); - return PopScope(canPop: !_sending, child: dialog); + return PopScope(canPop: !_sending, child: _material(context)); } Widget _material(BuildContext context) { @@ -248,31 +236,6 @@ class _RunPipelineDialogState extends State<_RunPipelineDialog> { ); } - Widget _cupertino(BuildContext context) { - return CupertinoAlertDialog( - title: Text(runPipelineDialogTitle(widget.detail.name)), - content: _content(context), - actions: [ - CupertinoDialogAction( - key: runPipelineCancelKey, - onPressed: _sending ? null : _cancel, - child: const Text(runPipelineCancelLabel), - ), - CupertinoDialogAction( - key: const Key('run-pipeline-schedule'), - onPressed: _sending ? null : _schedule, - child: const Text('Schedule…'), - ), - CupertinoDialogAction( - key: runPipelineConfirmKey, - isDefaultAction: true, - onPressed: _sending ? null : _confirm, - child: Text(_confirmLabel), - ), - ], - ); - } - /// Leaves the dialog for the schedule editor with the typed prompt, /// workspace and the pinned version. void _schedule() { @@ -294,9 +257,7 @@ class _RunPipelineDialogState extends State<_RunPipelineDialog> { } Widget _content(BuildContext context) { - final errorStyle = widget.cupertino - ? TextStyle(color: CupertinoColors.systemRed.resolveFrom(context)) - : TextStyle(color: Theme.of(context).colorScheme.error); + final errorStyle = TextStyle(color: Theme.of(context).colorScheme.error); return Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, @@ -305,7 +266,7 @@ class _RunPipelineDialogState extends State<_RunPipelineDialog> { prompt: _prompt, workspace: _workspace, directories: _directories, - cupertino: widget.cupertino, + cupertino: false, onChooseDirectory: _chooseDirectory, notifyMode: _notify, outputFormat: _outputFormat, diff --git a/app/lib/features/pipelines/ui/run_pipeline_fields.dart b/app/lib/features/pipelines/ui/run_pipeline_fields.dart index bd77c202..387a3237 100644 --- a/app/lib/features/pipelines/ui/run_pipeline_fields.dart +++ b/app/lib/features/pipelines/ui/run_pipeline_fields.dart @@ -1,11 +1,9 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../run_pipeline_intent.dart'; import 'run_pipeline_wording.dart'; -/// The dialog's three web fields, in the host's native controls. +/// The dialog's three web fields in standard Material controls. /// /// A confirmed launch locks every field: the request is immutable until its /// admission is known, exactly like the browser's disabled inputs. @@ -27,7 +25,10 @@ class RunPipelineFields extends StatelessWidget { final TextEditingController prompt; final TextEditingController workspace; final List directories; + + /// Retained for callers; the fields are Material on every host. final bool cupertino; + final ValueChanged onChooseDirectory; final RunNotifyMode notifyMode; final RunOutputFormat outputFormat; @@ -37,44 +38,28 @@ class RunPipelineFields extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = usesCupertinoHost(context); return Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - _FieldLabel(runPipelinePromptLabel, cupertino: cupertino), - _promptField(context, cupertino), + const _FieldLabel(runPipelinePromptLabel), + _promptField(), const SizedBox(height: 12), - _FieldLabel(runPipelineWorkspaceLabel, cupertino: cupertino), - _workspaceField(context, cupertino), - _helper(context, runPipelineWorkspaceHelper, cupertino), + const _FieldLabel(runPipelineWorkspaceLabel), + _workspaceField(), + _helper(context, runPipelineWorkspaceHelper), const SizedBox(height: 12), - _FieldLabel(runPipelineNotifyLabel, cupertino: cupertino), - _notifyField(context, cupertino), + const _FieldLabel(runPipelineNotifyLabel), + _notifyField(), const SizedBox(height: 12), - _FieldLabel(runPipelineOutputFormatLabel, cupertino: cupertino), - _outputFormatField(context, cupertino), - _helper(context, runPipelineOutputFormatHelper, cupertino), + const _FieldLabel(runPipelineOutputFormatLabel), + _outputFormatField(), + _helper(context, runPipelineOutputFormatHelper), ], ); } - Widget _promptField(BuildContext context, bool cupertino) { - if (cupertino) { - return CupertinoTextField( - key: runPipelinePromptKey, - controller: prompt, - placeholder: runPipelinePromptPlaceholder, - placeholderStyle: _cupertinoPlaceholder(context), - style: CupertinoTheme.of(context).textTheme.textStyle, - minLines: 3, - maxLines: 5, - enabled: !locked, - autofocus: !locked, - padding: const EdgeInsets.all(8), - textCapitalization: TextCapitalization.sentences, - ); - } + Widget _promptField() { return TextField( key: runPipelinePromptKey, controller: prompt, @@ -90,51 +75,26 @@ class RunPipelineFields extends StatelessWidget { ); } - Widget _workspaceField(BuildContext context, bool cupertino) { - final field = cupertino - ? _cupertinoWorkspace(context) - : _materialWorkspace(); + Widget _workspaceField() { return Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded(child: field), + Expanded(child: _materialWorkspace()), if (directories.isNotEmpty) - cupertino - ? CupertinoButton( - key: runPipelineWorkspaceSuggestionsKey, - padding: EdgeInsets.zero, - onPressed: locked - ? null - : () => _chooseCupertinoDirectory(context), - child: const Icon(CupertinoIcons.folder), - ) - : PopupMenuButton( - key: runPipelineWorkspaceSuggestionsKey, - tooltip: runPipelineWorkspaceLabel, - enabled: !locked, - onSelected: onChooseDirectory, - itemBuilder: (_) => [ - for (final path in directories) - PopupMenuItem(value: path, child: Text(path)), - ], - ), + PopupMenuButton( + key: runPipelineWorkspaceSuggestionsKey, + tooltip: runPipelineWorkspaceLabel, + enabled: !locked, + onSelected: onChooseDirectory, + itemBuilder: (_) => [ + for (final path in directories) + PopupMenuItem(value: path, child: Text(path)), + ], + ), ], ); } - Widget _cupertinoWorkspace(BuildContext context) { - return CupertinoTextField( - key: runPipelineWorkspaceKey, - controller: workspace, - placeholder: runPipelineWorkspacePlaceholder, - placeholderStyle: _cupertinoPlaceholder(context), - style: CupertinoTheme.of(context).textTheme.textStyle, - enabled: !locked, - autocorrect: false, - padding: const EdgeInsets.all(8), - ); - } - Widget _materialWorkspace() { return TextField( key: runPipelineWorkspaceKey, @@ -148,44 +108,7 @@ class RunPipelineFields extends StatelessWidget { ); } - Future _chooseCupertinoDirectory(BuildContext context) async { - final chosen = await showCupertinoModalPopup( - context: context, - builder: (sheetContext) => CupertinoActionSheet( - title: const Text(runPipelineWorkspaceLabel), - actions: [ - for (final path in directories) - CupertinoActionSheetAction( - onPressed: () => Navigator.of(sheetContext).pop(path), - child: Text(path), - ), - ], - cancelButton: CupertinoActionSheetAction( - onPressed: () => Navigator.of(sheetContext).pop(), - child: const Text(runPipelineCancelLabel), - ), - ), - ); - if (chosen != null) onChooseDirectory(chosen); - } - - Widget _notifyField(BuildContext context, bool cupertino) { - if (cupertino) { - return CupertinoButton( - key: runPipelineNotifyKey, - padding: EdgeInsets.zero, - alignment: AlignmentDirectional.centerStart, - onPressed: locked ? null : () => _chooseNotify(context), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Flexible(child: Text(notifyMode.label)), - const SizedBox(width: 4), - const Icon(CupertinoIcons.chevron_down, size: 14), - ], - ), - ); - } + Widget _notifyField() { return DropdownButtonFormField( key: runPipelineNotifyKey, initialValue: notifyMode, @@ -202,45 +125,7 @@ class RunPipelineFields extends StatelessWidget { ); } - Future _chooseNotify(BuildContext context) async { - final chosen = await showCupertinoModalPopup( - context: context, - builder: (sheetContext) => CupertinoActionSheet( - title: const Text(runPipelineNotifyLabel), - actions: [ - for (final mode in RunNotifyMode.values) - CupertinoActionSheetAction( - onPressed: () => Navigator.of(sheetContext).pop(mode), - child: Text(mode.label), - ), - ], - cancelButton: CupertinoActionSheetAction( - isDefaultAction: true, - onPressed: () => Navigator.of(sheetContext).pop(), - child: const Text(runPipelineCancelLabel), - ), - ), - ); - if (chosen != null) onNotifyChanged(chosen); - } - - Widget _outputFormatField(BuildContext context, bool cupertino) { - if (cupertino) { - return CupertinoButton( - key: runPipelineOutputFormatKey, - padding: EdgeInsets.zero, - alignment: AlignmentDirectional.centerStart, - onPressed: locked ? null : () => _chooseOutputFormat(context), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Flexible(child: Text(outputFormat.label)), - const SizedBox(width: 4), - const Icon(CupertinoIcons.chevron_down, size: 14), - ], - ), - ); - } + Widget _outputFormatField() { return DropdownButtonFormField( key: runPipelineOutputFormatKey, initialValue: outputFormat, @@ -257,75 +142,34 @@ class RunPipelineFields extends StatelessWidget { ); } - Future _chooseOutputFormat(BuildContext context) async { - final chosen = await showCupertinoModalPopup( - context: context, - builder: (sheetContext) => CupertinoActionSheet( - title: const Text(runPipelineOutputFormatLabel), - actions: [ - for (final format in RunOutputFormat.values) - CupertinoActionSheetAction( - onPressed: () => Navigator.of(sheetContext).pop(format), - child: Text(format.label), - ), - ], - cancelButton: CupertinoActionSheetAction( - isDefaultAction: true, - onPressed: () => Navigator.of(sheetContext).pop(), - child: const Text(runPipelineCancelLabel), - ), - ), - ); - if (chosen != null) onOutputFormatChanged(chosen); - } - - TextStyle _cupertinoPlaceholder(BuildContext context) { - // The host's own dynamic placeholder colour (light and dark), resolved for - // the dialog's inherited Cupertino brightness. - return TextStyle( - color: CupertinoColors.placeholderText.resolveFrom(context), - ); - } - - Widget _helper(BuildContext context, String text, bool cupertino) { + Widget _helper(BuildContext context, String text) { return Padding( padding: const EdgeInsets.only(top: 4), - child: Text(text, style: _secondaryStyle(context, cupertino)), + child: Text(text, style: _secondaryStyle(context)), ); } } -/// Secondary copy under a field: the host's own secondary role, never a -/// borrowed palette or invented point size. -TextStyle _secondaryStyle(BuildContext context, bool cupertino) { - if (cupertino) { - return CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ); - } +/// Secondary copy under a field: the theme's secondary role, never a borrowed +/// palette or invented point size. +TextStyle? _secondaryStyle(BuildContext context) { final theme = Theme.of(context); return (theme.textTheme.bodySmall ?? const TextStyle()).copyWith( color: theme.colorScheme.onSurfaceVariant, ); } -/// The label above each native field, using the web's exact words. +/// The label above each field, using the web's exact words. class _FieldLabel extends StatelessWidget { - const _FieldLabel(this.text, {required this.cupertino}); + const _FieldLabel(this.text); final String text; - final bool cupertino; @override Widget build(BuildContext context) { - // A theme label role with the primary label colour, matching the app's - // Cupertino form pattern; secondaryLabel is for helper copy only. - final style = cupertino - ? CupertinoTheme.of(context).textTheme.textStyle - : Theme.of(context).textTheme.labelLarge; return Padding( padding: const EdgeInsets.only(bottom: 4), - child: Text(text, style: style), + child: Text(text, style: Theme.of(context).textTheme.labelLarge), ); } } diff --git a/app/lib/features/pipelines/widgets/pipeline_archive_action.dart b/app/lib/features/pipelines/widgets/pipeline_archive_action.dart index fc5bb10d..59919ad2 100644 --- a/app/lib/features/pipelines/widgets/pipeline_archive_action.dart +++ b/app/lib/features/pipelines/widgets/pipeline_archive_action.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/segmented_bar_overflow.dart'; @@ -28,9 +27,7 @@ Widget pipelineActionsMenu( return SegmentedOverflowAction( overflowEntry: SegmentedOverflowEntry( label: archived ? 'Unarchive pipeline' : 'Archive pipeline…', - icon: useCupertinoControls(context) - ? CupertinoIcons.archivebox - : Icons.archive_outlined, + icon: Icons.archive_outlined, onPressed: () => run(context), ), child: AppOverflowMenu( @@ -104,64 +101,28 @@ class PipelineArchivedNotice extends StatelessWidget { Future _confirmArchive(BuildContext context, String name) async { final title = Text('Archive $name?'); final body = Text(archiveConfirmation(name)); - final confirmed = useCupertinoControls(context) - ? await showCupertinoDialog( - context: context, - builder: (context) => CupertinoAlertDialog( - title: title, - content: body, - actions: [ - CupertinoDialogAction( - onPressed: () => Navigator.pop(context, false), - child: const Text('Cancel'), - ), - CupertinoDialogAction( - key: const Key('pipeline-archive-confirm'), - isDefaultAction: true, - onPressed: () => Navigator.pop(context, true), - child: const Text('Archive'), - ), - ], - ), - ) - : await showDialog( - context: context, - builder: (context) => AlertDialog( - title: title, - content: body, - actions: [ - TextButton( - onPressed: () => Navigator.pop(context, false), - child: const Text('Cancel'), - ), - FilledButton( - key: const Key('pipeline-archive-confirm'), - onPressed: () => Navigator.pop(context, true), - child: const Text('Archive'), - ), - ], - ), - ); + final confirmed = await showDialog( + context: context, + builder: (context) => AlertDialog( + title: title, + content: body, + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, false), + child: const Text('Cancel'), + ), + FilledButton( + key: const Key('pipeline-archive-confirm'), + onPressed: () => Navigator.pop(context, true), + child: const Text('Archive'), + ), + ], + ), + ); return confirmed == true; } Future _showRefusal(BuildContext context, String title, String message) { - if (useCupertinoControls(context)) { - return showCupertinoDialog( - context: context, - builder: (context) => CupertinoAlertDialog( - title: Text(title), - content: Text(message), - actions: [ - CupertinoDialogAction( - isDefaultAction: true, - onPressed: () => Navigator.pop(context), - child: const Text('OK'), - ), - ], - ), - ); - } return showDialog( context: context, builder: (context) => AlertDialog( diff --git a/app/lib/features/pipelines/widgets/pipeline_bar_buttons.dart b/app/lib/features/pipelines/widgets/pipeline_bar_buttons.dart index 91c78725..9fd34cae 100644 --- a/app/lib/features/pipelines/widgets/pipeline_bar_buttons.dart +++ b/app/lib/features/pipelines/widgets/pipeline_bar_buttons.dart @@ -2,11 +2,12 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/segmented_bar_overflow.dart'; -import 'pipeline_controls.dart'; /// One icon action in the Pipelines bar's actions pill: a Material -/// [IconButton] with its tooltip, or a Cupertino button named for -/// accessibility. A narrow bar moves it into its More menu. +/// [IconButton] with its tooltip. A narrow bar moves it into its More menu. +/// +/// [cupertinoIcon] is retained in the signature for callers that still pass +/// it; the Material icon is drawn. Widget pipelineBarIconButton( BuildContext context, { required Key key, @@ -15,33 +16,23 @@ Widget pipelineBarIconButton( required IconData cupertinoIcon, required VoidCallback? onPressed, }) { - final Widget button; - final cupertino = useCupertinoControls(context); - if (cupertino) { - button = CupertinoButton( - key: key, - padding: EdgeInsets.zero, - onPressed: onPressed, - child: Icon(cupertinoIcon), - ); - } else { - button = IconButton( - key: key, - tooltip: label, - onPressed: onPressed, - icon: Icon(icon), - ); - } return SegmentedOverflowAction( overflowEntry: SegmentedOverflowEntry( label: label, - icon: cupertino ? cupertinoIcon : icon, + icon: icon, onPressed: onPressed, ), child: Semantics( button: true, label: label, - child: ExcludeSemantics(child: button), + child: ExcludeSemantics( + child: IconButton( + key: key, + tooltip: label, + onPressed: onPressed, + icon: Icon(icon), + ), + ), ), ); } diff --git a/app/lib/features/pipelines/widgets/pipeline_controls.dart b/app/lib/features/pipelines/widgets/pipeline_controls.dart index 859b4bbc..e62e411a 100644 --- a/app/lib/features/pipelines/widgets/pipeline_controls.dart +++ b/app/lib/features/pipelines/widgets/pipeline_controls.dart @@ -1,17 +1,11 @@ import '../../../ui/adaptive/app_menu_anchor.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/segmented_bar.dart'; import '../pipeline_query.dart'; -/// The one control-family decision for this feature: Cupertino only under an -/// explicit Cupertino host, Material on every platform otherwise. -bool useCupertinoControls(BuildContext context) => usesCupertinoHost(context); - -/// Standard platform activity indicator with an accessible status label. +/// Standard Material activity indicator with an accessible status label. class PipelineProgress extends StatelessWidget { const PipelineProgress({super.key, this.label = 'Loading'}); @@ -22,14 +16,12 @@ class PipelineProgress extends StatelessWidget { return Semantics( label: label, liveRegion: true, - child: useCupertinoControls(context) - ? const CupertinoActivityIndicator() - : const CircularProgressIndicator(), + child: const CircularProgressIndicator(), ); } } -/// A standard text action in the current platform's style. +/// A standard Material text action. class PipelineTextButton extends StatelessWidget { const PipelineTextButton({ super.key, @@ -42,18 +34,11 @@ class PipelineTextButton extends StatelessWidget { @override Widget build(BuildContext context) { - if (useCupertinoControls(context)) { - return CupertinoButton( - padding: EdgeInsets.zero, - onPressed: onPressed, - child: Text(label), - ); - } return TextButton(onPressed: onPressed, child: Text(label)); } } -/// Native back affordance used by the narrow list/detail layout. +/// Back affordance used by the narrow list/detail layout. class PipelineBackButton extends StatelessWidget { const PipelineBackButton({super.key, required this.onPressed}); @@ -62,19 +47,18 @@ class PipelineBackButton extends StatelessWidget { /// The same round Back as every page's segmented bar. @override Widget build(BuildContext context) { - final cupertino = useCupertinoControls(context); return Semantics( label: 'Back to pipelines', child: SegmentedPill( - cupertino: cupertino, - child: SegmentedBackButton(cupertino: cupertino, onPressed: onPressed), + cupertino: false, + child: SegmentedBackButton(cupertino: false, onPressed: onPressed), ), ); } } -/// The list's sort control: a Material menu on Android/desktop, an action -/// sheet on iOS. The label is the current choice, exactly as on web. +/// The list's sort control: a Material menu. The label is the current choice, +/// exactly as on web. class PipelineSortButton extends StatelessWidget { const PipelineSortButton({ super.key, @@ -92,23 +76,6 @@ class PipelineSortButton extends StatelessWidget { @override Widget build(BuildContext context) { final label = 'Sort: ${sort.label}'; - if (useCupertinoControls(context)) { - return Semantics( - button: true, - label: icon ? 'Sort pipelines: ${sort.label}' : null, - excludeSemantics: icon, - child: CupertinoButton( - padding: EdgeInsets.zero, - minimumSize: icon - ? const Size.square(kMinInteractiveDimensionCupertino) - : null, - onPressed: () => _showCupertinoSheet(context), - child: icon - ? const Icon(CupertinoIcons.arrow_up_arrow_down) - : Text(label), - ), - ); - } return AppMenuAnchor( menuChildren: [ for (final option in PipelineSort.values) @@ -129,30 +96,6 @@ class PipelineSortButton extends StatelessWidget { ), ); } - - Future _showCupertinoSheet(BuildContext context) { - return showCupertinoModalPopup( - context: context, - builder: (sheetContext) => CupertinoActionSheet( - title: const Text('Sort pipelines'), - actions: [ - for (final option in PipelineSort.values) - CupertinoActionSheetAction( - onPressed: () { - Navigator.of(sheetContext).pop(); - onSelected(option); - }, - child: Text(option.label), - ), - ], - cancelButton: CupertinoActionSheetAction( - isDefaultAction: true, - onPressed: () => Navigator.of(sheetContext).pop(), - child: const Text('Cancel'), - ), - ), - ); - } } /// A truthful, non-blocking error line with an optional retry action. @@ -170,10 +113,7 @@ class PipelineErrorBanner extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = useCupertinoControls(context); - final color = cupertino - ? CupertinoColors.systemRed.resolveFrom(context) - : Theme.of(context).colorScheme.error; + final color = Theme.of(context).colorScheme.error; return Semantics( liveRegion: true, child: Padding( diff --git a/app/lib/features/pipelines/widgets/pipeline_definition_validation.dart b/app/lib/features/pipelines/widgets/pipeline_definition_validation.dart index ee395c35..82f5368c 100644 --- a/app/lib/features/pipelines/widgets/pipeline_definition_validation.dart +++ b/app/lib/features/pipelines/widgets/pipeline_definition_validation.dart @@ -1,8 +1,6 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; -import '../../../ui/adaptive/host.dart'; import '../../../ui/layout/warnings_section.dart'; // The gateway bounds this cache to one server connection. Retain at most sixteen @@ -100,15 +98,10 @@ class _PipelineDefinitionValidationState if (snapshot.hasError || !validReply) Align( alignment: AlignmentDirectional.centerStart, - child: usesCupertinoHost(context) - ? CupertinoButton( - onPressed: () => setState(() => _load(retry: true)), - child: const Text('Retry validation'), - ) - : TextButton( - onPressed: () => setState(() => _load(retry: true)), - child: const Text('Retry validation'), - ), + child: TextButton( + onPressed: () => setState(() => _load(retry: true)), + child: const Text('Retry validation'), + ), ), ], ); diff --git a/app/lib/features/pipelines/widgets/pipeline_detail_styles.dart b/app/lib/features/pipelines/widgets/pipeline_detail_styles.dart index 0e55f161..fb1ed9fc 100644 --- a/app/lib/features/pipelines/widgets/pipeline_detail_styles.dart +++ b/app/lib/features/pipelines/widgets/pipeline_detail_styles.dart @@ -1,35 +1,19 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'pipeline_controls.dart'; - TextStyle? pipelineTitleStyle(BuildContext context) => - useCupertinoControls(context) - ? CupertinoTheme.of(context).textTheme.navLargeTitleTextStyle - : Theme.of(context).textTheme.headlineSmall; + Theme.of(context).textTheme.headlineSmall; TextStyle? pipelineSectionStyle(BuildContext context) => - useCupertinoControls(context) - ? CupertinoTheme.of(context).textTheme.navTitleTextStyle - : Theme.of(context).textTheme.titleMedium; + Theme.of(context).textTheme.titleMedium; TextStyle? pipelineValueStyle(BuildContext context, {bool monospace = false}) { - final base = useCupertinoControls(context) - // SelectableText requires an explicit baseline when it inherits no style; - // merge the Cupertino system style with the ambient text style. - ? CupertinoTheme.of(context).textTheme.textStyle.copyWith(inherit: true) - : Theme.of(context).textTheme.bodyMedium; + final base = Theme.of(context).textTheme.bodyMedium; // Metadata can identify code-like values, but the user requested native // typography even for source/hash surfaces; do not replace the host font. return base; } TextStyle? pipelineMutedStyle(BuildContext context) { - if (useCupertinoControls(context)) { - return CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ); - } final theme = Theme.of(context); return theme.textTheme.bodySmall?.copyWith( color: theme.colorScheme.onSurfaceVariant, diff --git a/app/lib/features/pipelines/widgets/pipeline_detail_tab.dart b/app/lib/features/pipelines/widgets/pipeline_detail_tab.dart index 9fdcdb50..56b649b8 100644 --- a/app/lib/features/pipelines/widgets/pipeline_detail_tab.dart +++ b/app/lib/features/pipelines/widgets/pipeline_detail_tab.dart @@ -14,5 +14,7 @@ enum PipelineDetailTab { /// The tab's glyph, the only thing the bottom bar draws (the label is its /// accessible name); distinct from the shell's Pipelines tab beneath it. final IconData icon; + + /// Retained for callers; the Material [icon] is drawn. final IconData cupertinoIcon; } diff --git a/app/lib/features/pipelines/widgets/pipeline_filter_cupertino_body.dart b/app/lib/features/pipelines/widgets/pipeline_filter_cupertino_body.dart deleted file mode 100644 index 1523e0a5..00000000 --- a/app/lib/features/pipelines/widgets/pipeline_filter_cupertino_body.dart +++ /dev/null @@ -1,129 +0,0 @@ -import '../../../ui/theme/app_theme.dart'; -import 'package:flutter/cupertino.dart'; - -import '../pipeline_filter.dart'; - -/// Cupertino filter form using native grouped lists and checkboxes. -class PipelineFilterCupertinoBody extends StatelessWidget { - const PipelineFilterCupertinoBody({ - super.key, - required this.filters, - required this.name, - required this.hasUnclassified, - required this.onChanged, - required this.onClear, - }); - - final PipelineFilters filters; - final TextEditingController name; - final bool hasUnclassified; - final ValueChanged onChanged; - final VoidCallback onClear; - - @override - Widget build(BuildContext context) { - return ListView( - children: [ - Padding( - padding: const EdgeInsets.all(16), - child: CupertinoTextField( - controller: name, - placeholder: 'Pipeline name contains', - ), - ), - CupertinoListSection.insetGrouped( - backgroundColor: AppColors.groupedBackground, - header: const Text('RUNS'), - children: [ - for (final presence in RunPresence.values) - _choice( - label: presence.label, - selected: filters.presence == presence, - onTap: () => onChanged(filters.copyWith(presence: presence)), - ), - ], - ), - CupertinoListSection.insetGrouped( - backgroundColor: AppColors.groupedBackground, - header: const Text('LAST RUN STATUS'), - children: [ - for (final status in runStatusFilters) - _check( - label: status, - checked: filters.lastRunStatuses.contains(status), - onChanged: (checked) { - final next = {...filters.lastRunStatuses}; - if (checked) { - next.add(status); - } else { - next.remove(status); - } - onChanged(filters.copyWith(lastRunStatuses: next)); - }, - ), - ], - ), - CupertinoListSection.insetGrouped( - backgroundColor: AppColors.groupedBackground, - header: const Text('SCHEDULING'), - footer: const Text('Configured schedules, including paused.'), - children: [ - for (final schedule in ScheduleFilter.values) - _choice( - label: schedule.label, - selected: filters.schedule == schedule, - onTap: () => onChanged(filters.copyWith(schedule: schedule)), - ), - ], - ), - Padding( - padding: const EdgeInsets.all(16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - if (hasUnclassified) - const Padding( - padding: EdgeInsets.only(bottom: 12), - child: Text( - 'Some records have no scheduling metadata; they stay unclassified.', - ), - ), - CupertinoButton( - padding: EdgeInsets.zero, - onPressed: onClear, - child: const Text('Clear filters'), - ), - ], - ), - ), - ], - ); - } - - Widget _choice({ - required String label, - required bool selected, - required VoidCallback onTap, - }) { - return CupertinoListTile( - title: Text(label), - trailing: CupertinoCheckbox(value: selected, onChanged: (_) => onTap()), - onTap: onTap, - ); - } - - Widget _check({ - required String label, - required bool checked, - required ValueChanged onChanged, - }) { - return CupertinoListTile( - title: Text(label), - trailing: CupertinoCheckbox( - value: checked, - onChanged: (value) => onChanged(value ?? false), - ), - onTap: () => onChanged(!checked), - ); - } -} diff --git a/app/lib/features/pipelines/widgets/pipeline_filter_page.dart b/app/lib/features/pipelines/widgets/pipeline_filter_page.dart index 045f9f05..fa06a8ea 100644 --- a/app/lib/features/pipelines/widgets/pipeline_filter_page.dart +++ b/app/lib/features/pipelines/widgets/pipeline_filter_page.dart @@ -1,40 +1,27 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/segmented_bar.dart'; import '../pipeline_filter.dart'; -import 'pipeline_controls.dart'; -import 'pipeline_filter_cupertino_body.dart'; import 'pipeline_filter_material_body.dart'; -/// Opens the platform's native full-screen filter editor. +/// Opens the full-screen filter editor. Future openPipelineFilters( BuildContext context, { required PipelineFilters initial, required bool hasUnclassified, required ValueChanged onApply, }) { - final cupertino = useCupertinoControls(context); - final route = cupertino - ? CupertinoPageRoute( - fullscreenDialog: true, - builder: (_) => PipelineFilterPage( - initial: initial, - hasUnclassified: hasUnclassified, - onApply: onApply, - cupertino: true, - ), - ) - : MaterialPageRoute( - fullscreenDialog: true, - builder: (_) => PipelineFilterPage( - initial: initial, - hasUnclassified: hasUnclassified, - onApply: onApply, - cupertino: false, - ), - ); - return Navigator.of(context).push(route); + return Navigator.of(context).push( + MaterialPageRoute( + fullscreenDialog: true, + builder: (_) => PipelineFilterPage( + initial: initial, + hasUnclassified: hasUnclassified, + onApply: onApply, + cupertino: false, + ), + ), + ); } /// A draft copy of the filters. Changes take effect on Done; leaving the page @@ -51,6 +38,8 @@ class PipelineFilterPage extends StatefulWidget { final PipelineFilters initial; final bool hasUnclassified; final ValueChanged onApply; + + /// Retained for callers; the page is Material on every host. final bool cupertino; @override @@ -83,37 +72,6 @@ class _PipelineFilterPageState extends State { @override Widget build(BuildContext context) { - final body = widget.cupertino - ? PipelineFilterCupertinoBody( - filters: _draft, - name: _name, - hasUnclassified: widget.hasUnclassified, - onChanged: (filters) => setState(() => _draft = filters), - onClear: _clear, - ) - : PipelineFilterMaterialBody( - filters: _draft, - name: _name, - hasUnclassified: widget.hasUnclassified, - onChanged: (filters) => setState(() => _draft = filters), - onClear: _clear, - ); - if (widget.cupertino) { - return CupertinoPageScaffold( - navigationBar: SegmentedBar( - cupertino: true, - title: 'Filter pipelines', - actions: [ - CupertinoButton( - padding: const EdgeInsets.symmetric(horizontal: 16), - onPressed: _apply, - child: const Text('Done'), - ), - ], - ), - child: SafeArea(top: false, bottom: false, child: body), - ); - } return Scaffold( extendBodyBehindAppBar: true, appBar: SegmentedBar( @@ -121,7 +79,17 @@ class _PipelineFilterPageState extends State { title: 'Filter pipelines', actions: [TextButton(onPressed: _apply, child: const Text('Done'))], ), - body: SafeArea(top: false, bottom: false, child: body), + body: SafeArea( + top: false, + bottom: false, + child: PipelineFilterMaterialBody( + filters: _draft, + name: _name, + hasUnclassified: widget.hasUnclassified, + onChanged: (filters) => setState(() => _draft = filters), + onClear: _clear, + ), + ), ); } } diff --git a/app/lib/features/pipelines/widgets/pipeline_graph_tab.dart b/app/lib/features/pipelines/widgets/pipeline_graph_tab.dart index 2af76f1e..03ed4046 100644 --- a/app/lib/features/pipelines/widgets/pipeline_graph_tab.dart +++ b/app/lib/features/pipelines/widgets/pipeline_graph_tab.dart @@ -1,11 +1,9 @@ import 'dart:math' as math; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../graph/widgets/definition_graph_view.dart'; import '../pipeline_models.dart'; -import 'pipeline_controls.dart'; import 'pipeline_detail_styles.dart'; /// The Graph tab's guidance note. Gestures stay the host's own: wheel or pinch @@ -207,14 +205,6 @@ class _GraphGuidanceNoteState extends State<_GraphGuidanceNote> { /// The host's own scrollbar: visible whenever the note is clipped, and /// draggable with the pointer, so the rest is discoverable without a wheel. Widget _scrollbar(Widget child) { - if (useCupertinoControls(context)) { - return CupertinoScrollbar( - key: const Key('pipeline-graph-note-scrollbar'), - controller: _scrollController, - thumbVisibility: true, - child: child, - ); - } return Scrollbar( key: const Key('pipeline-graph-note-scrollbar'), controller: _scrollController, diff --git a/app/lib/features/pipelines/widgets/pipeline_list_panel.dart b/app/lib/features/pipelines/widgets/pipeline_list_panel.dart index 27045e0b..f3b63954 100644 --- a/app/lib/features/pipelines/widgets/pipeline_list_panel.dart +++ b/app/lib/features/pipelines/widgets/pipeline_list_panel.dart @@ -1,7 +1,6 @@ import '../../../core/servers/server_context.dart'; import '../../../ui/layout/app_list_avatar.dart'; import '../../../ui/layout/app_list_row.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../shell/shell_list_shortcuts.dart'; @@ -213,7 +212,6 @@ class PipelineListPanel extends StatelessWidget { List items, ) { final now = DateTime.now(); - final cupertino = useCupertinoControls(context); // The default padding is the media padding: the controls start below the // top bar and the last row clears the floating tab bar. return ListView.builder( @@ -228,12 +226,12 @@ class PipelineListPanel extends StatelessWidget { final badge = run == null ? null : runBadge(run, now); return AppListRow( key: Key('pipeline-row-${pipeline.id}'), - cupertino: cupertino, + cupertino: false, selected: controller.selectedId == pipeline.id, divider: index < header.length + items.length - 1, onTap: () => controller.openPipeline(pipeline.id, version: pipeline.version), - leading: _pipelineIdentityIcon(context, pipeline, cupertino), + leading: _pipelineIdentityIcon(context, pipeline), title: Text(pipeline.displayName), time: badge?.ranAgo, subtitleLeading: badge == null @@ -274,11 +272,6 @@ class PipelineListPanel extends StatelessWidget { } TextStyle? _mutedStyle(BuildContext context) { - if (useCupertinoControls(context)) { - return CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ); - } final theme = Theme.of(context); return theme.textTheme.bodySmall?.copyWith( color: theme.colorScheme.onSurfaceVariant, @@ -290,19 +283,9 @@ class PipelineListPanel extends StatelessWidget { Widget _pipelineIdentityIcon( BuildContext context, PipelineSummary pipeline, - bool cupertino, ) { - final List colors; - if (cupertino) { - colors = [ - CupertinoTheme.of(context).primaryColor, - CupertinoColors.systemIndigo.resolveFrom(context), - CupertinoColors.systemTeal.resolveFrom(context), - ]; - } else { - final scheme = Theme.of(context).colorScheme; - colors = [scheme.primary, scheme.secondary, scheme.tertiary]; - } + final scheme = Theme.of(context).colorScheme; + final colors = [scheme.primary, scheme.secondary, scheme.tertiary]; return Semantics( label: 'Pipeline ${pipeline.displayName}', child: ExcludeSemantics( @@ -334,34 +317,17 @@ List pipelineListActions( final label = filters.count == 0 ? 'Filter pipelines' : '${filters.count} active ${filters.count == 1 ? 'filter' : 'filters'}'; - final cupertino = useCupertinoControls(context); - final filterIcon = cupertino - ? (filters.count > 0 - ? CupertinoIcons.line_horizontal_3_decrease_circle_fill - : CupertinoIcons.line_horizontal_3_decrease_circle) - : (filters.count > 0 ? Icons.filter_alt : Icons.filter_alt_outlined); - final filter = cupertino - ? Semantics( - button: true, - label: label, - excludeSemantics: true, - child: CupertinoButton( - key: const Key('pipeline-filter'), - padding: EdgeInsets.zero, - minimumSize: const Size.square(kMinInteractiveDimensionCupertino), - onPressed: openFilters, - child: Icon(filterIcon), - ), - ) - : IconButton( - key: const Key('pipeline-filter'), - tooltip: label, - isSelected: filters.count > 0, - onPressed: openFilters, - icon: Icon(filterIcon), - ); - // A narrow bar moves either into its More menu; sorting is then a - // submenu (Material) or a second action sheet (Cupertino). + final filterIcon = filters.count > 0 + ? Icons.filter_alt + : Icons.filter_alt_outlined; + final filter = IconButton( + key: const Key('pipeline-filter'), + tooltip: label, + isSelected: filters.count > 0, + onPressed: openFilters, + icon: Icon(filterIcon), + ); + // A narrow bar moves either into its More menu; sorting is then a submenu. return [ SegmentedOverflowAction( overflowEntry: SegmentedOverflowEntry( @@ -374,7 +340,7 @@ List pipelineListActions( SegmentedOverflowAction( overflowEntry: SegmentedOverflowEntry( label: 'Sort pipelines: ${controller.sort.label}', - icon: cupertino ? CupertinoIcons.arrow_up_arrow_down : Icons.sort, + icon: Icons.sort, choices: [ for (final option in PipelineSort.values) SegmentedMenuChoice( diff --git a/app/lib/features/pipelines/widgets/pipeline_scope_control.dart b/app/lib/features/pipelines/widgets/pipeline_scope_control.dart index ae1b5afe..aac7d704 100644 --- a/app/lib/features/pipelines/widgets/pipeline_scope_control.dart +++ b/app/lib/features/pipelines/widgets/pipeline_scope_control.dart @@ -1,8 +1,5 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'pipeline_controls.dart'; - /// The list's scope: every active pipeline, only scheduled ones, or the /// archived pipelines (which the other two never show). enum PipelineScope { @@ -15,7 +12,7 @@ enum PipelineScope { final String label; } -/// Uses a native picker when the segmented labels cannot fit at the user's +/// Uses a standard dropdown when the segmented labels cannot fit at the user's /// text scale. The decision is content-measured, not a fixed pane width. class PipelineScopeControl extends StatelessWidget { const PipelineScopeControl({ @@ -32,10 +29,7 @@ class PipelineScopeControl extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = useCupertinoControls(context); - final style = cupertino - ? CupertinoTheme.of(context).textTheme.textStyle - : Theme.of(context).textTheme.labelLarge; + final style = Theme.of(context).textTheme.labelLarge; var requiredWidth = kMinInteractiveDimension * labels.length; for (final label in labels.values) { final painter = TextPainter( @@ -49,84 +43,35 @@ class PipelineScopeControl extends StatelessWidget { return LayoutBuilder( builder: (context, constraints) { if (constraints.maxWidth >= requiredWidth) { - return cupertino - ? CupertinoSlidingSegmentedControl( - key: const Key('pipeline-scope'), - groupValue: scope, - onValueChanged: (value) => - onSelected(value ?? PipelineScope.all), - children: { - for (final entry in labels.entries) - entry.key: Text(entry.value), - }, - ) - : SegmentedButton( - key: const Key('pipeline-scope'), - showSelectedIcon: false, - segments: [ - for (final entry in labels.entries) - ButtonSegment(value: entry.key, label: Text(entry.value)), - ], - selected: {scope}, - onSelectionChanged: (value) => onSelected(value.single), - ); - } - if (!cupertino) { - return DropdownButton( + return SegmentedButton( key: const Key('pipeline-scope'), - value: scope, - isExpanded: true, - items: [ + showSelectedIcon: false, + segments: [ for (final entry in labels.entries) - DropdownMenuItem( - value: entry.key, - child: Text( - entry.value, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), + ButtonSegment(value: entry.key, label: Text(entry.value)), ], - onChanged: (value) { - if (value != null) onSelected(value); - }, + selected: {scope}, + onSelectionChanged: (value) => onSelected(value.single), ); } - return CupertinoButton( + return DropdownButton( key: const Key('pipeline-scope'), - padding: EdgeInsets.zero, - onPressed: () => showCupertinoModalPopup( - context: context, - builder: (sheetContext) => CupertinoActionSheet( - title: const Text('Pipeline scope'), - actions: [ - for (final entry in labels.entries) - CupertinoActionSheetAction( - onPressed: () { - Navigator.of(sheetContext).pop(); - if (context.mounted) onSelected(entry.key); - }, - child: Text(entry.value), - ), - ], - cancelButton: CupertinoActionSheetAction( - onPressed: () => Navigator.of(sheetContext).pop(), - child: const Text('Cancel'), - ), - ), - ), - child: Row( - children: [ - Expanded( + value: scope, + isExpanded: true, + items: [ + for (final entry in labels.entries) + DropdownMenuItem( + value: entry.key, child: Text( - labels[scope]!, + entry.value, maxLines: 1, overflow: TextOverflow.ellipsis, ), ), - const Icon(CupertinoIcons.chevron_down), - ], - ), + ], + onChanged: (value) { + if (value != null) onSelected(value); + }, ); }, ); diff --git a/app/lib/features/pipelines/widgets/pipeline_summary_view.dart b/app/lib/features/pipelines/widgets/pipeline_summary_view.dart index a86d69ad..96977693 100644 --- a/app/lib/features/pipelines/widgets/pipeline_summary_view.dart +++ b/app/lib/features/pipelines/widgets/pipeline_summary_view.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../core/api_gateway.dart'; @@ -10,7 +9,6 @@ import '../pipeline_format.dart'; import '../pipeline_models.dart'; import '../pipeline_query.dart'; import '../pipelines_controller.dart'; -import 'pipeline_controls.dart'; import 'pipeline_definition_validation.dart'; import 'pipeline_detail_styles.dart'; @@ -85,7 +83,7 @@ class PipelineSummaryView extends StatelessWidget { if (fields.isEmpty) return const SizedBox.shrink(); return FactsGrid( key: pipelineSummaryFactsKey, - cupertino: useCupertinoControls(context), + cupertino: false, items: [ for (final field in fields) FactsGridItem( @@ -101,7 +99,6 @@ class PipelineSummaryView extends StatelessWidget { } Widget _versions(BuildContext context) { - final cupertino = useCupertinoControls(context); final effective = detail.resolvedVersion; final showingLatest = effective == detail.latestVersion; final versions = detail.versions; @@ -109,7 +106,7 @@ class PipelineSummaryView extends StatelessWidget { if (!showingLatest) AppListRow( key: const Key('pipeline-latest-version'), - cupertino: cupertino, + cupertino: false, title: Text('View latest v${detail.latestVersion}'), subtitle: const Text('Return to the latest version'), divider: versions.isNotEmpty, @@ -118,7 +115,7 @@ class PipelineSummaryView extends StatelessWidget { for (var index = 0; index < versions.length; index += 1) AppListRow( key: Key('pipeline-version-${versions[index].version}'), - cupertino: cupertino, + cupertino: false, selected: versions[index].version == effective, title: Text('v${versions[index].version}'), time: formatLocalTimestamp(versions[index].createdAt), diff --git a/app/lib/features/pipelines/widgets/pipeline_tabs.dart b/app/lib/features/pipelines/widgets/pipeline_tabs.dart index 13ad4f5c..e66eb210 100644 --- a/app/lib/features/pipelines/widgets/pipeline_tabs.dart +++ b/app/lib/features/pipelines/widgets/pipeline_tabs.dart @@ -2,7 +2,6 @@ import 'package:flutter/widgets.dart'; import '../../../ui/adaptive/floating_bar_layout.dart'; import '../../../ui/adaptive/floating_destination_bar.dart'; -import 'pipeline_controls.dart'; import 'pipeline_detail_tab.dart'; export 'pipeline_detail_tab.dart'; @@ -30,12 +29,11 @@ class PipelineDetailTabs extends StatelessWidget { @override Widget build(BuildContext context) { - final cupertino = useCupertinoControls(context); const tabs = PipelineDetailTab.values; return KeyedSubtree( key: const Key('pipeline-detail-tabs'), child: FloatingDestinationBar( - cupertino: cupertino, + cupertino: false, currentIndex: tabs.indexOf(selected), edge: edge, onTap: (value) => onSelected(tabs[value]), @@ -43,7 +41,7 @@ class PipelineDetailTabs extends StatelessWidget { for (final tab in tabs) FloatingDestinationItem( key: ValueKey('pipeline-detail-tab-${tab.name}'), - icon: Icon(cupertino ? tab.cupertinoIcon : tab.icon), + icon: Icon(tab.icon), label: tab.label, ), ], diff --git a/app/test/application/pipelines_registration_test.dart b/app/test/application/pipelines_registration_test.dart index 291c8c17..0d181a08 100644 --- a/app/test/application/pipelines_registration_test.dart +++ b/app/test/application/pipelines_registration_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/application/pipelines_app.dart'; @@ -12,83 +11,66 @@ import 'pipelines_replies.dart'; import 'package:pipelines_app/ui/adaptive/segmented_bar.dart'; void main() { - for (final cupertino in [false, true]) { - testWidgets( - 'the /pipelines route renders real rows, detail and source ($cupertino)', - (tester) async { - tester.view.physicalSize = const Size(1100, 900); - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); - if (cupertino) { - tester.platformDispatcher.platformBrightnessTestValue = - Brightness.dark; - addTearDown( - tester.platformDispatcher.clearPlatformBrightnessTestValue, - ); - } + testWidgets('the /pipelines route renders real rows, detail and source', ( + tester, + ) async { + tester.view.physicalSize = const Size(1100, 900); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.resetPhysicalSize); + addTearDown(tester.view.resetDevicePixelRatio); - final fixture = PipelineFixture(); - final channel = FakeChannel()..readyCompleter.complete(); - var sockets = 0; - final client = PipelinesClient( - channelFactory: (_) { - sockets++; - return channel; - }, - ); - final provider = PlatformRouteInformationProvider( - initialRouteInformation: RouteInformation( - uri: Uri.parse('/pipelines'), - ), - ); - addTearDown(provider.dispose); - - await tester.pumpWidget( - PipelinesApp( - server: webServer(), - client: client, - cupertino: cupertino, - routeInformationProvider: provider, - ), - ); - await tester.pump(); - await replyPipelines(tester, channel, fixture); - await tester.pump(); - - expect(find.text('Alpha review'), findsOneWidget); - expect(find.text('2 stages · 1 schedule'), findsOneWidget); - expect(find.text('Pipelines — Not implemented'), findsNothing); - expect(sockets, 1); - - // The shell owns the only navigation bar; the embedded screen adds no - // second bar. - expect(find.byType(SegmentedBar), findsOneWidget); - if (cupertino) { - expect(find.byType(CupertinoPageScaffold), findsOneWidget); - expect(find.byType(Material), findsNothing); - } else { - expect(find.byType(Scaffold), findsOneWidget); - } - - await tester.tap(find.byKey(const Key('pipeline-row-1'))); - await tester.pump(); - await replyPipelineDetail(tester, channel, fixture); - await tester.pump(); - expect(find.text('hash-alpha'), findsOneWidget); - - await tester.tap(find.byKey(const Key('pipeline-detail-tab-source'))); - await tester.pump(); - expect( - selectableText( - 'name: Alpha review\nstages:\n review:\n type: model', - ), - findsOneWidget, - ); - - await tester.pumpWidget(const SizedBox.shrink()); - await tester.pump(); + final fixture = PipelineFixture(); + final channel = FakeChannel()..readyCompleter.complete(); + var sockets = 0; + final client = PipelinesClient( + channelFactory: (_) { + sockets++; + return channel; }, ); - } + final provider = PlatformRouteInformationProvider( + initialRouteInformation: RouteInformation(uri: Uri.parse('/pipelines')), + ); + addTearDown(provider.dispose); + + await tester.pumpWidget( + PipelinesApp( + server: webServer(), + client: client, + cupertino: false, + routeInformationProvider: provider, + ), + ); + await tester.pump(); + await replyPipelines(tester, channel, fixture); + await tester.pump(); + + expect(find.text('Alpha review'), findsOneWidget); + expect(find.text('2 stages · 1 schedule'), findsOneWidget); + expect(find.text('Pipelines — Not implemented'), findsNothing); + expect(sockets, 1); + + // The shell owns the only navigation bar; the embedded screen adds no + // second bar. + expect(find.byType(SegmentedBar), findsOneWidget); + expect(find.byType(Scaffold), findsOneWidget); + + await tester.tap(find.byKey(const Key('pipeline-row-1'))); + await tester.pump(); + await replyPipelineDetail(tester, channel, fixture); + await tester.pump(); + expect(find.text('hash-alpha'), findsOneWidget); + + await tester.tap(find.byKey(const Key('pipeline-detail-tab-source'))); + await tester.pump(); + expect( + selectableText( + 'name: Alpha review\nstages:\n review:\n type: model', + ), + findsOneWidget, + ); + + await tester.pumpWidget(const SizedBox.shrink()); + await tester.pump(); + }); } diff --git a/app/test/application/settings_page_test.dart b/app/test/application/settings_page_test.dart index 16089843..28edd59f 100644 --- a/app/test/application/settings_page_test.dart +++ b/app/test/application/settings_page_test.dart @@ -1,5 +1,4 @@ import '../features/settings/settings_topic_test_helper.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/application/pipelines_app.dart'; @@ -20,7 +19,6 @@ import 'pipelines_replies.dart'; void main() { Future pumpApp( WidgetTester tester, { - required bool cupertino, required String location, required Size size, }) async { @@ -37,7 +35,7 @@ void main() { PipelinesApp( server: webServer(), client: PipelinesClient(channelFactory: (_) => channel), - cupertino: cupertino, + cupertino: false, routeInformationProvider: provider, ), ); @@ -52,82 +50,77 @@ void main() { .widget(find.byType(FloatingDestinationBar)) .currentIndex; - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; - for (final size in [const Size(390, 844), const Size(1200, 800)]) { - testWidgets('$host ${size.width}: the Pipelines bar gear opens Settings ' - 'as a page and Back returns', (tester) async { - final provider = await pumpApp( - tester, - cupertino: cupertino, - location: '/pipelines', - size: size, - ); - // Four tabs; Settings is none of them. - expect( - tester - .widget( - find.byType(FloatingDestinationBar), - ) - .items - .map((item) => item.label), - ['Pipelines', 'Runs', 'Chat', 'Search'], - ); - expect( - find.byKey(const ValueKey('shell.destination.settings')), - findsNothing, - ); - expect(find.byKey(const ValueKey('shell.back')), findsNothing); - - await tapBarAction( - tester, - find.byKey(const Key('pipelines-open-settings')), - 'Settings', - ); - await tester.pump(); - await tester.pump(); - expect(provider.value.uri.path, '/settings'); - expect(find.byType(SettingsScreen), findsOneWidget); - expect(find.text('Quick switch animation'), findsOneWidget); - await selectSettingsTopic(tester, 'Connection'); - expect(find.text('Server URL'), findsOneWidget); - // A page of Pipelines: Back in its bar, Pipelines still selected. - expect(find.byKey(const ValueKey('shell.back')), findsOneWidget); - expect(find.byKey(const ValueKey('shell.search')), findsNothing); - expect(selectedTab(tester), 0); - expect(tester.takeException(), isNull); - - await tester.tap(find.byKey(const ValueKey('shell.back'))); - await tester.pump(); - await tester.pump(); - expect(provider.value.uri.path, '/pipelines'); - expect(find.byKey(const Key('pipelines-open-settings')), findsWidgets); - expect(find.byKey(const ValueKey('shell.back')), findsNothing); - await tester.pumpWidget(const SizedBox.shrink()); - await tester.pump(); - }); - } - - testWidgets('$host: the /settings deep link opens the Settings page and ' - 'the system Back closes it to Pipelines', (tester) async { + for (final size in [const Size(390, 844), const Size(1200, 800)]) { + testWidgets('${size.width}: the Pipelines bar gear opens Settings ' + 'as a page and Back returns', (tester) async { final provider = await pumpApp( tester, - cupertino: cupertino, - location: '/settings', - size: const Size(390, 844), + location: '/pipelines', + size: size, + ); + // Four tabs; Settings is none of them. + expect( + tester + .widget( + find.byType(FloatingDestinationBar), + ) + .items + .map((item) => item.label), + ['Pipelines', 'Runs', 'Chat', 'Search'], + ); + expect( + find.byKey(const ValueKey('shell.destination.settings')), + findsNothing, + ); + expect(find.byKey(const ValueKey('shell.back')), findsNothing); + + await tapBarAction( + tester, + find.byKey(const Key('pipelines-open-settings')), + 'Settings', ); await tester.pump(); + await tester.pump(); + expect(provider.value.uri.path, '/settings'); expect(find.byType(SettingsScreen), findsOneWidget); + expect(find.text('Quick switch animation'), findsOneWidget); + await selectSettingsTopic(tester, 'Connection'); + expect(find.text('Server URL'), findsOneWidget); + // A page of Pipelines: Back in its bar, Pipelines still selected. expect(find.byKey(const ValueKey('shell.back')), findsOneWidget); + expect(find.byKey(const ValueKey('shell.search')), findsNothing); expect(selectedTab(tester), 0); + expect(tester.takeException(), isNull); - final handled = await tester.binding.handlePopRoute(); - expect(handled, isTrue, reason: 'Back closes the page, not the app'); + await tester.tap(find.byKey(const ValueKey('shell.back'))); await tester.pump(); await tester.pump(); expect(provider.value.uri.path, '/pipelines'); + expect(find.byKey(const Key('pipelines-open-settings')), findsWidgets); + expect(find.byKey(const ValueKey('shell.back')), findsNothing); await tester.pumpWidget(const SizedBox.shrink()); await tester.pump(); }); } + + testWidgets('the /settings deep link opens the Settings page and ' + 'the system Back closes it to Pipelines', (tester) async { + final provider = await pumpApp( + tester, + location: '/settings', + size: const Size(390, 844), + ); + await tester.pump(); + expect(find.byType(SettingsScreen), findsOneWidget); + expect(find.byKey(const ValueKey('shell.back')), findsOneWidget); + expect(selectedTab(tester), 0); + + final handled = await tester.binding.handlePopRoute(); + expect(handled, isTrue, reason: 'Back closes the page, not the app'); + await tester.pump(); + await tester.pump(); + expect(provider.value.uri.path, '/pipelines'); + await tester.pumpWidget(const SizedBox.shrink()); + await tester.pump(); + }); } diff --git a/app/test/application/settings_registration_test.dart b/app/test/application/settings_registration_test.dart index c79c7b03..ccad068c 100644 --- a/app/test/application/settings_registration_test.dart +++ b/app/test/application/settings_registration_test.dart @@ -1,7 +1,6 @@ import '../features/settings/settings_topic_test_helper.dart'; import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/application/pipelines_app.dart'; @@ -16,89 +15,73 @@ import 'pipelines_replies.dart'; import 'package:pipelines_app/ui/adaptive/segmented_bar.dart'; void main() { - for (final cupertino in [false, true]) { - testWidgets('Settings shares socket and one native bar ($cupertino)', ( - tester, - ) async { - SharedPreferences.setMockInitialValues({}); - if (cupertino) { - tester.platformDispatcher.platformBrightnessTestValue = Brightness.dark; - addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue); - } - final channel = FakeChannel()..readyCompleter.complete(); - var sockets = 0; - final client = PipelinesClient( - channelFactory: (_) { - sockets++; - return channel; - }, - ); - final provider = PlatformRouteInformationProvider( - initialRouteInformation: RouteInformation(uri: Uri.parse('/pipelines')), - ); - addTearDown(provider.dispose); - await tester.pumpWidget( - PipelinesApp( - server: webServer(), - client: client, - cupertino: cupertino, - routeInformationProvider: provider, - ), - ); - await tester.pump(); - expect( - requestOf(channel, 'ping'), - isNull, - reason: 'Unvisited settings must not issue hidden requests', - ); - await replyPipelines(tester, channel, PipelineFixture()); + testWidgets('Settings shares socket and one native bar', (tester) async { + SharedPreferences.setMockInitialValues({}); + final channel = FakeChannel()..readyCompleter.complete(); + var sockets = 0; + final client = PipelinesClient( + channelFactory: (_) { + sockets++; + return channel; + }, + ); + final provider = PlatformRouteInformationProvider( + initialRouteInformation: RouteInformation(uri: Uri.parse('/pipelines')), + ); + addTearDown(provider.dispose); + await tester.pumpWidget( + PipelinesApp( + server: webServer(), + client: client, + cupertino: false, + routeInformationProvider: provider, + ), + ); + await tester.pump(); + expect( + requestOf(channel, 'ping'), + isNull, + reason: 'Unvisited settings must not issue hidden requests', + ); + await replyPipelines(tester, channel, PipelineFixture()); - await tapBarAction( - tester, - find.byKey(const Key('pipelines-open-settings')), - 'Settings', - ); - await tester.pump(); - await tester.pump(); - expect(provider.value.uri.path, '/settings'); - expect(find.text('Quick switch animation'), findsOneWidget); - await selectSettingsTopic(tester, 'Connection'); - expect(find.text('Server URL'), findsOneWidget); - if (cupertino) { - final title = tester.widget(find.text('Connection').last); - expect( - title.style!.color!.computeLuminance(), - greaterThan(0.5), - reason: 'Cupertino dark host must not inherit light Material text', - ); - } - expect(find.text('Settings — Not implemented'), findsNothing); - expect(sockets, 1); - expect(find.byType(SegmentedBar), findsOneWidget); - final ping = requestOf(channel, 'ping')!; - channel.incoming.add( - jsonEncode({ - 'id': ping['id'], - 'type': 'pong', - 'build': {'version': 'settings-fixture'}, - 'time': 'fixture time', - 'protocol': 2, - }), - ); - await tester.pump(); - await tester.pump(); - expect(find.textContaining('settings-fixture'), findsOneWidget); - expect( - find.text( - 'Protocol mismatch: this page speaks protocol 1, ' - 'the server reports 2.', - ), - findsOneWidget, - reason: 'a mismatched server must stay visibly flagged in Settings', - ); - expect(tester.takeException(), isNull); - await tester.pumpWidget(const SizedBox.shrink()); - await tester.pump(); - }); - } + await tapBarAction( + tester, + find.byKey(const Key('pipelines-open-settings')), + 'Settings', + ); + await tester.pump(); + await tester.pump(); + expect(provider.value.uri.path, '/settings'); + expect(find.text('Quick switch animation'), findsOneWidget); + await selectSettingsTopic(tester, 'Connection'); + expect(find.text('Server URL'), findsOneWidget); + expect(find.text('Settings — Not implemented'), findsNothing); + expect(sockets, 1); + expect(find.byType(SegmentedBar), findsOneWidget); + final ping = requestOf(channel, 'ping')!; + channel.incoming.add( + jsonEncode({ + 'id': ping['id'], + 'type': 'pong', + 'build': {'version': 'settings-fixture'}, + 'time': 'fixture time', + 'protocol': 2, + }), + ); + await tester.pump(); + await tester.pump(); + expect(find.textContaining('settings-fixture'), findsOneWidget); + expect( + find.text( + 'Protocol mismatch: this page speaks protocol 1, ' + 'the server reports 2.', + ), + findsOneWidget, + reason: 'a mismatched server must stay visibly flagged in Settings', + ); + expect(tester.takeException(), isNull); + await tester.pumpWidget(const SizedBox.shrink()); + await tester.pump(); + }); } diff --git a/app/test/application/tab_location_navigation_test.dart b/app/test/application/tab_location_navigation_test.dart index 6da663d8..cae8dfb3 100644 --- a/app/test/application/tab_location_navigation_test.dart +++ b/app/test/application/tab_location_navigation_test.dart @@ -22,7 +22,6 @@ Future<({PlatformRouteInformationProvider provider, FakeChannel channel})> mount( WidgetTester tester, { String route = '/pipelines', - bool cupertino = false, TabLocationsStore? store, }) async { tester.view.physicalSize = const Size(560, 1000); @@ -39,7 +38,7 @@ mount( PipelinesApp( server: webServer(), client: client, - cupertino: cupertino, + cupertino: false, serverId: 'navigation-test', routeInformationProvider: provider, tabLocationsStore: store, @@ -58,44 +57,41 @@ Future tab(WidgetTester tester, String name) async { void main() { setUp(() => SharedPreferences.setMockInitialValues({})); - for (final cupertino in [false, true]) { - testWidgets( - 'Settings is retained inside Pipelines across tab switches ($cupertino)', - (tester) async { - final app = await mount(tester, cupertino: cupertino); - await replyPipelines(tester, app.channel, PipelineFixture()); - await tester.pumpAndSettle(); - await tapBarAction( - tester, - find.byKey(const Key('pipelines-open-settings')), - 'Settings', - ); - await tester.pumpAndSettle(); - expect(app.provider.value.uri.path, '/settings'); - final settingsState = tester.state(find.byType(SettingsScreen)); - await tab(tester, 'chat'); - expect(app.provider.value.uri.path, '/chat'); - await tab(tester, 'pipelines'); - expect(app.provider.value.uri.path, '/settings'); - expect(tester.state(find.byType(SettingsScreen)), same(settingsState)); - await tab(tester, 'pipelines'); - expect( - app.provider.value.uri.path, - '/settings', - reason: 'tab retap is not Back', - ); - await tester.tap(find.byKey(const ValueKey('shell.back'))); - await tester.pump(); - await tester.pump(const Duration(milliseconds: 500)); - expect( - app.provider.value.uri.path, - '/pipelines', - reason: 'explicit Back still exits Settings', - ); - expect(tester.takeException(), isNull); - }, + testWidgets('Settings is retained inside Pipelines across tab switches', ( + tester, + ) async { + final app = await mount(tester); + await replyPipelines(tester, app.channel, PipelineFixture()); + await tester.pumpAndSettle(); + await tapBarAction( + tester, + find.byKey(const Key('pipelines-open-settings')), + 'Settings', ); - } + await tester.pumpAndSettle(); + expect(app.provider.value.uri.path, '/settings'); + final settingsState = tester.state(find.byType(SettingsScreen)); + await tab(tester, 'chat'); + expect(app.provider.value.uri.path, '/chat'); + await tab(tester, 'pipelines'); + expect(app.provider.value.uri.path, '/settings'); + expect(tester.state(find.byType(SettingsScreen)), same(settingsState)); + await tab(tester, 'pipelines'); + expect( + app.provider.value.uri.path, + '/settings', + reason: 'tab retap is not Back', + ); + await tester.tap(find.byKey(const ValueKey('shell.back'))); + await tester.pump(); + await tester.pump(const Duration(milliseconds: 500)); + expect( + app.provider.value.uri.path, + '/pipelines', + reason: 'explicit Back still exits Settings', + ); + expect(tester.takeException(), isNull); + }); testWidgets( 'per-tab locations survive app recreation; an explicit deep link wins', (tester) async { @@ -209,24 +205,19 @@ void main() { ); expect(tester.takeException(), isNull); }); - for (final cupertino in [false, true]) { - testWidgets('ordinary root with query restores its tab ($cupertino)', ( - tester, - ) async { - final store = MemoryTabLocationsStore() - ..value = const TabLocationsSnapshot( - routes: {AppDestination.pipelines: AppRoute.settings}, - ); - final app = await mount( - tester, - route: '/?appearance=cupertino', - cupertino: cupertino, - store: store, + testWidgets('ordinary root with query restores its tab', (tester) async { + final store = MemoryTabLocationsStore() + ..value = const TabLocationsSnapshot( + routes: {AppDestination.pipelines: AppRoute.settings}, ); - await tester.pumpAndSettle(); - expect(app.provider.value.uri.path, '/settings'); - expect(find.byType(SettingsScreen), findsOneWidget); - expect(tester.takeException(), isNull); - }); - } + final app = await mount( + tester, + route: '/?appearance=cupertino', + store: store, + ); + await tester.pumpAndSettle(); + expect(app.provider.value.uri.path, '/settings'); + expect(find.byType(SettingsScreen), findsOneWidget); + expect(tester.takeException(), isNull); + }); } diff --git a/app/test/features/artifacts/actions/artifact_file_actions_test.dart b/app/test/features/artifacts/actions/artifact_file_actions_test.dart index 7532a6a3..36569c10 100644 --- a/app/test/features/artifacts/actions/artifact_file_actions_test.dart +++ b/app/test/features/artifacts/actions/artifact_file_actions_test.dart @@ -1,6 +1,5 @@ import 'dart:typed_data'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -59,7 +58,6 @@ Future _fetch(Uri uri) async => ArtifactFetchResult(status: 200, bytes: _bytes); Widget _row({ - required bool cupertino, ArtifactFileBridge? bridge, ArtifactRecord? artifact, ArtifactFetch? fetch, @@ -70,19 +68,11 @@ Widget _row({ fetch: fetch ?? _fetch, bridge: bridge ?? _bridge(), ); - return cupertino - ? CupertinoApp( - home: CupertinoPageScaffold( - child: SafeArea( - child: Padding(padding: const EdgeInsets.all(8), child: actions), - ), - ), - ) - : MaterialApp( - home: Scaffold( - body: Padding(padding: const EdgeInsets.all(8), child: actions), - ), - ); + return MaterialApp( + home: Scaffold( + body: Padding(padding: const EdgeInsets.all(8), child: actions), + ), + ); } TextButton _materialButton(WidgetTester tester, String label) => @@ -92,24 +82,12 @@ TextButton _materialButton(WidgetTester tester, String label) => .first, ); -CupertinoButton _cupertinoButton(WidgetTester tester, String label) => - tester.widget( - find - .ancestor( - of: find.text(label), - matching: find.byType(CupertinoButton), - ) - .first, - ); - void main() { testWidgets('Download saves the exact named bytes and reports it', ( tester, ) async { final saved = []; - await tester.pumpWidget( - _row(cupertino: false, bridge: _bridge(saved: saved)), - ); + await tester.pumpWidget(_row(bridge: _bridge(saved: saved))); await tester.tap(find.text('Download')); await tester.pumpAndSettle(); @@ -123,9 +101,7 @@ void main() { testWidgets('Share starts one file transfer, not a link', (tester) async { final shared = []; - await tester.pumpWidget( - _row(cupertino: false, bridge: _bridge(shared: shared)), - ); + await tester.pumpWidget(_row(bridge: _bridge(shared: shared))); await tester.tap(find.text('Share')); await tester.pumpAndSettle(); @@ -140,10 +116,7 @@ void main() { ) async { final saved = []; await tester.pumpWidget( - _row( - cupertino: false, - bridge: _bridge(saved: saved, shareSupported: false), - ), + _row(bridge: _bridge(saved: saved, shareSupported: false)), ); expect(find.text('No share on this host.'), findsOneWidget); @@ -160,7 +133,6 @@ void main() { ) async { await tester.pumpWidget( _row( - cupertino: false, bridge: _bridge(), fetch: (_) => Future.delayed( const Duration(seconds: 30), @@ -183,9 +155,7 @@ void main() { await tester.pump(const Duration(seconds: 31)); }); - testWidgets('both hosts keep the file actions whole at 320/2x dark', ( - tester, - ) async { + testWidgets('the file actions stay whole at 320/2x dark', (tester) async { tester.view.physicalSize = const Size(640, 1200); tester.view.devicePixelRatio = 2; tester.platformDispatcher.textScaleFactorTestValue = 2; @@ -195,20 +165,12 @@ void main() { addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue); addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue); - for (final cupertino in [false, true]) { - await tester.pumpWidget(_row(cupertino: cupertino)); - await tester.pumpAndSettle(); - expect(tester.takeException(), isNull); - expect(find.text('Download'), findsOneWidget); - expect(find.text('Share'), findsOneWidget); - 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); - } - } + await tester.pumpWidget(_row()); + await tester.pumpAndSettle(); + expect(tester.takeException(), isNull); + expect(find.text('Download'), findsOneWidget); + expect(find.text('Share'), findsOneWidget); + expect(_materialButton(tester, 'Download').onPressed, isNotNull); }); testWidgets('the gallery selection offers both file actions in its dialog', ( @@ -315,44 +277,27 @@ void main() { ], ), ]; - for (final cupertino in [false, true]) { - await tester.pumpWidget( - cupertino - ? CupertinoApp( - theme: const CupertinoThemeData(brightness: Brightness.dark), - home: ArtifactGalleryPage( - steps: steps, - configuredEndpoint: _endpoint, - fetch: _fetch, - fileBridge: _bridge(), - ), - ) - : MaterialApp( - theme: ThemeData(brightness: Brightness.dark), - home: ArtifactGalleryPage( - steps: steps, - configuredEndpoint: _endpoint, - fetch: _fetch, - fileBridge: _bridge(), - ), - ), - ); - await tester.pumpAndSettle(); - await tester.tap(find.text('report.zip')); - await tester.pumpAndSettle(); + await tester.pumpWidget( + MaterialApp( + theme: ThemeData(brightness: Brightness.dark), + 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(find.text('Download'), findsOneWidget); - expect(find.text('Share'), findsOneWidget); - expect( - cupertino - ? find.byType(CupertinoAlertDialog) - : find.byType(AlertDialog), - findsOneWidget, - ); - await tester.tap(find.text('Close')); - await tester.pumpAndSettle(); - } + expect(tester.takeException(), isNull); + expect(find.text('Download'), findsOneWidget); + expect(find.text('Share'), findsOneWidget); + expect(find.byType(AlertDialog), findsOneWidget); + await tester.tap(find.text('Close')); + await tester.pumpAndSettle(); }); testWidgets( diff --git a/app/test/features/artifacts/ui/artifact_fullscreen_test.dart b/app/test/features/artifacts/ui/artifact_fullscreen_test.dart index 2a06125c..7accb49a 100644 --- a/app/test/features/artifacts/ui/artifact_fullscreen_test.dart +++ b/app/test/features/artifacts/ui/artifact_fullscreen_test.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -33,9 +32,8 @@ final ArtifactGroup _group = visitGroup(artifacts: [_report, _log]); typedef _Rendered = List<(String, bool)>; Future<({_Rendered rendered, List opened})> _pump( - WidgetTester tester, { - bool cupertino = false, -}) async { + WidgetTester tester, +) async { final rendered = <(String, bool)>[]; final opened = []; final page = ArtifactViewerPage( @@ -61,17 +59,13 @@ Future<({_Rendered rendered, List opened})> _pump( children: [ Expanded( child: Navigator( - onGenerateRoute: (_) => cupertino - ? CupertinoPageRoute(builder: (_) => page) - : MaterialPageRoute(builder: (_) => page), + onGenerateRoute: (_) => MaterialPageRoute(builder: (_) => page), ), ), const SizedBox(key: _shellBar, height: 56, child: Text('Tabs')), ], ); - await tester.pumpWidget( - cupertino ? CupertinoApp(home: shell) : MaterialApp(home: shell), - ); + await tester.pumpWidget(MaterialApp(home: shell)); await tester.pumpAndSettle(); return (rendered: rendered, opened: opened); } @@ -81,61 +75,53 @@ Future _enter(WidgetTester tester) async { await tester.pumpAndSettle(); } -/// A bar control by its accessible name: the Material button's tooltip, the -/// Cupertino button's semantics label. -Finder _named(bool cupertino, String name) => - cupertino ? find.bySemanticsLabel(name) : find.byTooltip(name); +/// A bar control by its Material tooltip. +Finder _named(String name) => find.byTooltip(name); void main() { - for (final cupertino in [false, true]) { - final host = cupertino ? 'Cupertino' : 'Material'; + testWidgets('the bottom actions offer Full screen', (tester) async { + 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, ('

Hi

', false)); + }); - testWidgets('$host: the bottom actions offer Full screen', (tester) async { - final result = await _pump(tester, cupertino: cupertino); - final bar = find.byKey(const Key('artifact-viewer-actions')); - expect( - find.descendant(of: bar, matching: find.byKey(artifactFullscreenKey)), - findsOneWidget, - ); - expect(_named(cupertino, 'Full screen'), findsOneWidget); - expect(result.rendered.single, ('

Hi

', false)); - }); + testWidgets('full screen covers the shell, keeps the actions and ' + 'renders the fetched document in the app', (tester) async { + final result = await _pump(tester); + await _enter(tester); - testWidgets('$host: full screen covers the shell, keeps the actions and ' - 'renders the fetched document in the app', (tester) async { - final result = await _pump(tester, cupertino: cupertino); - await _enter(tester); + expect(find.byKey(_shellBar), findsNothing); + // The same document, fetched once with the app's session, now in the + // full-screen scope; nothing was handed to the system browser. + expect(result.rendered.last, ('

Hi

', 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); - // The same document, fetched once with the app's session, now in the - // full-screen scope; nothing was handed to the system browser. - expect(result.rendered.last, ('

Hi

', 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(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('Exit full screen returns to the viewer', (tester) async { + await _pump(tester); + await _enter(tester); + await tester.tap(find.byKey(artifactFullscreenKey)); + await tester.pumpAndSettle(); + expect(find.byKey(_shellBar), findsOneWidget); + expect(_named('Full screen'), findsOneWidget); + }); testWidgets('Escape and the system back leave full screen', (tester) async { await _pump(tester); diff --git a/app/test/features/artifacts/ui/artifact_gallery_debug_files_test.dart b/app/test/features/artifacts/ui/artifact_gallery_debug_files_test.dart index 2cc8edc3..73e7baec 100644 --- a/app/test/features/artifacts/ui/artifact_gallery_debug_files_test.dart +++ b/app/test/features/artifacts/ui/artifact_gallery_debug_files_test.dart @@ -1,6 +1,5 @@ import 'dart:typed_data'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.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'; -enum _Platform { material, cupertino } - JsonMap _file(String name, String group) => artifact( name, contentType: 'text/markdown', @@ -36,7 +33,7 @@ List _steps() => [ ), ]; -Future _pump(WidgetTester tester, _Platform platform) async { +Future _pump(WidgetTester tester) async { tester.view.physicalSize = const Size(900, 2600); tester.view.devicePixelRatio = 1; addTearDown(tester.view.resetPhysicalSize); @@ -49,43 +46,37 @@ Future _pump(WidgetTester tester, _Platform platform) async { ArtifactFetchResult(status: 200, bytes: Uint8List.fromList([35])), markdownBuilder: (context, value) => Text(value), ); - await tester.pumpWidget( - platform == _Platform.material - ? MaterialApp(home: page) - : CupertinoApp(home: page), - ); + await tester.pumpWidget(MaterialApp(home: page)); await tester.pumpAndSettle(); } void main() { - for (final platform in _Platform.values) { - testWidgets('${platform.name}: only deliverables show until Debugging ' - 'files is revealed', (tester) async { - await _pump(tester, platform); - expect(find.text('public/report.md'), findsOneWidget); - for (final name in [ - 'history.md', - 'memory.md', - 'input.md', - 'private/scratch.md', - ]) { - expect(find.text(name), findsNothing, reason: name); - } - expect(find.text('Debugging files'), findsNothing); + testWidgets('only deliverables show until Debugging ' + 'files is revealed', (tester) async { + await _pump(tester); + expect(find.text('public/report.md'), findsOneWidget); + for (final name in [ + 'history.md', + 'memory.md', + 'input.md', + 'private/scratch.md', + ]) { + expect(find.text(name), findsNothing, reason: name); + } + expect(find.text('Debugging files'), findsNothing); - await tester.tap(find.byKey(const Key('artifact-debug-toggle'))); - await tester.pumpAndSettle(); - expect(find.text('Debugging files'), findsOneWidget); - for (final name in [ - 'history.md', - 'memory.md', - 'input.md', - 'output.md', - 'private/scratch.md', - ]) { - expect(find.text(name), findsOneWidget, reason: name); - } - expect(find.text('public/report.md'), findsOneWidget); - }); - } + await tester.tap(find.byKey(const Key('artifact-debug-toggle'))); + await tester.pumpAndSettle(); + expect(find.text('Debugging files'), findsOneWidget); + for (final name in [ + 'history.md', + 'memory.md', + 'input.md', + 'output.md', + 'private/scratch.md', + ]) { + expect(find.text(name), findsOneWidget, reason: name); + } + expect(find.text('public/report.md'), findsOneWidget); + }); } diff --git a/app/test/features/artifacts/ui/artifact_gallery_documents_test.dart b/app/test/features/artifacts/ui/artifact_gallery_documents_test.dart index 177558aa..3c6852c2 100644 --- a/app/test/features/artifacts/ui/artifact_gallery_documents_test.dart +++ b/app/test/features/artifacts/ui/artifact_gallery_documents_test.dart @@ -1,6 +1,5 @@ import 'dart:typed_data'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.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'; -enum _Platform { material, cupertino } - const String _endpoint = 'ws://127.0.0.1:8081/connect'; JsonMap _recorded( @@ -48,8 +45,7 @@ List _steps() => [ ]; Future _pump( - WidgetTester tester, - _Platform platform, { + WidgetTester tester, { List? steps, ArtifactFetch? fetch, ArtifactExternalOpen? openExternal, @@ -72,11 +68,7 @@ Future _pump( ), markdownBuilder: (context, value) => Text(value), ); - await tester.pumpWidget( - platform == _Platform.material - ? MaterialApp(home: page) - : CupertinoApp(home: page), - ); + await tester.pumpWidget(MaterialApp(home: page)); await tester.pumpAndSettle(); } @@ -85,230 +77,194 @@ Future _showTurnDocuments(WidgetTester tester) async { await tester.pumpAndSettle(); } -Finder _dialog(_Platform platform, String text) => find.descendant( - of: find.byType( - platform == _Platform.material ? AlertDialog : CupertinoAlertDialog, - ), - matching: find.text(text), -); +Finder _dialog(String text) => + find.descendant(of: find.byType(AlertDialog), matching: find.text(text)); void main() { - for (final platform in _Platform.values) { - testWidgets('${platform.name}: debug hides documents by default and shows ' - 'each visit when enabled', (tester) async { - await _pump(tester, platform); - expect(find.text('input.md'), findsNothing); - expect(find.textContaining('Turn documents'), findsNothing); - expect(find.byTooltip('Show debugging files'), findsOneWidget); - await _showTurnDocuments(tester); - expect(find.byTooltip('Hide debugging files'), findsOneWidget); - expect(find.text('input.md'), findsNWidgets(2)); - expect(find.text('output.md'), findsNWidgets(2)); - expect(find.text('session.html'), findsNWidgets(2)); - expect(find.text('memory.md'), findsNWidgets(2)); - expect(find.text('text/markdown · 120\u00a0B'), findsOneWidget); - expect(find.text('text/plain · 512\u00a0B'), findsOneWidget); - }); + testWidgets('debug hides documents by default and shows ' + 'each visit when enabled', (tester) async { + await _pump(tester); + expect(find.text('input.md'), findsNothing); + expect(find.textContaining('Turn documents'), findsNothing); + expect(find.byTooltip('Show debugging files'), findsOneWidget); + await _showTurnDocuments(tester); + expect(find.byTooltip('Hide debugging files'), findsOneWidget); + expect(find.text('input.md'), findsNWidgets(2)); + expect(find.text('output.md'), findsNWidgets(2)); + expect(find.text('session.html'), findsNWidgets(2)); + expect(find.text('memory.md'), findsNWidgets(2)); + expect(find.text('text/markdown · 120\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( + find.ancestor(of: absence, matching: find.byType(ListTile)), + ); + expect(tile.enabled, isTrue); + expect(tile.onTap, isNull); + expect( + tester.widget(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 = []; + await _pump( tester, - ) async { - await _pump(tester, platform); - 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('${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( - find.ancestor(of: absence, matching: find.byType(ListTile)), - ); - expect(tile.enabled, isTrue); - expect(tile.onTap, isNull); - expect( - tester.widget(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); + openExternal: (uri) async { + 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('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, - ) async { - final opened = []; - await _pump( - tester, - platform, - openExternal: (uri) async { - 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'), - ]); - }); + steps: [ + step( + stage: 'review', + visit: 1, + artifacts: [ + _recorded('input.md', contentType: 'text/markdown', sizeBytes: 1), + ], + ), + ], + ); - testWidgets('${platform.name}: a stage artifact pages only through stage ' - 'artifacts while Debug is off', (tester) async { - await _pump(tester, platform); + 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); + }); - // 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('${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', ( + testWidgets('focused document-only visits retain turn ' + 'documents', (tester) async { + await _pump( tester, - ) async { - await _pump(tester, platform, focusIndex: 0); + focusIndex: 0, + steps: [ + step( + stage: 'review', + visit: 1, + artifacts: [ + _recorded('input.md', contentType: 'text/markdown', sizeBytes: 1), + ], + ), + ], + ); - expect(find.text('session.html'), findsNothing); - await _showTurnDocuments(tester); - expect(find.text('session.html'), findsOneWidget); - }); - } + 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('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); + }); } diff --git a/app/test/features/artifacts/ui/artifact_gallery_page_test.dart b/app/test/features/artifacts/ui/artifact_gallery_page_test.dart index 1415326b..57f7f029 100644 --- a/app/test/features/artifacts/ui/artifact_gallery_page_test.dart +++ b/app/test/features/artifacts/ui/artifact_gallery_page_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.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'; -enum _Platform { material, cupertino } - JsonMap _recorded( String name, { String url = '', @@ -51,7 +48,6 @@ List _steps() => [ Future _pumpGallery( WidgetTester tester, - _Platform platform, List steps, { int? focusIndex, String configuredEndpoint = '', @@ -77,65 +73,53 @@ Future _pumpGallery( size: surface, textScaler: TextScaler.linear(textScale), ), - child: platform == _Platform.material - ? MaterialApp(home: page) - : CupertinoApp(home: page), + child: MaterialApp(home: page), ), ); await tester.pumpAndSettle(); } -Finder _inDialog(_Platform platform, String text) => find.descendant( - of: find.byType( - platform == _Platform.material ? AlertDialog : CupertinoAlertDialog, - ), - matching: find.text(text), -); +Finder _inDialog(String text) => + find.descendant(of: find.byType(AlertDialog), matching: find.text(text)); void main() { - for (final platform in _Platform.values) { - testWidgets('${platform.name}: lists recorded groups and rows', ( - tester, - ) async { - await _pumpGallery(tester, platform, _steps()); - expect(find.text('Artifacts · 4 recorded'), findsOneWidget); - expect(find.text('build · visit 1'), findsOneWidget); - expect(find.text('review · visit 1'), findsOneWidget); - expect(find.text('review · visit 2'), findsOneWidget); - expect(find.text('result.zip'), findsNWidgets(2)); - expect(find.text('notes.md'), findsOneWidget); - expect(find.text('text/markdown · 2.0\u00a0KiB'), findsOneWidget); - }); + testWidgets('lists recorded groups and rows', (tester) async { + await _pumpGallery(tester, _steps()); + expect(find.text('Artifacts · 4 recorded'), findsOneWidget); + expect(find.text('build · visit 1'), findsOneWidget); + expect(find.text('review · visit 1'), findsOneWidget); + expect(find.text('review · visit 2'), 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', ( - tester, - ) async { - final steps = _steps(); - await _pumpGallery(tester, platform, steps); - await tester.tap(find.text('result.zip').at(1)); - await tester.pumpAndSettle(); + testWidgets('duplicate filename stays visit distinct', (tester) async { + final steps = _steps(); + await _pumpGallery(tester, steps); + await tester.tap(find.text('result.zip').at(1)); + await tester.pumpAndSettle(); - final groups = artifactGroups(steps); - final visitTwo = groups.firstWhere( - (group) => group.stageKey == 'review' && group.visit == 2, - ); - final list = tester.widget( - find.byType(ArtifactVisitList), - ); - expect( - list.selectedIdentity, - artifactVisitIdentity(visitTwo, visitTwo.artifacts.single), - ); - expect(_inDialog(platform, 'review · visit 2'), findsOneWidget); - expect(_inDialog(platform, 'review · visit 1'), findsNothing); - expect(_inDialog(platform, 'Artifacts · 1 recorded'), findsOneWidget); - }); - } + final groups = artifactGroups(steps); + final visitTwo = groups.firstWhere( + (group) => group.stageKey == 'review' && group.visit == 2, + ); + final list = tester.widget( + find.byType(ArtifactVisitList), + ); + expect( + list.selectedIdentity, + artifactVisitIdentity(visitTwo, visitTwo.artifacts.single), + ); + expect(_inDialog('review · visit 2'), findsOneWidget); + expect(_inDialog('review · visit 1'), findsNothing); + expect(_inDialog('Artifacts · 1 recorded'), findsOneWidget); + }); testWidgets('capture notes and partial label come from the visit step', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -151,18 +135,15 @@ void main() { await tester.tap(find.text('result.zip')); await tester.pumpAndSettle(); expect( - _inDialog(_Platform.material, 'Artifacts · 2 recorded · partial capture'), + _inDialog('Artifacts · 2 recorded · partial capture'), findsOneWidget, ); expect( - _inDialog(_Platform.material, '2 files excluded from artifact capture.'), + _inDialog('2 files excluded from artifact capture.'), findsOneWidget, ); expect( - _inDialog( - _Platform.material, - '3 files omitted by artifact capture limits.', - ), + _inDialog('3 files omitted by artifact capture limits.'), findsOneWidget, ); }); @@ -170,7 +151,7 @@ void main() { testWidgets('an unavailable capture never claims nothing was recorded', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step(stage: 'review', visit: 1, includeArtifacts: false), ]); expect(find.text('Artifacts · capture unavailable'), findsOneWidget); @@ -180,7 +161,7 @@ void main() { testWidgets('a recorded empty capture says nothing was recorded', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step(stage: 'review', visit: 1, artifacts: const []), ]); 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 { - await _pumpGallery(tester, _Platform.material, const []); + await _pumpGallery(tester, const []); expect(find.text('No steps recorded for this run.'), findsOneWidget); }); @@ -196,7 +177,6 @@ void main() { final opened = []; await _pumpGallery( tester, - _Platform.material, [ step( stage: 'review', @@ -214,7 +194,7 @@ void main() { ); await tester.tap(find.text('result.zip')); await tester.pumpAndSettle(); - await tester.tap(_inDialog(_Platform.material, 'Open in browser')); + await tester.tap(_inDialog('Open in browser')); await tester.pumpAndSettle(); expect(opened, [ @@ -227,7 +207,7 @@ void main() { testWidgets('an unsafe recorded url offers no open or copy action', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -237,20 +217,17 @@ void main() { await tester.tap(find.text('result.zip')); await tester.pumpAndSettle(); expect( - _inDialog( - _Platform.material, - 'The recorded artifact URL cannot be opened safely.', - ), + _inDialog('The recorded artifact URL cannot be opened safely.'), findsOneWidget, ); - expect(_inDialog(_Platform.material, 'Open in browser'), findsNothing); - expect(_inDialog(_Platform.material, 'Copy link'), findsNothing); + expect(_inDialog('Open in browser'), findsNothing); + expect(_inDialog('Copy link'), findsNothing); }); testWidgets('a record with no url is explicit and offers no action', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -266,11 +243,8 @@ void main() { ]); await tester.tap(find.text('result.zip')); await tester.pumpAndSettle(); - expect( - _inDialog(_Platform.material, 'No artifact URL recorded.'), - findsOneWidget, - ); - expect(_inDialog(_Platform.material, 'Open in browser'), findsNothing); + expect(_inDialog('No artifact URL recorded.'), findsOneWidget); + expect(_inDialog('Open in browser'), findsNothing); }); testWidgets('Copy link copies the resolved url, separate from Open', ( @@ -295,7 +269,6 @@ void main() { final opened = []; await _pumpGallery( tester, - _Platform.material, [ step( stage: 'review', @@ -313,7 +286,7 @@ void main() { ); await tester.tap(find.text('result.zip')); await tester.pumpAndSettle(); - await tester.tap(_inDialog(_Platform.material, 'Copy link')); + await tester.tap(_inDialog('Copy link')); await tester.pumpAndSettle(); 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 { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -336,7 +309,7 @@ void main() { testWidgets('the run header names the visit each capture note belongs to', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -368,7 +341,7 @@ void main() { testWidgets('a focused visit header states its own notes without a prefix', ( tester, ) async { - await _pumpGallery(tester, _Platform.material, [ + await _pumpGallery(tester, [ step( stage: 'review', visit: 1, @@ -400,7 +373,7 @@ void main() { }); 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')]), ]); @@ -409,103 +382,93 @@ void main() { expect(find.textContaining('files omitted'), findsNothing); }); - for (final platform in _Platform.values) { - testWidgets( - '${platform.name}: a long run header scrolls with the gallery rows', - (tester) async { - // 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. - await _pumpGallery(tester, platform, [ - for (var visit = 1; visit <= 10; visit += 1) - step( - stage: 'review', - sequence: visit, - visit: visit, - artifacts: [_recorded('file$visit.zip')], - skipped: 1, - ), - ], surface: const Size(360, 640)); + testWidgets('a long run header scrolls with the gallery rows', ( + tester, + ) async { + // 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. + await _pumpGallery(tester, [ + for (var visit = 1; visit <= 10; visit += 1) + step( + stage: 'review', + sequence: visit, + visit: visit, + artifacts: [_recorded('file$visit.zip')], + skipped: 1, + ), + ], surface: const Size(360, 640)); - expect(tester.takeException(), isNull); - final list = find.byType(CustomScrollView); - expect(tester.getSize(list).height, greaterThan(0)); - // The header belongs to that scroll view, so it scrolls away instead of - // shrinking the list. - expect( - find.descendant( - of: list, - matching: find.text('Artifacts · 10 recorded · partial capture'), - ), - findsOneWidget, - ); - await tester.scrollUntilVisible(find.text('file10.zip'), 200); - expect(find.text('file10.zip'), findsOneWidget); - }, + expect(tester.takeException(), isNull); + final list = find.byType(CustomScrollView); + expect(tester.getSize(list).height, greaterThan(0)); + // The header belongs to that scroll view, so it scrolls away instead of + // shrinking the list. + expect( + find.descendant( + of: list, + matching: find.text('Artifacts · 10 recorded · partial capture'), + ), + findsOneWidget, ); + await tester.scrollUntilVisible(find.text('file10.zip'), 200); + expect(find.text('file10.zip'), findsOneWidget); + }); - testWidgets( - '${platform.name}: focused notes at 2x text keep the artifact list', - (tester) async { - await _pumpGallery( - tester, - platform, - [ - step( - stage: 'review', - visit: 1, - artifacts: [ - _recorded('result.zip', url: '/artifacts/1/1/result.zip'), - ], - skipped: 12, - truncated: 34, - ), + testWidgets('focused notes at 2x text keep the artifact list', ( + tester, + ) async { + await _pumpGallery( + tester, + [ + step( + stage: 'review', + visit: 1, + artifacts: [ + _recorded('result.zip', url: '/artifacts/1/1/result.zip'), ], - focusIndex: 0, - surface: const Size(320, 568), - textScale: 2, - ); - - expect(tester.takeException(), isNull); - expect( - 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); - }, + skipped: 12, + truncated: 34, + ), + ], + focusIndex: 0, + surface: const Size(320, 568), + textScale: 2, ); - testWidgets( - '${platform.name}: sheet actions keep Close, Copy, Open order', - (tester) async { - await _pumpGallery(tester, platform, [ - 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(tester.takeException(), isNull); + expect( + 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('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'))); + }); } diff --git a/app/test/features/artifacts/ui/artifact_selection_facts_test.dart b/app/test/features/artifacts/ui/artifact_selection_facts_test.dart index 224f082d..a9f85c82 100644 --- a/app/test/features/artifacts/ui/artifact_selection_facts_test.dart +++ b/app/test/features/artifacts/ui/artifact_selection_facts_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -21,7 +20,7 @@ ArtifactGroup _group() => ArtifactGroup( artifacts: [ArtifactRecord.fromJson(_recorded())], ); -Future _pump(WidgetTester tester, {required bool cupertino}) async { +Future _pump(WidgetTester tester) async { final group = _group(); final facts = Padding( padding: const EdgeInsets.all(16), @@ -37,50 +36,36 @@ Future _pump(WidgetTester tester, {required bool cupertino}) async { resolved: null, ), ); - await tester.pumpWidget( - cupertino - ? CupertinoApp( - home: CupertinoPageScaffold( - backgroundColor: CupertinoColors.systemGroupedBackground, - child: facts, - ), - ) - : MaterialApp(home: Scaffold(body: facts)), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: facts))); } void main() { - for (final cupertino in [false, true]) { - testWidgets( - '${cupertino ? 'cupertino' : 'material'}: facts lead with metadata, then the visit, then its capture', - (tester) async { - await _pump(tester, cupertino: cupertino); + testWidgets('facts lead with metadata, then the visit, then its capture', ( + tester, + ) async { + await _pump(tester); - const metadata = 'text/csv · 2.0\u00a0KiB'; - const visit = 'review · visit 1'; - const summary = 'Artifacts · 1 recorded · partial capture'; - const note = '2 files excluded from artifact capture.'; - const urlState = 'The recorded artifact URL cannot be opened safely.'; + const metadata = 'text/csv · 2.0\u00a0KiB'; + const visit = 'review · visit 1'; + const summary = 'Artifacts · 1 recorded · partial capture'; + const note = '2 files excluded from artifact capture.'; + 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(visit), lessThan(topOf(summary))); - expect(topOf(summary), lessThan(topOf(note))); - expect(topOf(note), lessThan(topOf(urlState))); + expect(topOf(metadata), lessThan(topOf(visit))); + expect(topOf(visit), lessThan(topOf(summary))); + expect(topOf(summary), lessThan(topOf(note))); + expect(topOf(note), lessThan(topOf(urlState))); - final context = tester.element(find.text(metadata)); - final secondary = cupertino - ? CupertinoColors.secondaryLabel.resolveFrom(context) - : Theme.of(context).colorScheme.onSurfaceVariant; - final metadataStyle = tester.widget(find.text(metadata)).style; - final visitStyle = tester.widget(find.text(visit)).style; - final summaryStyle = tester.widget(find.text(summary)).style; + final context = tester.element(find.text(metadata)); + final secondary = Theme.of(context).colorScheme.onSurfaceVariant; + final metadataStyle = tester.widget(find.text(metadata)).style; + final visitStyle = tester.widget(find.text(visit)).style; + final summaryStyle = tester.widget(find.text(summary)).style; - expect(metadataStyle?.color, secondary); - expect(visitStyle?.color, secondary); - expect(summaryStyle?.color, isNot(secondary)); - }, - ); - } + expect(metadataStyle?.color, secondary); + expect(visitStyle?.color, secondary); + expect(summaryStyle?.color, isNot(secondary)); + }); } diff --git a/app/test/features/artifacts/ui/artifact_viewer_page_test.dart b/app/test/features/artifacts/ui/artifact_viewer_page_test.dart index 800a9c1b..4072820e 100644 --- a/app/test/features/artifacts/ui/artifact_viewer_page_test.dart +++ b/app/test/features/artifacts/ui/artifact_viewer_page_test.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -42,7 +41,6 @@ Future _pumpViewer( WidgetTester tester, { required List groups, required String selected, - bool cupertino = false, ArtifactFetch? fetch, Widget Function(BuildContext, String)? markdownBuilder, ArtifactExternalOpen? openExternal, @@ -61,11 +59,7 @@ Future _pumpViewer( data: MediaQueryData(padding: EdgeInsets.only(bottom: bottomClearance)), child: page, ); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: child) - : MaterialApp(home: Scaffold(body: child)), - ); + await tester.pumpWidget(MaterialApp(home: Scaffold(body: child))); await tester.pumpAndSettle(); } @@ -86,7 +80,6 @@ const String _markdownBody = /// viewer exactly as the run detail does. Future _openMarkdownFromGallery( WidgetTester tester, { - required bool cupertino, String name = 'notes.md', String contentType = 'text/markdown', }) async { @@ -109,9 +102,7 @@ Future _openMarkdownFromGallery( fetch: (_) async => ArtifactFetchResult(status: 200, bytes: utf8.encode(_markdownBody)), ); - await tester.pumpWidget( - cupertino ? CupertinoApp(home: page) : MaterialApp(home: page), - ); + await tester.pumpWidget(MaterialApp(home: page)); await tester.pumpAndSettle(); await tester.tap(find.text(name)); await tester.pumpAndSettle(); @@ -533,33 +524,10 @@ void main() { 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', ( tester, ) async { - await _openMarkdownFromGallery(tester, cupertino: false); + await _openMarkdownFromGallery(tester); expect(find.byType(ArtifactViewerPage), findsOneWidget); expect(find.byType(ChatMarkdownView), findsOneWidget); @@ -583,7 +551,6 @@ void main() { ) async { await _openMarkdownFromGallery( tester, - cupertino: false, name: 'notes.markdown', contentType: '', ); @@ -597,29 +564,6 @@ void main() { 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', ( tester, ) async { @@ -651,83 +595,71 @@ void main() { expect(find.textContaining('1 of 2'), findsWidgets); }); - for (final cupertino in [false, true]) { - testWidgets( - 'pinch owns image pan and native reset (Cupertino=$cupertino)', - (tester) async { - final first = recordedArtifact( - '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() : isA(), - ); - // 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('pinch owns image pan and native reset', (tester) async { + final first = recordedArtifact( + '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), + ); + + 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(), + ); + // 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 { tester.view.physicalSize = const Size(640, 1200); @@ -770,57 +702,49 @@ void main() { } }); - for (final cupertino in [false, true]) { - for (final size in [ - const Size(390, 844), - const Size(880, 1000), - const Size(1100, 800), - ]) { - testWidgets( - '${cupertino ? 'Cupertino' : 'Material'} pager clears stacked bar at $size', - (tester) async { - tester.view.physicalSize = size; - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.reset); - final first = recordedArtifact( - '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)); - }, + for (final size in [ + const Size(390, 844), + const Size(880, 1000), + const Size(1100, 800), + ]) { + testWidgets('pager clears stacked bar at $size', (tester) async { + tester.view.physicalSize = size; + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); + final first = recordedArtifact( + '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), + 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 { diff --git a/app/test/features/artifacts/ui/artifact_visit_list_fixture.dart b/app/test/features/artifacts/ui/artifact_visit_list_fixture.dart index 8ca8f37b..2ba68d23 100644 --- a/app/test/features/artifacts/ui/artifact_visit_list_fixture.dart +++ b/app/test/features/artifacts/ui/artifact_visit_list_fixture.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:pipelines_app/features/artifacts/domain/artifact_groups.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); } -/// 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. Widget artifactListHost({ - required bool cupertino, required List groups, String? selectedIdentity, ArtifactSelected? onSelected, @@ -73,16 +71,8 @@ Widget artifactListHost({ ).copyWith(textScaler: TextScaler.linear(textScale)), child: child ?? const SizedBox.shrink(), ); - return cupertino - ? CupertinoApp( - builder: scaled, - home: CupertinoPageScaffold( - backgroundColor: CupertinoColors.systemGroupedBackground, - child: list, - ), - ) - : MaterialApp( - builder: scaled, - home: Scaffold(body: list), - ); + return MaterialApp( + builder: scaled, + home: Scaffold(body: list), + ); } diff --git a/app/test/features/artifacts/ui/artifact_visit_list_semantics_test.dart b/app/test/features/artifacts/ui/artifact_visit_list_semantics_test.dart index 8d580d37..9fd90356 100644 --- a/app/test/features/artifacts/ui/artifact_visit_list_semantics_test.dart +++ b/app/test/features/artifacts/ui/artifact_visit_list_semantics_test.dart @@ -32,35 +32,25 @@ List _threeGroups() => [ ]; void main() { - testWidgets('every group heading is a header node under both hosts', ( - tester, - ) async { + testWidgets('every group heading is a header node', (tester) async { final handle = tester.ensureSemantics(); - for (final cupertino in [false, true]) { - await tester.pumpWidget( - artifactListHost(cupertino: cupertino, groups: _threeGroups()), + await tester.pumpWidget(artifactListHost(groups: _threeGroups())); + for (final label in [ + '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 [ - '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(); }); - testWidgets('a Cupertino heading stays separate from its single row', ( - tester, - ) async { + testWidgets('a heading stays separate from its single row', (tester) async { final handle = tester.ensureSemantics(); final group = visitGroup( visit: 2, @@ -74,7 +64,7 @@ void main() { ], ); await tester.pumpWidget( - artifactListHost(cupertino: true, groups: [group], onSelected: (_, _) {}), + artifactListHost(groups: [group], onSelected: (_, _) {}), ); final heading = tester.getSemantics(find.text('review · visit 2')); @@ -105,9 +95,7 @@ void main() { handle.dispose(); }); - testWidgets('rows without a callback expose no tap action under both hosts', ( - tester, - ) async { + testWidgets('rows without a callback expose no tap action', (tester) async { final handle = tester.ensureSemantics(); final group = visitGroup( artifacts: [ @@ -115,24 +103,20 @@ void main() { ], ); - for (final cupertino in [false, true]) { - await tester.pumpWidget( - artifactListHost(cupertino: cupertino, groups: [group]), - ); - final row = tester.getSemantics(find.text('result.csv')); - expect( - row.getSemanticsData().hasAction(SemanticsAction.tap), - isFalse, - reason: 'without onSelected the row is read-only', - ); - expect( - row, - isSemantics(isButton: false), - reason: 'a read-only row must not expose a button role', - ); - await tester.tap(find.text('result.csv')); - expect(tester.takeException(), isNull); - } + await tester.pumpWidget(artifactListHost(groups: [group])); + final row = tester.getSemantics(find.text('result.csv')); + expect( + row.getSemanticsData().hasAction(SemanticsAction.tap), + isFalse, + reason: 'without onSelected the row is read-only', + ); + expect( + row, + isSemantics(isButton: false), + reason: 'a read-only row must not expose a button role', + ); + await tester.tap(find.text('result.csv')); + expect(tester.takeException(), isNull); handle.dispose(); }); @@ -150,7 +134,6 @@ void main() { ); await tester.pumpWidget( artifactListHost( - cupertino: true, groups: [first, second], selectedIdentity: artifactVisitIdentity( second, diff --git a/app/test/features/artifacts/ui/artifact_visit_list_test.dart b/app/test/features/artifacts/ui/artifact_visit_list_test.dart index 5f123121..82a9f44e 100644 --- a/app/test/features/artifacts/ui/artifact_visit_list_test.dart +++ b/app/test/features/artifacts/ui/artifact_visit_list_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.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'; void main() { - for (final cupertino in [false, true]) { - testWidgets( - '${cupertino ? 'Cupertino' : 'Material'} artifact groups start collapsed and expand', - (tester) async { - final group = visitGroup(artifacts: [recordedArtifact('result.csv')]); - 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); - }, + testWidgets('artifact groups start collapsed and expand', (tester) async { + final group = visitGroup(artifacts: [recordedArtifact('result.csv')]); + await tester.pumpWidget( + 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); + }); test('a shared filename in two visits has distinct identities', () { const url = '/artifacts/7/result.csv'; @@ -112,7 +100,6 @@ void main() { ArtifactRecord? pickedArtifact; await tester.pumpWidget( artifactListHost( - cupertino: false, groups: [first, second], selectedIdentity: artifactVisitIdentity( second, @@ -147,48 +134,7 @@ void main() { expect(pickedArtifact!.url, '/artifacts/7/2/result.csv'); }); - testWidgets('Cupertino shows a grid of tiles and selects per visit', ( - 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(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 { + testWidgets('long names fit their tile at 2x', (tester) async { tester.view.devicePixelRatio = 2; tester.view.physicalSize = const Size(780, 1560); addTearDown(tester.view.resetPhysicalSize); @@ -206,22 +152,19 @@ void main() { ], ); - for (final cupertino in [false, true]) { - await tester.pumpWidget( - artifactListHost( - cupertino: cupertino, - groups: [withLongName], - textScale: 2, - onSelected: (_, _) {}, - ), - ); - expect(tester.takeException(), isNull); - // A tile shows one line of the name; its accessible name is whole. - expect( - find.bySemanticsLabel(RegExp(RegExp.escape(longArtifactName))), - findsOneWidget, - ); - } + await tester.pumpWidget( + artifactListHost( + groups: [withLongName], + textScale: 2, + onSelected: (_, _) {}, + ), + ); + expect(tester.takeException(), isNull); + // A tile shows one line of the name; its accessible name is whole. + expect( + find.bySemanticsLabel(RegExp(RegExp.escape(longArtifactName))), + findsOneWidget, + ); }); testWidgets('a missing name and content type stay explicit', (tester) async { @@ -236,9 +179,7 @@ void main() { ), ], ); - await tester.pumpWidget( - artifactListHost(cupertino: false, groups: [group]), - ); + await tester.pumpWidget(artifactListHost(groups: [group])); expect(find.text('(unnamed artifact)'), findsOneWidget); expect( @@ -254,9 +195,7 @@ void main() { }); testWidgets('empty groups keep the honest empty wording', (tester) async { - await tester.pumpWidget( - artifactListHost(cupertino: false, groups: const []), - ); + await tester.pumpWidget(artifactListHost(groups: const [])); expect(find.text('No stage artifacts recorded.'), findsOneWidget); expect(find.byType(ListTile), findsNothing); }); @@ -319,11 +258,7 @@ void main() { ], ); await tester.pumpWidget( - artifactListHost( - cupertino: false, - groups: [group], - onSelected: (_, _) {}, - ), + artifactListHost(groups: [group], onSelected: (_, _) {}), ); expect(find.byType(ArtifactTile), findsNWidgets(2)); diff --git a/app/test/features/pipelines/pipeline_archive_test.dart b/app/test/features/pipelines/pipeline_archive_test.dart index 489f78b2..992c39fc 100644 --- a/app/test/features/pipelines/pipeline_archive_test.dart +++ b/app/test/features/pipelines/pipeline_archive_test.dart @@ -1,5 +1,3 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/pipelines/screen.dart'; @@ -52,19 +50,13 @@ FakeGateway archiveGateway(PipelineFixture fixture, {String? refusal}) { }); } -Future pump( - WidgetTester tester, - FakeGateway gateway, { - bool cupertino = false, -}) async { +Future pump(WidgetTester tester, FakeGateway gateway) async { tester.view.physicalSize = const Size(1100, 900); tester.view.devicePixelRatio = 1; addTearDown(tester.view.resetPhysicalSize); addTearDown(tester.view.resetDevicePixelRatio); final screen = PipelinesScreen(gateway: gateway); - await tester.pumpWidget( - cupertino ? CupertinoApp(home: screen) : MaterialApp(home: screen), - ); + await tester.pumpWidget(MaterialApp(home: screen)); await tester.pumpAndSettle(); } @@ -161,24 +153,4 @@ void main() { await tester.pumpAndSettle(); expect(rowNamed('Alpha review'), findsOneWidget); }); - - testWidgets('Cupertino archives through the action sheet and alert', ( - tester, - ) async { - debugDefaultTargetPlatformOverride = TargetPlatform.iOS; - try { - final gateway = archiveGateway(PipelineFixture()); - await pump(tester, gateway, cupertino: true); - await tester.tap(rowNamed('Beta deploy')); - await tester.pumpAndSettle(); - await openMenuItem(tester, 'pipeline-archive'); - expect(find.byType(CupertinoAlertDialog), findsOneWidget); - await tester.tap(find.byKey(const Key('pipeline-archive-confirm'))); - await tester.pumpAndSettle(); - expect(gateway.callsOf('archive_pipeline'), hasLength(1)); - expect(rowNamed('Beta deploy'), findsNothing); - } finally { - debugDefaultTargetPlatformOverride = null; - } - }); } diff --git a/app/test/features/pipelines/pipeline_definition_warnings_test.dart b/app/test/features/pipelines/pipeline_definition_warnings_test.dart index 63c31c14..50135775 100644 --- a/app/test/features/pipelines/pipeline_definition_warnings_test.dart +++ b/app/test/features/pipelines/pipeline_definition_warnings_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/core/api_gateway.dart'; @@ -21,44 +20,31 @@ class _Gateway implements ApiGateway { Stream get frames => const Stream.empty(); } -Widget _host( - _Gateway gateway, { - bool cupertino = false, - String source = '# stage build', -}) { +Widget _host(_Gateway gateway, {String source = '# stage build'}) { final body = Column( children: [ const Text('Pipeline source remains available'), PipelineDefinitionValidation(gateway: gateway, source: source), ], ); - return cupertino - ? CupertinoApp( - home: CupertinoPageScaffold(child: SafeArea(child: body)), - ) - : MaterialApp(home: Scaffold(body: body)); + return MaterialApp(home: Scaffold(body: body)); } void main() { - for (final cupertino in [false, true]) { - testWidgets( - 'definition warnings stay visible on ${cupertino ? 'Cupertino' : 'Material'}', - (tester) async { - final gateway = _Gateway() - ..answer = () async => { - 'type': 'validated', - 'warnings': ['Review prompt exceeds 2000 bytes.', '', 42], - }; - await tester.pumpWidget(_host(gateway, cupertino: cupertino)); - await tester.pumpAndSettle(); - expect(find.text('Definition warnings'), findsOneWidget); - expect(find.text('Review prompt exceeds 2000 bytes.'), findsOneWidget); - expect(find.text('42'), findsNothing); - expect(gateway.calls.single, {'source': '# stage build'}); - expect(tester.takeException(), isNull); - }, - ); - } + testWidgets('definition warnings stay visible', (tester) async { + final gateway = _Gateway() + ..answer = () async => { + 'type': 'validated', + 'warnings': ['Review prompt exceeds 2000 bytes.', '', 42], + }; + await tester.pumpWidget(_host(gateway)); + await tester.pumpAndSettle(); + expect(find.text('Definition warnings'), findsOneWidget); + expect(find.text('Review prompt exceeds 2000 bytes.'), findsOneWidget); + expect(find.text('42'), findsNothing); + expect(gateway.calls.single, {'source': '# stage build'}); + expect(tester.takeException(), isNull); + }); testWidgets( 'loading validation never hides detail and a source is checked once', diff --git a/app/test/features/pipelines/pipeline_list_composition_test.dart b/app/test/features/pipelines/pipeline_list_composition_test.dart index 858b6b1b..c35ae3f9 100644 --- a/app/test/features/pipelines/pipeline_list_composition_test.dart +++ b/app/test/features/pipelines/pipeline_list_composition_test.dart @@ -1,7 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/ui/layout/app_list_row.dart'; @@ -211,34 +209,4 @@ void main() { ); expect(tester.takeException(), isNull); }); - - testWidgets('Cupertino keeps the shared row with the same row identity', ( - tester, - ) async { - debugDefaultTargetPlatformOverride = TargetPlatform.iOS; - tester.view.physicalSize = const Size(1100, 900); - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.reset); - try { - await tester.pumpWidget( - CupertinoApp( - home: PipelinesScreen(gateway: gatewayFor(PipelineFixture())), - ), - ); - await tester.pumpAndSettle(); - - expect( - tester - .widget(find.byKey(const Key('pipeline-row-1'))) - .cupertino, - isTrue, - ); - expect(find.text('2 stages · 1 schedule'), findsOneWidget); - expect(find.textContaining('v2 · #'), findsNothing); - expect(find.byKey(const Key('pipeline-avatar-1')), findsOneWidget); - expect(find.byKey(const Key('pipeline-status-1')), findsOneWidget); - } finally { - debugDefaultTargetPlatformOverride = null; - } - }); } diff --git a/app/test/features/pipelines/pipeline_scope_control_test.dart b/app/test/features/pipelines/pipeline_scope_control_test.dart index bd4db29b..475363d0 100644 --- a/app/test/features/pipelines/pipeline_scope_control_test.dart +++ b/app/test/features/pipelines/pipeline_scope_control_test.dart @@ -1,45 +1,35 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/pipelines/widgets/pipeline_scope_control.dart'; void main() { - for (final cupertino in [false, true]) { - for (final width in [120.0, 500.0]) { - testWidgets( - 'native scope remains usable at $width, Cupertino=$cupertino', - (tester) async { - var scope = PipelineScope.all; - final control = StatefulBuilder( - builder: (context, setState) => Center( - child: SizedBox( - width: width, - child: PipelineScopeControl( - scope: scope, - onSelected: (value) => setState(() => scope = value), - ), - ), + for (final width in [120.0, 500.0]) { + testWidgets('native scope remains usable at $width', (tester) async { + var scope = PipelineScope.all; + final control = StatefulBuilder( + builder: (context, setState) => Center( + child: SizedBox( + width: width, + child: PipelineScopeControl( + scope: scope, + onSelected: (value) => setState(() => scope = value), ), - ); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: control)) - : MaterialApp(home: Scaffold(body: control)), - ); - await tester.pumpAndSettle(); - if (width == 120) { - await tester.tap(find.byKey(const Key('pipeline-scope'))); - await tester.pumpAndSettle(); - await tester.tap(find.text('Scheduled').last); - } else { - await tester.tap(find.text('Scheduled')); - } - await tester.pumpAndSettle(); - expect(scope, PipelineScope.scheduled); - expect(tester.takeException(), isNull); - }, + ), + ), ); - } + await tester.pumpWidget(MaterialApp(home: Scaffold(body: control))); + await tester.pumpAndSettle(); + if (width == 120) { + await tester.tap(find.byKey(const Key('pipeline-scope'))); + await tester.pumpAndSettle(); + await tester.tap(find.text('Scheduled').last); + } else { + await tester.tap(find.text('Scheduled')); + } + await tester.pumpAndSettle(); + expect(scope, PipelineScope.scheduled); + expect(tester.takeException(), isNull); + }); } testWidgets('wide scope control hugs its labels', (tester) async { diff --git a/app/test/features/pipelines/pipeline_summary_flat_test.dart b/app/test/features/pipelines/pipeline_summary_flat_test.dart index f58a8383..24283204 100644 --- a/app/test/features/pipelines/pipeline_summary_flat_test.dart +++ b/app/test/features/pipelines/pipeline_summary_flat_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/pipelines/screen.dart'; @@ -8,68 +7,62 @@ import 'package:pipelines_app/ui/layout/app_list_row.dart'; import 'fixtures.dart'; -/// The pipeline Summary is flat on both hosts: facts in the shared grid, -/// Schedules with Add as its heading's only action (no body Refresh), and -/// versions as the shared list row. +/// The pipeline Summary is flat: facts in the shared grid, Schedules with Add +/// as its heading's only action (no body Refresh), and versions as the shared +/// list row. void main() { - for (final cupertino in [false, true]) { - testWidgets('pipeline Summary is a facts grid with flat sections ' - '(${cupertino ? 'cupertino' : 'material'})', (tester) async { - final gateway = FakeGateway((type, fields) { - return switch (type) { - 'list_pipelines' => pipelineListReply([ - pipelineSummary(id: 1, name: 'Alpha review', version: 3), - ]), - 'list_runs' => runListReply([]), - 'get_pipeline' => pipelineDetailReply( - pipelineDetail( - id: 1, - name: 'Alpha review', - version: 3, - latestVersion: 3, - versions: [versionSummary(2), versionSummary(3)], - ), + testWidgets('pipeline Summary is a facts grid with flat sections', ( + tester, + ) async { + final gateway = FakeGateway((type, fields) { + return switch (type) { + 'list_pipelines' => pipelineListReply([ + pipelineSummary(id: 1, name: 'Alpha review', version: 3), + ]), + 'list_runs' => runListReply([]), + 'get_pipeline' => pipelineDetailReply( + pipelineDetail( + id: 1, + name: 'Alpha review', + version: 3, + latestVersion: 3, + versions: [versionSummary(2), versionSummary(3)], ), - 'list_schedules' => {'type': 'schedules', 'schedules': []}, - _ => errorReply('unexpected $type'), - }; - }); - tester.view.physicalSize = const Size(1100, 900); - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); - final screen = PipelinesScreen(gateway: gateway); - await tester.pumpWidget( - cupertino - ? CupertinoApp(home: CupertinoPageScaffold(child: screen)) - : MaterialApp(home: screen), - ); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(const Key('pipeline-row-1'))); - await tester.pumpAndSettle(); - - expect(find.byKey(pipelineSummaryFactsKey), findsOneWidget); - // Short facts share a line instead of one label/value row each. - final latest = tester.getRect( - find.byKey(const ValueKey('pipeline-summary-latest-version')), - ); - final versionCreated = tester.getRect( - find.byKey(const ValueKey('pipeline-summary-version-created')), - ); - expect(versionCreated.top, moreOrLessEquals(latest.top)); - expect(versionCreated.left, greaterThan(latest.right)); - - expect(find.text('Refresh'), findsNothing); - expect(find.text(scheduleAddLabel), findsNothing); - expect(find.byKey(scheduleAddKey), findsOneWidget); - expect(find.byType(CupertinoListSection), findsNothing); - expect(find.byType(ListTile), findsNothing); - final row = tester.widget( - find.byKey(const Key('pipeline-version-3')), - ); - expect(row.selected, isTrue); - expect(row.cupertino, cupertino); - expect(tester.takeException(), isNull); + ), + 'list_schedules' => {'type': 'schedules', 'schedules': []}, + _ => errorReply('unexpected $type'), + }; }); - } + tester.view.physicalSize = const Size(1100, 900); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.resetPhysicalSize); + addTearDown(tester.view.resetDevicePixelRatio); + final screen = PipelinesScreen(gateway: gateway); + await tester.pumpWidget(MaterialApp(home: screen)); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('pipeline-row-1'))); + await tester.pumpAndSettle(); + + expect(find.byKey(pipelineSummaryFactsKey), findsOneWidget); + // Short facts share a line instead of one label/value row each. + final latest = tester.getRect( + find.byKey(const ValueKey('pipeline-summary-latest-version')), + ); + final versionCreated = tester.getRect( + find.byKey(const ValueKey('pipeline-summary-version-created')), + ); + expect(versionCreated.top, moreOrLessEquals(latest.top)); + expect(versionCreated.left, greaterThan(latest.right)); + + expect(find.text('Refresh'), findsNothing); + expect(find.text(scheduleAddLabel), findsNothing); + expect(find.byKey(scheduleAddKey), findsOneWidget); + expect(find.byType(ListTile), findsNothing); + final row = tester.widget( + find.byKey(const Key('pipeline-version-3')), + ); + expect(row.selected, isTrue); + expect(row.cupertino, isFalse); + expect(tester.takeException(), isNull); + }); } diff --git a/app/test/features/pipelines/pipeline_tabs_test.dart b/app/test/features/pipelines/pipeline_tabs_test.dart index 8b07a261..bf34be92 100644 --- a/app/test/features/pipelines/pipeline_tabs_test.dart +++ b/app/test/features/pipelines/pipeline_tabs_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/pipelines/widgets/pipeline_tabs.dart'; @@ -26,64 +25,52 @@ void main() { ); }); - for (final cupertino in [false, true]) { - for (final width in [320.0, 390.0, 720.0, 1200.0]) { - testWidgets('floating tabs at $width, 2x, Cupertino=$cupertino', ( - tester, - ) async { - tester.view.physicalSize = Size(width, 640); - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.reset); - PipelineDetailTab? selected; - final body = Align( - alignment: Alignment.bottomCenter, - child: PipelineDetailTabs( - selected: PipelineDetailTab.summary, - onSelected: (value) => selected = value, - ), + for (final width in [320.0, 390.0, 720.0, 1200.0]) { + testWidgets('floating tabs at $width, 2x', (tester) async { + tester.view.physicalSize = Size(width, 640); + tester.view.devicePixelRatio = 1; + addTearDown(tester.view.reset); + PipelineDetailTab? selected; + final body = Align( + alignment: Alignment.bottomCenter, + child: PipelineDetailTabs( + selected: PipelineDetailTab.summary, + onSelected: (value) => selected = value, + ), + ); + Widget scaled(BuildContext context, Widget? child) => MediaQuery( + data: MediaQuery.of( + context, + ).copyWith(textScaler: TextScaler.linear(2)), + child: child!, + ); + await tester.pumpWidget( + MaterialApp(builder: scaled, home: Scaffold(body: body)), + ); + await tester.pumpAndSettle(); + // One floating bar of separate round tab buttons. + expect(find.byType(FloatingDestinationBar), findsOneWidget); + final pill = tester.getRect(find.byKey(FloatingDestinationBar.rowKey)); + // Sized to its three tabs at the right edge, on a phone as when wide. + expect(pill.right, width - 16); + expect( + pill.width, + FloatingDestinationBar.rowWidth( + cupertino: false, + tabs: PipelineDetailTab.values.length, + ), + ); + for (final tab in PipelineDetailTab.values) { + final rect = tester.getRect( + find.byKey(ValueKey('pipeline-detail-tab-${tab.name}')), ); - Widget scaled(BuildContext context, Widget? child) => MediaQuery( - data: MediaQuery.of( - context, - ).copyWith(textScaler: TextScaler.linear(2)), - child: child!, - ); - await tester.pumpWidget( - cupertino - ? CupertinoApp( - builder: scaled, - home: CupertinoPageScaffold(child: body), - ) - : MaterialApp( - builder: scaled, - home: Scaffold(body: body), - ), - ); - await tester.pumpAndSettle(); - // One floating bar of separate round tab buttons. - expect(find.byType(FloatingDestinationBar), findsOneWidget); - final pill = tester.getRect(find.byKey(FloatingDestinationBar.rowKey)); - // Sized to its three tabs at the right edge, on a phone as when wide. - expect(pill.right, width - 16); - expect( - pill.width, - FloatingDestinationBar.rowWidth( - cupertino: cupertino, - tabs: PipelineDetailTab.values.length, - ), - ); - for (final tab in PipelineDetailTab.values) { - final rect = tester.getRect( - find.byKey(ValueKey('pipeline-detail-tab-${tab.name}')), - ); - expect(rect.left, greaterThanOrEqualTo(pill.left), reason: tab.name); - expect(rect.right, lessThanOrEqualTo(pill.right), reason: tab.name); - } - await tester.tap(find.byKey(const Key('pipeline-detail-tab-source'))); - await tester.pumpAndSettle(); - expect(selected, PipelineDetailTab.source); - expect(tester.takeException(), isNull); - }); - } + expect(rect.left, greaterThanOrEqualTo(pill.left), reason: tab.name); + expect(rect.right, lessThanOrEqualTo(pill.right), reason: tab.name); + } + await tester.tap(find.byKey(const Key('pipeline-detail-tab-source'))); + await tester.pumpAndSettle(); + expect(selected, PipelineDetailTab.source); + expect(tester.takeException(), isNull); + }); } } diff --git a/app/test/features/pipelines/pipelines_adaptive_test.dart b/app/test/features/pipelines/pipelines_adaptive_test.dart index 061e0fee..69eaf249 100644 --- a/app/test/features/pipelines/pipelines_adaptive_test.dart +++ b/app/test/features/pipelines/pipelines_adaptive_test.dart @@ -1,15 +1,11 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:pipelines_app/ui/layout/app_list_row.dart'; import '../../native_back.dart'; import 'package:pipelines_app/features/graph/widgets/definition_graph_view.dart'; import 'package:pipelines_app/features/pipelines/pipeline_repository.dart'; import 'package:pipelines_app/features/pipelines/pipelines_controller.dart'; import 'package:pipelines_app/features/pipelines/screen.dart'; import 'package:pipelines_app/features/pipelines/widgets/pipeline_detail_panel.dart'; -import 'package:pipelines_app/ui/adaptive/floating_destination_bar.dart'; import 'fixtures.dart'; import 'test_helpers.dart'; @@ -110,66 +106,6 @@ void main() { expect(find.byKey(const Key('pipeline-detail')), findsOneWidget); }); - testWidgets('iOS uses Cupertino scaffolds, list tiles and segmented tabs', ( - tester, - ) async { - debugDefaultTargetPlatformOverride = TargetPlatform.iOS; - tester.view.physicalSize = const Size(1100, 900); - tester.view.devicePixelRatio = 1; - addTearDown(tester.view.resetPhysicalSize); - addTearDown(tester.view.resetDevicePixelRatio); - final fixture = PipelineFixture(); - try { - await tester.pumpWidget( - CupertinoApp(home: PipelinesScreen(gateway: gatewayFor(fixture))), - ); - await tester.pumpAndSettle(); - - expect(find.byType(CupertinoPageScaffold), findsOneWidget); - // The shared list row, in its Cupertino form. - expect( - tester - .widget(find.byKey(const Key('pipeline-row-1'))) - .cupertino, - isTrue, - ); - expect(find.byType(CupertinoActionSheet), findsNothing); - await tester.tap(find.byKey(const Key('pipeline-row-1'))); - await tester.pumpAndSettle(); - // The tabs are the floating glass Cupertino tab bar. - expect( - find.descendant( - of: find.byKey(const Key('pipeline-detail-tabs')), - matching: find.byType(FloatingDestinationBar), - ), - findsOneWidget, - ); - // Versions are the shared row in its Cupertino form, flat on the page. - expect( - tester - .widget(find.byKey(const Key('pipeline-version-1'))) - .cupertino, - isTrue, - ); - expect(find.byType(CupertinoListSection), findsNothing); - - await tester.tap(find.byKey(const Key('pipeline-version-1'))); - await tester.pumpAndSettle(); - expect(find.text('Viewing v1 (latest v2).'), findsOneWidget); - await tester.tap(find.byKey(const Key('pipeline-detail-tab-source'))); - await tester.pump(); - expect( - selectableText( - 'name: Alpha review\nstages:\n review:\n type: model\n' - '# selected version 1', - ), - findsOneWidget, - ); - } finally { - debugDefaultTargetPlatformOverride = null; - } - }); - testWidgets('3x text in a very short panel keeps the tabs reachable', ( tester, ) async { diff --git a/app/test/features/pipelines/pipelines_screen_filter_test.dart b/app/test/features/pipelines/pipelines_screen_filter_test.dart index 0ac94f43..65a5d88d 100644 --- a/app/test/features/pipelines/pipelines_screen_filter_test.dart +++ b/app/test/features/pipelines/pipelines_screen_filter_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/pipelines/screen.dart'; @@ -136,21 +135,15 @@ void main() { expect(find.text('Beta deploy'), findsOneWidget); }); - for (final cupertino in [false, true]) { - testWidgets('Schedules opens from the bar (cupertino: $cupertino)', ( - tester, - ) async { - var opened = 0; - final screen = PipelinesScreen( - gateway: gatewayFor(PipelineFixture()), - onOpenSchedules: () => opened++, - ); - await tester.pumpWidget( - cupertino ? CupertinoApp(home: screen) : MaterialApp(home: screen), - ); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(const Key('pipelines-open-schedules'))); - expect(opened, 1); - }); - } + testWidgets('Schedules opens from the bar', (tester) async { + var opened = 0; + final screen = PipelinesScreen( + gateway: gatewayFor(PipelineFixture()), + onOpenSchedules: () => opened++, + ); + await tester.pumpWidget(MaterialApp(home: screen)); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const Key('pipelines-open-schedules'))); + expect(opened, 1); + }); } diff --git a/app/test/features/pipelines/ui/run_pipeline_launch_test.dart b/app/test/features/pipelines/ui/run_pipeline_launch_test.dart index afe8897f..d611ca9f 100644 --- a/app/test/features/pipelines/ui/run_pipeline_launch_test.dart +++ b/app/test/features/pipelines/ui/run_pipeline_launch_test.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -53,17 +52,14 @@ JsonMap noRun() => {'type': 'run', 'run_detail': null}; Future pumpScreen( WidgetTester tester, FakeGateway gateway, - List navigated, { - bool cupertino = false, -}) async { + List navigated, +) async { tester.view.physicalSize = const Size(1100, 900); tester.view.devicePixelRatio = 1; addTearDown(tester.view.resetPhysicalSize); addTearDown(tester.view.resetDevicePixelRatio); final screen = PipelinesScreen(gateway: gateway, onRunStarted: navigated.add); - await tester.pumpWidget( - cupertino ? CupertinoApp(home: screen) : MaterialApp(home: screen), - ); + await tester.pumpWidget(MaterialApp(home: screen)); await tester.pumpAndSettle(); } @@ -582,74 +578,6 @@ void main() { expect(navigated, [86]); }); - testWidgets('the Cupertino host shows the same native prompt and words', ( - tester, - ) async { - final fixture = PipelineFixture(); - final navigated = []; - final gateway = launchGateway( - fixture, - onLaunch: (fields) => acceptedRun(84), - ); - await pumpScreen(tester, gateway, navigated, cupertino: true); - await openDetail(tester); - await tester.tap(find.byKey(runPipelineActionKey)); - await tester.pumpAndSettle(); - - expect(find.byType(CupertinoAlertDialog), findsOneWidget); - expect(find.byType(AlertDialog), findsNothing); - expect(find.text('Run Alpha review'), findsOneWidget); - expect(find.text(runPipelinePromptLabel), findsOneWidget); - expect(find.text(runPipelineWorkspaceLabel), findsOneWidget); - expect(find.text(runPipelineNotifyLabel), findsOneWidget); - expect( - find.descendant( - of: find.byType(CupertinoAlertDialog), - matching: find.text(runPipelineConfirmLabel), - ), - findsOneWidget, - ); - expect(find.text(runPipelineCancelLabel), findsOneWidget); - expect(gateway.callsOf('run_pipeline'), isEmpty); - - await tester.tap(find.byKey(runPipelineCancelKey)); - await tester.pumpAndSettle(); - expect(find.byType(CupertinoAlertDialog), findsNothing); - expect(gateway.callsOf('run_pipeline'), isEmpty); - }); - - testWidgets('Cupertino field labels and helper use theme label roles', ( - tester, - ) async { - final fixture = PipelineFixture(); - final gateway = launchGateway( - fixture, - onLaunch: (fields) => acceptedRun(87), - ); - await pumpScreen(tester, gateway, [], cupertino: true); - await openDetail(tester); - await tester.tap(find.byKey(runPipelineActionKey)); - await tester.pumpAndSettle(); - - final context = tester.element(find.byType(CupertinoAlertDialog)); - final theme = CupertinoTheme.of(context); - final labelStyle = theme.textTheme.textStyle; - for (final label in [ - runPipelinePromptLabel, - runPipelineWorkspaceLabel, - runPipelineNotifyLabel, - ]) { - final style = tester.widget(find.text(label)).style; - expect(style?.color, labelStyle.color, reason: label); - expect(style?.fontSize, labelStyle.fontSize, reason: label); - } - final helper = tester - .widget(find.text(runPipelineWorkspaceHelper)) - .style; - expect(helper?.color, CupertinoColors.secondaryLabel.resolveFrom(context)); - expect(helper?.fontSize, theme.textTheme.tabLabelTextStyle.fontSize); - }); - testWidgets('Schedule… leaves the run dialog for the schedule editor', ( tester, ) async { diff --git a/app/test/features/runs/ui/run_artifacts_action_test.dart b/app/test/features/runs/ui/run_artifacts_action_test.dart index 54c3973b..fd1595a3 100644 --- a/app/test/features/runs/ui/run_artifacts_action_test.dart +++ b/app/test/features/runs/ui/run_artifacts_action_test.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.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'; -enum _Platform { material, cupertino } - class _FakeGateway implements ApiGateway { _FakeGateway(this.detail); final JsonMap detail; @@ -34,7 +31,6 @@ JsonMap _run({required List steps}) => { Future _pumpDetail( WidgetTester tester, - _Platform platform, RunsController controller, ApiGateway gateway, ) async { @@ -46,17 +42,7 @@ Future _pumpDetail( gateway: gateway, onBack: () {}, ); - await tester.pumpWidget( - 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.pumpWidget(MaterialApp(home: Scaffold(body: view))); await tester.pumpAndSettle(); } @@ -67,61 +53,49 @@ Future _loaded(ApiGateway gateway) async { } void main() { - for (final platform in _Platform.values) { - testWidgets('${platform.name}: the action opens the recorded groups', ( - tester, - ) async { - final gateway = _FakeGateway( - _run( - steps: [ - step( - stage: 'implementer', - sequence: 1, - artifacts: [ - artifact( - 'build.log', - contentType: 'text/plain', - sizeBytes: 2337, - ), - ], - ), - step( - stage: 'reviewer', - sequence: 2, - artifacts: [ - artifact( - 'shot.png', - contentType: 'image/png', - sizeBytes: 80544, - ), - ], - ), - ], - ), - ); - final controller = await _loaded(gateway); - addTearDown(controller.dispose); - await _pumpDetail(tester, platform, controller, gateway); + testWidgets('the action opens the recorded groups', (tester) async { + final gateway = _FakeGateway( + _run( + steps: [ + step( + stage: 'implementer', + sequence: 1, + artifacts: [ + artifact('build.log', contentType: 'text/plain', sizeBytes: 2337), + ], + ), + step( + stage: 'reviewer', + sequence: 2, + artifacts: [ + artifact('shot.png', contentType: 'image/png', sizeBytes: 80544), + ], + ), + ], + ), + ); + final controller = await _loaded(gateway); + addTearDown(controller.dispose); + await _pumpDetail(tester, controller, gateway); - expect( - find.byKey(const ValueKey('run-detail-tab-artifacts')), - findsOneWidget, - ); - await tester.ensureVisible( - find.byKey(const ValueKey('run-detail-tab-artifacts')), - ); - await tester.pumpAndSettle(); - await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts'))); - await tester.pumpAndSettle(); - // Artifact groups start open: the files show without a tap. + expect( + find.byKey(const ValueKey('run-detail-tab-artifacts')), + findsOneWidget, + ); + await tester.ensureVisible( + find.byKey(const ValueKey('run-detail-tab-artifacts')), + ); + await tester.pumpAndSettle(); + await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts'))); + await tester.pumpAndSettle(); + // Artifact groups start open: the files show without a tap. - expect(find.text('Artifacts · 2 recorded'), findsOneWidget); - expect(find.text('build.log'), findsOneWidget); - expect(find.text('shot.png'), findsOneWidget); - expect(find.text('implementer · visit 1'), findsOneWidget); - expect(find.text('reviewer · visit 1'), findsOneWidget); - }); - } + expect(find.text('Artifacts · 2 recorded'), findsOneWidget); + expect(find.text('build.log'), findsOneWidget); + expect(find.text('shot.png'), findsOneWidget); + expect(find.text('implementer · visit 1'), findsOneWidget); + expect(find.text('reviewer · visit 1'), findsOneWidget); + }); testWidgets('the action is offered only when the detail has steps', ( tester, @@ -129,7 +103,7 @@ void main() { final gateway = _FakeGateway(_run(steps: const [])); final controller = await _loaded(gateway); addTearDown(controller.dispose); - await _pumpDetail(tester, _Platform.material, controller, gateway); + await _pumpDetail(tester, controller, gateway); expect( find.byKey(const ValueKey('run-detail-tab-artifacts')), findsNothing, @@ -146,7 +120,7 @@ void main() { ); final controller = await _loaded(gateway); addTearDown(controller.dispose); - await _pumpDetail(tester, _Platform.material, controller, gateway); + await _pumpDetail(tester, controller, gateway); await tester.ensureVisible( find.byKey(const ValueKey('run-detail-tab-artifacts')), @@ -167,7 +141,7 @@ void main() { ); final controller = await _loaded(gateway); addTearDown(controller.dispose); - await _pumpDetail(tester, _Platform.material, controller, gateway); + await _pumpDetail(tester, controller, gateway); await tester.ensureVisible( find.byKey(const ValueKey('run-detail-tab-artifacts')), diff --git a/app/test/features/runs/ui/run_detail_behind_bar_test.dart b/app/test/features/runs/ui/run_detail_behind_bar_test.dart index b4908aa3..60c4eefa 100644 --- a/app/test/features/runs/ui/run_detail_behind_bar_test.dart +++ b/app/test/features/runs/ui/run_detail_behind_bar_test.dart @@ -21,7 +21,7 @@ void main() { ) .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 ' 'tab scrolls behind both', (tester) async { await pumpRunDetail(tester, platform, size: const Size(390, 520)); diff --git a/app/test/features/runs/ui/run_detail_flat_bodies_test.dart b/app/test/features/runs/ui/run_detail_flat_bodies_test.dart index 6bb26ec5..f14264d8 100644 --- a/app/test/features/runs/ui/run_detail_flat_bodies_test.dart +++ b/app/test/features/runs/ui/run_detail_flat_bodies_test.dart @@ -26,13 +26,15 @@ void main() { expect(tester.takeException(), isNull); }); - testWidgets('${platform.name} the stage Session nests no group in a ' - 'group', (tester) async { - await openVisit(tester, platform); - await openVisitTab(tester, RunVisitSection.session); - expect(find.text('Turn documents'), findsOneWidget); - expect(find.byType(CupertinoListSection), findsNothing); - }); + if (platform == RunDetailTestPlatform.material) { + testWidgets('${platform.name} the stage Session nests no group in a ' + 'group', (tester) async { + await openVisit(tester, platform); + await openVisitTab(tester, RunVisitSection.session); + expect(find.text('Turn documents'), findsOneWidget); + expect(find.byType(CupertinoListSection), findsNothing); + }); + } testWidgets('${platform.name} beside a list the tabs and the header ' 'share one row', (tester) async { diff --git a/app/test/features/runs/ui/run_detail_visit_documents_test.dart b/app/test/features/runs/ui/run_detail_visit_documents_test.dart index f5b5dd5d..eb388957 100644 --- a/app/test/features/runs/ui/run_detail_visit_documents_test.dart +++ b/app/test/features/runs/ui/run_detail_visit_documents_test.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -20,7 +19,7 @@ JsonMap document(String name, int sequence, {String? url}) => { }; void main() { - for (final platform in RunDetailTestPlatform.values) { + for (final platform in const [RunDetailTestPlatform.material]) { testWidgets( '${platform.name} Session exposes exact repeated visit documents', (tester) async { @@ -87,11 +86,7 @@ void main() { }, ); await tester.pumpWidget(const SizedBox.shrink()); - await tester.pumpWidget( - platform == RunDetailTestPlatform.cupertino - ? CupertinoApp(home: preview) - : MaterialApp(home: preview), - ); + await tester.pumpWidget(MaterialApp(home: preview)); await tester.pumpAndSettle(); expect(fetched.single.path, '/artifacts/3/$name'); expect(find.text('Raw $name visit 3'), findsOneWidget); diff --git a/app/test/features/runs/ui/run_detail_visit_sections_test.dart b/app/test/features/runs/ui/run_detail_visit_sections_test.dart index 4e855bda..21610c2d 100644 --- a/app/test/features/runs/ui/run_detail_visit_sections_test.dart +++ b/app/test/features/runs/ui/run_detail_visit_sections_test.dart @@ -17,7 +17,7 @@ Future _showTurnDocuments(WidgetTester tester) async { } 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', ( tester, ) 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 [ Size(390, 844), Size(884, 832), diff --git a/app/test/features/runs/ui/run_detail_visit_session_test.dart b/app/test/features/runs/ui/run_detail_visit_session_test.dart index 079f5eb3..1055e635 100644 --- a/app/test/features/runs/ui/run_detail_visit_session_test.dart +++ b/app/test/features/runs/ui/run_detail_visit_session_test.dart @@ -8,7 +8,7 @@ import 'run_detail_graph_support.dart'; import 'run_detail_visit_support.dart'; void main() { - for (final platform in RunDetailTestPlatform.values) { + for (final platform in const [RunDetailTestPlatform.material]) { testWidgets('${platform.name} legacy session.html stays openable', ( tester, ) async { diff --git a/app/test/features/runs/ui/run_detail_visit_test.dart b/app/test/features/runs/ui/run_detail_visit_test.dart index 872ea86c..00c8a016 100644 --- a/app/test/features/runs/ui/run_detail_visit_test.dart +++ b/app/test/features/runs/ui/run_detail_visit_test.dart @@ -9,7 +9,7 @@ import 'run_detail_graph_support.dart'; import 'run_detail_visit_support.dart'; void main() { - for (final platform in RunDetailTestPlatform.values) { + for (final platform in const [RunDetailTestPlatform.material]) { testWidgets('${platform.name} visit shows only its recorded facts', ( tester, ) async { diff --git a/app/test/features/runs/ui/run_search_selection_test.dart b/app/test/features/runs/ui/run_search_selection_test.dart index df30a291..d64b0540 100644 --- a/app/test/features/runs/ui/run_search_selection_test.dart +++ b/app/test/features/runs/ui/run_search_selection_test.dart @@ -107,7 +107,7 @@ void _expectSummarySection(RunSearchTarget target, RunSummarySection? section) { const _origin = 'http://127.0.0.1:8096'; void main() { - for (final platform in RunDetailTestPlatform.values) { + for (final platform in const [RunDetailTestPlatform.material]) { testWidgets('${platform.name} artifact hit opens its recorded visit', ( tester, ) async { @@ -145,7 +145,7 @@ void main() { 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 ' 'Artifacts tab, and the timeline keeps working afterwards', ( tester, diff --git a/app/test/ui/adaptive/icon_only_tab_bars_test.dart b/app/test/ui/adaptive/icon_only_tab_bars_test.dart index 9b7db1c5..16678a90 100644 --- a/app/test/ui/adaptive/icon_only_tab_bars_test.dart +++ b/app/test/ui/adaptive/icon_only_tab_bars_test.dart @@ -55,6 +55,8 @@ void main() { for (final cupertino in [false, true]) { final name = cupertino ? 'Cupertino' : 'Material'; for (final MapEntry(key: label, value: (bar, tabs)) in bars.entries) { + // The pipeline detail bar is Material on every host. + if (cupertino && label == 'pipeline detail') continue; testWidgets('$name $label tabs are icons named for assistive ' 'technology', (tester) async { final semantics = tester.ensureSemantics();