Flutter: Position the textfield labelText

Viewed 118

For the Flutter TextField LabelText, the default focused behaviour is as follow:

enter image description here

...where the LabelText ("Email") is in the top border.

I am trying to reposition the labelText as below when focused:

enter image description here

...where the labelText is below the border.

I know that a separate border can be made ontop of the textField, but then there is a bit more work involved to adopt the border behaviour based on the textField (ie. error, focused, disabled etc), and might cause more headache down the road.

Is there a way of moving the labelText position within the TextField properties?

1 Answers

You can do this manually. Wrap TextField and GestureDetector->Container->Column->Text() * 2 into Stack widget . in short, Stack has two widgets, TextField and GestureDector. GestureDector has Contianer , Container has Column and Column as your desired Text widgets.

Related