我知道这个问题对您来说特别容易,特别是对于退伍军人来说,因为我是新手,所以我仍然感到困惑如何将我的Icon设置为与DropdownButtonFormField相同的大小?
Container(
width: (globals.screenWidth * 0.85),
height: (globals.screenHeight * 0.07),
padding: EdgeInsets.only(top: 0, left: 10),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.brown),
borderRadius: BorderRadius.all(Radius.circular(8.0)),
),
child: DropdownButtonFormField(
iconSize: 20,
icon: Container(
color: Colors.black54,
child: Icon(
Icons.keyboard_arrow_down,
color: Colors.white,
),
),
style: TextStyle(
fontSize: globals.fontsize_19,
color: Colors.black,
fontWeight: FontWeight.bold,
),
value: _selectedLocation,
onChanged: (newValue) {
setState(() {
_selectedLocation = newValue;
});
},
items: _locations.map((location) {
return DropdownMenuItem(
child: new Text(location),
value: location,
);
}).toList(),
)
),
我尝试了这个,iconSize: 50,
但这是结果
这是结果
这就是我要的
尝试添加
decoration: InputDecoration(
contentPadding: EdgeInsets.zero
),
到您的DropdownButtonFormField,只需将扩展的窗口小部件添加为图标窗口小部件的父级。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句