我想在 if 条件之后设置图标,比如如果条件为真,我将设置一个图标,否则我将设置另一个图标。我的问题是我可以在 flutter 小部件中使用 if 语句吗?如果是,我如何使用此处的图标,这是我的代码:
if(this.iconName == 'green'){
Icon(Icons.verified_user, color: Colors.green),
}else{
Icon(Icons.verified_user, color: Colors.blueAccent),
}
试试看
Icon(Icons.verified_user: , color: this.iconName=='green'? Colors.green : Colors.blueAccent),
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句