Flutter如何在单击TextField时始终隐藏键盘,但保持焦点(保持显示光标) [英] Flutter How to alway hide keyboard when click on TextField but keep focus(Keep show cursor)

查看:1824
本文介绍了Flutter如何在单击TextField时始终隐藏键盘,但保持焦点(保持显示光标)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法控制键盘的显示或隐藏,在我的项目中,我需要始终隐藏键盘,但要始终专注于显示我的自定义键盘(小部件).

I can't control keyboard show or hide, In my project I need to always hide keyboard but keep focused to display my custom keyboard(a widget).

这是我想要的

这是我的问题

推荐答案

要隐藏键盘并保持光标可见,请将readOnly设置为true,将showCursor设置为true.

To hide keyboard and keep the cursor visible, set readOnly to true and showCursor to true.

TextFormField(
  showCursor: true,
  readOnly: true),

请参见 flutter/issues/#16863

这篇关于Flutter如何在单击TextField时始终隐藏键盘,但保持焦点(保持显示光标)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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