So now that we’ve pretty much created all of the interface of our ‘I Am Rich’ app, we have a scaffold with an app bar, a body, an image that comes from our assets in our images folder.
But there’s just one thing that we still haven’t got. We haven’t got a custom app icon. For every single app that you create using Flutter, you get a default Flutter logo as your app icon.
Now if you start creating lots of apps, they can get very confusing very quickly. And besides, when you’re uploading it to the App Store, you don’t want it to look like a default Flutter app.
So how do we give our apps an app icon.
Now first things first.
I want you to go ahead and download the ‘I Am Rich’ app icon from this current lesson.
There’s a file that you can download and once you’ve downloaded it and open it, you should see an image that looks something like this.
And then what you’re going to do is you’re gonna go to a website called appicon.co
And you’re going to drag and drop your image that’s pretty large, into the place holder there.
And then we’re going to select for all the platforms that we want to create an app icon for.
So we’re going to uncheck iPad, watch and Mac. We’re only going to generate icons for the iPhone and Android.
Go ahead and click generate.
And you should be able download a zipped file that contains all of the icons that they’ve generated for you.
If you have a peek inside here, you can see inside Android, we’ve got some folders that contain different sized icons.
So for example this one is the smallest.
And this one is the largest Android icon. And it’s done the same for iOS as well.
And it’s inside the assets.xcassets folder.
The next thing we have to do is to actually move these assets into our current project. And to do that, we’re going to need the project navigator over here.
So remember I said that we have our iOS folder which contains all the files of our iOS app, and our Android folder that contains all the files of our Android app. And these files include the actual launcher icon or the app icon if you will.
So let’s first start with the Android app.
If you go into the app folder, then you go into src, then you go into main, and finally you go into res.
You can see that we’ve got a whole bunch of folders here. And all of these that start with a mipmap are your app icon folders.
So if you select the res folder, right click and open ‘Reveal in Finder’, it will locate that folder for you.
And if you’re working on Windows, then when you right click on the folder, you should find something that says, ‘Show in Explorer’ which is the equivalent of Finder on Windows.
But once we’ve got that folder found and we can open it up, we can have it side by side with the downloads that we had from the app icon.co website. And we open up the Android folder, you can see that there’s a couple of files that look pretty much the same as over here.
We’ve got a lot of mipmap folders.
So what I want you to do is to select everything inside the res folder that says mipmap, and you’re going to move it into your trash.
Now instead you’re going to select all the ones that came from your android folder, your download off of the appicon website, and you’re going to drag it in.
And now that adds all of the app icons that were generated from our website, into our project.
So we’re done with our Android project and we can collapse it. So onto the iOS project.
Now inside the iOS folder, we’re going to open up the folder that’s called Runner, not runner.xco project, not runner .xcoworkspace, but the actual runner folder. And here, we have something called assets.xcassets which is where our app icons actually live.
And you can see that at the moment, there are different resolutions of the Flutter default icon.
So let’s change that.
We’re going to right click on the assets.xcassets folder, and we’re going to, again ‘Reveal in Finder’ or ‘Show in Explorer’ and we’re going to have our windows side by side again.
And on the left the Runner is of course, our iOS app.
And on the right we’ve got the images from our app icons download.
And then we’re going to delete the assets.xcassets folder from our Runner over here.
So we’re just going to drag that again to trash or COMMAND + backspace, to delete. And then I’m going to drag the same one from the downloaded file into here.
And if you’ve done everything that I’ve just said we should now have app icons for both our iOS and Android app.
I’m going to go ahead and launch my Android emulator.
So now I’m going to make sure I’ve got my Android emulator selected, and I’m going to go ahead and click run.
And we now have our app showing up on our Android phone.
/* If physical your device connected via USB. And if I click on the home button, and drag up to show all of my apps, you can see that we’ve got our ‘I Am Rich’ app right here with the custom icon.*/
Now if you’re an Android user, you might have noticed that within the past few years, Google has pretty dramatically changed the styling of the app icons.
What used to be square icons with transparencies and different shapes, has now been pretty much unified into these circular icons. And you can see with our ‘I Am Rich’ icon even though we’re providing the right sized assets for the app icon, it gets this white circle around it which some of you may or may not like.
And in the wild, I’ve seen some app designers deciding to go along with this style, but others have decided to embrace the circular icon.
So I want to quickly show you how you can do this also. Inside our project folder, if we expand the Android folder and we go to app, source, main, then we’re going to right click on the res folder, gonna click on new and were gonna select ‘Image Asset’.
And then we get into our image asset configuration wizard. And we get to pick a path, or namely the starting image.
I’m gonna go ahead and pick our ‘I Am Rich’ app icon, and I’m going to click on open and then it’s going to show you your icon in all sorts of different configurations.
Square, rounded square, square called circle etc.
And what you can do is you can resize the image so that it fits into the space that you want it to be seen in.
If you’re going for your round icon, or your legacy icon, you can see in all of these scenarios, it still looks good.
The diamond is still within the circle.
So once you’re done adjusting, go ahead and click next. And then it’s going to replace all of the places we had our previous images with the new ones.
It’s going to be overwritten by this.
And that’s exactly what we want.
So go ahead and click finish.
And now it added the files that we’ve edited, and we can go ahead and run our up again. Now that our app has started again.
/* If your physical device connected via USB. I’m going to click on the home button, and when we drag up our menu, you can see our new icon fills the entire space of the circle.*/
And to my eyes at least, I think that looks a lot better.
It’s up to you which style you want to choose.
You can go for sort of like the calculator app, the calendar app style, where you’ve got your square icon within a circle, or you can fill up the entire circle with your design.
But these are the two ways that you can incorporate your Android app icon.
And if I run the app on the iPhone, you can see that my app icon has also updated to the one that I want.
So this is a really easy way of updating your Android and iOS app icons.
And if you want different app icons, then you can simply use a different image and only generate the iPhone sets, or only generate the Android sets and replace them as you need to.
So this has been pretty fun.
We’ve built an app complete with an app icon, with image assets, and all the good parts of any mobile app.
So now we have to do is to run it on a physical device. For all of that and more, I’ll see on the next lesson.