我正在使用带有卡片的列表视图,但是我需要在左侧放置一个功能区
错误:
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")),
),
],
),
],
),
)
],
),
),
);
答案 0 :(得分:2)
您需要为第二个孩子换行-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
答案 1 :(得分:0)
将fit属性设置为FittedBox
的{{1}}中的文本换行非常适合自动调整大小。