Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Custom height with scroll on a dropdown

So I have a dropdown widget but when the list increases the dropdown increases. How can I avoid this? I for e.g I want to make it 400 height max and have a scroll inside. Also is it possible to add a placeholder instead of adding a value as first selected?

enter image description here

child: DropdownButtonHideUnderline(
                    child: DropdownButton(
                        dropdownColor: Colors.white,
                        isExpanded: true,
                        value: dropdownValue,
                        focusColor: Colors.white,
                        items: [
                          'Country',
                          'B',
                          'C',
                          'D',
                          'E',
                          'A',
                          'B',
                          'C',
                          'D',
                          'E'
                        ].map((String value) {
                          return DropdownMenuItem(
                              value: value, child: Text(value));
                        }).toList(),
                        onChanged: (_) {}),
                  ),

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use menuMaxHeight:400 to set Custom height.

DropdownButtonHideUnderline(
  child: DropdownButton(
    menuMaxHeight: 400,
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading