LabelTextfieldWidget in Flutter
1 min readJul 17, 2019
Basically, the top text will show hint text if user input otherwise it shows nothing.
Getting Started
Our final code will be:
Direction
- Imagine parameters you want your users to control it.
- Create
Stack
layout with 2 widgets:Text
andTextField
. - Listen to events such as
onTap
onChanged
onEditingComplete
andfocusNode
in order to update the top message.
Let’s code
1. Parameters:
2. Create UI:
isShowHintText
is used to refresh UI
3. Listen to events:
- Add
FocusNode
andTextEditingController
toTextField
- Implement events:
- Final code: