[英]Flutter notification badge listen when update
I am new to flutter, I would like to make a chat app with notification badge that listen to incoming message and remove badge when I click.我是 Flutter 的新手,我想制作一个带有通知徽章的聊天应用程序,它可以在我点击时收听传入的消息并删除徽章。 How do I make it?我该怎么做?
Thank you.谢谢你。
Can you try to look at into this?你能试着看看这个吗? Hope this helps https://api.flutter.dev/flutter/widgets/NotificationListener-class.html希望这有助于https://api.flutter.dev/flutter/widgets/NotificationListener-class.html
You Can use flutter badge plugin and firestore for remove badge when click您可以在点击时使用颤振徽章插件和 Firestore 移除徽章
Some example code:-一些示例代码:-
bool _showbadge = false;
.
.
.
.
if(int.parse(snapshot1.data["chat_count"]) > 0){
_showbadge = true;
}else{
_showbadge = false;
}
Badge(
showBadge: _showbadge,
position: BadgePosition.topEnd(top: 0.55, end: 0.155),
animationType: BadgeAnimationType.scale,
badgeContent: Text("${snapshot1.data["chat_count"]}"),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.