I have a TextField like this:
I want the hint and the text to be aligned at the top, not in the center.
I tried textAlign: TextAlign.start
but that is just for the horizontal alignment.
TextField(
textAlign: TextAlign.start,
expands: true,
maxLines: null,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(3),
),
hintText: 'Enter Unicode text'),
),
How to I make the text go to the top?
I found the answer so I am adding this as a self-answer Q&A.
To align the text inside of a TextField to the top, use
textAlignVertical: TextAlignVertical.top
This will give you what you want:
TextField(
textAlignVertical: TextAlignVertical.top,
expands: true,
maxLines: null,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(3),
),
hintText: 'Enter Unicode text'),
)