我正在尝试使用 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: ...
),
)
https://stackoverflow.com/questions/50122394/
相关文章:
dart - Flutter - 如何在 AppBar 不存在时设置状态栏颜色
flutter - 检查 Flutter 应用上是否有可用的 Internet 连接
dart - 如何在 Flutter 中设置主屏幕的背景颜色?
flutter - 另一个异常被抛出 : type 'MyApp' is not a subtype
dart - Flutter:如何解决错误导入包:http/http.dart
dart - 在没有动画的情况下替换 MaterialApp 中的初始路由?
flutter - 如何在 Flutter Widget(Center Widget)的子属性中使用