颤动状态栏中的图标通知

icon notification in statusbar in flutter

我使用 flutter_local_notification 来管理 flutter 中的 fcm 通知。 为了在 StatusBar 中显示图标,在 drawable 中添加徽标 png 文件并使用它。

我的图片是白色的,当StatusBar是白色的时候,图标没有出现。 另一个应用程序,如 whatsapp,通知图标颜色根据 Appbar 颜色更改。 如何解决这个问题?

尝试使用此 link https://romannurik.github.io/AndroidAssetStudio/icons-notification.html 为您的通知生成图标,然后确保您已在初始化中定义图标,例如 Android:

const AndroidInitializationSettings('@drawable/ic_firebase_notification');

并在 AndroidManifext.xml 文件的 application tag 中添加此代码。

<!-- Add custom icon to the notifications -->
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_firebase_notification" />

并且不要忘记将之前生成的图标放入 android/app/src/main/res/drawable/ 文件夹。我以前试过这个,对我来说效果很好。