簡體   English   中英

更改Flutter本地通知圖標背景色

[英]Change Flutter local notification icon background color

大家好,我想知道如何更改本地通知圖標的背景色/強調色。 我知道改變 firebase 消息圖標背景我們使用這個

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

但我找不到 flutter 本地通知的任何內容,它始終是灰色的。 有任何想法嗎?

您可以通過在 NotificationDetails 中指定顏色來更改圖標顏色。 但要確保圖標是單色的並且背景是透明的。

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

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

將您不想顯示的圖像的所有部分轉換為透明像素。 所有顏色和非透明像素均以白色顯示

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM