简体   繁体   English

打开键盘时如何固定小部件布局?

[英]How to immobilize widget layout when keyboard is open?

I am developing a Flutter App. 我正在开发Flutter应用。 In a specific screen, I have a Cupertino style text field. 在特定的屏幕上,我有一个Cupertino样式的文本字段。 (The whole app is Cupertino, I have four TabBars below the screen). (整个应用程序是Cupertino,我在屏幕下方有四个TabBar)。 Whenever I click on the textfield, the virtual keyboard opens and all the widgets squeeze between the textfield and the keyboard (with yellow-black bands of course). 每当我单击文本字段时,虚拟键盘就会打开,并且所有小部件都会在文本字段和键盘之间挤压(当然会有黄黑带)。

The widgets are Expandable rows and columns (Flexible also has the same result). 这些小部件是可扩展的行和列(Flexible也具有相同的结果)。

resizeToAvoidBottomPadding is disabled. resizeToAvoidBottomPadding已禁用。 resizeToAvoidBottomInset does not have any functionality. resizeToAvoidBottomInset没有任何功能。 SingleChildScrollView does not work. SingleChildScrollView不起作用。 ListView is meaningless, since my widgets are stateless and static. ListView是没有意义的,因为我的小部件是无状态且静态的。

What I need is to have keyboard open on top of the current widgets, instead of moving them. 我需要的是在当前小部件上打开键盘,而不是移动它们。 This problem exists both in iOS and Android. 此问题在iOS和Android中均存在。

After couple of weeks, I finally reached the solution. 几周后,我终于找到了解决方案。 Despite indicating 'resizeToAvoidBottomInset' as not working above, I was using that in one of the folders of tabs. 尽管上面指出“ resizeToAvoidBottomInset”无法正常工作,但我还是在选项卡的其中一个文件夹中使用了它。 However this should be added where you build the tabs. 但是,应在构建选项卡的位置将其添加。

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

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