How to fix Flutter dropdown button overflow issue?
Though I have flagged the question as possible duplicate, a partial solution not mentioned in the other question is to use the isExpanded
property for DropDownButton
.
child: new DropdownButton<String>( isExpanded: true, ...
In most cases, in addition to the expanded, it is also good to make it ellipsized.. steps 1 and 2. If it's not ellipsized it will make it wrap to next line and if the component doesn't support multiples lines it will truncated the text.
DropdownButton( isExpanded: true, //Step 1 items: [ new DropdownMenuItem( child: Text("Long text that overflow the size.. wrapped or ellipsized", overflow: TextOverflow.ellipsis), //Step 2 ), ], onChanged: (val) { })