All right.
So now that we've pretty much created all of the interface of our rich app, we have a scaffold with
a 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, it 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, right?
So how do we give our apps an app icon?
Now, first things first.
I want you to go ahead and download the image app icon.
From this current lesson, there's a file that you can download, and once you've downloaded it and
opened it, you should see an image that looks something like this.
And then what you're going to do is you're going to go to a website called app icon.co and you're going
to drag and drop your image that's pretty large into the placeholder 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, and we're only going to generate icons for the iPhone
and Android.
Go ahead and click Generate and you should be able to download a zip 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 dot assets 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 source, then you go into Main and finally you're going
to raise.
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 rez 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, right?
We've got a lot of mipmap folders.
So what I want you to do is to select everything inside the rez 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 app icon 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 dot
Xcode project, not runner dot Xcode workspace, but the actual runner folder.
And here we have something called assets Dot assets, which is where our app icons actually live.
And you can see that at the moment they're different resolutions of the Flutter default icon.
So let's change that.
We're going to right click on the Assets Dot Assets 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 dot assets 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.
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 image 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 image 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.
So back in Android studio, head over to the left hand pane and I want you to right click on the project.
I'm rich.
Go down to Flutter and then click on Open Android module.
Now open up a new window and then once your project files have loaded.
Go ahead and expand the app folder.
Expand the folder.
And then right click on the rez folder and go to New 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 going to go ahead and pick our image 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, squircle circle,
etcetera.
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.
So if you want to view those icons that you've just added, go ahead into the Mipmap folder and then
into the icy launcher round.
And then you should be able to view all the different sizes of the images that you've added.
And now it added the files that we've edited and we can go ahead and run our app again.
Now that our app has started again, 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 all we have to do is to run it on a physical device for all of that and more.
I'll see you on the next lesson.