使用FloatingLabelBehavior.neverinsideInputDecoration将帮助您隐藏标签,而不是labelText您可以使用它hintText,这样当您键入内容时标签就会消失。
TextFormField(
decoration: InputDecoration(
hintText: "Search",
floatingLabelBehavior: FloatingLabelBehavior.never,
border: InputBorder.none,
suffixIcon: Icon(
Icons.search,
),
),
),
Run Code Online (Sandbox Code Playgroud)
试试这个
TextFormField(
cursorColor: Colors.black,
keyboardType: TextInputType.text,
decoration: new InputDecoration(
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 15, bottom: 11, top: 11, right: 15),
hintText: "Hints"),
)
And customize textfield decoration as you desired.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3275 次 |
| 最近记录: |