我正在尝试使用 BorderSide
更改我的 TextField
边框的颜色,但它不起作用。
这是我下面的代码。
new TextField(
decoration: new InputDecoration(
border: new OutlineInputBorder(
borderSide: new BorderSide(color: Colors.teal)
),
hintText: 'Tell us about yourself',
helperText: 'Keep it short, this is just a demo.',
labelText: 'Life story',
prefixIcon: const Icon(Icons.person, color: Colors.green,),
prefixText: ' ',
suffixText: 'USD',
suffixStyle: const TextStyle(color: Colors.green)),
)
)
结果截图如下。
最佳答案
这样做的新方法是像这样使用 enabledBorder
:
new TextField(
decoration: new InputDecoration(
enabledBorder: const OutlineInputBorder(
borderSide: const BorderSide(color: Colors.grey, width: 0.0),
),
focusedBorder: ...
border: ...
),
)
关于dart - 无法更改 TextField 边框颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50122394/