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
+32
View File
@@ -0,0 +1,32 @@
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
/// Left and right arrow keys step to the previous and next item (an
/// artifact, a changed file) wherever a keyboard is attached. A field that
/// takes the arrows itself (a text box) keeps them while it has focus.
class ArrowKeyPager extends StatelessWidget {
const ArrowKeyPager({
super.key,
required this.onPrevious,
required this.onNext,
required this.child,
});
/// Null at the first item.
final VoidCallback? onPrevious;
/// Null at the last item.
final VoidCallback? onNext;
final Widget child;
@override
Widget build(BuildContext context) => CallbackShortcuts(
bindings: {
const SingleActivator(LogicalKeyboardKey.arrowLeft): () =>
onPrevious?.call(),
const SingleActivator(LogicalKeyboardKey.arrowRight): () =>
onNext?.call(),
},
child: Focus(autofocus: true, child: child),
);
}