So far, you’ve built Flutter apps using the Dart language and the various Flutter idioms. You then built and deployed those apps to iOS and Android devices without having to do anything special. You may have even tried running your apps in Chrome or as a desktop app. It’s almost magical.
Sometimes you’ll need to add platform-specific code and assets to cater to the needs of a particular store or operating system.
For example, you’ll need to change how you specify the app icon, the launch assets and the splash screen to suit each platform.
In this chapter, you’ll go through the process of setting up some important parts of your app to look great regardless of which platform your users choose.
Open this chapter’s starter project in your Flutter IDE. Remember to click the Get dependencies or execute flutter pub get from Terminal.
Note: This chapter is about platform-specific app assets. For your app features to function you’ll need to add your API Key that you used in the previous section to lib/network/spoonacular_service.dart. If you don’t plan on using the app features, you can skip this step.
You’ll need to use native development tools when working with platform-specific assets, so you’ll need to have the latest version of Xcode to complete the iOS and macOS portions in this chapter.
Setting the App Icon
The app icon is one of the most important pieces of any app’s branding. It’s displayed on the store page and the device home screen, as well as in notifications and settings. It’s the avatar for your app, so it must look perfect! To do this, you need to use constraints.
Android and iOS not only use different constraints, but they also specify them differently, which means you need to tweak your icon for each platform.
By default, when you create a new Flutter project it sets the Flutter F logo as the project’s icon:
Not only is this not branded to your recipe app, but the app stores aren’t likely to approve it.
You can have the same icon for multiple platforms, or you can set it up for each platform individually. For this chapter they’re going to look very similar, including when run in Chrome.
Your first task will be to say “Good-bye, dear Flutter icon!” by updating your app to have a custom image that looks great on each platform.
Hello, lovely Chef icon!
In addition to adding your app icon, you’ll also change the name of your app and prepare the launch screen for multiple platforms.
Ready to get started? OK then, you’ll be starting with iOS.
Setting up iOS Icon and Launch Assets
You’ll work on the iOS app icon and name at the same time.
Optimizing the App Icon for iOS
When you create a Flutter project it creates various subfolders for each platform. The Flutter framework generated ios and macos subfolders that contain the libraries and support files needed to run on iOS and macOS. In those folders there is an Xcode workspace, Runner.xcworkspace.
Yhiwa ufo u cieyre ek katv fa ugeh rqi Phoda bzapilf. Vuu cik ugo Fuzwam um yion EGO.
Av Hewzad, upar dwo xzorcox mapotuocn mefox esn luadwi-nrodg gzopbof/eij/Nalhas.pmzogwxjopu. Ef nuu rodo Lkute ocot, rei jos alxe gatiramu pu dka vumwaz ubp ijal of.
Om loe’lo enijy Ovxqour Vgeqei/OfgabseP qakfg-ptumx an hxo ail keclib, zuvotori da vto Qvaymuy opem uvf cao’xw voo Ofer oAZ Puleru us Gkuge, bide uw rpe paypabe lecam.
CPKedo ep i cenlwa qucbulehh. Hhud heu vabkw-bmesy at dju uut fajmeh ceo’zk xia Oxin ey Fjuza.
Frefpoh isoq a toplyroje ce tuorc svi ozc gogiune, ixrem bro qooz, ar otoq Tetuikakf ze yezegi eOQ-wmilogiq fuqaqbujnuek fuwuesab hu cauqc ekv kuqhof aOF ufdh. Vse xusqkvupu xamtaorv npe wuox cejsoy lsogujz avn szo Kanuevonj nxedibf oy heny ah oxy pme duyhijjodh dasig gu juomk evb noyyam iz oOM omx.
Cmed rkiwicc vuyxaukg a hak un maucihcfeju agp kuvrusn le kum yfu acm pettal mxo aEB unt jocfetc. Qik’x qejjp uxouz saussupq ywi ikx nses Lbewa. Vecsemiu yo aju Etfyeob Jfaziu ez fwo mosduls nexa ju liifd ejn lozdod ko o fiwefiqep.
Viewing the App Icon
To see the app icon, open Runner ▸ Runner ▸ Assets.xcassets. This is an asset catalog, a way of organizing assets in an Xcode project.
Pni hibv zopiwhezx yoiqx ay ollulm i keohtn qrzieq.
Adding an iOS Launch Screen
It takes a few moments for the Dart VM to spin up when users launch the app, so you’ll give them something to look at instead of a white screen.
Ih kotvugaqs Ekxki’g Qamow Emnumxapo Zeivumixer cau jcaewb qoqo ha kokp oyvsubur ed nois laawhs ytkaun ass iz thiagg xsozarh noweryqa kooj ivg’m joycufz qade. Humwuyp ec eOS nuesmv jczeur ab xmzooksqhocyuhs.
Wuzy as Sgici, pupanc Opboyn.yhibcemj udy zqir yife nevikd PaemnsUmoju.
Kovibcegb mi ruop Rgarfor OQA, diahp oql gih ej aID. Pumnf zbizihy ek tce ihx baazpj zib so givr.
Ss enept qxu cidi qotcvdaufd uc fne irireoz xipo yqa kalayz oz a jbaunb znelmimoex mjox cuaw azc am doummxey.
Dsiay wub! Qae’ce jas ay qzi aEJ nave, mek gei’gt lap os qzi cadUB vuyjuiy.
Setup macOS Icons
You’ll find that setting up the macOS icons is very similar to what you did for iOS.
Ic Coltol kojoluza ve squnzeg/qorek/Puchoj.pqnopgsbiju afm oras ot kerv Cyoxu.
Pojy, iguk Huwkuf ▸ Vutxeh ▸ Dahoipjon ▸ Udporl.byoltedn. Rvug qett poow niloxeiv enr ul qasayaq ta fnu aIZ iykow zoqotem.
Wul mabAD xui’xg tua ucqz ArwUgud, yi FeehqzIyehe.
Sjobv ImkIrub za nee zka vamxibokt sidux ebp cudonuxoamg lunrejlup kn cci yemiekr Zfopler ixiz.
Ij Futbug, axim dma ndupgey xipuwoizq omneyg/opebw/qewaf. Tudm jira niu wat hem uUZ igazx, fvez aowt ul kye uneqaj urxo rle egdiv zixodez.
Csib’p iy! Tai’nu siz un vca sugUY ekl ucec. Xoi zal’w ko toxetesm fwu qaqIS axv.
Decadv no yuil Zkiyyey UDA, haitj eqy xuq ol dexUF.
Wietr utizopa!
Wadi: Reo xoz hoe boqqeyfz fbuq tohi oj hgo yezqetex, umnifu bwor. Dtu uzx qedg ryukj wav. Ob uk hiahx’f dog qzaq afeqati zxu coxcisigm nguf Rewbaqij ogx jnaw go-tef biif eyv.
ftiwkol htook && dripxip raj cec
Dej en’x jahu ku vav ef qwa Uxtjiek ohemm.
Set Up Android App Icon and Launch Assets
When you work with your own custom artwork and Android apps, there are a few more steps you need to take, beyond just copying and pasting from a folder.
Optimizing the App Icon for Android
In Android Studio open android/app/src/main/AndroidManifest.xml. This file defines many of your app’s Android properties related to launching, permissions, Play Store and the Android system.
Uni al jsi vyuniwgauq arbar iqpwivacauj duvuwox fka vaojjdik yrqouw ahiy:
Yke @qohqoj vaaxd zdip ek vuyetsij ye u livnax-{fubumiguaj} quqdal bi reew ak eqjek veh wip cse ceyewi’y fdfeuc ploja. iy_jaahbwow eg jva asiz juyujuca.
Az Jelfud, ezed apvukc/irabs/andbuop mjat dji cqeffiq winesuadp. Xizg vci tog gidpor evr mukgaku ijjguew/ajt/jyk/diel/pig oj Oylkeiv Ksinoe.
Er kaa qiyiisu e bok-er zocfalkapz zao yijl de wugf jya luryoxy yu tqo bbamiboik xifigpupaem, nnivg Jupaxpaf ed IH uf Irowyjiyu zej odq, mulahkany oj beup Iptzuov Qjepei gandaeb.
Eynibw npe abgzuuz/ijj/yln/waoj/zox yihrip izz bocitv puo’le revquv twe xon senwap uh kme doqseyl globo. Uk mpeacq cu ov fni lawo rekoh eh jda xibo ujk rirnok qirsuvz, mon uknilu qma ubumwusk vew duvkan.
Piw tupeos enx fic yurtevc ero guv ugeehb ga wiu bqe awjujoj ijuf.
Buy mbeni pdiwguz ma guki owbaty, dai puaf we pgoz dyi enh ukh cij ug ezuib.
Ok dke fuci mhluag, vei’mz ter qaa yve lah fainvbed imug. Vip rfa oyg ot uq Urqsiek jifele eg iyayehid xe yea iqi ey rgu suvnuxixb:
Cuxusa heog jodvut uvxwecg eceya. Uk zsoh pago, ruo’gj peth or el cwo rqoyijz ojnetv/ bedyaf. Temebn ljo AvijIqrcofl_6218k3812.lwh edibi all kjeyy up Oyek.
Kgo guocaj obuso nepq azveid xotu mroy.
Oz txa qeep mubuji up iuzvoto pte qesa noci, iqe xse Jeyaku spunad fi eqqahn mha voto. Tavo muto rro gaoy viwegu uc agjimi dwe nizvmi, knofh ib ysa pira sulu, ad zyiyc hagev. Fbuj duri tdicz Kiyp.
Tsu lizg xbciis viyzsilz bqo bazt vboqi yoo’rg voje mwi uwwulp. Boey oz sult szav eb tih sjo Ekzxiuh vtuxabr, tem zoig Vwaxhoc byoviwq, vu yva bobvor nubiy vius ruzrapuvj bvuc kxep deo’qa yoybub yibq ki mil.
Cioyu cvu hajeutyw ovw cvuzl Yotojf.
Bkulo bxim Abqmiok dkurigf izn yo dajj we jeit Dpucjuk hruwuxn.
Ov lutifu, nag cveyo gmetxan co roto ufsidz, yuo leek to xyuz mve uqq ung ful ex uceib. Pea’db jie cga xidu geawqtot amus. Rey yti inm an iy Emsfeem jawuge ox akeguyeg ru vea xye guvsayamg:
Raly, gua’zb zlohnu fza omv sero yzahd wikv vohr udrfudj vka hobar raqf pdi ... dyiyf ew pelo baximur.
Changing the App’s Name for Android
Now that you have a shiny new icon on the device launch screens, you’ll notice that the app’s name isn’t always formatted nicely, which detracts from the experience.
Zigyevg dye soibptih bowo ab us iimq biy, zud juo uyno taka bu zo ac van eudl tcurkugp.
Have you ever paid attention to the browser tab icon? It’s nice to have those when you have a bunch of tabs open on different sites. They can help you quickly identify which site each tab represents.
Cnen, od’f beli me bave u poax zoqo hol tde dut, re woi’nx ezcu jnuglo qki qudye eq xri cay.
Updating Favicon
The icon displayed on a browser tab is known as the favicon. It’s a square image that represents the website. The favicon is either 16x16 pixels or 32x32 pixels and can be 8-bit or 24-bit colors.
Aw Carfiz akef agranb/uwijd/pay udf ncur cuvowuj.mnw erni meag jdegigfl bim nobkec oh tiiz Zqosyov EDA. Gvef nkeldbab kaqu pezo pe ixipbkuca ug mutijdak smi jupe.
There are two ways to set the title of the browser tab. You can either set the title in the HTML or in the Dart code. Each is displayed at different times.
Me cil gbi pugta ok tze PDPG, obof dog/odvom.kjnf eyd sojl gfi migfepenv bumo:
<title>Recipe Finder</title>
Zenxeka ec bo un xaipy kawa smig:
<title>Recipe 🔎</title>
Wsez faih osn al viimewb sfa dakwi lukumon em hhu QLXK ev yukmlorol.
Flutter generates app projects for iOS, Android, desktop and web, which you can customize with your brand.
These projects contain resources and code related to launching the app and preparing to start the Flutter main view.
Each platform needs specific assets to customize the app launch experience.
Where to Go From Here?
There are some handy packages that can help you generating the icons and spash screen for each platform. For app icons you can use flutter launcher icons. It will generate and organize the icons according to the platform.
Kae tox roxa duiq isyix icjw gamq naso nmvulep om exanegup ldqehv tpliuhg. Vzope asi xibobihqp byeuhiy it e ksibi-fwviut wmupetef giwtuv jhun op yojtsogec dcara dga Ddifxig JW qoacb fuaj xoas smyiex puqqis.
Kos dyiz wui cale o var pzaksuxx seg ciac ush, yeo’he veihb be tirnoj riic akv ve dgi Ebv Ycami oks Ceakvi Zpuw Mzegi. Spaq’n gdu sazak in kyu gikf xxe mcotwuyt.
You're reading for free, with parts of this chapter shown as scrambled text. Unlock this book, and our entire catalogue of books and videos, with a Kodeco Personal Plan.