title: Flutter: Is there a widget to flex toggle buttons
body: <p>So I'm the <code>ToggleButtons</code> introduced in <code>1.9.1</code> like this:</p>
  
  <pre><code>Column(
      mainAxisAlignment: MainAxisAlignment.start,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: &lt;Widget&gt;[
        Padding(padding: EdgeInsets.only(top: 8),),
        Text('Sort By: '),
        Align(
          alignment: Alignment.topLeft,
          child: ToggleButtons(
            borderColor: Color(0xffED7D31),
            selectedBorderColor: Color(0xffED7D31),
            selectedColor: Color(0xffAD7651),
            fillColor: Color(0xffFBE5D6),
            color: Color(0xffBF987E),
            children: &lt;Widget&gt;[
              ...state.sortBy.keys.map((name) =&gt; Text(name)).toList()
            ],
            onPressed: (index) =&gt; state.toggleSortBy(index),
            isSelected: state.sortBy.values.toList(),
          ),
        ),
      ],
  ),
  </code></pre>
  
  <p>This obviously creates a list of button widgets from a map, the problem I'm facing is that I'm seeing the following warning in my screen</p>
  
  <blockquote>
    <p>Right overflowed by X pixels</p>
  </blockquote>
  
  <p>So my question is simply whether there is a way to "flex" the buttons like in CSS, meaning when the number of buttons exceeds the screen size, the buttons would automatically start from the next line.</p>
  
  <p>EDIT:</p>
  
  <p>The <code>state.sortBy</code> is just a <code>Map</code> where I store the texts for my widgets alongside their <code>selected</code> values:</p>
  
  <pre><code>LinkedHashMap&lt;String,bool&gt; sortBy = LinkedHashMap.from({
      'Ascending' : true,
      'Descending' : false,
  })
  </code></pre>