android - I/flutter (17109):抛出另一个异常:A RenderFlex 溢出右侧 80 像素
问题描述
我正在使用带有卡片的列表视图,但我需要在左侧放一条丝带
错误:
I/flutter (17109): Another exception was thrown: A RenderFlex overflowed by 80 pixels on the right.
I/flutter (17109): Another exception was thrown: A RenderFlex overflowed by 2.0 pixels on the right.
I/flutter (17109): Another exception was thrown: A RenderFlex overflowed by 63 pixels on the right.
I/flutter (17109): Another exception was thrown: A RenderFlex overflowed by 19 pixels on the right.
I/flutter (17109): Another exception was thrown: A RenderFlex overflowed by 80 pixels on the right.
I/flutter (17109): Another exception was thrown: A RenderFlex overflowed by 2.0 pixels on the right
代码项构建器列表视图
Dismissible(
onDismissed: (direction){
launch("tel:0${snapshot.data[index].celular}");
},
background: Card(
color: hexToColor("#25D366"),
child: Padding(padding: EdgeInsets.all(3.0),
child: Align(
alignment:Alignment.centerRight,
child: Icon(Icons.phone, color: Colors.white, size: 35.0,),
),
)
),
direction: DismissDirection.endToStart,
key: Key(DateTime.now().millisecondsSinceEpoch.toString()),
child: Card(
margin: EdgeInsets.symmetric(
horizontal: 5.0, vertical: 4.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
width: 8.0,
height: 110.0,
color: Colors.green,
child: Card(
),
),
Padding(
padding: EdgeInsets.only(
left: 1.0,
top: 7.0,
right: 5.0,
bottom: 5.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("CLIENTE: " + snapshot.data[index].nomeCliente, style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blueGrey),),
Text("CONTATO: " + snapshot.data[index].contato,style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blueGrey),),
Text("DESCRIÇAO: " + snapshot.data[index].descricaoOS,style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blueGrey),),
Text("CELULAR: " +snapshot.data[index].celular,style: TextStyle(fontWeight: FontWeight.bold,color: Colors.blueGrey),),
Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: <Widget>[
Container(
margin: EdgeInsets.only(
bottom: 0.0, top: 0.0),
width: 25.0,
height: 30.0,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
image: DecorationImage(
image: AssetImage(
snapshot.data[index].origemOS == "INTERNO"?"images/interno.png":"images/carro.png"
)),
),
),
Text(
"OS: " +
snapshot.data[index].numOS
.toString(),
style: TextStyle(
fontWeight: FontWeight.bold,
color: hexToColor("#90B348")),
),
],
),
],
),
)
],
),
),
);
解决方案
Padding
你需要用小部件包裹你的第二个孩子Expanded
。
Dismissible(
onDismissed: (direction) {
// launch("tel:0123");
},
background: Card(
color: Colors.grey,
child: Padding(
padding: EdgeInsets.all(3.0),
child: Align(
alignment: Alignment.centerRight,
child: Icon(
Icons.phone,
color: Colors.white,
size: 35.0,
),
),
)),
direction: DismissDirection.endToStart,
key: Key(DateTime.now().millisecondsSinceEpoch.toString()),
child: Card(
margin: EdgeInsets.symmetric(horizontal: 5.0, vertical: 4.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
width: 8.0,
height: 110.0,
color: Colors.green,
child: Card(),
),
Expanded( //Add this - wrap second Child with Expanded
child: Padding(
padding:
EdgeInsets.only(left: 1.0, top: 7.0, right: 5.0, bottom: 5.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
......//Code Cont
推荐阅读
- tabs - 如何在 Flutter 中使用函数创建动态 TabBarView/渲染新 Tab?
- html - 我应该如何严格地将样式与 html 代码分开?
- powerbi-desktop - 对唯一值进行计数和求和 POwer BI
- javascript - 如何在刷新时保持输入字段禁用?
- asp.net-mvc-4 - 日期时间字段未在 MVC 页面上显示日期时间选择器
- python - 使用相同大小的 y 计算 tensorflow 中的梯度 (dy/dx)
- c# - Android 通知如何显示?
- javascript - 未在回调中设置全局变量?
- r - SSL:没有替代证书主题。RStudio 中的 RCurl
- php - 没有 swiftmailer 如何在 laravel 中发送邮件?