简体   繁体   English

更改Flutter本地通知图标背景色

[英]Change Flutter local notification icon background color

Hey guys i was wondering how i could change the background color/accent color of the local notification icon.大家好,我想知道如何更改本地通知图标的背景色/强调色。 i know for changing firebase messaging icon background we use this我知道改变 firebase 消息图标背景我们使用这个

<meta-data android:name="com.google.firebase.messaging.default_notification_color"
              android:resource="@color/background_color" />

but i couldn't find any thing for flutter local notifications, it's always grey.但我找不到 flutter 本地通知的任何内容,它始终是灰色的。 any ideas?有任何想法吗?

You can change icon color by specifying color in the NotificationDetails.您可以通过在 NotificationDetails 中指定颜色来更改图标颜色。 But make sure the icon is monochrome and has a transparent background.但要确保图标是单色的并且背景是透明的。

NotificationDetails(
      android: AndroidNotificationDetails('id', 'name', 'des',
          // Specify the color
          color: const Color.fromARGB(255, 255, 0, 0),

          importance: Importance.max),
      iOS: IOSNotificationDetails(),
    );

Convert all parts of the image that you don't want to show to transparent pixels.将您不想显示的图像的所有部分转换为透明像素。 All colors and non transparent pixels are displayed in white所有颜色和非透明像素均以白色显示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM