Practical Flutter.pdf

所需积分/C币:50 2019-07-22 13:53:52 5.17MB PDF
收藏 收藏
举报

From the Back Cover Explore what Flutter has to offer, where it came from, and where it’s going. Mobile development is progressing at a fast rate and with Flutter – an open-source mobile application development SDK created by Google – you can develop applications for Android and iOS, as well as Goog
Practical Flutter: Improve your Mobile Development with Google's latest Open-Source SDK Frank zammetti Pottstown, PA, usa ISBN-13(pbk):978-1-4842-4971-0 ISBN-13( electronic):978-1-4842-4972-7 htps:/ doi. org/10.1007/978-1-4842-4972-7 Copyright o 2019 by Frank Zammetti This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse ofillustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights While the advice and information in this book are believed to be true and accurate at the date of publication neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Louise Corrigan Development Editor: James Markham Coordinating Editor: Nancy Chen Cover designed by e Calamar CoverimagedesignedbyFreepik(www.freepik.com) Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax(201)348-4505, e-mail orders-ny@springer sbm.com,orvisitwww.springeronline.comApressMedia,LlcisaCaliforniaLlcandthesolemember (owner)is Springer Science+ Business Media Finance Inc(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation Forinformationontranslationspleasee-mailrights@apress.comorvisithttp://www.apress.com/ rights-permissions Apress titles may be purchased in bulk for academic, corporate or promotional use. ebook versions and licenses are also available for most titles. For more information reference our Print and ebook bulk sales webpageathttp://www.apress.com/bulk-sales Any source code or other supplementary material referenced by the author in this book is available to readersonGithubviathebooksproductpagelocatedatwww.apress.com/9781484249710.foRmore detailedinformationpleasevisithttp://www.apress.com/source-code Printed on acid-free paper www.allitebooks.com Id like to dedicate this book to butterflies, which flutter in the wind No, wait, that's too easy Id like to dedicate this book to gamblers who, the british people might say, make a flutter on the horses es, that's actually a real usage of the word flutter, but that too is too easy no, Id like to dedicate this book to all the unknowns the human race has yet to discover and, in some cases, create I am a pessimist by nature, but I fight that nature each and every day because i also recognize that the universe is a wondrous place and despite what the evening news tells us, the human race is capable of great beauty and wondrous creation And, with my stated goal of being immortal, because death just isn't me -it's been done before, so I'm just gonna go ahead and skip it-I look forward to seeing it all www.allitebooks.com Table of contents About the author About the technical reviewer ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ XII Acknowledgments ■■■■■■■■■ Introduction Chapter 1: Flutter: A Gentle Introduction.ammmmaammmammmaammmammnmanna 1 Meditations on the abyss.mmmamamaaamamaaamaaaanaan What's in a (silly )Name? Dart: Language of the Gods? Widgets to the Left of Me, Widgets to the Right! 8 Brass Tacks: The Pros and cons of flutter 13 Ok, Enough Talk, Let's Get Going with Flutter!.mmmmmmmmmmmmmmmmmmmm. 17 Flutter sdK 17 Android studio0…19 The( Slightly Less)) Typical“"Helo,Word!"App………,…, ■重重,重面重D重 20 Hot reload: You 'll love Basic Flutter Application Structure.mmammmmammmanmmmmmnmnmmmmmmmmmmmmmmmmnmn 31 A Few More“ Under-the- Covers” Details. 35 Summary…… 36 Chapter 2: Hitting the bullseye with Dart ■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■口■■口■■ 37 The Things You Must Know 38 No Comment: all about comments 39 Nothing Stays the Same: Variables.mmmm.....mmmnammnmemmn, 41 Everybody Has a Type: Data www.allitebooks.com TABLE OF CONTENTS When a single value Just Won't Do: Enumerations What's Your Type:The“as”and“i!” Keywords..,..,51 Going with the Flow: Flow Control (and Logic! )Constructs. mmmmmmnmmmmmnn 51 The Big Nothing: void 54 Smooth Operators........................,…55 Classing the Joint Up:0 bject orientation in Dart….,,,,……58 Getting funky with Functions Tell me Is t so: Assertions 71 Out of Time: Asynchrony.mm.mmmm..mmmmmmmmmmmmmm 7 Ssshhh, Be Quiet: Libraries (and visibility) 73 Let's be exceptional!: EXception Handling….,……74 Have the power generators mmm. 76 Metatude: Metadata mmmmm. 78 Speaking in General: Generics 79 Summary Chapter 3: Say Hello to My little Friend: Flutter, Part I maar ■■■■■■■■■口■■口■■口■■■■ 83 A Buffet of widgets 84 Layout....…84 Navigation 97 nput......,,108 Dialogs, Popups, and Messages…… 124 Summary 134 Chapter 4: Say Hello to My Little Friend: Flutter, Part I mmmmmmm 135 Styling Widgets Theme and themedata.……136 0 pacity…....,138 Decorated0X…138 Transform,,,,…………… n139 Animations and transitions Animated Container Animated TABLE OF CONTENTS AnimatedDefaultTextstyle nananemnaenmneennennnnnennnennnnnnmnnn 144 A Few others: AnimatedOpacity, AnimatedPositioned, PositionedTransition SlideTransition, AnimatedSize Scale transition Size Transition and rotation transition 145 Drag and Drop..,.,..,..,.,,,,,146 Data views 147 Tab|e,…147 Datatable mm 150 gridview .mmmm 153 Listview and listtile 155 Miscellaneous 重面重D重重■面重D面重a重■面重D,面重夏重,重■ 157 CircularProgresslndicator(CupertinoActivityIndicator) and LinearProgressIndicator... 157 cOn…………158 Chi ■1D面重D重a重1面重重重■面重D重a重■面重D重■ 162 FloatingAction Button .mmmmmmmmmmmmmmmmmm..m. 164 PopupMenuButton. Wither APls? ■重重■面重D面重重,■面重D,面重夏■重,重D面重D重 Core flutter framework libraries ,168 Dart libraries 171 Other(Support Libraries...mannammeannammmnnmmmnnnm, 175 Summary.amm. 177 Chapter5:F| utter Book, Part,,,…,…,,…,:179 What Are We Building? Project Kickoff1…...................182 Configuration and plugins.…,,,,,,……182 UI Structure 184 App Code Structure mmmmmnmeammaannmmnmammmnmmnmammnn 185 The starting Line.....,,,,,,,……186 Some global utilities On State Management………..192 Starting with an easy one: Notes.mmmmmmmmmmmmmmmmmmm. 197 TABLE OF CONTENTS The starting point: Notes.dart.,.,.,.,.,,……,…,197 The model: notes model dart …199 The database Layer: NotesDBWorker dart 200 The list screen noteslist dart 206 The Entry screen: NotesEntry dart 212 Summary ■D面重DDD重夏DD重夏D面重DD面重夏D■D重夏D,D面重DD面重DDD重,D重DD面重D■ 222 Chapter 6: FlutterBook, Part ll ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 223 Get“ Er Done: Tasks…223 TasksModel TasksDBWorker, dart mm.. 224 Tasks. dart…… 225 Taskslist dart ,225 TasksEntry dart 28 Make a Date: Appointments Appointments Model.dart 230 AppointmentsDBWorkerdart 231 Appointments. dart AppointementsList. dart. AppointmentsEntry dart…… 240 Reaching out: Contacts 243 Contacts Model, dart 243 ContactsDBWorker dart 244 Contacts, dart…245 Contactslist dart …………,245 Contacts Entry. dart. ..mm..mm.mm.mm.m. 250 Summary.............,,,,,,.257 Chapter 7: FlutterChat, Part The servera 259 Can We build It? Yes, We Can But, uh, What is"It"? ee..seems. 259 Node, mmmm mmmmmmmmm. 260 Keeping the Lines of Communication Open: socket io 265 TABLE OF CONTENTS Flutter chat server code 269 Two Bits of State and an Object Walk into a Bar . .......n..n 270 The Big Hookup: Messages…,… 272 Summary. Chapter 8: FlutterChat, Part I: The client ■■■■■■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■口■■■ 285 Model. dart 285 Connector dart 重■D,重夏重,面重D面重D重,夏重1面重重重面重 288 Server-Bound Message Functions 292 Client-Bound Message Handlers. main dart 297 LoginDialog dart Existing User Login. Home. dart,,…308 AppDrawerdart 309 oby.dart..............…………313 Createroom dart…317 Building the Form,…,, 1320 Userlist dart 323 Room. dart 325 The room functions The main screen content Inviting or Kicking a User 335 Summary..eeemneaennt ,340 Chapter 9: FlutterHero: A Flutter Game mmmamammmmamamnammmaammammaman 341 The Story So Far… 341 The basic layout ,343 Directory Structure and Component Source Files 344 Configuration: pubspec yaml 346 The gameobject Class. EXtending from Gameobject: The Enemy class……… ■重重面重重a重■面 353 TABLE OF CONTENTS EXtending from Gameobject: The player class…… 355 Where t all starts: main, dart mmg 359 The Main Game Loop and core game logic mm..mmmmmmmmmmnmm.mmmmmmmmmm. 365 Kicking It off...,,,,,……365 First time initialization ggmmmmgmmm 366 Resetting Game State. The Main Game Loop ■重■重■DB■重■重■DB重重■DB■口重重■DB■重■重■B■口重■重■D■重■重■B■重■重■B■重■重■ 373 Checking for collisions. Randomly Positioning an Object...,…,……378 Transferring Energy….,.,.,..,.,.,,,,,… 379 Taking Control: nputController:dart.....,,……………382 Summary.........,,,,,384 Index ■■■■■■■■■■■■■■■■■■■口■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■■■■■■■■■ 387

...展开详情
试读 127P Practical Flutter.pdf
立即下载 低至0.43元/次 身份认证VIP会员低至7折
抢沙发
一个资源只可评论一次,评论内容不能少于5个字
关注 私信 TA的资源
上传资源赚积分,得勋章
最新推荐
Practical Flutter.pdf 50积分/C币 立即下载
1/127
Practical Flutter.pdf第1页
Practical Flutter.pdf第2页
Practical Flutter.pdf第3页
Practical Flutter.pdf第4页
Practical Flutter.pdf第5页
Practical Flutter.pdf第6页
Practical Flutter.pdf第7页
Practical Flutter.pdf第8页
Practical Flutter.pdf第9页
Practical Flutter.pdf第10页
Practical Flutter.pdf第11页
Practical Flutter.pdf第12页
Practical Flutter.pdf第13页
Practical Flutter.pdf第14页
Practical Flutter.pdf第15页
Practical Flutter.pdf第16页
Practical Flutter.pdf第17页
Practical Flutter.pdf第18页
Practical Flutter.pdf第19页
Practical Flutter.pdf第20页

试读结束, 可继续阅读

50积分/C币 立即下载 >