feat(app): left/right arrows step through artifacts and changed files

This commit is contained in:
2026-10-23 22:34:11 +01:00
parent 0defe42ac1
commit f81957cd73
4 changed files with 92 additions and 7 deletions
@@ -1,3 +1,4 @@
import '../../../ui/input/arrow_key_pager.dart';
import 'dart:convert';
import 'package:flutter/cupertino.dart';
@@ -219,7 +220,7 @@ class _ArtifactViewerPageState extends State<ArtifactViewerPage> {
final title = page == null
? artifactViewerTitle
: artifactDisplayName(page.artifact);
final body = page == null || plan == null
Widget body = page == null || plan == null
? const Center(child: Text('No previewable artifacts recorded.'))
: ArtifactViewerBody(
page: page,
@@ -239,6 +240,12 @@ class _ArtifactViewerPageState extends State<ArtifactViewerPage> {
onOpen: plan.resolved == null ? () {} : () => _open(plan.resolved!),
onCopy: plan.resolved == null ? () {} : () => _copy(plan.resolved!),
);
// Left/right arrows walk the same list as the Previous/Next buttons.
body = ArrowKeyPager(
onPrevious: () => _step(-1),
onNext: () => _step(1),
child: body,
);
if (usesCupertinoHost(context)) {
return CupertinoPageScaffold(
backgroundColor: CupertinoColors.systemGroupedBackground,
@@ -1,3 +1,4 @@
import '../../../ui/input/arrow_key_pager.dart';
import 'dart:async';
import 'package:flutter/cupertino.dart';
@@ -287,12 +288,17 @@ class _FileDiffPageState extends State<FileDiffPage> {
onPrevious: _index > 0 ? () => _step(-1) : null,
onNext: _index < count - 1 ? () => _step(1) : null,
);
final body = Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(child: viewer),
?pager,
],
// Left/right arrows step between changed files, like the chevrons.
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,
],
),
);
if (cupertino) {
return CupertinoPageScaffold(