gpt4 book ai didi

flutter - 如何更改Flutter App键盘颜色?

转载 作者:行者123 更新时间:2023-12-03 15:56:07 27 4
gpt4 key购买 nike

在 flutter 中,我创建了一个TextFormField,但是在iOS中它的键盘颜色是黑色,我想知道如何将其更改为白色。

flutter 语言版本:> = 2.2.2 <3.0.0

这是我关于TextFormField的代码:

TextFormField(
style: TextStyle(
fontSize: 14,
color: Colors.black),
autofocus: false,
initialValue: 'initial value',
maxLines: 1,
// onSaved: (String value) => _person = value,
// obscureText: _isObscure,
validator: (String value) {
if (value.isEmpty) {
return 'nononono';
}
return null;
},
decoration: InputDecoration(
hintText: 'please make sure',
contentPadding: EdgeInsets.fromLTRB(15, 5, 15, 5),
hintStyle: TextStyle(
color: Colors.grey,
fontSize: 12,
),
hasFloatingPlaceholder: false,
// contentPadding: contentPadding,
border: InputBorder.none,
),
),

当我单击此TextFormField时

我得到的是:
黑色键盘

我想要的是:
白色键盘

最佳答案

白色键盘使用Brightness.light
黑色键盘使用Brightness.dark

    body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextField(
keyboardType: TextInputType.text,
keyboardAppearance: Brightness.light, // no matter what you set, it simply shows white keyboard
)
],
),
)

关于flutter - 如何更改Flutter App键盘颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57619369/

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