Change TextField's Underline in Flutter

后端 未结 4 538
长情又很酷
长情又很酷 2020-12-09 02:54

I\'m working on an application using Flutter SDK. When I use a TextField widget, and I focus it, the underline becomes blue. I need to change this color to red, how can I do

4条回答
  •  爱一瞬间的悲伤
    2020-12-09 03:30

    I haven't tried it yet, but I had a look at the docs for you.

    Looking at the TextField class you can set an InputDecoration, which in turn has an InputBorder. Setting that to an UnderlineInputBorder with your own BorderSide should do the trick I guess. You can set the color of the BorderSide.

    You can also set an InputBorder in the global InputDecorationTheme if you want all textfields to have the same style.

提交回复
热议问题