【问题标题】:change label color textFormField on focus when floating Label Behavior is auto in the flutter当浮动标签行为在颤动中自动时,更改标签颜色 textFormField 焦点
【发布时间】:2021-12-30 10:58:09
【问题描述】:

当浮动标签行为在颤动中自动时,更改标签颜色 TextFormField 焦点

image that focus node is off

image that focus node is on

我想在flutter中解决这个问题

【问题讨论】:

  • 您想在聚焦时更改标签颜色?

标签: flutter flutter-layout flutter-animation flutter-textformfield


【解决方案1】:

试试下面的代码希望对你有帮助。

参考文本字段here

参考 InputDecoration here

Container(
    padding: const EdgeInsets.all(8.0),
    child: TextField(
      decoration: InputDecoration(
        border: OutlineInputBorder(),
       // hintText: 'Enter Name here',
        labelText: 'First Name',
      ),
    ),
  ),

您的结果屏幕->

【讨论】:

  • 这不是我的回答,感谢您的回答
  • 你到底想要什么?
  • floatingLabelBehavior: FloatingLabelBehavior.auto 我无法通过更改焦点节点来更改标签颜色
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-02-08
  • 2018-12-01
  • 1970-01-01
  • 2021-12-02
  • 1970-01-01
  • 2015-08-13
相关资源
最近更新 更多