![](https://img.haomeiwen.com/i3974484/93ddf935dc197f15.png)
有时只需要样式,不需要弹框。
把 DropdownButton 的 onChanged: null, 方法就不会弹框了。
但是又需要点击时间,触发一些操作。 于是可以在外层嵌套 GestureDetector(),利用GestureDetector的 onTap: ()来触发。
GestureDetector(
onTap: () {
ToastTool.showToast("点击了时间");
},
child: DropdownButton(
value: _timeValue,
iconDisabledColor: Color(0xFF333333),//图标禁用颜色
//禁用提示 的样式
disabledHint: Text(
"时间",
style: TextStyle(color: Color(0xFF333333)),
),
underline: Text(""),
items: itemList,
onChanged: null,
),
);
网友评论