【发布时间】:2021-03-03 13:03:02
【问题描述】:
如何在 DropdownButtonFormField 中设置圆角边框?以及如何在下拉图标中制作背景颜色?请看下图
Container(
padding: EdgeInsets.only(top: 10),
width: (globals.screenWidth * 0.8),
height: (globals.screenHeight * 0.08),
color: Colors.white,
child: DropdownButtonFormField(
style: TextStyle(
fontSize: globals.fontsize_18,
color: Colors.black,
fontWeight: FontWeight.normal,
),
value: _selectedLocation,
onChanged: (newValue) {
setState(() {
_selectedLocation = newValue;
});
},
items: _locations.map((location) {
return DropdownMenuItem(
child: new Text(location),
value: location,
);
}).toList(),
)
)
结果
这是我想要的结果
【问题讨论】:
-
如果您也希望项目也被舍入,请查看此处。 [stackoverflow.com/questions/66135853/… 剧透:你不会使用
DropdownMenuButton,而是PopupMenuButton