フォーカス、キーボード、入力 UX
フォーカス、キーボードの種類、入力アクション、アクセシビリティを管理し、Flutter のフォームで快適な入力体験を実現します。
「フォーカス、キーボード、入力 UX」はCoddyKit上の無料Flutter Mobile Developmentレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはFlutter Mobile Development学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Flutter Mobile Developmentコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Why Input UX Matters
A working form is not enough — users expect the keyboard, focus order and actions to feel effortless. This lesson covers the polish that makes forms delightful.
FocusNode Basics
A FocusNode represents the focus state of a field. Create one per field you want to control.
final emailFocus = FocusNode();
final passwordFocus = FocusNode();Attaching Focus
Pass the node to a TextField via the focusNode property.
TextField(
focusNode: emailFocus,
decoration: const InputDecoration(labelText: 'Email'),
);Moving Focus Programmatically
Request focus on the next field when the user submits the current one.
TextField(
focusNode: emailFocus,
onSubmitted: (_) => FocusScope.of(context).requestFocus(passwordFocus),
);Keyboard Types
Pick the right keyboardType so the keyboard matches the field.
TextInputType.emailAddressTextInputType.numberTextInputType.phone
TextField(
keyboardType: TextInputType.emailAddress,
);Input Actions
The textInputAction controls the keyboard's action button — Next, Done, Search and more.
TextField(
textInputAction: TextInputAction.next,
);Obscuring & Toggling Passwords
Use obscureText for passwords, and a suffix icon to toggle visibility.
TextField(
obscureText: hidden,
decoration: InputDecoration(
suffixIcon: IconButton(
icon: Icon(hidden ? Icons.visibility : Icons.visibility_off),
onPressed: () => setState(() => hidden = !hidden),
),
),
);Input Formatters
inputFormatters restrict or transform input — for example digits only.
TextField(
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
);Dismissing the Keyboard
Unfocus to dismiss the keyboard when the user taps elsewhere.
GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: const FormBody(),
);Avoiding the Keyboard Overlap
Wrap your form in a scrollable so fields are not hidden behind the keyboard. A SingleChildScrollView handles this automatically.
SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(children: fields),
);Disposing Focus Nodes
FocusNodes are resources — dispose them to avoid leaks.
@override
void dispose() {
emailFocus.dispose();
passwordFocus.dispose();
super.dispose();
}Quick Check
Which property sets the keyboard's bottom-right button to say Next?
Recap
You polished input UX:
- FocusNode and moving focus on submit
- keyboardType and textInputAction
- Password toggles and input formatters
- Dismissing the keyboard and avoiding overlap
These details turn a functional form into a great one.
よくある質問
「フォーカス、キーボード、入力 UX」レッスンは無料ですか?
はい。「フォーカス、キーボード、入力 UX」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Flutter Mobile Developmentコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Flutter Mobile Developmentコースには全4レッスンが含まれています。
「フォーカス、キーボード、入力 UX」で何を学びますか?
フォーカス、キーボードの種類、入力アクション、アクセシビリティを管理し、Flutter のフォームで快適な入力体験を実現します。 ブラウザで直接実行するハンズオンコードでFlutter Mobile Developmentを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Flutter Mobile Developmentを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのFlutter Mobile Developmentは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「フォーカス、キーボード、入力 UX」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このFlutter Mobile Developmentレッスンでコードを書いて実行できますか?
はい。すべてのFlutter Mobile Developmentレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- Formウィジェットとコントローラー
- 入力値の検証技法
- カスタムフォームフィールド
- フォーカス、キーボード、入力 UX