在Flutter中,
我尝试使用![输入图像描述](https://istack.dev59.com/gPMzI.webp)
DropdownButton
根据其拥有的最大DropdownMenuItem
来设置其宽度。如果选择了一个小项目,则在项目和箭头之间留下了很多空白。我该如何使按钮缩放以适合所选项的宽度?我尝试使用
Expanded
、一些Flexible
的东西,但我仍然无法改变它的宽度。DropdownButton(
value: null,
hint: Text("Small text"),
items: ..., //Text widgets that have more text and are larger than the hint
)
我正在尝试消除hint
和箭头之间下划线标出的空格:
![输入图像描述](https://istack.dev59.com/gPMzI.webp)