Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter web- disable spacebar to scroll?

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)]))
like image 495
Provendor Avatar asked Nov 23 '25 21:11

Provendor


1 Answers

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,
      // ...
    );
  }

like image 78
Spatz Avatar answered Nov 27 '25 01:11

Spatz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!