简体   繁体   中英

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

<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. any ideas?

You can change icon color by specifying color in the 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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