在 ListTitle 中,PopupMenuButton 在调试中工作,但在 flutter 中不在发布模式中工作
In a ListTitle PopupMenuButton works in debug but not in release mode in flutter
当我将其保存在 AppBar 中时,它可以正常工作。但在 ListTile 中它不起作用。
它在调试版本中工作,在发布版本中不工作。我可以知道到底是什么问题吗..
在我的例子中,当我添加 PopupMenuButton 时,按钮本身没有显示在发布版本中。
Widget popupMenu() {
return PopupMenuButton(
color: Colors.white,
icon: Icon(
Icons.more_vert,
size: 30,
color: Colors.black,
),
onSelected: (value) {
//conditions check
},
itemBuilder: (context) => [
PopupMenuItem(
value: 'Message',
child: Text(
'Message',
)),
]);
}
在我的例子中,问题出在 ListTitle PopupMenuButton 没有被占用。我添加了一行,并在行内添加了具有宽度和 PopupMenuButton 的 ListTitle 容器。
@override
Widget build(BuildContext context) {
return new Column(
children: <Widget>[
new Container(
child: Align(
alignment: Alignment.centerLeft,
child: new Row(
children: <Widget>[
new Container(
width: MediaQuery.of(context).size.width - 50,
child: new Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ListTile(
dense: true,
),
],
),
),
popupMenu(aspirantCardVO),
],
),
),
)
],
);
}
Widget popupMenu() {
return PopupMenuButton(
color: Colors.white,
icon: Icon(
Icons.more_vert,
size: 30,
color: Colors.black,
),
onSelected: (value) {
//conditions check
},
itemBuilder: (context) => [
PopupMenuItem(
value: 'Message',
child: Text(
'Message',
)),
]);
}
当我将其保存在 AppBar 中时,它可以正常工作。但在 ListTile 中它不起作用。
它在调试版本中工作,在发布版本中不工作。我可以知道到底是什么问题吗..
在我的例子中,当我添加 PopupMenuButton 时,按钮本身没有显示在发布版本中。
Widget popupMenu() {
return PopupMenuButton(
color: Colors.white,
icon: Icon(
Icons.more_vert,
size: 30,
color: Colors.black,
),
onSelected: (value) {
//conditions check
},
itemBuilder: (context) => [
PopupMenuItem(
value: 'Message',
child: Text(
'Message',
)),
]);
}
在我的例子中,问题出在 ListTitle PopupMenuButton 没有被占用。我添加了一行,并在行内添加了具有宽度和 PopupMenuButton 的 ListTitle 容器。
@override
Widget build(BuildContext context) {
return new Column(
children: <Widget>[
new Container(
child: Align(
alignment: Alignment.centerLeft,
child: new Row(
children: <Widget>[
new Container(
width: MediaQuery.of(context).size.width - 50,
child: new Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ListTile(
dense: true,
),
],
),
),
popupMenu(aspirantCardVO),
],
),
),
)
],
);
}
Widget popupMenu() {
return PopupMenuButton(
color: Colors.white,
icon: Icon(
Icons.more_vert,
size: 30,
color: Colors.black,
),
onSelected: (value) {
//conditions check
},
itemBuilder: (context) => [
PopupMenuItem(
value: 'Message',
child: Text(
'Message',
)),
]);
}