fix: filter keydownevents in actions handler (#4817)

This commit is contained in:
Mathias Mogensen 2024-03-04 13:42:42 +01:00 committed by GitHub
parent 107e3cea4f
commit b087a9aeb3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,3 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/inline_actions/inline_actions_menu.dart'; import 'package:appflowy/plugins/inline_actions/inline_actions_menu.dart';
import 'package:appflowy/plugins/inline_actions/inline_actions_result.dart'; import 'package:appflowy/plugins/inline_actions/inline_actions_result.dart';
@ -7,8 +10,6 @@ import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/style_widget/text.dart'; import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
/// All heights are in physical pixels /// All heights are in physical pixels
const double _groupTextHeight = 14; // 12 height + 2 bottom spacing const double _groupTextHeight = 14; // 12 height + 2 bottom spacing
@ -208,6 +209,10 @@ class _InlineActionsHandlerState extends State<InlineActionsHandler> {
results[groupIndex].results[handlerIndex]; results[groupIndex].results[handlerIndex];
KeyEventResult onKeyEvent(focus, KeyEvent event) { KeyEventResult onKeyEvent(focus, KeyEvent event) {
if (event is! KeyDownEvent) {
return KeyEventResult.ignored;
}
const moveKeys = [ const moveKeys = [
LogicalKeyboardKey.arrowUp, LogicalKeyboardKey.arrowUp,
LogicalKeyboardKey.arrowDown, LogicalKeyboardKey.arrowDown,