-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#13268Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsplatform-webWeb applications specificallyWeb applications specifically
Milestone
Description
On mobile, pressing the enter key while editing a TextField triggers onSubmitted.
On the web, it is never called.
Example:
body: TextField(
onSubmitted: (s) {
// this is never called
debugPrint('onSubmitted s=$s');
},
),In the meantime, there's a workaround with RawKeyboardListener:
body: RawKeyboardListener(
focusNode: focusNode,
onKey: (event) {
if (event is RawKeyUpEvent && event.data is RawKeyEventDataAndroid) {
var data = event.data as RawKeyEventDataAndroid;
if (data.keyCode == 13) {
debugPrint('onSubmitted');
}
}
},
child: TextField(),
),But it would be nice if it was natively handled.
By the way, contrary to #19027 there is absolutely no log when pressing enter. Nothing like inactive InputConnection, etc.
edit:
flutter_web version: commit 1ed4317 (June 22)
Mac OS X 10.14.5 18F132, locale en-KR
tlarsendataguy, matthewtsmith, dbacinski, sclee15, Sacchid and 5 more
Metadata
Metadata
Assignees
Labels
a: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsplatform-webWeb applications specificallyWeb applications specifically