如何在flutter中移动文本字段中的标签?

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

嗨,我有一个用于内容的文本字段。所以它应该有更大的空间。

但我的问题是我在此文本字段中使用的标签文本。位于中心。我一点也不喜欢它。

我想在盒子的开头:(

像这样:

enter image description here

这也是我的代码:

 TextField(
              maxLines: 10,
              controller: _content,
              decoration: const InputDecoration(
                floatingLabelAlignment: FloatingLabelAlignment.start,
                labelText: 'Content',
                border: OutlineInputBorder(
                    borderRadius: BorderRadius.all(Radius.circular(15))),
              ),
android flutter dart text textfield
1个回答
0
投票

您只需将

alignLabelWithHint
设置为
true
enter image description here

TextField(
              maxLines: 10,
             
              decoration: const InputDecoration(
                floatingLabelAlignment: FloatingLabelAlignment.start,
                alignLabelWithHint: true,
                labelText: 'Content',
                border: OutlineInputBorder(
                    borderRadius: BorderRadius.all(Radius.circular(15))),
              ),)

了解更多信息这里

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