I have a TextField
like this, where the input text and the hint text are sized differently.
TextField(
style: Theme.of(context).textTheme.subhead.copyWith(
fontSize: 70.0,
),
decoration: InputDecoration(
hintText: 'Enter a number',
hideDivider: true,
hintStyle: TextStyle(
color: Colors.grey[500],
fontSize: 25.0,
),
),
);
While the user input text is centered in my parent container, the hintText is not (top has more space than the bottom). Is there a way to vertically center the hint text as well?
The reason the hint text is not the same size as the input text is that it takes up more space than the green Container has, so it looks like Enter a nu...
, which isn't very user friendly. (So alternatively, is there a way to have a newline in the hintText?)
I see this is over 2 years old but in case others run into this problem:
InputDecoration has the property contentPadding.
TextField(
decoration: InputDecoration(
hintText: 'Hint Text',
contentPadding: EdgeInsets.all(10.0),
),
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With