3

I've got a DropdownButton in my Flutter app that contains some fairly long strings and i'm having an issue with some text overlapping in the DropdownMenuItems. There is a link to the image and in there you can see the text from one option is overlapping with the next option. I tried to wrap the text in an expanded but that isn't doing the trick.

Is there a way to create some equal separation between the DropdownMenuItems? I've tried to play around with softwrap and overflow but these are simply cutting the Strings short which is not ideal as the user needs to be able to fully read each item from the DropDown.

Ideally an equal gap between each item and no overlap is the outcome i'm looking for. Surely there is a solution to having long strings in a dropdown

enter image description here

DropdownMenuItem(
    value: value,
    child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[Expanded(child: Text(value))],
    ))

2 Answers 2

6
DropdownButton(
isExpanded: true, //just add this property as true
Sign up to request clarification or add additional context in comments.

Comments

1
Expanded( // wrap the DropdownButton with Expanded widget
  child: DropdownButton(
    isExpanded: true, // also set the isExpanded property to true

2 Comments

While this code may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion
Also, this is virtually identical to Joel’s answer from a year ago. When answering old questions, please be sure to review the existing answers.

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.