Spacebar key doesn't work on a TextField only for Flutter Web Production build

Viewed 433

Whenever I try to press "Space" inside a TextField of a Flutter Web release(production) it doesn't do anything. However, the behavior does not replicate on a flutter web debug environment. What I found so far:

  • Flutter Web was supported only by Chrome broswer, but as of now - Chrome, Safari, Edge, Firefox are supported (See Flutter Documentation)
  • The problem does not reproduce on Chrome browser, even in release build.

Update: Works after upgrading to Flutter 2.10

1 Answers

Spacebar won't work if you are using Textfield or TextFormField inside SingleChildScrollView or ListView on Flutter web.

As it will take its default behavior which is to scroll the screen.

To avoid this, set the primary property of your scrollable widget to false.

SingleChildScrollView(
    primary: false,  //<------- this one, by default it is true
    child: TextFormField(...),
    )

Related