flutter - 如何解决“A RenderFlex 在右侧溢出”。行错误?
问题描述
我在 Row 小部件上收到错误消息。我该如何解决?
Column(
children: [
Padding(
padding: const EdgeInsets.all(20.0),
child: Row( // error is shown on this line
children: [
const Image(
height: 120,
width: 120,
image: NetworkImage(...),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Wrap(
spacing: 5.0,
runSpacing: 5.0,
direction: Axis.vertical,
children: [
Text('Message:'),
Text('Hello world! How are you doing?'),
],
),
)
],
),
),
],
),
右侧的 RenderFlex 溢出了 16 个像素。
解决方案
Expanded
顶部的小部件Padding
为您解决问题
Column(
children: [
Padding(
padding: const EdgeInsets.all(0.0),
child: Row(
// error is shown on this line
children: [
Image(
height: 120,
width: 120,
image: NetworkImage(""),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Wrap(
spacing: 5.0,
runSpacing: 5.0,
direction: Axis.vertical,
children: [
Text('Message:'),
Text(
'Hello world! How are you doing?',),
],
),
))
],
),
),
],
),
推荐阅读
- reactjs - 如何从 Redux 商店填充 Select Options?
- javascript - 我可以在数据绑定中调用函数吗?ASP.NET
- html - 如何设计/使锚标签看起来像按钮一样(非常模糊,但请看下面的细节)
- sql-server - SSAS:元数据管理器中的错误...加载“DatabasePermission”时。在不相关的立方体中
- google-app-engine - Point 已将自定义域添加到应用服务 Google Cloud Platform
- c# - C# 相对连接字符串不起作用
- java - 无法使用 JDBC 或 MySQL Workbench 连接到作为 Docker 容器安装的 MySQL 实例
- cassandra - 不匹配的唯一约束
- makefile - 制作:评估调用结果:配方在第一个目标之前开始
- ns-3 - ns3 模拟器中是否有任何特定的传感器节点?ns3有哪些类型的传感器?