如何删除 DropdownButton 中的高度?
How to remove the elevation in DropdownButton?
帮助我删除 DropdownButton 中的这个高度,我尝试使用 elevation = 0
,但没有任何反应,或者如果你有更好的小部件来显示像 DropdownButton 这样的项目,请告诉我。
谢谢
要删除下划线,我们应该用 DropdownButtonHideUnderline
小部件包裹 DropdownButton
小部件。
elevation
属性会在打开状态下使下拉层升高
例子
DropdownButtonHideUnderline(
child: DropdownButton(
style: TextStyle(color: Colors.black),
items: <String>[
'Android',
'IOS',
'Flutter',
'Python',
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
hint: Text(
"Please choose a langauage",
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w600),
),
onChanged: (value) {
print(value);
},
),
),
帮助我删除 DropdownButton 中的这个高度,我尝试使用 elevation = 0
,但没有任何反应,或者如果你有更好的小部件来显示像 DropdownButton 这样的项目,请告诉我。
谢谢
要删除下划线,我们应该用 DropdownButtonHideUnderline
小部件包裹 DropdownButton
小部件。
elevation
属性会在打开状态下使下拉层升高
例子
DropdownButtonHideUnderline(
child: DropdownButton(
style: TextStyle(color: Colors.black),
items: <String>[
'Android',
'IOS',
'Flutter',
'Python',
].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
hint: Text(
"Please choose a langauage",
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w600),
),
onChanged: (value) {
print(value);
},
),
),