Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I would like that when a variable is = true the icon would be a color, but if it was = false it would be another.Any idea how I can do that in flutter?
Since you have not specified, I'm going to use the container widget as an example.
bool colorChange = false; Container( color: colorChange? Colors.blue : Colors.red, )
This will work for sure.
Add a comment
try this,
Icon( Icons.widgets, color: (your boolean value goes here)? Colors.blue : Colors.amber, ),
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.