fix input

This commit is contained in:
nyne
2024-10-02 16:26:15 +08:00
parent b1e7adb1c5
commit c8d4b3db88
2 changed files with 2 additions and 6 deletions

View File

@@ -40,7 +40,7 @@ class KeyEventListenerState extends State<KeyEventListener> {
focusNode: focusNode, focusNode: focusNode,
autofocus: true, autofocus: true,
onKeyEvent: (node, event) { onKeyEvent: (node, event) {
if (event is! KeyUpEvent) return KeyEventResult.handled; if (event is! KeyUpEvent) return KeyEventResult.ignored;
if (event.logicalKey == LogicalKeyboardKey.escape) { if (event.logicalKey == LogicalKeyboardKey.escape) {
if (App.rootNavigatorKey.currentState?.canPop() ?? false) { if (App.rootNavigatorKey.currentState?.canPop() ?? false) {
App.rootNavigatorKey.currentState?.pop(); App.rootNavigatorKey.currentState?.pop();
@@ -52,7 +52,7 @@ class KeyEventListenerState extends State<KeyEventListener> {
for (var handler in _handlers) { for (var handler in _handlers) {
handler(event.logicalKey); handler(event.logicalKey);
} }
return KeyEventResult.handled; return KeyEventResult.ignored;
}, },
child: widget.child, child: widget.child,
); );

View File

@@ -33,8 +33,6 @@ class _SearchPageState extends State<SearchPage> {
int searchType = 0; int searchType = 0;
final focusNode = FocusNode();
static const searchTypes = [ static const searchTypes = [
"Search artwork", "Search artwork",
"Search novel", "Search novel",
@@ -102,8 +100,6 @@ class _SearchPageState extends State<SearchPage> {
children: [ children: [
Expanded( Expanded(
child: TextBox( child: TextBox(
focusNode: focusNode,
autofocus: false,
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const EdgeInsets.symmetric(horizontal: 12),
placeholder: placeholder:
'${searchTypes[searchType].tl} / ${"Open link".tl}', '${searchTypes[searchType].tl} / ${"Open link".tl}',