From 80d0a385cbb77ede2f45a2a1fee497db5398a3c3 Mon Sep 17 00:00:00 2001 From: Gradi Nandoy <32736595+nandoys@users.noreply.github.com> Date: Tue, 20 Sep 2022 02:06:55 +0100 Subject: [PATCH] fix: KeyEventResult issue Exception caught by services library The following TypeErrorImpl was thrown while processing the key message handler: Expected a value of type 'KeyEventResult', but got one of type 'bool' --- lib/src/dropdown.dart | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/src/dropdown.dart b/lib/src/dropdown.dart index a2499e1..d183983 100644 --- a/lib/src/dropdown.dart +++ b/lib/src/dropdown.dart @@ -374,26 +374,31 @@ class DropdownFormFieldState extends State } else { _toggleOverlay(); } - return false; + //return false; + return KeyEventResult.ignored; } else if (event.isKeyPressed(LogicalKeyboardKey.escape)) { _removeOverlay(); - return true; + //return true; + return KeyEventResult.handled; } else if (event.isKeyPressed(LogicalKeyboardKey.arrowDown)) { int v = _listItemFocusedPosition; v++; if (v >= _options!.length) v = 0; _listItemFocusedPosition = v; _listItemsValueNotifier.value = List.from(_options ?? []); - return true; + //return true; + return KeyEventResult.handled; } else if (event.isKeyPressed(LogicalKeyboardKey.arrowUp)) { int v = _listItemFocusedPosition; v--; if (v < 0) v = _options!.length - 1; _listItemFocusedPosition = v; _listItemsValueNotifier.value = List.from(_options ?? []); - return true; + //return true; + return KeyEventResult.handled; } - return false; + //return false; + return KeyEventResult.ignored; } _search(String str) async {