Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/content/learn/tutorial/user-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ And after the user enters a guess, the focus should stay
in the `TextField` so they can enter their next guess.

To resolve the first focus issue,
set up the `autoFocus` property on the `TextField`.
set up the `autofocus` property on the `TextField`.

```dart
class GuessInput extends StatelessWidget {
Expand All @@ -344,7 +344,7 @@ class GuessInput extends StatelessWidget {
),
),
controller: _textEditingController,
autoFocus: true, // NEW
autofocus: true, // NEW
onSubmitted: (String input) {
print(input); // Temporary
_textEditingController.clear();
Expand Down Expand Up @@ -411,7 +411,7 @@ class GuessInput extends StatelessWidget {
),
),
controller: _textEditingController,
autoFocus: true,
autofocus: true,
focusNode: _focusNode, // NEW
onSubmitted: (String input) {
print(input); // Temporary
Expand Down Expand Up @@ -465,7 +465,7 @@ class GuessInput extends StatelessWidget {
),
),
controller: _textEditingController,
autoFocus: true,
autofocus: true,
focusNode: _focusNode,
onSubmitted: (String input) {
onSubmitGuess(_textEditingController.text.trim());
Expand Down Expand Up @@ -730,9 +730,9 @@ items:
- text: "Call `TextField.focus()` directly."
correct: false
explanation: TextField doesn't have a focus method; you use a FocusNode.
- text: "Set the `autoFocus` property to true at runtime."
- text: "Set the `autofocus` property to true at runtime."
correct: false
explanation: autoFocus only works on initial build, not for moving focus later.
explanation: The 'autofocus' property only works on initial build, not for moving focus later.
- text: "Use a FocusNode and call `requestFocus()` on it."
correct: true
explanation: "A FocusNode gives you control over focus, and calling `requestFocus()` moves focus to its associated widget."
Expand Down
Loading