此卡中有此卡,我需要添加popupmenubutton。所以我尝试添加,但是问题是它在我想要的最左侧。
已更新: 我已经尝试过添加popupmenubutton,但是它在我想要的最左侧。
Card(
elevation: 4,
child: Padding(
padding: EdgeInsets.only(left: 10.0, top: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Row(
children: <Widget>[
Container(
width: 45,
height: 45,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage("Image here"),
fit: BoxFit.cover,
),
borderRadius: BorderRadius.all(
Radius.circular(50.5)),
),
),
Padding(
padding: EdgeInsets.only(left: 15),
child: Text("Name here"),
),
Expanded(
child: PopupMenuButton(
padding: EdgeInsets.only(left: 100),
elevation:3.2,
itemBuilder: (BuildContext context) {
return [
PopupMenuItem(
child: Container(
child: InkWell(
child: Text("Delete"),
onTap:() {
print("deleted");
},
),
),
),
];
},
),
),
],
),
Padding(
padding:
EdgeInsets.only(left: 60, bottom: 10),
child: Text("Date"),
),
Flexible(
child: Padding(
padding:
EdgeInsets.only(left: 75, right: 15),
child: Text("Description"),
),
),
],
),
),
);
谢谢
答案 0 :(得分:1)
更改代码的这一部分
Padding(
padding: EdgeInsets.only(left: 15),
child: Text("Name here"),
),
Expanded(
child: PopupMenuButton(
padding: EdgeInsets.only(left: 100),
elevation:3.2,
itemBuilder: (BuildContext context) {
return [
PopupMenuItem(
child: Container(
child: InkWell(
child: Text("Delete"),
onTap:() {
print("deleted");
},
),
),
),
与此一起
...
Expanded(
child: Padding(
padding: EdgeInsets.only(left: 15),
child: Text("Name here"),
),
),
PopupMenuButton(
padding: EdgeInsets.only(left: 100),
elevation: 3.2,
itemBuilder: (BuildContext context) {
return [
PopupMenuItem(
child: Container(
child: InkWell(
child: Text("Delete"),
onTap: () {
print("deleted");
},
),
),
),
...
换句话说,将文本用Expand换行,然后从popupmenu取消扩展
结果
这是您要的吗?