【问题标题】:How to change the color of the bottom border in text form Field Flutter [duplicate]如何更改文本表单Field Flutter中底部边框的颜色[重复]
【发布时间】:2021-05-13 17:35:31
【问题描述】:
 TextFormField(
                decoration: InputDecoration(
                  hintText: "Name",
                  hintStyle: TextStyle(color: Colors.white),
                  border: OutlineInputBorder(
                    borderSide: BorderSide(color: Colors.teal)
                  ),
                ),
              ),

这使得整个文本字段我不想要,只有底部

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    尝试使用此代码:

    TextFormField(
                decoration: InputDecoration(
              hintText: "Name",
              hintStyle: TextStyle(color: Colors.white),
              enabledBorder: UnderlineInputBorder(
                borderSide: BorderSide(color: Colors.teal),
              ),
              focusedBorder: UnderlineInputBorder(
                borderSide: BorderSide(color: Colors.teal),
              ),
              border: UnderlineInputBorder(
                borderSide: BorderSide(color: Colors.teal),
              ),
            )),
    

    【讨论】:

      【解决方案2】:
      TextFormField(
        decoration: InputDecoration(
          hintText: "Name",
          hintStyle: TextStyle(color: Colors.white),
          //When the TextFormField is NOT on focus
          enabledBorder: UnderlineInputBorder(
            borderSide: BorderSide(color: Colors.black),
          ),
          //When the TextFormField is ON focus
          focusedBorder: UnderlineInputBorder(
            borderSide: BorderSide(color: Colors.teal),
          ),
        ),
      )
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-11-19
        • 2012-08-08
        • 2017-06-03
        • 2018-12-08
        • 2019-11-23
        • 1970-01-01
        • 1970-01-01
        • 2019-12-26
        相关资源
        最近更新 更多