博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Flutter底部溢出
阅读量:4092 次
发布时间:2019-05-25

本文共 2599 字,大约阅读时间需要 8 分钟。

最近在学习Flutter开发,真的是一路踩坑过来的。这里记录自己的踩坑之路,以备以后再遇到此类问题,同时希望能够帮助到其他正在学习的童鞋们。

这次的异常是手机屏幕底部有黄线,并且提示“A RenderFlex overflowed by 3.8 pixels on the bottom.”。
IDE用的是VS code,具体异常如下:

I/flutter (19319): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════I/flutter (19319): The following message was thrown during layout:I/flutter (19319): A RenderFlex overflowed by 3.8 pixels on the bottom.I/flutter (19319):I/flutter (19319): The overflowing RenderFlex has an orientation of Axis.vertical.I/flutter (19319): The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow andI/flutter (19319): black striped pattern. This is usually caused by the contents being too big for the RenderFlex.I/flutter (19319): Consider applying a flex factor (e.g. using an Expanded widget) to force the children of theI/flutter (19319): RenderFlex to fit within the available space instead of being sized to their natural size.I/flutter (19319): This is considered an error condition because it indicates that there is content that cannot beI/flutter (19319): seen. If the content is legitimately bigger than the available space, consider clipping it with aI/flutter (19319): ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,I/flutter (19319): like a ListView.I/flutter (19319): The specific RenderFlex in question is:I/flutter (19319):   RenderFlex#5e2be relayoutBoundary=up18 OVERFLOWINGI/flutter (19319):   creator: Column ← ConstrainedBox ← Padding ← Container ← Recommend ← Column ← _SingleChildViewportI/flutter (19319):   ← IgnorePointer-[GlobalKey#05573] ← Semantics ← Listener ← _GestureSemantics ←I/flutter (19319):   RawGestureDetector-[LabeledGlobalKey
#6ee6a] ← ⋯I/flutter (19319): parentData:
(can use size)I/flutter (19319): constraints: BoxConstraints(0.0<=w<=392.7, h=198.9)I/flutter (19319): size: Size(392.7, 198.9)I/flutter (19319): direction: verticalI/flutter (19319): mainAxisAlignment: startI/flutter (19319): mainAxisSize: maxI/flutter (19319): crossAxisAlignment: centerI/flutter (19319): verticalDirection: downI/flutter (19319): ◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤I/flutter (19319): ════════════════════════════════════════════════════════════════════════════════════════════════════

我从网上看了一下别人的方法,说是放到SingleChildScrollView()组件中,然后做了相应的修改,修改后的具体代码如下:

在外层添加SingleChildScrollView

但是错误依然没有解决,后来发现是padding的问题:
padding里的参数问题
修改padding: EdgeInsets.fromLTRB(10.0,2.0,0,5.0)里的最后一个参数为(4.0),如上图所示,问题成功解决。黄色底边消失,达到预期显示效果。

转载地址:http://rncii.baihongyu.com/

你可能感兴趣的文章
Java并发编程1-线程池
查看>>
CentOS7,玩转samba服务,基于身份验证的共享
查看>>
计算机网络-网络协议模型
查看>>
计算机网络-OSI各层概述
查看>>
Java--String/StringBuffer/StringBuilder区别
查看>>
mySQL--深入理解事务隔离级别
查看>>
分布式之redis复习精讲
查看>>
数据结构与算法7-栈
查看>>
线性数据结构学习笔记
查看>>
数据结构与算法14-跳表
查看>>
Java并发编程 | 一不小心就死锁了,怎么办?
查看>>
(python版)《剑指Offer》JZ01:二维数组中的查找
查看>>
(python版)《剑指Offer》JZ06:旋转数组的最小数字
查看>>
(python版)《剑指Offer》JZ13:调整数组顺序使奇数位于偶数前面
查看>>
(python版)《剑指Offer》JZ28:数组中出现次数超过一半的数字
查看>>
(python版)《剑指Offer》JZ30:连续子数组的最大和
查看>>
(python版)《剑指Offer》JZ32:把数组排成最小的数
查看>>
(python版)《剑指Offer》JZ02:替换空格
查看>>
JSP/Servlet——MVC设计模式
查看>>
使用JSTL
查看>>