[英]Soft Keyboard covers TextInput on the SlidingUpPanel flutter
This is the package am using, when I use a TextInput within the panelBuilder
it has both the ListView and the InputTextField, however when I start typing the Soft keyboard covers the InputText field.这是正在使用的package ,当我在
panelBuilder
中使用 TextInput 时,它同时具有 ListView 和 InputTextField,但是当我开始键入软键盘时,会覆盖 InputText 字段。
I also tried to add this line:我也尝试添加这一行:
resizeToAvoidBottomInset: false,
in the Scaffold
plus this one in the Manfiest file resizeToAvoidBottomInset: false,
在Scaffold
加上 Manfiest 文件中的这个
<item name="android:windowFullscreen">true</item>
. <item name="android:windowFullscreen">true</item>
。
But no luck.但没有运气。
Below are the screenshots:以下是截图:
Wrap the contents of your panelBuilder
result in a Scaffold
and don't change resizeToAvoidBottomInset
.将
panelBuilder
的内容包装在Scaffold
中,并且不要更改resizeToAvoidBottomInset
。 By default the resize is true
which will move the content up to avoid being hidden by keyboard when it appears.默认情况下,resize 为
true
,这将向上移动内容以避免在出现时被键盘隐藏。 A false
setting prevents the resize from happening. false
设置可防止发生调整大小。
The below example is from the slide_up_panel package example , with the panelBuilder
argument result wrapped in a Scaffold
.下面的示例来自slide_up_panel package 示例,其中
panelBuilder
参数结果包装在Scaffold
中。 (I'm not suggesting you wrap _panel
like I've done below, it's just easier to show the example working this way. Likely better to use Scaffold within the _panel
function itself.) (我不建议您像我在下面所做的那样包装
_panel
,只是更容易显示以这种方式工作的示例。在_panel
function 本身中使用 Scaffold 可能会更好。)
@override
Widget build(BuildContext context){
_panelHeightOpen = MediaQuery.of(context).size.height * .80;
return Material(
child: Stack(
alignment: Alignment.topCenter,
children: <Widget>[
SlidingUpPanel(
maxHeight: _panelHeightOpen,
minHeight: _panelHeightClosed,
parallaxEnabled: true,
parallaxOffset: .5,
body: _body(),
// WRAP panel contents in Scaffold
panelBuilder: (sc) => Scaffold(body: _panel(sc)),
// ↑↑↑↑↑↑↑↑
borderRadius: BorderRadius.only(topLeft: Radius.circular(18.0), topRight: Radius.circular(18.0)),
onPanelSlide: (double pos) => setState((){
_fabHeight = pos * (_panelHeightOpen - _panelHeightClosed) + _initFabHeight;
}),
),
To test yourself add a TextFormField to the bottom of the Widget _panel(ScrollController sc)
method (around line 242)为了测试自己,将 TextFormField 添加到
Widget _panel(ScrollController sc)
方法的底部(大约第 242 行)
SizedBox(height: 24,),
// ↓ Added for testing
TextFormField(
initialValue: 'type here',
onSaved: (txt) => null,
)
Then run the example, scroll the panel upwards and tap the TextField to have the keyboard slide up.然后运行示例,向上滚动面板并点击 TextField 以使键盘向上滑动。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.