3

I am building an application on flutter web and have recently added a textfield to my program. A new update recently added support for scrolling with the spacebar. Is there any way to disable or intercept the spacebar to scroll feature recently implemented? The spacebar to scroll feature can be reproduced on any scrollable list on the dev channel (for example listview)

Body(child:ListView(children:[TextField(),Container(height:10000,width:100)]))
2
  • can you please add a short reproducible code, please? Because I couldn’t able to replicate it. Commented Jan 18, 2021 at 12:07
  • @imgkl sorry! Edited the post to add the code Commented Jan 18, 2021 at 13:53

1 Answer 1

6

Override application shortcuts to revert to previous behavior:

  Widget build(BuildContext context) {
    final shortcuts = WidgetsApp.defaultShortcuts;
    shortcuts[LogicalKeySet(LogicalKeyboardKey.space)] = ActivateIntent();
    return MaterialApp(
      shortcuts: shortcuts,
      // ...
    );
  }

Sign up to request clarification or add additional context in comments.

1 Comment

after 1 hour of searching.. you saved my life here, thanks a lot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.