title: How to open DropDown dialog below DropdownButton like Spinner in Flutter?
body: <p>I want to open DropDown dialog below <code>DropdownButton</code> like Spinner in <strong>Flutter</strong>. Right now its open over Button widget and when I select last item and re-open as down side.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>import 'package:flutter/material.dart';
  
  class DropDown extends StatefulWidget {
    DropDown() : super();
  
    final String title = "DropDown Demo";
  
    @override
    DropDownState createState() =&gt; DropDownState();
  }
  
  class Company {
    int id;
    String name;
  
    Company(this.id, this.name);
  
    static List&lt;Company&gt; getCompanies() {
      return &lt;Company&gt;[
        Company(1, 'Apple'),
        Company(2, 'Google'),
        Company(3, 'Samsung'),
        Company(4, 'Sony'),
        Company(5, 'LG'),
      ];
    }
  }
  
  class DropDownState extends State&lt;DropDown&gt; {
    //
    List&lt;Company&gt; _companies = Company.getCompanies();
    List&lt;DropdownMenuItem&lt;Company&gt;&gt; _dropdownMenuItems;
    Company _selectedCompany;
  
    @override
    void initState() {
      _dropdownMenuItems = buildDropdownMenuItems(_companies);
      _selectedCompany = _dropdownMenuItems[0].value;
      super.initState();
    }
  
    List&lt;DropdownMenuItem&lt;Company&gt;&gt; buildDropdownMenuItems(List companies) {
      List&lt;DropdownMenuItem&lt;Company&gt;&gt; items = List();
      for (Company company in companies) {
        items.add(
          DropdownMenuItem(
            value: company,
            child: Text(company.name),
          ),
        );
      }
      return items;
    }
  
    onChangeDropdownItem(Company selectedCompany) {
      setState(() {
        _selectedCompany = selectedCompany;
      });
    }
  
    @override
    Widget build(BuildContext context) {
      return new MaterialApp(
        debugShowCheckedModeBanner: false,
        home: new Scaffold(
          appBar: new AppBar(
            title: new Text("DropDown Button Example"),
          ),
          body: new Container(
            child: Center(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisAlignment: MainAxisAlignment.center,
                children: &lt;Widget&gt;[
                  Text("Select a company"),
                  SizedBox(
                    height: 20.0,
                  ),
                  DropdownButton(
                    value: _selectedCompany,
                    items: _dropdownMenuItems,
                    onChanged: onChangeDropdownItem,
                  ),
                  SizedBox(
                    height: 20.0,
                  ),
                  Text('Selected: ${_selectedCompany.name}'),
                ],
              ),
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/1WzMu.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1WzMu.png" alt="Example Image"></a></p>
  
  <p>Note: Example is taken from <a href="https://www.coderzheaven.com/2019/04/16/dropdown-list-in-flutter/" rel="noreferrer">here</a>.</p>