dimanche 29 mars 2020

Flutter set icon using if condition

i want to set the icon after an if condition , like if the condition is true i will set an icon else i will set another icon . my question is can i use it if statements in flutter widgets ? and if yes how can i use with the icon here , here is my code :


               if(this.iconName == 'green'){
                 Icon(Icons.verified_user, color: Colors.green),
               }else{
                 Icon(Icons.verified_user, color: Colors.blueAccent),
               }

Aucun commentaire:

Enregistrer un commentaire