fix(app): close the artifact viewer with Escape

This commit is contained in:
2026-10-26 18:41:44 +00:00
parent 41a3be8715
commit 56f18acf78
3 changed files with 44 additions and 0 deletions
+8
View File
@@ -9,6 +9,7 @@ class ArrowKeyPager extends StatelessWidget {
super.key,
required this.onPrevious,
required this.onNext,
this.onEscape,
required this.child,
});
@@ -17,6 +18,10 @@ class ArrowKeyPager extends StatelessWidget {
/// Null at the last item.
final VoidCallback? onNext;
/// Escape, when the surface can be dismissed (a viewer page). Absent means
/// Escape keeps whatever meaning the surrounding page gives it.
final VoidCallback? onEscape;
final Widget child;
@override
@@ -26,6 +31,9 @@ class ArrowKeyPager extends StatelessWidget {
onPrevious?.call(),
const SingleActivator(LogicalKeyboardKey.arrowRight): () =>
onNext?.call(),
if (onEscape != null)
const SingleActivator(LogicalKeyboardKey.escape): () =>
onEscape!.call(),
},
child: Focus(autofocus: true, child: child),
);