flutter - Flutter RenderFlex 溢出
问题描述
嗨,我是新来的,我正面临这个错误
A RenderFlex overflowed by 9.0 pixels on the right.
The relevant error-causing widget was Row
这是我下面的代码:
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0.0,
iconTheme: IconThemeData(
color: Colors.grey[600],
),
leading: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: GestureDetector(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Icon(
Icons.arrow_back_ios_outlined,
),
Text(
'Back',
style: GoogleFonts.poppins(
color: Colors.grey[600],
fontSize: 20
),
),
],
),
你能帮我解决这个错误吗?
解决方案
Icon
用小部件包装Expanded
将消除这里的错误。
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0.0,
iconTheme: IconThemeData(
color: Colors.grey[600],
),
leading: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: GestureDetector(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: Icon(
Icons.arrow_back_ios_outlined,
),
),
Text(
'Back',
style: GoogleFonts.poppins(
color: Colors.grey[600], fontSize: 20),
),
],
),
),
),
),
);
这能解决你的问题吗?
推荐阅读
- javascript - 如何使用 Bitly V4 API 和 jQuery 缩短 URL
- php - 如何确定数组中的每个日期是否介于其他数组中的日期之间
- .net - 将 ELMAH 错误记录到 Elasticsearch
- python - 使用 for 循环和列表的 Python 索引错误
- python - Saving what I see in PyPlot
- oracle12c - 为什么 dbca 给出错误 NoClassDefFoundError
- javascript - 根据地图的缩放级别和点击显示多边形图层
- javascript - 将 html5 表单自定义属性传递给 JSON
- svelte - Svelte 不会从输入更新派生值
- r - 使用条形图时设置订单级别