简体   繁体   中英

How to change the background of the flutter app default icon?

I have an app and its default icon is a flutter default icon. Its background is white.

在此处输入图像描述

However, when i use the app the background of this icon changes to blue.

在此处输入图像描述

I believe it is a default color for flutter apps.

How can I change it to green, for example?

That's a part of your accent color so you need to add primaryColor in your MaterialApp() widget

for example

MaterialApp(
    debugShowCheckedModeBanner: false,
    theme: ThemeData(
      primaryColor: Colors.lightGreen,//here it goes try changing this to your preferred colour
      accentColor: Colors.green.shade800,
    ),
    home: StartScreen(),
    routes: {
      '/home': (context) => Home(),
    },
  )

If you want to change your background or fit your icon then head over to (android/app/src/main/res) and right click and go to new/Image Asset then android studio opens an image asset configuration box there you have to change the path and customize it whatever you want your icon to be.

or

If you want to change the flutter app icon or want to add your custom icon follow these steps:

  1. Create your own icon using this link ( https://appicon.co/ ) and download the files
  2. For android move that downloaded file to your flutter folder (android/app/src/main/res)
  3. Rebuild your project

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