flutter - 颤振布局错误“底部的无限像素溢出的 RenderFlex”
问题描述
我有脚手架和
MaterialApp(
home: Scaffold(
body: Stact(
....
....
return Column(
children: <Widget>[
Align(
alignment: Alignment.topCenter,
child: Padding(
padding: EdgeInsets.fromLTRB(0.0, 60.0, 0.0, 0.0),
child: Image(
image: AssetImage('assets/images/logo.png'),
),
),
),
authController.signIn() == true ? SignInView() : SignUpView(),
Align(
alignment: Alignment.center,
child: Padding(
padding: const EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 35.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RaisedButton(
child: Text('Sign In',
style: TextStyle(
color: Colors.white,
)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(15.0),
topLeft: Radius.circular(15.0),
),
side: BorderSide(color: Colors.orange)),
color: Colors.transparent,
onPressed: () {
print('login');
authController.toSignIn(true);
},
),
RaisedButton(
child: Text('Sign Up',
style: TextStyle(
color: Colors.white,
)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(15.0),
topRight: Radius.circular(15.0),
),
side: BorderSide(color: Colors.orange)),
color: Colors.transparent,
onPressed: () {
print('signup');
authController.toSignIn(false);
},
),
],
),
),
)
],
);
SignInView() 与
return Scaffold(
backgroundColor: Colors.transparent,
body: Container(
height: 100.0,
child: Column(
children: <Widget>[
Text('hey'),
],
),
),
);
只要我在 中添加 SignInView 和 SignOutView Column Children
,我就会收到这个A RenderFlex overflowed by Infinity pixels on the bottom
。
我试图将 Scaffold 更改为其他东西,Container 甚至使用 Padding 小部件。如何将 Scaffold 高度设置为其父级高度 100%,如 CSS 高度 100vh 或 Flutter 中的其他内容?
解决方案
你不应该在另一个 Scaffold 中使用 Scaffold。从 SignInView() 中移除脚手架并将其保留为 Container
return Container(
height: 100.0,
child: Column(
children: <Widget>[
Text('hey'),
],
),
),
请让我知道这是否有帮助。干杯
推荐阅读
- python - Python Boto3 分页错误:“PageIterator”对象不可下标
- javascript - 用于绘图的 React UseEffect
- javascript - Brython:拒绝加载脚本....违反以下内容安全策略指令:“script-src 'self'
- swift - 使用 WebView 以 100% 的比例打开网站
- python - 使用python循环遍历列表以在csv文件中写入新行的问题
- r - 'list' 对象不能被强制输入'integer' -- WRS2 包
- single-sign-on - 如何使用 IdentityServer 在 Web 应用程序和本机应用程序之间实现 SSO?
- sql - 大更新后,单个 PostgreSQL 表的查找突然变得非常慢
- datetime - Ms-Access 将日期时间转换为自纪元以来的秒数
- typescript - 有没有在 TypeScrip 中编写 firebase-messaging-sw.js 文件的好方法?