如何更改Flutter App键盘颜色? [英] How to change flutter app keyboard color?

查看:382
本文介绍了如何更改Flutter App键盘颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In my flutter , I create a TextFormField, but it's keyboard color is black in iOS, I want to know how to change it to white.

Flutter语言版本:> = 2.2.2< 3.0.0

flutter language version: >=2.2.2 <3.0.0

这是我有关TextFormField的代码:

this is my code about the 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时

when I click this 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 App键盘颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆