我如何使文本扩展到其内容?我试过了
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,
))
答案 0 :(得分:1)
将isExpanded
的{{1}}属性设置为DropdownButton
true
喜欢:
isExpanded: true