gpt4 book ai didi

android-studio - Flutter - 如何更改 TextField 边框颜色?

转载 作者:IT王子 更新时间:2023-10-29 07:17:07 25 4
gpt4 key购买 nike

我已经尝试了所有方法来尝试更改文本字段的边框颜色,但它似乎被忽略了。

我试过 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),

)

我想更改看起来很细的黑色边框并更改其颜色和宽度。

Image of what it currently is

最佳答案

使用 enabledBorderfocusedBorder(当文本框获得焦点时)

InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red, width: 5.0),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.blue, width: 3.0),
),
hintText: "Search people",
),

关于android-studio - Flutter - 如何更改 TextField 边框颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57031719/

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