本文介绍了如何在焦点上更改 Flutter TextField 边框颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个带有输入装饰和 Outlineboraderinput
的简单文本字段.当我在该文本字段上键入时,我想更改边框颜色.下面的链接,你可以看到我的工作.我想要的是将蓝色边框更改为白色:
I created a simple text field with input decoration and Outlineboraderinput
. When I type on that text field I want to change the border color. Below link, you can see my work. What I want is change that blue border to white:
TextFormField(
decoration: InputDecoration(
labelText: "Resevior Name",
fillColor: Colors.white,
enabledBorder:OutlineInputBorder(
borderSide: const BorderSide(color: Colors.white, width: 2.0),
borderRadius: BorderRadius.circular(25.0),
),
),
)
推荐答案
添加focusBorder insted of enabledBorder
Add focusBorder insted of enabledBorder
TextFormField(
decoration: InputDecoration(
labelText: "Resevior Name",
fillColor: Colors.white,
focusedBorder:OutlineInputBorder(
borderSide: const BorderSide(color: Colors.white, width: 2.0),
borderRadius: BorderRadius.circular(25.0),
),
),
)
这篇关于如何在焦点上更改 Flutter TextField 边框颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!