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

时间:2021-07-16 23:16:13

标签: flutter user-interface notifications

大家好,我想知道如何更改本地通知图标的背景颜色/重音颜色。我知道我们使用这个来改变 firebase 消息图标背景

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

但是我找不到任何有关颤动本地通知的内容,它始终是灰色的。有什么想法吗?

2 个答案:

答案 0 :(得分:0)

将您不想显示的图像的所有部分转换为透明像素。所有颜色和非透明像素显示为白色

答案 1 :(得分:0)

您可以通过在 NotificationDetails 中指定颜色来更改图标颜色。但请确保图标是单色的并具有透明背景。

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

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

相关问题