【问题标题】:To change the UnderlineInputBorder properties in flutter在颤振中更改 UnderlineInputBorder 属性
【发布时间】:2019-08-24 14:19:50
【问题描述】:

我有一个TextField(),我想更改 Underlineinput border color 和它的 thickness,因为它看起来像厚度。我已经尝试过我的水平来改变它,但它根本不起作用。

我已经关注了这些链接,但对我没有任何帮助:

到目前为止尝试过的是:

代码:

decoration: InputDeocration(
   border: UnderlineInputBorder(
     borderSide: new BorderSide(
        color: Color.fromRGBO(173, 179, 191, 1),
        width: 0.5,
        style: BorderStyle.none
     )
   )
)

这里唯一起作用或改变颜色的是focussedBorderenabledBorder。我不想要这个,所以我期待在这里得到一些好的建议。

它不会改变任何东西。 我想要的是:

到目前为止,无论我对设计所做的更改如何,我都得到了这样的结果:

【问题讨论】:

    标签: flutter uitextfield


    【解决方案1】:

    您可以更改 Underlineinput border colorthickness 使用 enabledBorderfocusedBorder 属性。

    TextField(
     decoration: InputDecoration(
        enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.red,width: 2.0)),
        focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.teal,width: 5.0)),
        labelText: 'Your Email or Phone'
      )
    )
    

    【讨论】:

    • enabledBorder 发挥了作用。我知道它,但没有尝试。男人!
    猜你喜欢
    • 1970-01-01
    • 2021-04-20
    • 2019-01-03
    • 2021-11-24
    • 1970-01-01
    • 2023-03-06
    • 2022-11-15
    • 2019-02-19
    • 1970-01-01
    相关资源
    最近更新 更多