feat(app): previous/next for visits, artifacts and diffs are chevrons in one row at the bottom right

This commit is contained in:
2026-10-23 17:14:44 +01:00
parent 73d59f4d85
commit 3fc7a28e76
9 changed files with 204 additions and 225 deletions
@@ -1,3 +1,4 @@
import '../../../ui/navigation/chevron_pager.dart';
import 'dart:typed_data';
import 'package:flutter/cupertino.dart';
@@ -182,6 +183,9 @@ class _Actions extends StatelessWidget {
}
}
const artifactPreviousKey = ValueKey<String>('artifact-previous');
const artifactNextKey = ValueKey<String>('artifact-next');
class _Pager extends StatelessWidget {
const _Pager({
required this.index,
@@ -200,48 +204,17 @@ class _Pager extends StatelessWidget {
if (count <= 1) return const SizedBox.shrink();
final hasPrevious = pagedIndex(index, -1, count) != index;
final hasNext = pagedIndex(index, 1, count) != index;
if (usesCupertinoHost(context)) {
return SafeArea(
top: false,
child: Wrap(
alignment: WrapAlignment.spaceBetween,
children: [
CupertinoButton(
onPressed: hasPrevious ? onPrevious : null,
child: const Text('Previous artifact'),
),
CupertinoButton(
onPressed: hasNext ? onNext : null,
child: const Text('Next artifact'),
),
],
),
);
}
return SafeArea(
top: false,
child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(8, 0, 8, 4),
// A `Row` clips the second labelled button once 2x text is wider than
// the viewport; a `Wrap` keeps both controls whole and lets them take
// separate lines, like the Cupertino pager.
child: Wrap(
alignment: WrapAlignment.spaceBetween,
spacing: 8,
runSpacing: 4,
children: [
TextButton.icon(
onPressed: hasPrevious ? onPrevious : null,
icon: const Icon(Icons.arrow_back),
label: const Text('Previous artifact'),
),
TextButton.icon(
onPressed: hasNext ? onNext : null,
icon: const Icon(Icons.arrow_forward),
label: const Text('Next artifact'),
),
],
),
child: ChevronPager(
index: index,
count: count,
previousLabel: 'Previous artifact',
nextLabel: 'Next artifact',
previousKey: artifactPreviousKey,
nextKey: artifactNextKey,
onPrevious: hasPrevious ? onPrevious : null,
onNext: hasNext ? onNext : null,
),
);
}