diff --git a/lib/widgets/popup.dart b/lib/widgets/popup.dart index ba2d8ec..a1357c0 100644 --- a/lib/widgets/popup.dart +++ b/lib/widgets/popup.dart @@ -26,10 +26,13 @@ class Popup extends PopupRoute { Popup({ required this.child, required this.direction, - }); + }) { + _focusNode = FocusNode(); + } final Widget child; final PopupDirection direction; + late final FocusNode _focusNode; bool _isPopping = false; @@ -51,11 +54,17 @@ class Popup extends PopupRoute { @override Duration get transitionDuration => const Duration(milliseconds: 250); + @override + void dispose() { + _focusNode.dispose(); + super.dispose(); + } + @override Widget buildPage(BuildContext context, Animation animation, Animation secondaryAnimation) { return KeyboardListener( - focusNode: FocusNode(), + focusNode: _focusNode, autofocus: true, onKeyEvent: (event) { if (event.logicalKey == LogicalKeyboardKey.escape) { diff --git a/pubspec.yaml b/pubspec.yaml index 5ef0447..8bdc548 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -89,4 +89,4 @@ msix_config: trim_logo: false languages: en-us, zh-cn execution_alias: iris - file_extension: .aac, .aiff, .alac, .amr, .ape, .caf, .cda, .dsd, .dts, .flac, .m4a, .midi, .mp3, .mpc, .oga, .ogg, .opus, .raw, .spx, .tak, .tta, .wav, .wma, .wv, .3gp, .amv, .asf, .avi, .divx, .dpx, .drc, .dv, .f4v, .flv, .h264, .h265, .hevc, .m2ts, .m4p, .m4v, .mkv, .mng, .mov, .mp2, .mp4, .mpe, .mpeg, .mpg, .mpv, .mts, .mxf, .nsv, .ogv, .qt, .rm, .rmvb, .ts, .vob, .webm, .wmv, .yuv, \ No newline at end of file + file_extension: .aac, .aiff, .alac, .amr, .ape, .caf, .cda, .dsd, .dts, .flac, .m4a, .midi, .mp3, .mpc, .oga, .ogg, .opus, .raw, .spx, .tak, .tta, .wav, .wma, .wv, .3gp, .amv, .asf, .avi, .divx, .dpx, .drc, .dv, .f4v, .flv, .h264, .h265, .hevc, .m2ts, .m4p, .m4v, .mkv, .mng, .mov, .mp2, .mp4, .mpe, .mpeg, .mpg, .mpv, .mts, .mxf, .nsv, .ogv, .qt, .rm, .rmvb, .ts, .vob, .webm, .wmv, .yuv \ No newline at end of file