flutter - 颤振显示专业徽章的火力基地人物
问题描述
我正在尝试在我的应用中订阅的用户名旁边显示专业徽章。然而,我的方法导致所有用户都拥有专业徽章,即使是那些未订阅的用户。
这是我的逻辑
//function checking firebase if user is pro
checkfirebasepro(var ownerid)async{
await FirebaseFirestore.instance
.collection('users')
.doc(ownerid)
.get()
.then((prostatus) {
if (prostatus.data()["isPro"]==true) {
setState(() { isprouser=true;
});
} else {
isprouser=false;
}
});
}
然后在调用上述函数后在我的 listview.builder 中,这是我如何尝试为专业用户显示专业徽章
isprouser ==true?Container(
height: 15,
width: 33,
child: Center(
child: Text(
"PRO",
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.bold,
color: Colors.black),
)),
decoration: BoxDecoration(
color: kGoldColor,
borderRadius: BorderRadius.circular(4)),
):Text("")
解决方案
推荐阅读
- ruby-on-rails - ActionController::ParameterMissing 和多选表中的行
- asp.net-mvc - asp.net MVC 不允许新建事务,因为会话中还有其他线程在运行
- visual-studio-code - 如何禁用 Visual Studio Code 自动保存
- sql - 在一对多关系中,是否可以在不使用计数和分组依据的情况下根据他们是否有某些孩子来查询父母?
- reactjs - 向蓝图选择组件弹出框添加元素?
- javascript - Javascript 不会将数组值放在 CSS 语法中
- javascript - 反应下拉不显示选项
- java - 为什么`equals`不比较字符串和字符串数组?
- javascript - 使用 Jquery 动态删除脚本标签时的问题
- javascript - 在 HTML 中使用计时器平滑滚动