How to emulate Android's showAsAction="ifRoom" in Flutter? : <p>In my Flutter app I have a screen that is a MaterialApp with a Scaffold widget as it's home.</p>

<p>The appBar property of this Scaffold is an AppBar widget with the actions property filled with some actions and a popup menu to house the rest of the options.</p>

<p>The thing is, as I understand a child of AppBar <code>actions</code> list can either be a generic widget (it will be added as an action) or an instance of <code>PopupMenuButton</code>, in which case it will add the platform specific icon that when triggered opens the AppBar popup menu.</p>

<p>On native Android that's not how it works. I just need to inflate a menu filled with menu items and each item either can be forced to be an action, forced to NOT be an action or have the special value "ifRoom" that means "be an action if there is space, otherwise be an item inside de popup menu".</p>

<p>Is there a way in Flutter to have this behavior without having to write a complex logic to populate the "actions" property of the AppBar?</p>

<p>I've looked into both AppBar and PopupMenuButton documentations and so far nothing explains how to do such a thing. I could simulate the behavior but then I would have to actually write a routine to calculate the available space and build the "actions" list accordingly.</p>

<p>Here's a typical Android menu that mixes actions and popup menu entries. Notice the "load_game" entry can be an action if there is room and will become a menu entry if not.</p>

<pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item android:id="@+id/new_game"
          android:icon="@drawable/ic_new_game"
          android:title="@string/new_game"
          android:showAsAction="always"/&gt;
    &lt;item android:id="@+id/load_game"
          android:icon="@drawable/ic_load_game"
          android:title="@string/load_game"
          android:showAsAction="ifRoom"/&gt;
    &lt;item android:id="@+id/help"
          android:icon="@drawable/ic_help"
          android:title="@string/help"
          android:showAsAction="never" /&gt;
&lt;/menu&gt;
</code></pre>

<p>On the other hand in Flutter I have to decide ahead of time if the options will be an action or a menu entry.</p>

<pre class="lang-dart prettyprint-override"><code>AppBar(
  title: Text("My Incredible Game"),
  primary: true,
  actions: &lt;Widget&gt;[
    IconButton(
      icon: Icon(Icons.add),
      tooltip: "New Game",
      onPressed: null,
    ),
    IconButton(
      icon: Icon(Icons.cloud_upload),
      tooltip: "Load Game",
      onPressed: null,
    ),
    PopupMenuButton(
      itemBuilder: (BuildContext context) {
        return &lt;PopupMenuEntry&gt;[
          PopupMenuItem(
            child: Text("Help"),
          ),
        ];
      },
    )
  ],
)
</code></pre>

<p>What I hoped would work is that the AppBar actually had just a single "action" property instead of "actions". That property would be just a widget allowing me to have anything so if I wanted just a list of actions then a Row filled with IconButton's would suffice.</p>

<p>Along with that each PopupMenuItem inside the PopupMenuButton would have a "showAsAction" property. If one or more PopupMenuItem inside the PopupMenuButton was checked to be an action or "ifRoom" and there is room, then the PopupMenuButton would expand horizontally and place these items as actions.</p>
