onSubmitted property
Called when the user indicates that they are done editing the text in the field.
By default, onSubmitted is called after onChanged when the user
has finalized editing; or, if the default behavior has been overridden,
after onEditingComplete
. See onEditingComplete
for details.
Testing
The following is the recommended way to trigger onSubmitted in a test:
await tester.testTextInput.receiveAction(TextInputAction.done);
Sending a LogicalKeyboardKey.enter
via tester.sendKeyEvent
will not
trigger onSubmitted. This is because on a real device, the engine
translates the enter key to a done action, but tester.sendKeyEvent
sends
the key to the framework only.
See also:
- EditableText.onSubmitted for an example of how to handle moving to the next/previous field when using TextInputAction.next and TextInputAction.previous for TextInputAction.
Implementation
final ValueChanged<String>? onSubmitted;