So I'm reallyexcitedtoofferthistoyoubecause I'vetakenaboutsixoreightmonthsoffilmingandcontentcreation, and I'veboileditdownintothiscourse, andwhatit's meanttodoissaveyoutimelearningflutter.
Ifyouwanttoagain, goseeothervideos, checkoutflood a crashcoursedotcombutwe'regoingtonowstartourfirstlesson, whichisChapterone, whichiscreating a basicscreen.
Andsincetheseairreasonablekindofpiecesofcodehere, we'regonnamakethisinto a widget.
So I'm gonna, uh, takethetemplateofthisfilelikealltheimport, theclasshere, thebuildmethod, and I'm goingtocopyit, and I'm gonnacreate a newfilecalledTextSection.
We'regoingtodefineanywhereelseintheappsowecankeepitlocaltothisscreenisgoingtopastethisinandwehave a nicetemplateforourstatelesswidgetwe'regonnabuildwhichisdefining a textsection.
We'regonnanameitlikethat, Um, andtheninthelocation, detailsscreen, I cancopyorcutthecontentwewanttoshow.
I'm gonnasaycontainer, and I'm gonnasayreturnhereandnowwecanjustupdatethissowecouldsaytextsectiononweakenDefineLet's saylet's saythreeoftheseitlater.
Andtodothat, I saythetypeofmemberitis, whichis a color.
And I haveanunderscoreforthenameofthememberbecausethatunderscoremeansthatit's gonnabeprivateesogonnasaycolorandtocustomizeit, I'm gonnacreate a customconstructor.
So a constructorletsmecustomizehow I am.
Stan, seethisclass?
So I'm gonnasaytextsectionbecausethat's thenameoftheclass.
Sointhisvideowe'regonnafirstimportanactualimageassetlike a filelike a JPEGfiletoourapp, andwe'regoingtoincludeitinourpubspec, theammofile, andthenwe'regonnaimplementitlater.
We'regonnapulltheimagefrom a u R l Sothereshouldbeprettysimple, butwe'regonnacoversomethingsyouprobablydon't knowaboutyet, likeconstraintsandhowtolayouttheimage.
Sotospecifytheheightandflutterordarkwe'regoingtouse a doubleand a doubleis a certaindatatype.
Youcouldseeitherethatjustbasically, ithas a decimalpoint, that's all.
That's allyouhavetoknow, soyoucansay 200 likethis, butsometimesthevisualstudiocodewillgiveyou a warning.
Youdon't alsodolikethis, butusing a decimallike a properdecimalevenifit's 2000.0, wasprobablybetter.
Um, andthat's constraints, Sothat's we'llseehowitworksin a second.
Butconstraintsisgoingtosayexpandsallthecontentuntiltheheightis 200 we'regonnahave a decoration, andwe'regoingtogiveit a decorationof, ah, backgroundcolor.
We'vealreadycoveredthisandtheothervideo.
Wecouldjustsaygreathere.
Um, thereasonwhywe'regivingthecontainerofbackgroundcolorisbecauselaterwhenweloadedasfrom a girlIfthatyou'reallfailstoloadtheimage, westillwanttoshowsomekindofplaceholder.
Um, notjustwhitespace.
Sothat's justthedecision I made.
Um, youdon't havetodothat.
Sothechildnowisgoingtobetheimagewidget.
Sowejustsayimageandtousetheimagewidgetwe'regonnausealso a namedconstructorandrememberandnamedConstructorisgoeslikethenameofthewidgetandthendotandthenthenameofthatconstructor.
Sointhelocationdetailsscreen, wedousesomethingcalled a column.
Wealreadycoveredthatinthelayouttovideo, buteachtextsectionwillhaveitsowncolumnbecausecontentislaidoutfromtoptobottomin a columnformat.
Soit's gonnabesummaryandthenthisbodyoftext.
Soinsteadofcontainerhere, let's implement a column.
Itsgonnabeitsowncolumn.
MainaxisalignmentsisgoingtobeStartmeetingwth E.
Eachchildisgonnabelaidoutfromtoptobottomsequentiallywithoutanypatternacrossaxisalignmentwillbestretch, So I wantedtostretchtothefullwidthofthecontainer.
Soit's a summary, somethingoneandthensomethingtoendsomethingfree.
Solaterwe'regonnamakeallthistextdynamicit's gonnapullfrom a Webserver, a p i M p I runningon a Webserversomewhere, And, uh, we'renotgonnahardcoatanythingliketheimagenamesandallthatsocool.
sotoaddpaddingtoeachtextbitoftexthere, we'regoingtowrapeachtextwidgetin a containerwhichitthecontainerwidgetletsusdefinethatthatthetextdoesn't sotoaddpaddingto a container.
Sowewanttocontrolpattingontheleftandrightandthetopandbottom, andit's gonnabedifferentforeachweregoingtosayconstant, whichis a constantedgeinsectsandthenfromlt R b.
Sothat's a specialnamesconstructorforEJinsetsandletsyougranularreallydefineallthatpadding.
Sobecausethiseachthistextsection, whichitisgoingtosharethesameleftandrightpadding, I'm goingto, forsimplicity's sake, define a constantuphere.
Andit's well, it's gonnabe a staticconstant, Um, and I'llgettothatWhyhasbestaticin a second, butwe'regonnacallithorizontalpaddingandfromjustbrevity.
Because I usethislot, I'm goingtosay h padandpeopleusuallywillfigureoutwhatthatmeans.
Thereasonwhyit's staticisbecausesince I'm using a concerthere.
Itjusthastobestatic.
I can't.
I can't.
Yousee, if I removeithere, I can't define a constant a cz a memberof a classhere.
Um, forthetopofthebottom, I'm justgoingtouse a customvaluesinterviews 32 4 Youdon't reallyneedtospecifythedecimalpoint, but I justliketo, becauseit's a doubleandjustmoreconsistentthatway.
Andit's justgonnahavedifferentpaddingbecausebecauseofthefactthatitis a justbasedonthedesignoftheAPPisgonnahavedifferenttypeofpaddingsothatpaddingwillbeLetmelookatmynotes.
Basically, allthemainoptionsfor a generaltechsteamand I won't getintoistoomuch, butforthesakeofbrevityinthisvideo, I'm goingtofindthetextingthat I wanttouse.
Andinsteadofhardcoatingintomyfilehere, I'm goingtodefinethetextteamin a separatefile.
Soit's nicelyorganized, butfornow, I'm justgonnatypeinwhat I wanttoimplement, andthat's gonnabeatbartextstyle.
Thisisgoingtobesomething I defineas a customthing.
Uh, injust a moment I'm gonnanow I'm goingtoimplementit.
Sotoorganizeyourstyleproperly, what I personallytookwedois I create a filecalledStyleDocDartandthatstylethatDarkisgoingtodefineallthestyleofmyapp.
Andwhat I'm gonnadoisinforitsmaterial.
And I'm gonnadefinesomeconstantsatthetopbecause I'm justgonnapasteitinhereandwhatthisdoes.
Itletsmekeepmystylefileverysuccinctandclear.
So I'm definingspecificdifferentcategoriesoftextsizeisandthenthenameofthefarm I wanttouse.
Thisisthecorefamilyname I definedinmypubspec e m o phile.
So I'm gonnapacethisinhere.
Thisisgoingtomeetmyappbarstyle.
It's gonnabeitagain.
Andit's a textstyleanditworksagain.
Itworks a lotlikeCSS, soit's veryeasytofollow.
Has a fontfamily.
SoreferstomyFontaine, Montserrat A Wait.
Soforfontwaitinflutter.
Youcandefinedifferentfrontwaitssotheyallgofrom 100 to 900.
Andbecause I definedonethat's called 300 inmypubspecammofile, Seehere I canusethat.
Wait.
Sothat's thefront.
Wait.
Andthenthefontsize, it's medium.
It's 20 andthenthecolors.
It's justgonnabekindofwhitebecausethefactthat I have a coloredknavebaruphere, So I'm goingtosavethat.
Soforlet's say, thetitletextile, it's notgonnausethis, uh, certainelementsofthisSoit's notgonnabelargeyet, sototokindofdeliberatelysayheyforthistitleherelets a summaryone I wanttousethetitletextile I havetodeliverLeegointomytextsectionwidgetandwe'regonnahavetoupdatethat.
Theinputofthedatawouldbe a listoflocationsthatcanbeshowntotheuser, andeachlocationcouldhave a listoffaxofthatlocation, likefun, interestingthingsthatyouwanttoshowtotheuser.
Soifwewanttorepresentthatdatainourapp, we'regoingtocreatetwoclasses, a locationclassand a location.
Factclass, andwe'regonnahave a relationshipbetweenthem.
So, um, themodelalsorepresentstherelationshipsbetweendifferentpiecesofdata.
Sothelocation, modelorclass, ifyouwill, willhave a listitem a member.
That's a listThedartlist.
That's gonnabe a listoffax.
Sothere's a onetoomanyrelationshipbetweenlocationandlocation.
Wehave a singlelocation, detailsscreen, it's gonnaload.
We'regonnasay, Hey, justgiveme, like, from a listofgivenlocationsbasedon a location, identifyheror i D.
We'regonnaalsoaddthatinthislesson, giveusthenameofthelocationandthenrenderitinthenavigationbarandthenforeachlocationfactagain, it's a onetoomanyrelationshipbetweenlocation, location, factrender a giventextsectiononourscreen.
Sorightnow, asyoucanseeinmysimulator, I havethreetextsections.