在 ListTitle PopupMenuButton 在调试中工作,但在颤振中不在发布模式下工作

时间:2021-01-07 09:03:04

标签: flutter flutter-layout flutter-dependencies popupmenubutton

当我将它保存在 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',
                  )),
            ]);
  }

1 个答案:

答案 0 :(得分:0)

就我而言,问题出在 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',
                  )),
            ]);
  }
相关问题