0

I do have a DropdownButton and all I want is to increase the height of it just a little bit to be able to see minimum 2 lines of text when the user select an option from the list. I already tried with Container, SizedBox and Padding, but nothing worked or maybe I was doing something wrong. This is my code:

Padding(
        padding: const EdgeInsets.only(bottom: 30),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          mainAxisSize: MainAxisSize.min,
          children: [
            const Text("Dropdown options"),
            Expanded(
              child: DropdownButton(
                value: currentOptionIDSelected.toString(),
                isExpanded: true,
                isDense: true,
                items: optionsList.map((OptionModel option) {
                  return DropdownMenuItem(
                    value: option.optionID,
                    child: Text(option.name ?? ""),
                  );
                }).toList(),
                onChanged: (String? newOptionID) {
                  setState(() { },
                padding: const EdgeInsets.only(left: 40),
                style: const TextStyle(fontSize: 14, height: 1),
              ),
            ),
          ],
        ),
      ),

Here is a screenshot of how it looks for the moment: enter image description here

Thanks for reading this !

1 Answer 1

0

I found the solution for my issue. To increase the height of the DropdownButton you need to set 3 properties:

  • isExpanded: true
  • isDense: true
  • iconSize: 30.0 (by default the icon size is 24.0). In my case the icon size had the default value and this is why I wasn't able to see 2 lines of text. enter image description here
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.