Flutter TextField hintText align

问题描述 投票:0回答:1

如何将hintText与TextField中的顶部对齐?

文本域 (

    decoration: InputDecoration(
        hintText: 'align me to the top',
        ),
  ),

1)textAlign根本不影响hintText。 2)TextStyle没有Align属性,因为可以使用hintStyle。

flutter textfield
1个回答
1
投票

如果不这样做,你可能需要更新你想要的图像,但我认为它可能就像使用labelText而不是hintText一样简单。

这是您可以添加的各种文本的位置:

Label, hint, and helper for InputDecoration

这是没有提示时标签看起来的样子,未选择输入,并且没有文字:

Label not selected

这就是Label在有文字或被选中时的样子。

Label text example

© www.soinside.com 2019 - 2024. All rights reserved.