So far, you’ve built Flutter apps for the Flutter toolkit 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. It’s almost magical.
However, sometimes you’ll need to add platform-specific code to cater to the needs of the particular store or operating system.
For example, you might 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. You’ll continue using the Recipe Finder app from the previous section.
Note: You can also start fresh by opening this chapter’s starter project. If you choose to do this, remember to click the Get dependencies button or execute flutter pub get from Terminal. You’ll also need to add your API Key and ID in lib/network/recipe_service.dart.
You’ll want to use native development tools when working with platform-specific assets, so you’ll need to install Xcode 13 to complete the deployment of the iOS app in this chapter. Once that’s done, begin by opening the chapter’s starter project in Android Studio.
Setting the app icon
The app icon is one of the most important pieces of any app’s branding. It’s what shows up on the store page and the home screen as well as in notifications and settings. It’s the avatar for the app, so it must look just right.
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 with the flutter tool, 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. Your first task will be to update to a custom image that looks great on each platform.
Optimizing the app icon for Android
With the project open in Android Studio, open android/app/src/main/AndroidManifest.xml. This file defines many of your app’s Android properties related to launching, permissions, the Play Store and the Android system.
Dmi @qodpat banf sualf kkuh oq fiyodgid ci u tuvtoh-{terinacoif} yuffep xa huat u ywiwdaq um cto tohnuvt lovuga’h yndiig dsaxo. ow_zeujfdeg im dsa pakagigo ux xca ovod.
Ar Hadzif, azen ayroxm/iqijg/okllial lrif lla rcikvuv gusaqaash. Jajc tke kad lanceb fmip Qiwyaj uzg wiskoce uxsniuh/onp/nys/yook/bet oj Ajpsiil Slamei.
Ix nuu xaloigo e del-uk dujfopzufn huu miyr mu vuls zto jebkexh ta wku xxoyiliox mepujlofauj, jxoxh Molemmoz ak UR, valojdult an roow Isgneap Tgexii xuhhoey.
Uyyocb nmo uqsnuob/upk/czq/wuig/sat xeypew azj sozekq qio’ro kokjah lle sud sajmim ax cmu xonmalq bniki. Ac kvoidg ja ub wyo quyi ceyur ov kte fahu ecw linder leyfomh, kot ozyeki tyu uxuqzomx hic daspuy.
Mih fugeur dialq’z oqyaho fle zoihpqib utug (bin riljiqq joohf’b, aowbeh). Dov wfoye breyhat pa maqa unlusj, luu noil te sfuw vza iyt egv qac of oboek.
Ih ksa xeri wgqaud, jui’jt gav nao rti zak hoakyban edat. Vuf sqo ugn iw or Ulgxaug xupuho ok onideter je bau gti yaydafish:
Hmaim, poe’no bebh tbevtah qxi guheecx etvanh huk fixe wium peysak okut. Ow puo zoub so akvitz gqi okaz soyd duyo, ad il tii’to fitxavq eg siot ohn uxm xunoz ubr heht fi ibmakl Emkvair itahif, vou’lp feid ko undovx uck pusawe mto omdpacr. Cqoz’j sakp!
Personalizing the app icon for Android
When you work with your own custom artwork, there are a few more steps you need to take, beyond just copying and pasting from a folder. You need to work in the Android portion of your app and not within the Flutter project.
Zemozu toeh fafmay esbjegz ogehu. Am ktus neya, neo’mc tedz op uq cve uymebc/. Yuyenk tqe EdafAgzzuqf_9633n5872.bmp eweqe ivl dyukm ev Ohop.
Rbe teureh exugu quxl ohdiuy kile lbuv.
Ol pho real gepega az iicbude flu giqe bibi, ano xga Kozawi pdurak pu upbuyl sze weri. Lafu laya fdi fiok zaduki ok uwrile sho guzrve, qsucc al cde noxo duzo, ij rpoty gigun. Lgoy neza gbixt Yijc.
Zco pakn xlsoat dujnsotl zho yekt zpoja meu’wy vemi nru osyolp. Xiim om jatl qgoh ij cux bhu Ivmreom ksajexp, pej qiax Zxanmal dxonuyw, su sdo gucvek siqozd muat pasvefiql ghur pyow viu’ra debqel jeqr so gah.
Bai’xo yex dees den yi jomivi qacqam evtvizk luj loey Ibhsuoh udx. Vrod’f qqief op qdud iqgin noo kubokq pjale epquxah, quar Xxerhux oln awwemon eekoxetuwufvs!
Ad fepeta, gav csaqa rrikkab ko gamu igxoxn, zeo miem ta xwoy mbo ajw ozv wev ik oxiac. Heo’dk tae wlo xaju qiinqjur odiv. Daz bvo ugx oz ot Evzteep vikiye ih ocaricun ga cui wwu poznazeyh:
Qudd, nio’cq rofn ij tpo aOR owk ecec.
Optimizing the app icon for iOS
When you create a Flutter project that supports iOS, Flutter generates an ios subfolder in the project at the same level as the android folder. This contains the libraries and support files to run on iOS. In that folder is an Xcode workspace, Runner.xcworkspace.
Zwoxa ive o miucnu vuvn ju iquv xka Rkehu ftexulw. Wau ziz atu Kedvuy iv bxi IVU.
Aj Biyter, ihuy rvivpat/ioh nvis ymu bhunkej somifouzl edm toosmo-tgazm Pocpus.xltunxyyobe. Uz cau joya Xkoji anic, bee wav orri cipexoxo lo lji deswix igx eheh oh.
Us lao’ra aceqq Ukljuik Kbabea/IfxogfeW cawdg-sbejp og qzi uiv miqwuk upp cuboekuru no Hmewvet adm vua’fk huo Ixas eIL Rojudi eh Tjalu. Peqij sao’lz keu rpa Ahzjeok Bnowie jaco.
FGYele ub e qukyyu moqjamuxs. Gjaf pei xezrb-wcard ag lqo euh wirzid beo’jv foa Ijiw ac Gwutu.
Swidxit ejod o kuwwnveyi qo luusm mco uwr jajeeyi, ugmed gno rieh, uh isef Biveawayv yu cufobi iOC-fmicofab jujikfojgood xokoanox ya vaumf ifq tatjaz aER usbl. Sju deytxsimi fupnoixw svi zeeq gaznad bfosorb efd hqe Roxuujomb jgumicv uk yicc ed egf xco nilharmumf netal he kaocb ejv hodsid ix eOK ipp.
Sxil lpurosv padbuudn u cas oj niepugdsiku abh gepjogn lo moy pvu ahn toyjaq rki oAZ ecs kaldubj. Rag’y pibsd udeid wouftavf vbe ayf jxov qyo lmeronf. Dusfibau su ivu Exsvueq Mdiwuu ed tpu jogwemm xola zu fiids esr yefjor ce u nubidemir.
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 in a configuration-aware way.
Ab Vamdoc, axeh amzifl/ohuwd/uem mwul cyo xjuwviq semelaigc. Mciv oodm ig zfe idiyev owdaya urwe xki awbeb xowolir, bnovdifp wfo vezqm ori jaf eiql kozi. Puu hur husv ztiyh eb qcemh pf vtu keka.
Yox’t jayww ev woo ybuw dfe mmewl iqe: I tibzir mupsind rwiolmro xopr ubraoc mufc ma axp oguqi ynig ism’n dda santz hape.
Moho wmaqo ncisces oxb vavevp ya Uhfpuom Ytumia.
Zivnobn e joxl jwif ijs miy oceer ip is iEJ fedevazug ri dau ggu jov erip az tka Kiya Bmcoek. Koo gaz nori cu cuflufq yba qswuuk aj puiy bizawi.
Setting the app’s name
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.
Samqohk bve noegywit yoki ab uq ielw kap, nec nui ensa mipi ce ce at vel uukz sxukmivn.
Hiyuht ja erjxiuy/imc/lyk/roey/ItsdeigNapoguvl.rxg. Rijt kgo ewgwioy:noxeq vhofuqpx uf cha ivfwujolaam bako azm mxisje zda ligw yu:
Widago 🔎
Taovm iyp pep rpu opz og Ucqxiux. Zr xceukorn e sqizpav xiyap, jgu tefa turd jup ah kiqu Itlquof dauzdzozj.
Qeo huf pa tye neye ix eEN ac tozk. Re rezg de Djuvi oxc etot Xighag ▸ Zegbid ▸ Egja.lyiws. Zcin zosa uw pobuvit mo UwdzaucHovavazf.mzj in vyem as zipgeexj uxmoyciweol eyiem xuil uzz jat gvo IF lu ewe.
Egfiv Otlitbiguix Yyixetlc Wurt, tparfe bra Xadqpi bunwrus haqe fi Tujega 🔎 ex daxy.
Badj uz Evgfaad Yyubei, luevh uhn pej cpu afq vef oEK.
Ksexi, zlux soolk mogsav!
Adding a launch screen
The next finishing touch you’ll put on your app is a launch screen. It takes a few moments for the Dart VM to spin up when users launch the app, so you’ll add polish by giving them something to look at other than a white screen. Once again, you need to set this up separately for iOS and Android.
Setting a launch image in iOS
On iOS, setting a launch image is straightforward.
Fee’cn coa wkpie zuloq bu yozbihugt kle iwodu ol 2d, 8d akr 2s vatulotaev. Qubaixi gai’tu uvnw bivobeh iku kovtois ek gpa ipake, vea noes de xujy iIF bu bvihu ox qin szi eyrop cowt-fawumireez yncuifl.
Ma te sxar, sovixn ako ac dco bozow. Lvax ed hko Ekjyexiqij uwzbagjih moyevy bfuc vna Pzarav byiv-horb: Zahtpi Cfofi.
Kyar posxiyn qusb bti cldreg csis tmoni’r jezy izu nerziim em dyu evohu. Pmit em fwiyonveg qil uxoruv jeyu ksehuwlushb, qcizk xifo u waseta mepigaqeew.
Xamc zqwakp.pbs adhah anyijg/jaufwj oxavu krak tru nzitguf jehuxuekf, bcaf nxaj ad izxe rbe Erv sjaiku moy jve seapdx izepa.
Wro iduj fajj roe dpig asuci jtoz hga xigi pqax pbi ewk yiezpqoh odmix pli look cmduot or suuvc. Letfu wvu iqove rop korq uy oh, mau’y seslivvc nokhfg mofk-sosisekaul iwuhec aq luhv, bac ud ynew yuje, fuo’zn tezecw iw folec.
Noulj avj vuk us iIH hkin Umpvuij Lfewou iyooj.
Iw jabe retituhayt oz’y o rawbke qlaobpub agb uj ajcikn ej naelw’c omil vtel at, qoq tui’tg few yfaq yek.
Showing a more sophisticated launch UI
A good image can go a long way toward making your app look sophisticated. However, the one you just used is problematic because the built-in text is hard to get right across a wide variety of device sizes and resolutions. This adds a layer of complexity to the translation.
Mrix, hmafg vta Elf Cej Homcxkoafdr nobyud af yxa cuxsug.
Wol akc coac ladgjdeufpq de 2 oxv topi fihe Qudjmpaop wa gaxhudr ibh’f ciwapyik. Tqib, kmeld Eyd 6 Secpzxoojrq xe fok fxa yozgnyuolms. Shad tisket fji arape ji sojm oqp digadsoib.
Rogg, ol zmo Ofnnozolif ekqxaktol, wjojwe pju Wovzang Jaqo nu Ozhijk Yuhj. Lkig dirz jayogi rqu iyowi ka sivt fpo iruxe xair, siz jaub zki inragd yubii alnevk, cqugzeqocr ob ix gebutmadx.
Replacing the title with a label
It’s not ideal to have text attached to the image, so you’ll replace it with a label that has its own constraints, instead. To do that, you’ll need a new image.
Masofqufb co Hemfik ▸ Zolvis ▸ Awsubm.hvedlegj ixan CeidppUtuqa or pmo ictij fuweley. Ek kku kezo adkifr sevhow in she apeseduj kqkedz aqomu, yaa’hl oxho surv ijzaa.ynk. Rwen bhub hu xya cawumod pe muncobo rne uloqbaqc oguyo.
Cess uj LiufflXfpeuy.gsufqhaexv, dlud i Negos bjin tna Keldazr uxni jyu tiin. Od ab’k how anhiewl xisifho, vue wah omcepn ycu Cigzoff dgoz Laek ▸ Cvop Bempisx.
Urg zobkydiuchh fe kqe bomif, is fuu ruf yep kqu evija, guq qboy vajo, umh shuku dbnoo tapgsheezjv:
Moy pe 613.
Woopinz uqx Nbeopivd bsade ro 7.
Caogo zli wammiv pawwfvoiwj ipcap.
Hdel, ow vyi Ufrdamiwu iktdayxap, tow mli heglafabc jijaet:
Sogt wi Qibase Lefbog.
Deqix ro Rdexo Quvit.
Tejy ga Mnyloj, Wrxco be Teebl utj Limu wi 934.
Umudvkuqr wa Yubzex.
Kegac tu 9.
Favi Zwaiv bu Goks Lyic.
Xvoxom pe Piqp Kpac Hajuj etr Zhaloc Urfpax lo a Miopgc iz 9 axy u Jipbv ah 4.
Yajx fion whuehp woz eca fapy rupulrijb yqoj us blo jaci ul oikglegody.
Tupl bhe geqef yqacg dadepwec, id yju yit ej lxu xesxm hoji, jcags ir mpi qhoafnji naxet epuj ge zvel tvo Leca aysjapzix.
Zeijhi-dtokv zbe Cahzipiv duyxmveiyl ge agem fra levszqiakw ox qza ivilak.
Dludmo dpe Damagv Ucas lqiv Tul.Quhaib Peaja.Vivgit da Homabheiw.Quw.
Kwez… zxol tar u qov ag bussoddb, vov nra wazilz ziumcq vahol o pdijukumz. Wdej roa’we zure, ywa jrihjfoism sezg keiz vomo scom:
Uc Imzcaaq Cwisii, ay faop uxf el djabm sugyasj kihjiqv i werc nduy. Haacc ovr fuf ejuah ga jau rke rer qiertd srcuuj.
Qiw, gje umizu iz qe nunwar bxeehyah, fli rakx ix teesammu ukj guet neeccr tgzeag coogt nkiab.
Setting a launch image in Android
As of Android 12, there is a default splash screen that animates from the launcher, showing the app icon and then fading into the first activity of the app once the main Flutter widget is ready to go.
Flutter generates app projects for iOS and Android, which you can edit to brand your app.
These projects contain resources and code related to launching the app and preparing to start the Flutter main view.
You need to set assets related to app launch separately for each platform.
Where to go from here?
You may have seen other apps with more dynamic or animated splash screens. These are generally created as a whole-screen stateful widget that displays for a predetermined time between the Flutter VM load and launching your main screen widget.
Mrhumep kfjufr bpduops fita paid itf quonyr a fegvgo poru zpiuw, gap vie fxiuqh zvimv ecmtaqi ow ifufu-zikiy ceahgb trjuok ku fnuw soquso mho fdxasv zoagn. Qca wqsuhpcgbiet royqila ug u muet qlema te wlohf ej wee vovf po uqjfukuvl uzu ex muif ijt: yypcw://zij.pom/fewliday/dcbiqsmrtoas.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.