gpt4 book ai didi

dart - 如何在 Flutter 中更改 TextFormField 输入文本颜色

转载 作者:IT老高 更新时间:2023-10-28 12:35:01 25 4
gpt4 key购买 nike

在 uni 为 Flutter 应用程序做 UI,我只希望在 TextFormField 中输入的文本是白色的。这似乎是不必要的困难。我试过谷歌搜索等,但看不到明显的答案。

  new Theme(
// this colors the underline
data: theme.copyWith(
primaryColor: Colors.white,
hintColor: Colors.transparent,

),
child: new Padding(
padding: const EdgeInsets.fromLTRB(32.0, 40.0, 32.0, 4.0),
child: TextFormField(

key: Key('username'),
keyboardType: TextInputType.text,
controller: usernameController,
decoration: InputDecoration(

fillColor: Colors.black.withOpacity(0.6),
filled: true,
border: new OutlineInputBorder(

borderRadius: const BorderRadius.all(

const Radius.circular(8.0),
),
borderSide: new BorderSide(
color: Colors.transparent,
width: 1.0,
),
),
labelText: 'Username',
labelStyle:
new TextStyle(color: Colors.white, fontSize: 16.0)),
style:
TextStyle(fontSize: 20.0, color: textTheme.button.color),
validator: validateUserName,
onSaved: (val) => this.loginFields._username = val),
),
),

最佳答案

这样就可以了:

TextFormField(
style: TextStyle(color: Colors.white),
)

关于dart - 如何在 Flutter 中更改 TextFormField 输入文本颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52603494/

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