For adaptive_icon_background, you would add the background color you want, such as "#ed1e79". You would use adaptive_icon_foreground and adaptive_icon_background to do it.įor adaptive_icon_foreground, you would make the image path the same as the image_path property. Let’s say you’re developing for Android and you want to create a custom background color for your icon that is also transparent. To do this, we can experiment with a few more properties that belong to flutter_launcher_icons. Adding a custom background to your Flutter icon Now, let’s try to make our icons a bit more interesting. Samsung Galaxy Tab A 8”, Android 11 iPad (6th Generation), iOS 15.4.1Īs you can see, the two icon layouts look different based on the operating system and physical device, but our icon is reflected correctly! This is a great start. Here is our app with its new launcher icon. If this worked correctly, the default Flutter icon should be replaced with your specified icon. Then, you can exit the app and see what the app icon looks like. To do this, run the app on whatever simulator or device you’d like to use and wait for it to open. Now we can try to see if our icons are reflected on their respective platforms. Perfect! It looks like there are no outstanding issues. Now that we have that in place, let’s run flutter_clean, then re-rerun flutter pub get & flutter pub run flutter_launcher_icons:main. It would appear that the solution is depending directly on a forked Git repo and branch of flutter_launcher_icons. Here, we are referencing the Git repository for the package directly, as well as a specific commit, branch, or tag. We can do this by adding the below code to pubspec.yaml under dependencies. The workaround is to directly depend on the package by referencing the Git repository. If you’re still planning on using 0.9.2, I found a solution here. If for whatever reason you’re unable to upgrade to 0.9.3 then continue reading about the workaround. N.B., flutter_launcher_icons released a new version in June 2022 (0.9.3) that appears to incorporate the solution I will outline below. It looks like the issue appears to be related to minSdkVersion, which basically specifies a minimum Android SDK version needed to work with the package. It would appear that there might be an issue with conflicting Flutter versions and the latest version of flutter_launcher_icons (0.9.2). I followed the README and tried to follow this tutorial, cleared cache, etc. This is the issue I mentioned earlier, and this stumped me for a while. But for some reason, when I got the below error. Normally, this is fine, and for some of you, this will be sufficient. If you follow the instructions under the installation on pub.dev, you will see it tells you to reference the latest version. flutter pub run flutter_launcher_icons:main Now you can run flutter pub get to get and update all mentioned dependencies in pubspec.yaml. Put the below code into pubspec.yaml to start. Otherwise, set true to default to image_path (I ran into an issue here too.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |