简体   繁体   English

如何更改 flutter 应用程序默认图标的背景?

[英]How to change the background of the flutter app default icon?

I have an app and its default icon is a flutter default icon.我有一个应用程序,它的默认图标是 flutter 默认图标。 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.我相信它是 flutter 应用程序的默认颜色。

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这是您的强调色的一部分,因此您需要在MaterialApp()小部件中添加primaryColor

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.如果你想改变你的背景或适合你的图标然后转到(android/app/src/main/res)并右键单击和 go 到new/Image Asset然后 android studio 打开一个图像资产配置框你必须改变路径并自定义您想要的图标。

or或者

If you want to change the flutter app icon or want to add your custom icon follow these steps:如果您想要更改 flutter 应用程序图标或想要添加您的自定义图标,请按照以下步骤操作:

  1. Create your own icon using this link ( https://appicon.co/ ) and download the files使用此链接( https://appicon.co/ )创建您自己的图标并下载文件
  2. For android move that downloaded file to your flutter folder (android/app/src/main/res)对于 android 将下载的文件移动到 flutter 文件夹(android/app/src/main/res)
  3. Rebuild your project重建你的项目

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

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