diff --git a/app/lib/features/artifacts/ui/artifact_viewer_body.dart b/app/lib/features/artifacts/ui/artifact_viewer_body.dart index 3a653639..b6c5bbbf 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_body.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_body.dart @@ -6,12 +6,13 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/host.dart'; +import '../../../ui/adaptive/floating_bar_layout.dart'; +import '../../../ui/adaptive/glass_pill.dart'; import '../actions/artifact_file_actions.dart'; import '../actions/artifact_file_bridge.dart'; import '../domain/artifact_preview.dart'; import '../domain/artifact_url.dart'; import '../domain/gallery_navigation.dart'; -import 'artifact_selection_facts.dart'; import 'artifact_viewer_content.dart'; import 'artifact_viewer_fetch.dart'; @@ -62,24 +63,11 @@ class ArtifactViewerBody extends StatelessWidget { @override Widget build(BuildContext context) { final resolved = plan.resolved; - // The page never scrolls: a thin strip on top, the preview filling the - // middle (it zooms or scrolls itself), the controls along the bottom. + // The page never scrolls: the preview fills the middle (it zooms or + // scrolls itself) and the controls float over its bottom edge. final content = Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - _InfoStrip( - label: artifactViewerPositionLabel( - index, - count, - page.artifact.contentType, - ), - facts: ArtifactSelectionFacts( - group: page.group, - artifact: page.artifact, - step: null, - resolved: plan.resolved, - ), - ), Expanded( child: ArtifactPreviewBody( plan: plan, @@ -94,47 +82,51 @@ class ArtifactViewerBody extends StatelessWidget { ); final hasPrevious = pagedIndex(index, -1, count) != index; final hasNext = pagedIndex(index, 1, count) != index; - return Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Expanded( - // A horizontal swipe moves to the previous or next artifact. - child: GestureDetector( - key: const Key('artifact-viewer-swipe'), - behavior: HitTestBehavior.translucent, - onHorizontalDragEnd: (details) { - final velocity = details.primaryVelocity ?? 0; - if (velocity < -250 && hasNext) onNext(); - if (velocity > 250 && hasPrevious) onPrevious(); - }, - child: content, - ), - ), - // Every action as an icon at the bottom, beside the pager. - SafeArea( - top: false, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 4), - child: Row( - key: const Key('artifact-viewer-actions'), - children: [ - if (resolved != null && !resolved.external) - ArtifactFileActions( - key: ValueKey( - 'viewer-files-${page.group.stageKey}\u0000' - '${page.group.visit}\u0000${page.artifact.url}', + final swipe = GestureDetector( + key: const Key('artifact-viewer-swipe'), + behavior: HitTestBehavior.translucent, + onHorizontalDragEnd: (details) { + final velocity = details.primaryVelocity ?? 0; + if (velocity < -250 && hasNext) onNext(); + if (velocity > 250 && hasPrevious) onPrevious(); + }, + child: content, + ); + // An unresolved single artifact has no actions and nothing to page: + // no empty glass bar, and no bottom clearance reserved for one. + if (resolved == null && count <= 1) return swipe; + return FloatingBarOverlay( + bar: SafeArea( + top: false, + minimum: const EdgeInsets.all(8), + child: SizedBox( + height: 56, + child: GlassPill( + cupertino: usesCupertinoHost(context), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2), + child: Row( + key: const Key('artifact-viewer-actions'), + children: [ + if (resolved != null && !resolved.external) + ArtifactFileActions( + key: ValueKey( + 'viewer-files-${page.group.stageKey}\u0000' + '${page.group.visit}\u0000${page.artifact.url}', + ), + artifact: page.artifact, + resolved: resolved, + fetch: fetch, + bridge: fileBridge, + compact: true, ), - artifact: page.artifact, - resolved: resolved, - fetch: fetch, - bridge: fileBridge, - compact: true, - ), - if (resolved != null) - _Actions(resolved: resolved, onOpen: onOpen, onCopy: onCopy), - Expanded( - child: Align( - alignment: AlignmentDirectional.centerEnd, + if (resolved != null) + _Actions( + resolved: resolved, + onOpen: onOpen, + onCopy: onCopy, + ), + Expanded( child: _Pager( index: index, count: count, @@ -142,12 +134,13 @@ class ArtifactViewerBody extends StatelessWidget { onNext: onNext, ), ), - ), - ], + ], + ), ), ), ), - ], + ), + child: swipe, ); } } @@ -331,10 +324,9 @@ class _Pager extends StatelessWidget { /// The viewer's top edge: where this artifact sits in the list, and an /// information button for its recorded facts. -class _InfoStrip extends StatelessWidget { - const _InfoStrip({required this.label, required this.facts}); +class ArtifactViewerInfoAction extends StatelessWidget { + const ArtifactViewerInfoAction({super.key, required this.facts}); - final String label; final Widget facts; void _show(BuildContext context) { @@ -366,35 +358,12 @@ class _InfoStrip extends StatelessWidget { @override Widget build(BuildContext context) { - final muted = usesCupertinoHost(context) - ? CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith( - color: CupertinoColors.secondaryLabel.resolveFrom(context), - ) - : Theme.of(context).textTheme.bodySmall?.copyWith( - color: Theme.of(context).colorScheme.onSurfaceVariant, - ); - return Padding( - padding: const EdgeInsetsDirectional.only(start: 16, end: 4), - child: Row( - children: [ - Expanded( - child: Text( - label, - key: const Key('artifact-viewer-position'), - style: muted, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - ArtifactIconAction( - key: const Key('artifact-info'), - label: 'Details', - icon: Icons.info_outline, - cupertinoIcon: CupertinoIcons.info, - onPressed: () => _show(context), - ), - ], - ), + return ArtifactIconAction( + key: const Key('artifact-info'), + label: 'Details', + icon: Icons.info_outline, + cupertinoIcon: CupertinoIcons.info, + onPressed: () => _show(context), ); } } diff --git a/app/lib/features/artifacts/ui/artifact_viewer_page.dart b/app/lib/features/artifacts/ui/artifact_viewer_page.dart index 11bd280d..1638b146 100644 --- a/app/lib/features/artifacts/ui/artifact_viewer_page.dart +++ b/app/lib/features/artifacts/ui/artifact_viewer_page.dart @@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../../../ui/adaptive/host.dart'; +import 'artifact_selection_facts.dart'; import '../actions/artifact_file_bridge.dart'; import '../domain/artifact_groups.dart'; import '../domain/artifact_preview.dart'; @@ -222,6 +223,25 @@ class _ArtifactViewerPageState extends State { final title = page == null ? artifactViewerTitle : artifactDisplayName(page.artifact); + final subtitle = page == null + ? null + : artifactViewerPositionLabel( + _index, + _pages.length, + page.artifact.contentType, + ); + final info = page == null || plan == null + ? const [] + : [ + ArtifactViewerInfoAction( + facts: ArtifactSelectionFacts( + group: page.group, + artifact: page.artifact, + step: null, + resolved: plan.resolved, + ), + ), + ]; Widget body = page == null || plan == null ? const Center(child: Text('No previewable artifacts recorded.')) : ArtifactViewerBody( @@ -253,14 +273,24 @@ class _ArtifactViewerPageState extends State { if (usesCupertinoHost(context)) { return CupertinoPageScaffold( backgroundColor: AppColors.groupedBackground, - navigationBar: SegmentedBar(cupertino: true, title: title), - child: SafeArea(child: body), + navigationBar: SegmentedBar( + cupertino: true, + title: title, + subtitle: subtitle, + actions: info, + ), + child: body, ); } return Scaffold( extendBodyBehindAppBar: true, - appBar: SegmentedBar(cupertino: false, title: title), - body: SafeArea(child: body), + appBar: SegmentedBar( + cupertino: false, + title: title, + subtitle: subtitle, + actions: info, + ), + body: body, ); } } diff --git a/app/lib/features/changes/widgets/changes_viewer.dart b/app/lib/features/changes/widgets/changes_viewer.dart index 75cc508f..3d6a6a56 100644 --- a/app/lib/features/changes/widgets/changes_viewer.dart +++ b/app/lib/features/changes/widgets/changes_viewer.dart @@ -10,6 +10,8 @@ import 'change_style.dart'; import 'file_diff_viewer.dart'; import 'visit_pager.dart'; import '../../../ui/adaptive/floating_bar_layout.dart'; +import '../../../ui/adaptive/glass_pill.dart'; +import '../../../ui/adaptive/host.dart'; /// The run's Changes surface: an honest final-state summary followed by the /// recorded stage/visit captures, with changed-filename filtering and the @@ -105,12 +107,24 @@ class _ChangesViewerState extends State { ); final note = showSummary ? runChangesNote(run) : ''; final visit = captures.isEmpty ? null : captures[_visitIndex]; - return Column( + final hasVisitPager = !widget.finalOnly && captures.length > 1; + final pager = hasVisitPager + ? ChangesVisitPager( + index: _visitIndex, + count: captures.length, + onPrevious: () => _stepVisit(-1), + onNext: () => _stepVisit(1), + ) + : null; + final content = Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ if (showSummary) Padding( - padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), + padding: withTopBarClearance( + context, + const EdgeInsets.fromLTRB(16, 16, 16, 8), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -149,7 +163,7 @@ class _ChangesViewerState extends State { Expanded( child: run.files.isEmpty ? SingleChildScrollView( - padding: withFloatingBarClearance( + padding: withTopBarClearance( context, const EdgeInsets.all(16), ), @@ -175,10 +189,9 @@ class _ChangesViewerState extends State { Expanded( child: visit == null ? SingleChildScrollView( - padding: withFloatingBarClearance( - context, - const EdgeInsets.all(16), - ), + padding: pager == null + ? withTopBarClearance(context, const EdgeInsets.all(16)) + : withBarClearance(context, const EdgeInsets.all(16)), child: Text(noChangeDetail(run)), ) : SingleChildScrollView( @@ -187,7 +200,9 @@ class _ChangesViewerState extends State { key: ValueKey( 'changes-visit-${visit.stage}-${visit.sequence}', ), - padding: withFloatingBarClearance(context, EdgeInsets.zero), + padding: hasVisitPager + ? withBarClearance(context, EdgeInsets.zero) + : withTopBarClearance(context, EdgeInsets.zero), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ @@ -208,15 +223,19 @@ class _ChangesViewerState extends State { ), ), ), - // Previous/next visit sit at the bottom right, under the visit. - if (!widget.finalOnly && visit != null) - ChangesVisitPager( - index: _visitIndex, - count: captures.length, - onPrevious: () => _stepVisit(-1), - onNext: () => _stepVisit(1), - ), ], ); + if (pager == null) return content; + return FloatingBarOverlay( + bar: Align( + alignment: AlignmentDirectional.centerEnd, + heightFactor: 1, + child: Padding( + padding: const EdgeInsets.all(8), + child: GlassPill(cupertino: usesCupertinoHost(context), child: pager), + ), + ), + child: content, + ); } } diff --git a/app/lib/features/changes/widgets/file_diff_viewer.dart b/app/lib/features/changes/widgets/file_diff_viewer.dart index 2706df5d..6ab86dcc 100644 --- a/app/lib/features/changes/widgets/file_diff_viewer.dart +++ b/app/lib/features/changes/widgets/file_diff_viewer.dart @@ -7,6 +7,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import '../../../ui/navigation/chevron_pager.dart'; +import '../../../ui/adaptive/floating_bar_layout.dart'; +import '../../../ui/adaptive/glass_pill.dart'; import '../domain/change_kind.dart'; import '../domain/change_wording.dart'; import '../domain/file_change.dart'; @@ -20,13 +22,22 @@ import 'raw_patch_view.dart'; /// bytes) and Close. Binary/truncated/mode-only/no-patch entries show an honest /// reason instead of a fabricated diff. class FileDiffViewer extends StatefulWidget { - const FileDiffViewer({super.key, required this.file, this.onClose}); + const FileDiffViewer({ + super.key, + required this.file, + this.onClose, + this.floatBehindTopBar = false, + }); final FileChange file; /// Called by the Close control. Defaults to popping the enclosing route. final VoidCallback? onClose; + /// The full-page presentation clears its floating navigation bar while the + /// diff content still occupies the page edge behind it. + final bool floatBehindTopBar; + @override State createState() => _FileDiffViewerState(); } @@ -44,15 +55,6 @@ class _FileDiffViewerState extends State { void _selectForm(DiffForm value) => setState(() => _form = value); - void _close() { - final close = widget.onClose; - if (close != null) { - close(); - } else { - Navigator.of(context).maybePop(); - } - } - Future _copy() async { final patch = widget.file.patch; if (patch == null) return; @@ -84,7 +86,12 @@ class _FileDiffViewerState extends State { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 8, 8), + padding: widget.floatBehindTopBar + ? withTopBarClearance( + context, + const EdgeInsets.fromLTRB(16, 12, 16, 8), + ) + : const EdgeInsets.fromLTRB(16, 12, 16, 8), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -142,7 +149,6 @@ class _FileDiffViewerState extends State { ), ), ), - closeDiffControl(context, _close), ], ), ), @@ -277,6 +283,7 @@ class _FileDiffPageState extends State { final viewer = FileDiffViewer( key: ValueKey('file-diff-${file.path}'), file: file, + floatBehindTopBar: true, ); final pager = count < 2 ? null @@ -293,26 +300,30 @@ class _FileDiffPageState extends State { final body = ArrowKeyPager( onPrevious: _index > 0 ? () => _step(-1) : null, onNext: _index < count - 1 ? () => _step(1) : null, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Expanded(child: viewer), - ?pager, - ], + child: FloatingBarOverlay( + bar: pager == null + ? const SizedBox.shrink() + : Align( + alignment: AlignmentDirectional.centerEnd, + heightFactor: 1, + child: Padding( + padding: const EdgeInsets.all(8), + child: GlassPill(cupertino: cupertino, child: pager), + ), + ), + child: viewer, ), ); if (cupertino) { return CupertinoPageScaffold( navigationBar: SegmentedBar(cupertino: true, title: name), - child: SafeArea( - child: Theme(data: hostTextTheme(context), child: body), - ), + child: Theme(data: hostTextTheme(context), child: body), ); } return Scaffold( extendBodyBehindAppBar: true, appBar: SegmentedBar(cupertino: false, title: name), - body: SafeArea(child: body), + body: body, ); } } diff --git a/app/lib/features/chat/ui/transcript/chat_image_viewer.dart b/app/lib/features/chat/ui/transcript/chat_image_viewer.dart index a92b5ef3..fee113bc 100644 --- a/app/lib/features/chat/ui/transcript/chat_image_viewer.dart +++ b/app/lib/features/chat/ui/transcript/chat_image_viewer.dart @@ -23,22 +23,20 @@ class ChatImageViewer extends StatelessWidget { @override Widget build(BuildContext context) { - final body = SafeArea( - child: InteractiveViewer( - key: const Key('chat-image-viewer-zoom'), - maxScale: 8, - child: Center( - child: Semantics( - image: true, - label: name, - child: Image.memory( - bytes, - key: const Key('chat-image-viewer-image'), - fit: BoxFit.contain, - gaplessPlayback: true, - errorBuilder: (context, _, _) => Icon( - cupertino ? CupertinoIcons.photo : Icons.broken_image_outlined, - ), + final body = InteractiveViewer( + key: const Key('chat-image-viewer-zoom'), + maxScale: 8, + child: Center( + child: Semantics( + image: true, + label: name, + child: Image.memory( + bytes, + key: const Key('chat-image-viewer-image'), + fit: BoxFit.contain, + gaplessPlayback: true, + errorBuilder: (context, _, _) => Icon( + cupertino ? CupertinoIcons.photo : Icons.broken_image_outlined, ), ), ), @@ -47,10 +45,14 @@ class ChatImageViewer extends StatelessWidget { void close() => Navigator.of(context).maybePop(); if (cupertino) { return CupertinoPageScaffold( + backgroundColor: CupertinoColors.black, navigationBar: SegmentedBar( cupertino: true, automaticallyImplyLeading: false, title: name, + backgroundColor: CupertinoColors.black, + pillColor: CupertinoColors.darkBackgroundGray, + foregroundColor: CupertinoColors.white, leading: CupertinoButton( key: const Key('chat-image-viewer-close'), padding: const EdgeInsets.symmetric(horizontal: 16), @@ -63,6 +65,7 @@ class ChatImageViewer extends StatelessWidget { } return Scaffold( extendBodyBehindAppBar: true, + backgroundColor: Colors.black, appBar: SegmentedBar( cupertino: false, automaticallyImplyLeading: false, @@ -73,6 +76,9 @@ class ChatImageViewer extends StatelessWidget { icon: const Icon(Icons.close), ), title: name, + backgroundColor: Colors.black, + pillColor: Colors.white24, + foregroundColor: Colors.white, ), body: body, ); diff --git a/app/lib/features/graph/viewport/graph_expanded_view.dart b/app/lib/features/graph/viewport/graph_expanded_view.dart index be11060e..e1c56300 100644 --- a/app/lib/features/graph/viewport/graph_expanded_view.dart +++ b/app/lib/features/graph/viewport/graph_expanded_view.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import '../../../ui/adaptive/segmented_bar.dart'; import '../../../ui/adaptive/host.dart'; +import '../../../ui/adaptive/floating_bar_layout.dart'; import 'graph_viewport.dart'; import 'graph_viewport_controller.dart'; @@ -116,7 +117,7 @@ class _GraphExpandedViewState extends State { ), ], ), - child: SafeArea(child: body), + child: BelowTopBar(child: body), ); } return Scaffold( @@ -133,7 +134,7 @@ class _GraphExpandedViewState extends State { ), ], ), - body: SafeArea(child: body), + body: BelowTopBar(child: body), ); } } diff --git a/app/lib/features/graph/viewport/graph_viewport.dart b/app/lib/features/graph/viewport/graph_viewport.dart index c0bb2490..3751a7ae 100644 --- a/app/lib/features/graph/viewport/graph_viewport.dart +++ b/app/lib/features/graph/viewport/graph_viewport.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../../ui/adaptive/host.dart'; +import '../../../ui/adaptive/glass_pill.dart'; import 'graph_viewport_controller.dart'; /// The fit control's web wording (`Fit graph to view`). @@ -113,23 +114,26 @@ class _GraphViewportState extends State { PositionedDirectional( top: 8, end: 8, - child: Wrap( - spacing: 8, - children: [ - _ViewportButton( - buttonKey: const Key('graph-fit'), - icon: _fitIcon(context), - label: graphFitLabel, - onPressed: widget.controller.fitToViewport, - ), - if (widget.onExpand != null) + child: GlassPill( + cupertino: usesCupertinoHost(context), + child: Wrap( + spacing: 2, + children: [ _ViewportButton( - buttonKey: const Key('graph-expand'), - icon: _expandIcon(context), - label: graphExpandLabel, - onPressed: widget.onExpand, + buttonKey: const Key('graph-fit'), + icon: _fitIcon(context), + label: graphFitLabel, + onPressed: widget.controller.fitToViewport, ), - ], + if (widget.onExpand != null) + _ViewportButton( + buttonKey: const Key('graph-expand'), + icon: _expandIcon(context), + label: graphExpandLabel, + onPressed: widget.onExpand, + ), + ], + ), ), ), ], @@ -145,7 +149,7 @@ class _GraphViewportState extends State { usesCupertinoHost(context) ? CupertinoIcons.fullscreen : Icons.fullscreen; } -/// One native graph control: a tinted icon button on either host. +/// One native graph control inside the shared floating glass pill. /// /// The label and the button's own tap action must reach the same semantics /// node: the icon is the only excluded child, and [MergeSemantics] folds the @@ -172,7 +176,7 @@ class _ViewportButton extends StatelessWidget { button: true, label: label, child: usesCupertinoHost(context) - ? CupertinoButton.tinted( + ? CupertinoButton( key: buttonKey, padding: const EdgeInsets.all(8), onPressed: onPressed, @@ -183,7 +187,7 @@ class _ViewportButton extends StatelessWidget { // The merged node already carries the label; the tooltip is // only the pointer affordance. excludeFromSemantics: true, - child: IconButton.filledTonal( + child: IconButton( key: buttonKey, onPressed: onPressed, icon: ExcludeSemantics(child: Icon(icon)), diff --git a/app/lib/features/runs/ui/run_changes_action.dart b/app/lib/features/runs/ui/run_changes_action.dart index f3800fdb..57444426 100644 --- a/app/lib/features/runs/ui/run_changes_action.dart +++ b/app/lib/features/runs/ui/run_changes_action.dart @@ -188,9 +188,7 @@ class _MaterialChangesPage extends StatelessWidget { Widget build(BuildContext context) => Scaffold( extendBodyBehindAppBar: true, appBar: SegmentedBar(cupertino: false, title: title), - body: SafeArea( - child: ChangesViewer(steps: steps, showSummary: showSummary), - ), + body: ChangesViewer(steps: steps, showSummary: showSummary), ); } @@ -208,13 +206,11 @@ class _CupertinoChangesPage extends StatelessWidget { @override Widget build(BuildContext context) => CupertinoPageScaffold( navigationBar: SegmentedBar(cupertino: true, title: title), - child: SafeArea( + child: Theme( // A CupertinoApp supplies no Material theme; follow the host brightness // so the viewer's Material-derived section text stays readable. - child: Theme( - data: hostTextTheme(context), - child: ChangesViewer(steps: steps, showSummary: showSummary), - ), + data: hostTextTheme(context), + child: ChangesViewer(steps: steps, showSummary: showSummary), ), ); } diff --git a/app/lib/features/runs/ui/run_graph_preview.dart b/app/lib/features/runs/ui/run_graph_preview.dart index 9ffa966c..f2e30e92 100644 --- a/app/lib/features/runs/ui/run_graph_preview.dart +++ b/app/lib/features/runs/ui/run_graph_preview.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import '../../../ui/adaptive/segmented_bar.dart'; import '../../../core/api_gateway.dart'; import '../../../ui/adaptive/host.dart'; +import '../../../ui/adaptive/floating_bar_layout.dart'; import '../../graph/widgets/run_graph_view.dart'; const runGraphPreviewKey = ValueKey('run-graph-preview'); @@ -68,17 +69,6 @@ class RunGraphPreview extends StatelessWidget { ), ), ), - PositionedDirectional( - end: 8, - bottom: 8, - child: Icon( - cupertino - ? CupertinoIcons.fullscreen - : Icons.open_in_full, - size: 18, - color: border, - ), - ), ], ), ), @@ -110,14 +100,14 @@ class RunGraphPreview extends StatelessWidget { cupertino: true, title: 'Graph', ), - child: SafeArea(child: graphView(page)), + child: BelowTopBar(child: graphView(page)), ), ) : MaterialPageRoute( builder: (page) => Scaffold( extendBodyBehindAppBar: true, appBar: const SegmentedBar(cupertino: false, title: 'Graph'), - body: SafeArea(child: graphView(page)), + body: BelowTopBar(child: graphView(page)), ), ), ); 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 0b45f9bc..3f620cbf 100644 --- a/app/test/features/artifacts/ui/artifact_viewer_page_test.dart +++ b/app/test/features/artifacts/ui/artifact_viewer_page_test.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:convert'; -import 'dart:typed_data'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -16,6 +15,7 @@ import 'package:pipelines_app/features/artifacts/ui/artifact_gallery_page.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_fetch.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_page.dart'; import 'package:pipelines_app/features/artifacts/ui/artifact_visit_list.dart'; +import 'package:pipelines_app/ui/adaptive/glass_pill.dart'; import 'package:pipelines_app/features/chat/ui/transcript/chat_markdown_view.dart'; import '../domain/artifact_fixtures.dart'; @@ -179,6 +179,26 @@ void main() { expect(find.byType(AlertDialog), findsNothing); }); + testWidgets('a single unresolvable artifact shows no empty glass bar', ( + tester, + ) async { + final odd = recordedArtifact( + 'notes.txt', + url: 'ftp://example.invalid/notes.txt', + contentType: 'text/plain', + ); + await _pumpViewer( + tester, + groups: [ + _group([odd]), + ], + selected: artifactVisitIdentity(_group([odd]), odd), + ); + + expect(find.byKey(const Key('artifact-viewer-actions')), findsNothing); + expect(find.byKey(const Key('artifact-viewer-swipe')), findsOneWidget); + }); + testWidgets('text/plain is fetched and shown as selectable text', ( tester, ) async { @@ -199,6 +219,13 @@ void main() { expect(find.byType(SelectableText), findsOneWidget); expect(find.text('build ok\n'), findsOneWidget); + expect( + find.ancestor( + of: find.byKey(const Key('artifact-viewer-actions')), + matching: find.byType(GlassPill), + ), + findsOneWidget, + ); await showFacts(tester); expect(find.text('text/plain · 0\u00a0B'), findsOneWidget); }); @@ -374,6 +401,7 @@ void main() { ); expect(find.text('1 of 3 · image/png'), findsOneWidget); + expect(find.byKey(const Key('artifact-info')), findsOneWidget); expect( tester.widget(find.byKey(artifactPreviousKey)).onPressed, isNull, diff --git a/app/test/features/changes/changes_viewer_test.dart b/app/test/features/changes/changes_viewer_test.dart index 2ceaa320..74e55fa4 100644 --- a/app/test/features/changes/changes_viewer_test.dart +++ b/app/test/features/changes/changes_viewer_test.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; +import 'package:pipelines_app/ui/adaptive/glass_pill.dart'; import 'package:pipelines_app/features/changes/changes.dart'; import 'package:pipelines_app/features/changes/widgets/visit_pager.dart'; @@ -139,6 +140,13 @@ void main() { // The second visit is its own page, not a second section. expect(find.text('reviewer'), findsNothing); expect(find.text(missingCaptureDetail), findsNothing); + expect( + find.ancestor( + of: find.byKey(ChangesVisitPager.nextKey), + matching: find.byType(GlassPill), + ), + findsOneWidget, + ); await tester.tap(find.byKey(ChangesVisitPager.nextKey)); await tester.pump(); @@ -269,7 +277,7 @@ void main() { expect(calls.single.arguments, {'text': multiHunkPatch}); expect(find.text('Copied'), findsOneWidget); - await tester.tap(find.byTooltip('Close diff')); + await tester.pageBack(); await tester.pumpAndSettle(); expect(find.byType(Dialog), findsNothing); }, @@ -385,7 +393,7 @@ void main() { expect(find.text('Rendered'), findsOneWidget); expect(find.text('Raw patch'), findsOneWidget); - await tester.tap(find.byIcon(CupertinoIcons.xmark)); + await tester.pageBack(); await tester.pumpAndSettle(); expect( find.byType(CupertinoSlidingSegmentedControl), @@ -444,7 +452,7 @@ void main() { // selection is offered through the native menu instead. expect(find.byTooltip('Diff form'), findsOneWidget); expect(find.text('Copy patch'), findsOneWidget); - expect(find.byTooltip('Close diff'), findsOneWidget); + expect(find.byTooltip('Close diff'), findsNothing); }); testWidgets('without the settled-run gate there is no run-wide summary', ( @@ -463,4 +471,40 @@ void main() { expect(find.text('Changes · not recorded for this run'), findsNothing); expect(find.text('Capture unavailable'), findsOneWidget); }); + + testWidgets('does not show an empty floating bar without multiple visits', ( + tester, + ) async { + await tester.pumpWidget( + materialHost( + ChangesViewer( + finalOnly: true, + steps: [ + stepFixture( + fileChanges: captureFixture( + files: [fileChangeFixture(path: 'lib/feature.dart')], + ), + ), + ], + ), + ), + ); + + expect(find.byType(GlassPill), findsNothing); + expect(find.byType(ChangesVisitPager), findsNothing); + + await tester.pumpWidget( + materialHost( + ChangesViewer(steps: [stepFixture(fileChanges: captureFixture())]), + ), + ); + + expect(find.byType(GlassPill), findsNothing); + expect(find.byType(ChangesVisitPager), findsNothing); + + await tester.pumpWidget(materialHost(const ChangesViewer(steps: []))); + + expect(find.byType(GlassPill), findsNothing); + expect(find.byType(ChangesVisitPager), findsNothing); + }); } diff --git a/app/test/features/graph/viewport/graph_viewport_controls_test.dart b/app/test/features/graph/viewport/graph_viewport_controls_test.dart index b17b3a47..cba0ed0a 100644 --- a/app/test/features/graph/viewport/graph_viewport_controls_test.dart +++ b/app/test/features/graph/viewport/graph_viewport_controls_test.dart @@ -2,6 +2,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pipelines_app/features/graph/viewport/graph_viewport_controller.dart'; +import 'package:pipelines_app/ui/adaptive/glass_pill.dart'; import 'graph_viewport_fixtures.dart'; @@ -24,6 +25,13 @@ void main() { ); await settleViewport(tester); final fitted = controller.snapshot; + expect( + find.ancestor( + of: find.byKey(const Key('graph-fit')), + matching: find.byType(GlassPill), + ), + findsOneWidget, + ); for (final control in viewportControls().entries) { final node = tester.getSemantics(find.byKey(control.key)); diff --git a/app/test/features/runs/ui/run_changes_action_test.dart b/app/test/features/runs/ui/run_changes_action_test.dart index 3ddbf41b..0089d38e 100644 --- a/app/test/features/runs/ui/run_changes_action_test.dart +++ b/app/test/features/runs/ui/run_changes_action_test.dart @@ -132,11 +132,7 @@ void main() { expect(rendered, contains('+ added line')); expect(rendered, contains('- removed line')); - if (platform == _Platform.material) { - await tester.tap(find.byTooltip('Close diff')); - } else { - await tester.tap(find.byIcon(CupertinoIcons.xmark)); - } + await tester.pageBack(); await tester.pumpAndSettle(); expect(find.text('lib/feature.dart'), findsOneWidget);