gpt4 book ai didi

dart - 无法更改 TextField 边框颜色

转载 作者:IT老高 更新时间:2023-10-28 13:48:50 25 4
gpt4 key购买 nike

我正在尝试使用 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com