【发布时间】:2019-01-28 10:39:55
【问题描述】:
目前,我有一个AlertDialog 和一个IconButton。用户可以点击 IconButton,每次点击我都有两种颜色。问题是我需要关闭 AlertDialog 并重新打开才能看到颜色图标的状态变化。我想在用户单击时立即更改 IconButton 颜色。
代码如下:
bool pressphone = false;
//....
new IconButton(
icon: new Icon(Icons.phone),
color: pressphone ? Colors.grey : Colors.green,
onPressed: () => setState(() => pressphone = !pressphone),
),
【问题讨论】:
标签: flutter dart flutter-layout flutter-alertdialog