ExpandIcon
小于 1 分钟
ExpandIcon
ExpandIcon是一个旋转展开/折叠按钮的组件。
基本用法如下:
bool _expanded = false;
return ExpandIcon(
onPressed: (value) {
setState(() {
_expanded = !_expanded;
});
},
isExpanded: _expanded,
);
效果如下:

点击时,向下的箭头旋转180度。
设置大小和颜色:
ExpandIcon(
size: 48,
color: Colors.blue,
...
)
效果如下:

设置禁用颜色和打开颜色:
ExpandIcon(
disabledColor: Colors.green,
expandedColor: Colors.blue,
color: Colors.red,
onPressed: (value) {
setState(() {
_expanded = !_expanded;
});
},
isExpanded: _expanded,
)
效果如下:

color
:正常未打开状态箭头的颜色。
disabledColor
:禁用状态(onPressed = null)箭头的颜色。
expandedColor
:打开状态箭头的颜色。