android-studio - Flutter - 如何更改 TextField 边框颜色?
问题描述
我已经尝试了一切来尝试更改文本字段的边框颜色,但它似乎被忽略了。
我尝试过sideBorder(甚至宽度也被忽略),hintStyle,仅将特定主题应用于此小部件,它们似乎都被忽略了。
child: new Theme(
data: ThemeData(
primaryColor: Colors.white,
accentColor: Colors.white,
hintColor: Colors.white //This is Ignored,
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white) //This is Ignored
),
),
),
child: new TextField(
style: TextStyle(color: Colors.white, decorationColor: Colors.white),
cursorColor: Colors.white,
decoration: InputDecoration(
border: new OutlineInputBorder(
//borderRadius: const BorderRadius.all(Radius.circular(30.0)),
borderSide: BorderSide(color: Colors.white, width: 0.0) //This is Ignored,
),
hintText: "Search people",
),
),
//new Divider(color: Colors.white, height: 20),
)
我想改变那条看起来黑色的细线并改变它的颜色和宽度。
解决方案
使用enabledBorder
and focusedBorder
(当文本字段被聚焦时)
InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red, width: 5.0),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.blue, width: 3.0),
),
hintText: "Search people",
),
推荐阅读
- excel - 在 VBA Excel 中引用范围函数内的命名偏移地址
- javascript - 如何从 websocket 动态添加 React 组件
- r - 按 R 中日期差异汇总的分组方式
- batch-file - 批处理 - 查找给定字符串中某个字符的出现
- java - Spring Data JPA - ManyToMany - JPQL - 存储库中的@Query 形成
- javascript - 我在使用 javascript 编辑 css 时遇到问题
- node.js - 错误:EBUSY:资源繁忙或锁定,rmdir
- android - 如何异步调用 HTTP Post API?
- .net - GCP: 403 调用者没有权限
- java - 返回两个数组的排序组合