这是我正在开发的登录页面的屏幕:
https://ibb.co/X22g4rc https://ibb.co/X22g4rc
当键盘出现时,它表明存在溢出,这似乎是正常的:
https://ibb.co/mzVLJ4f https://ibb.co/mzVLJ4f
经过在网上的一些研究后,我发现我必须使用SingleChildScrollView
小部件,以便当键盘出现时,我能够滚动。据我所见,我必须将其添加到body
脚手架的财产。这就是我所做的,并且它有效:我能够滚动并且不再出现溢出错误消息。
但是:如您所见,显示已被剪切:
https://ibb.co/rHJYqQV https://ibb.co/rHJYqQV
有人知道它来自哪里吗?
这是我的代码
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 网站示例所示,但它对我没有帮助:/