Reputation: 374
How can i make the text expand to it's content? I Tried this
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
items: _currentCitySelected.area
.map((String dropDownStringItem) {
return DropdownMenuItem<String>(
value: dropDownStringItem,
child: Container(
child: Text(
dropDownStringItem,
maxLines: 2,
// overflow: TextOverflow.clip,
)),
);
}).toList(),
onChanged: (String newValueSelected) {
setState(() {
this._currentAreaSelected =
newValueSelected;
});
},
value: _currentAreaSelected,
))
[ Text expands to content in drop down dialog content, but it does'nt works the same way in the main view.
Upvotes: 4
Views: 3662
Reputation: 15002
Set isExpanded
property of DropdownButton
to true
isExpanded: true
Like that:
DropdownButtonHideUnderline(
child: DropdownButton<String>(
isExpanded: true,
items: [...]
Upvotes: 10