简体   繁体   English

Flutter 通知徽章在更新时收听

[英]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.

相关问题 Flutter - 推送通知到达时在应用程序图标上显示徽章编号 - Flutter - Display badge number on app icon when push notification arrives 如何删除通知徽章-Flutter - how to remove notification badge -Flutter 在 Flutter 中接收通知时,如何使 Firebase 推送通知增加徽章计数? - How to make Firebase Push Notification Increase Badge Count When Receive Notification In Flutter? flutter 中浮动操作按钮上的通知徽章 - Notification badge on floating action button in flutter Flutter 桌面 windows 应用程序图标上的通知徽章 - Flutter desktop windows notification badge on app icon 为 flutter 中的特定网格添加通知徽章? - Add Notification Badge for particular grid in flutter? Flutter 在推送通知上显示应用程序图标徽章 - Flutter show app icon badge on push notification Flutter 通知计数然后在读取时隐藏徽章并在推送新通知时显示 - Flutter notification count then hide badge when its read and show when new notifications pushed 收到来自 firebase 云消息传递的通知时,在图标启动器上添加徽章 - Add badge on icon launcher when receiving notification from firebase cloud messaging flutter 应用程序图标徽章 - Firebase 推送通知 /FCM - Flutter - App icon badge - Firebase push notification /FCM - Flutter
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM