下面是我正在开发的登录页面的屏幕:
当键盘出现时,它提示我有溢出,这似乎是正常的:
在对网络进行了一些研究之后,我发现我不得不使用SingleChildScrollView小工具,这样当键盘出现时,我就可以滚动了。根据我所看到的,我必须将其添加到Scaffold的body属性中。这就是我所做的,并且它起作用了:我能够滚动,不再有溢出错误消息。
但是:正如你所看到的,显示器已经被削减了:
有人知道这是从哪里来的吗?
这是我的代码
return Scaffold(
body:
SingleChildScrollView(child:
Container(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
SizedBox(
height: 150,
),
Container(
padding: EdgeInsets.only(left: 20.0, right: 20.0),
child: Column(
children: <Widget>[
tabBarContainer,
SizedBox(
height: 20.0,
),
AnimatedContainer(
duration: Duration(seconds: 1),
padding: EdgeInsets.only(top: 40.0, left: 40.0, right: 40.0),
width: double.infinity,
height: _containerHeight,
decoration: cardDecoration,
child: TabBarView(
children: <Widget>[
LoginForm(),
RegisterForm(),
],
)
),
],
),
)
],
),
)
)
)
);编辑:我也尝试添加了ConstrainedBox,如api flutter网站的示例所示,但它对我没有帮助:/
发布于 2019-06-19 18:26:13
使用展开的SingleChildScrollView包装该列,并将其自身包装在列中。
Column(
children:<Widget>[
Expanded(
child:SingleChildScrollView(...)
)
]
)https://stackoverflow.com/questions/56664708
复制相似问题