我想改变一个container
的颜色取决于布尔值我已经保存.但当我改变容器的颜色它改变了所有容器的颜色,因为我的代码是指所有的容器,所以我怎么能只使一个容器的颜色改变这里是我的代码和一些额外的信息:
joined = false;
//when I click on a button it changes the value to true
...onPressed: (){Joined = true;}
//when Joined is true it should change the color to green
color: Joined ? Colors.blue : Colors.green),
//I also gave each container a key/id
//This is referencing a Firebase Database
People['key'] = snapshot.value;
//but when I write this code it makes ALL the container's colors green
//I have all the tools I just don't know how to write the code.
我试图在修改值时实现People['key']
代码,但它不起作用,我也不确定如何编写代码。我还尝试在YouTube和Google上搜索,但没有太多信息可供参考。
1条答案
按热度按时间vfh0ocws1#
使用Map,