Flutter中的DropdownButton根据它所拥有的项目中最大的DropdownMenuItem来设置其宽度。如果选择了一个较小的项目,则会在项目和箭头之间留下大量空白。如何使按钮缩放到恰好适合所选项目的宽度? 我试过使用Expanded,一些Flexible的东西,但我仍然不能让它改变宽度。DropdownButton( hint
使用DropdownButton时,我需要所选项目的颜色与点击按钮时出现的下拉菜单中的项目列表的颜色不同。根据the Flutter documentation的说法,我应该使用selectedItemBuilder。正如在the example within the documentation中可以看到的,使用selectedItemBuilder的结果是选中的
我尝试在颤振中设置下拉按钮的值。实际上,它从列表中获取项值。当我在Dropdownbutton按钮中添加value: _cStatus,时,收到以下错误消息:
应该正好有一个具有DropdownButton值的项:。检测到零或更多个DropdownMenuItems,其值为‘package:flutter/src/ Either /dropdown.dart. were