Flutter 在ListTitle中,PopupMenuButton在调试模式下工作,但在颤振模式下不在释放模式下工作
当我把它放在AppBar里时,它就开始工作了。但在ListTile中,它不起作用 它在调试版本中工作,而不是在发布版本中工作。我可以知道到底是什么问题吗 在我的例子中,当我添加PopupMenuButton按钮时,按钮本身不会显示在发布版本中Flutter 在ListTitle中,PopupMenuButton在调试模式下工作,但在颤振模式下不在释放模式下工作,flutter,flutter-layout,flutter-dependencies,popupmenubutton,Flutter,Flutter Layout,Flutter Dependencies,Popupmenubutton,当我把它放在AppBar里时,它就开始工作了。但在ListTile中,它不起作用 它在调试版本中工作,而不是在发布版本中工作。我可以知道到底是什么问题吗 在我的例子中,当我添加PopupMenuButton按钮时,按钮本身不会显示在发布版本中 Widget popupMenu() { return PopupMenuButton( color: Colors.white, icon: Icon( Icons.more_vert,
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',
)),
]);
}
@覆盖
小部件构建(构建上下文){
返回新列(
儿童:[
新容器(
子对象:对齐(
对齐:alignment.centerLeft,
孩子:新的一排(
儿童:[
新容器(
宽度:MediaQuery.of(context).size.width-50,
子:新列(
mainAxisAlignment:mainAxisAlignment.space,
儿童:[
列表砖(
是的,
),
],
),
),
弹出菜单(aspirantCardVO),
],
),
),
)
],
);
}
小部件弹出菜单(){
返回弹出菜单按钮(
颜色:颜色,白色,
图标:图标(
图标。更多信息,
尺码:30,
颜色:颜色,黑色,
),
onSelected:(值){
//条件检查
},
itemBuilder:(上下文)=>[
PopupMenuItem(
值:'消息',
子:文本(
"讯息",,
)),
]);
}
在我的例子中,问题在于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',
)),
]);
}
@覆盖
小部件构建(构建上下文){
返回新列(
儿童:[
新容器(
子对象:对齐(
对齐:alignment.centerLeft,
孩子:新的一排(
儿童:[
新容器(
宽度:MediaQuery.of(context).size.width-50,
子:新列(
mainAxisAlignment:mainAxisAlignment.space,
儿童:[
列表砖(
是的,
),
],
),
),
弹出菜单(aspirantCardVO),
],
),
),
)
],
);
}
小部件弹出菜单(){
返回弹出菜单按钮(
颜色:颜色,白色,
图标:图标(
图标。更多信息,
尺码:30,
颜色:颜色,黑色,
),
onSelected:(值){
//条件检查
},
itemBuilder:(上下文)=>[
PopupMenuItem(
值:'消息',
子:文本(
"讯息",,
)),
]);
}