feat(app): glass viewer bars, graph controls and immersive image viewer

Review findings F12, F13, F25 and F1 for viewers: the artifact viewer's
actions/pager and the Changes pager float as glass pills over content,
file facts move to the top bar, graph overlay controls are one glass pill
(duplicate fullscreen glyph removed), the image viewer is immersive, and
diff/artifact/graph views let content pass behind the bar. Implemented by
pipeline run #204 (Terra); its Review stopped after three rejections, the
last being an empty glass bar for a single unresolved artifact, which the
manager fixed here with a regression test.
This commit is contained in:
2026-10-31 04:26:22 +00:00
parent 6ab8551348
commit fde086cc4a
13 changed files with 301 additions and 199 deletions
@@ -6,12 +6,13 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.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_actions.dart';
import '../actions/artifact_file_bridge.dart'; import '../actions/artifact_file_bridge.dart';
import '../domain/artifact_preview.dart'; import '../domain/artifact_preview.dart';
import '../domain/artifact_url.dart'; import '../domain/artifact_url.dart';
import '../domain/gallery_navigation.dart'; import '../domain/gallery_navigation.dart';
import 'artifact_selection_facts.dart';
import 'artifact_viewer_content.dart'; import 'artifact_viewer_content.dart';
import 'artifact_viewer_fetch.dart'; import 'artifact_viewer_fetch.dart';
@@ -62,24 +63,11 @@ class ArtifactViewerBody extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final resolved = plan.resolved; final resolved = plan.resolved;
// The page never scrolls: a thin strip on top, the preview filling the // The page never scrolls: the preview fills the middle (it zooms or
// middle (it zooms or scrolls itself), the controls along the bottom. // scrolls itself) and the controls float over its bottom edge.
final content = Column( final content = Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
_InfoStrip(
label: artifactViewerPositionLabel(
index,
count,
page.artifact.contentType,
),
facts: ArtifactSelectionFacts(
group: page.group,
artifact: page.artifact,
step: null,
resolved: plan.resolved,
),
),
Expanded( Expanded(
child: ArtifactPreviewBody( child: ArtifactPreviewBody(
plan: plan, plan: plan,
@@ -94,47 +82,51 @@ class ArtifactViewerBody extends StatelessWidget {
); );
final hasPrevious = pagedIndex(index, -1, count) != index; final hasPrevious = pagedIndex(index, -1, count) != index;
final hasNext = pagedIndex(index, 1, count) != index; final hasNext = pagedIndex(index, 1, count) != index;
return Column( final swipe = GestureDetector(
crossAxisAlignment: CrossAxisAlignment.stretch, key: const Key('artifact-viewer-swipe'),
children: [ behavior: HitTestBehavior.translucent,
Expanded( onHorizontalDragEnd: (details) {
// A horizontal swipe moves to the previous or next artifact. final velocity = details.primaryVelocity ?? 0;
child: GestureDetector( if (velocity < -250 && hasNext) onNext();
key: const Key('artifact-viewer-swipe'), if (velocity > 250 && hasPrevious) onPrevious();
behavior: HitTestBehavior.translucent, },
onHorizontalDragEnd: (details) { child: content,
final velocity = details.primaryVelocity ?? 0; );
if (velocity < -250 && hasNext) onNext(); // An unresolved single artifact has no actions and nothing to page:
if (velocity > 250 && hasPrevious) onPrevious(); // no empty glass bar, and no bottom clearance reserved for one.
}, if (resolved == null && count <= 1) return swipe;
child: content, return FloatingBarOverlay(
), bar: SafeArea(
), top: false,
// Every action as an icon at the bottom, beside the pager. minimum: const EdgeInsets.all(8),
SafeArea( child: SizedBox(
top: false, height: 56,
child: Padding( child: GlassPill(
padding: const EdgeInsets.symmetric(horizontal: 4), cupertino: usesCupertinoHost(context),
child: Row( child: Padding(
key: const Key('artifact-viewer-actions'), padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
children: [ child: Row(
if (resolved != null && !resolved.external) key: const Key('artifact-viewer-actions'),
ArtifactFileActions( children: [
key: ValueKey<String>( if (resolved != null && !resolved.external)
'viewer-files-${page.group.stageKey}\u0000' ArtifactFileActions(
'${page.group.visit}\u0000${page.artifact.url}', key: ValueKey<String>(
'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, if (resolved != null)
resolved: resolved, _Actions(
fetch: fetch, resolved: resolved,
bridge: fileBridge, onOpen: onOpen,
compact: true, onCopy: onCopy,
), ),
if (resolved != null) Expanded(
_Actions(resolved: resolved, onOpen: onOpen, onCopy: onCopy),
Expanded(
child: Align(
alignment: AlignmentDirectional.centerEnd,
child: _Pager( child: _Pager(
index: index, index: index,
count: count, count: count,
@@ -142,12 +134,13 @@ class ArtifactViewerBody extends StatelessWidget {
onNext: onNext, 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 /// The viewer's top edge: where this artifact sits in the list, and an
/// information button for its recorded facts. /// information button for its recorded facts.
class _InfoStrip extends StatelessWidget { class ArtifactViewerInfoAction extends StatelessWidget {
const _InfoStrip({required this.label, required this.facts}); const ArtifactViewerInfoAction({super.key, required this.facts});
final String label;
final Widget facts; final Widget facts;
void _show(BuildContext context) { void _show(BuildContext context) {
@@ -366,35 +358,12 @@ class _InfoStrip extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final muted = usesCupertinoHost(context) return ArtifactIconAction(
? CupertinoTheme.of(context).textTheme.tabLabelTextStyle.copyWith( key: const Key('artifact-info'),
color: CupertinoColors.secondaryLabel.resolveFrom(context), label: 'Details',
) icon: Icons.info_outline,
: Theme.of(context).textTheme.bodySmall?.copyWith( cupertinoIcon: CupertinoIcons.info,
color: Theme.of(context).colorScheme.onSurfaceVariant, onPressed: () => _show(context),
);
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),
),
],
),
); );
} }
} }
@@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/host.dart';
import 'artifact_selection_facts.dart';
import '../actions/artifact_file_bridge.dart'; import '../actions/artifact_file_bridge.dart';
import '../domain/artifact_groups.dart'; import '../domain/artifact_groups.dart';
import '../domain/artifact_preview.dart'; import '../domain/artifact_preview.dart';
@@ -222,6 +223,25 @@ class _ArtifactViewerPageState extends State<ArtifactViewerPage> {
final title = page == null final title = page == null
? artifactViewerTitle ? artifactViewerTitle
: artifactDisplayName(page.artifact); : artifactDisplayName(page.artifact);
final subtitle = page == null
? null
: artifactViewerPositionLabel(
_index,
_pages.length,
page.artifact.contentType,
);
final info = page == null || plan == null
? const <Widget>[]
: <Widget>[
ArtifactViewerInfoAction(
facts: ArtifactSelectionFacts(
group: page.group,
artifact: page.artifact,
step: null,
resolved: plan.resolved,
),
),
];
Widget body = page == null || plan == null Widget body = page == null || plan == null
? const Center(child: Text('No previewable artifacts recorded.')) ? const Center(child: Text('No previewable artifacts recorded.'))
: ArtifactViewerBody( : ArtifactViewerBody(
@@ -253,14 +273,24 @@ class _ArtifactViewerPageState extends State<ArtifactViewerPage> {
if (usesCupertinoHost(context)) { if (usesCupertinoHost(context)) {
return CupertinoPageScaffold( return CupertinoPageScaffold(
backgroundColor: AppColors.groupedBackground, backgroundColor: AppColors.groupedBackground,
navigationBar: SegmentedBar(cupertino: true, title: title), navigationBar: SegmentedBar(
child: SafeArea(child: body), cupertino: true,
title: title,
subtitle: subtitle,
actions: info,
),
child: body,
); );
} }
return Scaffold( return Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: SegmentedBar(cupertino: false, title: title), appBar: SegmentedBar(
body: SafeArea(child: body), cupertino: false,
title: title,
subtitle: subtitle,
actions: info,
),
body: body,
); );
} }
} }
@@ -10,6 +10,8 @@ import 'change_style.dart';
import 'file_diff_viewer.dart'; import 'file_diff_viewer.dart';
import 'visit_pager.dart'; import 'visit_pager.dart';
import '../../../ui/adaptive/floating_bar_layout.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 /// The run's Changes surface: an honest final-state summary followed by the
/// recorded stage/visit captures, with changed-filename filtering and the /// recorded stage/visit captures, with changed-filename filtering and the
@@ -105,12 +107,24 @@ class _ChangesViewerState extends State<ChangesViewer> {
); );
final note = showSummary ? runChangesNote(run) : ''; final note = showSummary ? runChangesNote(run) : '';
final visit = captures.isEmpty ? null : captures[_visitIndex]; 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, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
if (showSummary) if (showSummary)
Padding( Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 8), padding: withTopBarClearance(
context,
const EdgeInsets.fromLTRB(16, 16, 16, 8),
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@@ -149,7 +163,7 @@ class _ChangesViewerState extends State<ChangesViewer> {
Expanded( Expanded(
child: run.files.isEmpty child: run.files.isEmpty
? SingleChildScrollView( ? SingleChildScrollView(
padding: withFloatingBarClearance( padding: withTopBarClearance(
context, context,
const EdgeInsets.all(16), const EdgeInsets.all(16),
), ),
@@ -175,10 +189,9 @@ class _ChangesViewerState extends State<ChangesViewer> {
Expanded( Expanded(
child: visit == null child: visit == null
? SingleChildScrollView( ? SingleChildScrollView(
padding: withFloatingBarClearance( padding: pager == null
context, ? withTopBarClearance(context, const EdgeInsets.all(16))
const EdgeInsets.all(16), : withBarClearance(context, const EdgeInsets.all(16)),
),
child: Text(noChangeDetail(run)), child: Text(noChangeDetail(run)),
) )
: SingleChildScrollView( : SingleChildScrollView(
@@ -187,7 +200,9 @@ class _ChangesViewerState extends State<ChangesViewer> {
key: ValueKey<String>( key: ValueKey<String>(
'changes-visit-${visit.stage}-${visit.sequence}', 'changes-visit-${visit.stage}-${visit.sequence}',
), ),
padding: withFloatingBarClearance(context, EdgeInsets.zero), padding: hasVisitPager
? withBarClearance(context, EdgeInsets.zero)
: withTopBarClearance(context, EdgeInsets.zero),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
@@ -208,15 +223,19 @@ class _ChangesViewerState extends State<ChangesViewer> {
), ),
), ),
), ),
// 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,
);
} }
} }
@@ -7,6 +7,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import '../../../ui/navigation/chevron_pager.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_kind.dart';
import '../domain/change_wording.dart'; import '../domain/change_wording.dart';
import '../domain/file_change.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 /// bytes) and Close. Binary/truncated/mode-only/no-patch entries show an honest
/// reason instead of a fabricated diff. /// reason instead of a fabricated diff.
class FileDiffViewer extends StatefulWidget { 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; final FileChange file;
/// Called by the Close control. Defaults to popping the enclosing route. /// Called by the Close control. Defaults to popping the enclosing route.
final VoidCallback? onClose; 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 @override
State<FileDiffViewer> createState() => _FileDiffViewerState(); State<FileDiffViewer> createState() => _FileDiffViewerState();
} }
@@ -44,15 +55,6 @@ class _FileDiffViewerState extends State<FileDiffViewer> {
void _selectForm(DiffForm value) => setState(() => _form = value); void _selectForm(DiffForm value) => setState(() => _form = value);
void _close() {
final close = widget.onClose;
if (close != null) {
close();
} else {
Navigator.of(context).maybePop();
}
}
Future<void> _copy() async { Future<void> _copy() async {
final patch = widget.file.patch; final patch = widget.file.patch;
if (patch == null) return; if (patch == null) return;
@@ -84,7 +86,12 @@ class _FileDiffViewerState extends State<FileDiffViewer> {
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
Padding( 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( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@@ -142,7 +149,6 @@ class _FileDiffViewerState extends State<FileDiffViewer> {
), ),
), ),
), ),
closeDiffControl(context, _close),
], ],
), ),
), ),
@@ -277,6 +283,7 @@ class _FileDiffPageState extends State<FileDiffPage> {
final viewer = FileDiffViewer( final viewer = FileDiffViewer(
key: ValueKey<String>('file-diff-${file.path}'), key: ValueKey<String>('file-diff-${file.path}'),
file: file, file: file,
floatBehindTopBar: true,
); );
final pager = count < 2 final pager = count < 2
? null ? null
@@ -293,26 +300,30 @@ class _FileDiffPageState extends State<FileDiffPage> {
final body = ArrowKeyPager( final body = ArrowKeyPager(
onPrevious: _index > 0 ? () => _step(-1) : null, onPrevious: _index > 0 ? () => _step(-1) : null,
onNext: _index < count - 1 ? () => _step(1) : null, onNext: _index < count - 1 ? () => _step(1) : null,
child: Column( child: FloatingBarOverlay(
crossAxisAlignment: CrossAxisAlignment.stretch, bar: pager == null
children: [ ? const SizedBox.shrink()
Expanded(child: viewer), : Align(
?pager, alignment: AlignmentDirectional.centerEnd,
], heightFactor: 1,
child: Padding(
padding: const EdgeInsets.all(8),
child: GlassPill(cupertino: cupertino, child: pager),
),
),
child: viewer,
), ),
); );
if (cupertino) { if (cupertino) {
return CupertinoPageScaffold( return CupertinoPageScaffold(
navigationBar: SegmentedBar(cupertino: true, title: name), navigationBar: SegmentedBar(cupertino: true, title: name),
child: SafeArea( child: Theme(data: hostTextTheme(context), child: body),
child: Theme(data: hostTextTheme(context), child: body),
),
); );
} }
return Scaffold( return Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: SegmentedBar(cupertino: false, title: name), appBar: SegmentedBar(cupertino: false, title: name),
body: SafeArea(child: body), body: body,
); );
} }
} }
@@ -23,22 +23,20 @@ class ChatImageViewer extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final body = SafeArea( final body = InteractiveViewer(
child: InteractiveViewer( key: const Key('chat-image-viewer-zoom'),
key: const Key('chat-image-viewer-zoom'), maxScale: 8,
maxScale: 8, child: Center(
child: Center( child: Semantics(
child: Semantics( image: true,
image: true, label: name,
label: name, child: Image.memory(
child: Image.memory( bytes,
bytes, key: const Key('chat-image-viewer-image'),
key: const Key('chat-image-viewer-image'), fit: BoxFit.contain,
fit: BoxFit.contain, gaplessPlayback: true,
gaplessPlayback: true, errorBuilder: (context, _, _) => Icon(
errorBuilder: (context, _, _) => Icon( cupertino ? CupertinoIcons.photo : Icons.broken_image_outlined,
cupertino ? CupertinoIcons.photo : Icons.broken_image_outlined,
),
), ),
), ),
), ),
@@ -47,10 +45,14 @@ class ChatImageViewer extends StatelessWidget {
void close() => Navigator.of(context).maybePop(); void close() => Navigator.of(context).maybePop();
if (cupertino) { if (cupertino) {
return CupertinoPageScaffold( return CupertinoPageScaffold(
backgroundColor: CupertinoColors.black,
navigationBar: SegmentedBar( navigationBar: SegmentedBar(
cupertino: true, cupertino: true,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
title: name, title: name,
backgroundColor: CupertinoColors.black,
pillColor: CupertinoColors.darkBackgroundGray,
foregroundColor: CupertinoColors.white,
leading: CupertinoButton( leading: CupertinoButton(
key: const Key('chat-image-viewer-close'), key: const Key('chat-image-viewer-close'),
padding: const EdgeInsets.symmetric(horizontal: 16), padding: const EdgeInsets.symmetric(horizontal: 16),
@@ -63,6 +65,7 @@ class ChatImageViewer extends StatelessWidget {
} }
return Scaffold( return Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
backgroundColor: Colors.black,
appBar: SegmentedBar( appBar: SegmentedBar(
cupertino: false, cupertino: false,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
@@ -73,6 +76,9 @@ class ChatImageViewer extends StatelessWidget {
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
), ),
title: name, title: name,
backgroundColor: Colors.black,
pillColor: Colors.white24,
foregroundColor: Colors.white,
), ),
body: body, body: body,
); );
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import '../../../ui/adaptive/segmented_bar.dart'; import '../../../ui/adaptive/segmented_bar.dart';
import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/host.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import 'graph_viewport.dart'; import 'graph_viewport.dart';
import 'graph_viewport_controller.dart'; import 'graph_viewport_controller.dart';
@@ -116,7 +117,7 @@ class _GraphExpandedViewState extends State<GraphExpandedView> {
), ),
], ],
), ),
child: SafeArea(child: body), child: BelowTopBar(child: body),
); );
} }
return Scaffold( return Scaffold(
@@ -133,7 +134,7 @@ class _GraphExpandedViewState extends State<GraphExpandedView> {
), ),
], ],
), ),
body: SafeArea(child: body), body: BelowTopBar(child: body),
); );
} }
} }
@@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/host.dart';
import '../../../ui/adaptive/glass_pill.dart';
import 'graph_viewport_controller.dart'; import 'graph_viewport_controller.dart';
/// The fit control's web wording (`Fit graph to view`). /// The fit control's web wording (`Fit graph to view`).
@@ -113,23 +114,26 @@ class _GraphViewportState extends State<GraphViewport> {
PositionedDirectional( PositionedDirectional(
top: 8, top: 8,
end: 8, end: 8,
child: Wrap( child: GlassPill(
spacing: 8, cupertino: usesCupertinoHost(context),
children: [ child: Wrap(
_ViewportButton( spacing: 2,
buttonKey: const Key('graph-fit'), children: [
icon: _fitIcon(context),
label: graphFitLabel,
onPressed: widget.controller.fitToViewport,
),
if (widget.onExpand != null)
_ViewportButton( _ViewportButton(
buttonKey: const Key('graph-expand'), buttonKey: const Key('graph-fit'),
icon: _expandIcon(context), icon: _fitIcon(context),
label: graphExpandLabel, label: graphFitLabel,
onPressed: widget.onExpand, 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<GraphViewport> {
usesCupertinoHost(context) ? CupertinoIcons.fullscreen : Icons.fullscreen; 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 /// 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 /// node: the icon is the only excluded child, and [MergeSemantics] folds the
@@ -172,7 +176,7 @@ class _ViewportButton extends StatelessWidget {
button: true, button: true,
label: label, label: label,
child: usesCupertinoHost(context) child: usesCupertinoHost(context)
? CupertinoButton.tinted( ? CupertinoButton(
key: buttonKey, key: buttonKey,
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
onPressed: onPressed, onPressed: onPressed,
@@ -183,7 +187,7 @@ class _ViewportButton extends StatelessWidget {
// The merged node already carries the label; the tooltip is // The merged node already carries the label; the tooltip is
// only the pointer affordance. // only the pointer affordance.
excludeFromSemantics: true, excludeFromSemantics: true,
child: IconButton.filledTonal( child: IconButton(
key: buttonKey, key: buttonKey,
onPressed: onPressed, onPressed: onPressed,
icon: ExcludeSemantics(child: Icon(icon)), icon: ExcludeSemantics(child: Icon(icon)),
@@ -188,9 +188,7 @@ class _MaterialChangesPage extends StatelessWidget {
Widget build(BuildContext context) => Scaffold( Widget build(BuildContext context) => Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: SegmentedBar(cupertino: false, title: title), appBar: SegmentedBar(cupertino: false, title: title),
body: SafeArea( body: ChangesViewer(steps: steps, showSummary: showSummary),
child: ChangesViewer(steps: steps, showSummary: showSummary),
),
); );
} }
@@ -208,13 +206,11 @@ class _CupertinoChangesPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) => CupertinoPageScaffold( Widget build(BuildContext context) => CupertinoPageScaffold(
navigationBar: SegmentedBar(cupertino: true, title: title), navigationBar: SegmentedBar(cupertino: true, title: title),
child: SafeArea( child: Theme(
// A CupertinoApp supplies no Material theme; follow the host brightness // A CupertinoApp supplies no Material theme; follow the host brightness
// so the viewer's Material-derived section text stays readable. // so the viewer's Material-derived section text stays readable.
child: Theme( data: hostTextTheme(context),
data: hostTextTheme(context), child: ChangesViewer(steps: steps, showSummary: showSummary),
child: ChangesViewer(steps: steps, showSummary: showSummary),
),
), ),
); );
} }
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import '../../../ui/adaptive/segmented_bar.dart'; import '../../../ui/adaptive/segmented_bar.dart';
import '../../../core/api_gateway.dart'; import '../../../core/api_gateway.dart';
import '../../../ui/adaptive/host.dart'; import '../../../ui/adaptive/host.dart';
import '../../../ui/adaptive/floating_bar_layout.dart';
import '../../graph/widgets/run_graph_view.dart'; import '../../graph/widgets/run_graph_view.dart';
const runGraphPreviewKey = ValueKey<String>('run-graph-preview'); const runGraphPreviewKey = ValueKey<String>('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, cupertino: true,
title: 'Graph', title: 'Graph',
), ),
child: SafeArea(child: graphView(page)), child: BelowTopBar(child: graphView(page)),
), ),
) )
: MaterialPageRoute<void>( : MaterialPageRoute<void>(
builder: (page) => Scaffold( builder: (page) => Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: const SegmentedBar(cupertino: false, title: 'Graph'), appBar: const SegmentedBar(cupertino: false, title: 'Graph'),
body: SafeArea(child: graphView(page)), body: BelowTopBar(child: graphView(page)),
), ),
), ),
); );
@@ -1,6 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:typed_data';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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_fetch.dart';
import 'package:pipelines_app/features/artifacts/ui/artifact_viewer_page.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/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 'package:pipelines_app/features/chat/ui/transcript/chat_markdown_view.dart';
import '../domain/artifact_fixtures.dart'; import '../domain/artifact_fixtures.dart';
@@ -179,6 +179,26 @@ void main() {
expect(find.byType(AlertDialog), findsNothing); 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', ( testWidgets('text/plain is fetched and shown as selectable text', (
tester, tester,
) async { ) async {
@@ -199,6 +219,13 @@ void main() {
expect(find.byType(SelectableText), findsOneWidget); expect(find.byType(SelectableText), findsOneWidget);
expect(find.text('build ok\n'), 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); await showFacts(tester);
expect(find.text('text/plain · 0\u00a0B'), findsOneWidget); 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.text('1 of 3 · image/png'), findsOneWidget);
expect(find.byKey(const Key('artifact-info')), findsOneWidget);
expect( expect(
tester.widget<IconButton>(find.byKey(artifactPreviousKey)).onPressed, tester.widget<IconButton>(find.byKey(artifactPreviousKey)).onPressed,
isNull, isNull,
@@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
import 'package:pipelines_app/features/changes/changes.dart'; import 'package:pipelines_app/features/changes/changes.dart';
import 'package:pipelines_app/features/changes/widgets/visit_pager.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. // The second visit is its own page, not a second section.
expect(find.text('reviewer'), findsNothing); expect(find.text('reviewer'), findsNothing);
expect(find.text(missingCaptureDetail), 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.tap(find.byKey(ChangesVisitPager.nextKey));
await tester.pump(); await tester.pump();
@@ -269,7 +277,7 @@ void main() {
expect(calls.single.arguments, {'text': multiHunkPatch}); expect(calls.single.arguments, {'text': multiHunkPatch});
expect(find.text('Copied'), findsOneWidget); expect(find.text('Copied'), findsOneWidget);
await tester.tap(find.byTooltip('Close diff')); await tester.pageBack();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.byType(Dialog), findsNothing); expect(find.byType(Dialog), findsNothing);
}, },
@@ -385,7 +393,7 @@ void main() {
expect(find.text('Rendered'), findsOneWidget); expect(find.text('Rendered'), findsOneWidget);
expect(find.text('Raw patch'), findsOneWidget); expect(find.text('Raw patch'), findsOneWidget);
await tester.tap(find.byIcon(CupertinoIcons.xmark)); await tester.pageBack();
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect( expect(
find.byType(CupertinoSlidingSegmentedControl<DiffForm>), find.byType(CupertinoSlidingSegmentedControl<DiffForm>),
@@ -444,7 +452,7 @@ void main() {
// selection is offered through the native menu instead. // selection is offered through the native menu instead.
expect(find.byTooltip('Diff form'), findsOneWidget); expect(find.byTooltip('Diff form'), findsOneWidget);
expect(find.text('Copy patch'), 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', ( 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('Changes · not recorded for this run'), findsNothing);
expect(find.text('Capture unavailable'), findsOneWidget); 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);
});
} }
@@ -2,6 +2,7 @@ import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/graph/viewport/graph_viewport_controller.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'; import 'graph_viewport_fixtures.dart';
@@ -24,6 +25,13 @@ void main() {
); );
await settleViewport(tester); await settleViewport(tester);
final fitted = controller.snapshot; 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) { for (final control in viewportControls().entries) {
final node = tester.getSemantics(find.byKey(control.key)); final node = tester.getSemantics(find.byKey(control.key));
@@ -132,11 +132,7 @@ void main() {
expect(rendered, contains('+ added line')); expect(rendered, contains('+ added line'));
expect(rendered, contains('- removed line')); expect(rendered, contains('- removed line'));
if (platform == _Platform.material) { await tester.pageBack();
await tester.tap(find.byTooltip('Close diff'));
} else {
await tester.tap(find.byIcon(CupertinoIcons.xmark));
}
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.text('lib/feature.dart'), findsOneWidget); expect(find.text('lib/feature.dart'), findsOneWidget);