简体   繁体   English

Flutter TextFormField 指针与文本重叠

[英]Flutter TextFormField pointer overlapping the text

When using TextFormField in Flutter and having the form prefilled with text, when I tap somewhere on it in order to start editing the text, I get the little rain drop pointer right over the text:在 Flutter 中使用TextFormField并预填充文本的表单时,当我点击它的某处以开始编辑文本时,我会在文本上方看到一个小雨滴指针:

在此处输入图片说明

I expect it to appear a little bit below the form.我希望它出现在表单下方。 Something like this:像这样的东西:

在此处输入图片说明

Here is the code:这是代码:

                  Container(
                    height: 40.0,
                    child: TextFormField(
                      style: TextStyle(
                        fontSize: 17,
                      ),
                      controller: serverAddressController,
                      decoration: InputDecoration(
                        border: OutlineInputBorder(
                          borderRadius: new BorderRadius.circular(10.0),
                        ),
                      ),
                      onChanged: (value) {
                        serverAddress = value;
                        changesSaved = false;
                      },
                      textInputAction: TextInputAction.next,
                      onFieldSubmitted: (_) {
                        FocusScope.of(context)
                            .requestFocus(daysBackFocusNode);
                      },
                    ),
                  ),

How do I do it?我该怎么做?

you've set Container height to low but didn't reduce content paddings just add contentPadding property您已将容器高度设置为低但没有减少内容填充只是添加contentPadding属性

decoration: InputDecoration(
  contentPadding: EdgeInsets.only(left: 16, right: 16),
  border: OutlineInputBorder(
    borderRadius: BorderRadius.circular(16.0),
  ),
),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM