gpt4 book ai didi

dart - Flutter 中带有调整下拉箭头图标的全宽 DropdownButton

转载 作者:IT老高 更新时间:2023-10-28 12:35:01 26 4
gpt4 key购买 nike

我还需要在 Flutter 中添加带有调整下拉箭头图标的全宽 DropdownButton。但是很多人尝试了很多方法,但它并没有完全扩展它的宽度。

这是我的 DropdownButton 代码:

new Expanded(
child: new Column(
children: <Widget>[
new DropdownButton(
items: [
new DropdownMenuItem(child: new Text("Abc")),
new DropdownMenuItem(child: new Text("Xyz")),
],
hint: new Text("Select City"),
onChanged: null
)
]
),
flex: 1,
)

最佳答案

只需将 isExpanded:true 添加到 DropdownButton

  Widget example() {
return new DropdownButton(
isExpanded: true,
items: [
new DropdownMenuItem(child: new Text("Abc")),
new DropdownMenuItem(child: new Text("Xyz")),
],
hint: new Text("Select City"),
onChanged: null
);
}

关于dart - Flutter 中带有调整下拉箭头图标的全宽 DropdownButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51841400/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com