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.

Set isExpanded property of DropdownButton to true
isExpanded: true
Like that:
DropdownButtonHideUnderline(
child: DropdownButton<String>(
isExpanded: true,
items: [...]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With