【发布时间】:2017-10-19 16:13:34
【问题描述】:
我正在尝试使用 GestureDetector 更改用户单击的元素的颜色:
new GestureDetector(
onTap: (){
// Change the color of the container beneath
},
child: new Container(
width: 80.0,
height: 80.0,
margin: new EdgeInsets.all(10.0),
color: Colors.orange,
),
),
问题是我不能在 onTap 中使用 setState。否则我会创建一个颜色变量。有什么建议吗?
【问题讨论】: