title: Flutter PopupMenuButton - how to disable it conditionally
body: <p>I have a simple <code>PopupMenuButton</code> implementation on <code>appTitle</code>. Here it is:</p>
  
  <pre><code>PopupMenuItem&lt;int&gt; _buildMenuItem(int size) {
    return PopupMenuItem&lt;int&gt;(
      value: size,
      child: Text('${size}x$size'),
    );
  }
  
  return Scaffold(
    appBar: AppBar(
      title: Text('Some title'),
      actions: &lt;Widget&gt;[
        PopupMenuButton&lt;int&gt;(
          icon: Icon(Icons.refresh),
          onSelected: _canReplay()
              ? (int size) {
                  // do something with the size
                }
              : null,
          itemBuilder: (BuildContext context) =&gt; &lt;PopupMenuItem&lt;int&gt;&gt;[
                _buildMenuItem(3),
                _buildMenuItem(4),
                _buildMenuItem(5),
              ],
        ),
      ],
    ),
    body: ...
  );
  </code></pre>
  
  <p>UPDATED - I have realized my initial question might not be quite clear, so I rephrased it below: </p>
  
  <p>What I would like to achieve is to disable <code>PopupMenuButton</code> based on app condition. Using the above code, I can enable / disable <code>onSelected</code> method invocation, however, icon appearance does not change. </p>
  
  <p>To summarize - I would like the entire <code>PopupMenuButton</code> along with its icon to become disabled in the same fashion <code>IconButton</code> is disabled with you pass <code>null</code> to its <code>onPressed</code> method. That way, the user won't be able to even press the button and to invoke the menu.</p>
  
  <p>Is that achievable?</p>