TextField with animated hint / label

Frank Harper picture Frank Harper · Sep 24, 2018 · Viewed 14.5k times · Source

I want to implement a form containing TextFields. Each field has a label / hint. I want the hint to animate and become a label when the user starts typing. This is a standard Material design pattern, so I expected it to be implemented by the standard Widgets.

Something like this: enter image description here

Answer

Frank Harper picture Frank Harper · Sep 24, 2018

It turns out to be very simple.

InputDecoration has a labelText parameter, which does what I wanted.

E.g.

TextField(decoration: InputDecoration(labelText: 'Full name')),