我试图将卡片设置为this image.i已在Row Expanded中使用,并且将is放出此处是我的代码
return Card(
shape: RoundedRectangleBorder(
side: BorderSide(color: Colors.white70, width: 1),
borderRadius: BorderRadius.circular(15),
),
child: new InkWell(
onTap: () {
},
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Text(
"${_userDetails[index].manifiest}",
style: TextStyle(
fontSize: 40.0,
fontWeight: FontWeight.w700,
),
),
),
Padding(
padding:
const EdgeInsets.only(left: 5),
child: Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: <Widget>[
IconButton(
icon: new Icon(
Icons.edit,
),
iconSize: 30,
onPressed: () {
int id =
userData[index]['id'];
Navigator.push(
context,
MaterialPageRoute(
));
},
),
IconButton(
icon: new Icon(
Icons.cancel,
),
iconSize: 30,
onPressed: () {
Utils.isConnected()
.then((intenet) {
if (intenet != null &&
intenet) {
// Internet Present Case
showAlertDialogTwo(
context,
"Are Sure You Want To Delete?",
index);
} else {
Utils.alertDialog(
context,
'Make Sure Connected with Internet',
"");
}
// No-Internet Case
});
},
)
],
))
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Row(
children: <Widget>[
Text(
"${_userDetails[index].fromBranch} ",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
Icon(Icons.compare_arrows,
color: Colors.black54),
Text(
" ${_userDetails[index].toBranch}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
],
)
),
Text("${_userDetails[index].date}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 12.0)),
new Padding(
padding: EdgeInsets.only(left: 5)),
Text("${_userDetails[index].time}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 12.0)),
new Padding(
padding: EdgeInsets.only(
top: 30.0,
))
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child:Text("Consignment"
style: TextStyle(
color: Colors.black54,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
),
Expanded(
child:Text("${_userDetails[index].totalConsignments}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 12.0)),
),
Expanded(
child:Text("PCs ",
style: TextStyle(
color: Colors.black54,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
),
Expanded(
child:Text("${_userDetails[index].totalPcs}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 12.0)),
),
new Padding(
padding: EdgeInsets.only(
top: 30.0,
))
],
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Expanded(
child:Text("Weight ",
style: TextStyle(
color: Colors.black54,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
),
Expanded(
child:Text("${_userDetails[index].totalWeight}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 12.0)),
),
Expanded(
child:Text("By",
style: TextStyle(
color: Colors.black54,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
),
Expanded(
child:Text("${_userDetails[index].enteredBy}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 12.0)),
),
new Padding(
padding: EdgeInsets.only(
top: 30.0,
))
],
),
],
),
),
),
margin: const EdgeInsets.only(
left: 10, top: 10, right: 10),
);
也我在行中使用了Flexible,我正在获得this类型的输出,这是我的Flexible代码
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
new Flexible(
child: new Text("Consignmens",
style: TextStyle(
color: Colors.black54,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
flex: 3,
),
new Flexible(
child: new Center(
child: Text(
"${_userDetails[index].totalConsignments}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 12.0)),
),
flex: 2,
),
new Flexible(
child: new Center(
child: Text("PCs ",
style: TextStyle(
color: Colors.black54,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
),
flex: 2,
),
new Flexible(
child: new Text(
"${_userDetails[index].totalPcs}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 12.0)),
flex: 2,
),
new Padding(
padding: EdgeInsets.only(
top: 30.0,
))
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
new Flexible(
child: Text("Weight",
style: TextStyle(
color: Colors.black54,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
flex: 3,
),
new Flexible(
child: new Center(
child: Text(
"${_userDetails[index].totalWeight}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 12.0)),
),
flex: 2,
),
new Flexible(
child: new Center(
child: Text("By",
style: TextStyle(
color: Colors.black54,
fontWeight: FontWeight.bold,
fontSize: 16.0)),
),
flex: 2,
),
new Flexible(
child: new Text(
"${_userDetails[index].enteredBy}",
style: TextStyle(
color: Colors.black45,
fontWeight: FontWeight.bold,
fontSize: 12.0)),
flex: 2,
)
],
),
[请帮助我,我是新手。如果需要对此代码进行任何更正,请也告诉我。预先谢谢你
正如Ryosuke所说的,在Expanded中使用flex属性非常感谢