feat(app): left/right arrows step through artifacts and changed files
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user