Beginning App Development with Flutter (eBook)
XXV, 309 Seiten
Apress (Verlag)
978-1-4842-5181-2 (ISBN)
Create iOS and Android apps with Flutter using just one codebase. App development on multiple platforms has historically been difficult and complex. This book breaks down complex concepts and tasks into easily digestible segments with examples, pictures, and hands-on labs with starters and solutions.
In doing so, you'll develop a basic understanding of the Dart programming language; the entire Flutter development toolchain; the differences between stateful and stateless widgets; and a working knowledge of the architecture of apps. All the most important parts of app development with Flutter are covered in this book. Work with themes and styles. Develop custom widgets. Teach your app to respond to gestures like taps, swipes, and pinches. Design, create and control the layout of your app. Create tools to handle form data entry from users. And ultimately create killer multiscreen apps with navigation, menus, and tabs.
Flutter is Google's new framework for creating mobile apps that run on iOS and Android phones both.You had to be a super-developer to write apps for iOS or Android alone. But writing for both? Forget about it! You had to be familiar with Swift, Java/Kotlin, Xcode, Eclipse, and a bunch of other technologies simultaneously. Beginning App Development with Flutter simplifies the entire process.
What You'll Learn
Get the most out of great Flutter widgets
- Create custom widgets, both stateless and stateful
- Exercise expert control over your Flutter layouts
- Make your app respond to gestures like swiping, pinching and tapping
- Initiate async Ajax calls to RESTful APIs - including Google Firebase!
Rap Payne has focused on mobile development since he started Agile Gadgets, a mobile app development company in 2003. He is a consultant, trainer, and entrepreneur who has written apps, mentored developers, and taught software development classes for Fortune 500 companies like Boeing, Walmart, Coca-Cola, Wells Fargo, Honda,CVS, GE, Chase, HP, Lockheed, Exxon-Mobil, Lowe's, Nike, J.C. Penney, USAA, Walgreen's, and government agencies like the US Air Force, Navy, Army, NASA, Britain's GCHQ, Canada's postal service, and several provincial governments, to name a few.
As a professional mentor and trainer, Rap has developed a talent for communicating highly complex ideas in easy-to-understand ways. And as a real-world developer, he understands the need to teach these topics using practical and realistic examples and exercises.
Create iOS and Android apps with Flutter using just one codebase. App development on multiple platforms has historically been difficult and complex. This book breaks down complex concepts and tasks into easily digestible segments with examples, pictures, and hands-on labs with starters and solutions. In doing so, you'll develop a basic understanding of the Dart programming language; the entire Flutter development toolchain; the differences between stateful and stateless widgets; and a working knowledge of the architecture of apps. All the most important parts of app development with Flutter are covered in this book. Work with themes and styles. Develop custom widgets. Teach your app to respond to gestures like taps, swipes, and pinches. Design, create and control the layout of your app. Create tools to handle form data entry from users. And ultimately create killer multiscreen apps with navigation, menus, and tabs.Flutter is Google's new framework for creating mobile apps that run on iOS and Android phones both.You had to be a super-developer to write apps for iOS or Android alone. But writing for both? Forget about it! You had to be familiar with Swift, Java/Kotlin, Xcode, Eclipse, and a bunch of other technologies simultaneously. Beginning App Development with Flutter simplifies the entire process.What You'll Learn Get the most out of great Flutter widgets Create custom widgets, both stateless and statefulExercise expert control over your Flutter layoutsMake your app respond to gestures like swiping, pinching and tappingInitiate async Ajax calls to RESTful APIs - including Google Firebase!Who This Book Is ForDevelopers who have coded in Java, C#, C++, or any similar language. It brings app development within the reach of younger developers, so STEM groups are likely to pick up the technology. Managers, product owners, and business analysts need to understand Flutter's capabilities.
Praise for Beginning AppDevelopment with Flutter 5
Table of Contents 7
About the Author 16
About the Technical Reviewer 17
Who is this book for? 18
Part I: Introduction to Flutter 23
Chapter 1: Hello Flutter 24
What is Flutter? 25
Why Flutter? 26
The other options 26
Native solutions 28
Conclusion 29
Chapter 2: Developing in Flutter 30
The Flutter toolchain 31
The Flutter SDK 31
Installing the flutter SDK 31
IDEs 31
VS Code from Microsoft 32
Android Studio/IntelliJ from JetBrains 32
Which IDE should I use? 32
IDE DevTools 33
Emulators 34
iOS simulator 34
Android emulator 35
Keeping the tools up to date 36
flutter doctor 37
flutter upgrade 38
The Flutter development process 39
Scaffolding the app and files 39
Anatomy of a Flutter project 40
Running your app 42
Running it as a web app 44
Running it on a tethered device 45
Hot reloading 45
Debugging 46
Conclusion 48
Part II: Foundational Flutter 49
Chapter 3: Everything Is Widgets 50
UI as code 52
Built-in Flutter widgets 54
Value widgets 55
Layout widgets 55
Navigation widgets 56
Other widgets 57
How to create your own stateless widgets 57
Widgets have keys 60
Passing a value into your widget 61
Stateless and Stateful widgets 64
So which one should I create? 64
Conclusion 65
Chapter 4: Value Widgets 66
The Text widget 66
The Icon widget 67
The Image widget 68
Embedded images 69
Network images 70
Sizing an image 70
Input widgets 73
Text fields 74
Making your TextField fancy 75
Checkboxes 79
Radio buttons 80
Sliders 81
Dropdowns 82
Putting the form widgets together 84
Form widget 84
FormField widget 86
onSaved 88
validator 88
Validate while typing 88
Validate only after submit attempt 90
One big Form example 90
Conclusion 95
Chapter 5: Responding to Gestures 96
Meet the button family 97
RaisedButton 99
FlatButton and IconButton 100
FloatingActionButton 100
CupertinoButton 101
Dismissible 102
Custom gestures for your custom widgets 102
Step 1: Decide on your gestures and behaviors 103
Step 2: Create your custom widget 104
Step 3: Add a GestureDetector widget 105
Step 4: Associate your gesture with its behavior 106
Example 1: Reacting to a long press 106
Example 2: Pinching to add a new item 108
Example 3: Swiping left or right 109
What if there are two or more gestures happening at the same time? 111
Conclusion 111
Chapter 6: Laying Out Your Widgets 112
Laying out the whole scene 119
MaterialApp widget 119
The Scaffold widget 120
The AppBar widget 121
SafeArea widget 123
SnackBar widget 124
How Flutter decides on a widget’s size 125
The dreaded “unbounded height” error 126
Flutter’s layout algorithm 127
Putting widgets next to or below others 129
Your widgets will never fit! 132
What if there’s extra space left over? 132
mainAxisAlignment 132
crossAxisAlignment 134
Expanded widget 136
What if there’s not enough space? 140
The ListView widget 140
Regular ListView: When you have a few widgets to display 141
ListView.builder: When you’re building widgets from a list of objects 142
Container widget and the box model 143
Alignment and positioning within a Container 145
So how do you determine the size of a Container? 147
Special layout widgets 149
Stack widget 149
GridView widget 150
GridView.extent() 150
GridView.count() 151
The Table widget 153
Conclusion 156
Chapter 7: Navigation and Routing 157
Stack navigation 158
Navigating forward and back 159
Get result after a scene is closed 161
Drawer navigation 162
The Drawer widget 164
Filling the drawer 166
Tab Navigation 168
TabController 169
TabBarView 169
TabBar and Tabs 170
TabBar at the bottom 171
The Dialog widget 171
showDialog() and AlertDialog 172
Responses with a Dialog 173
Navigation methods can be combined 175
Chapter 8: Styling Your Widgets 176
Thinking in Flutter Styles 177
A word about colors 178
Styling Text 180
TextStyle 180
Custom fonts 182
Container decorations 185
Border 187
BorderRadius 189
BoxShape 190
Stacking widgets 193
Positioned widget 195
Card widget 197
Themes 198
Applying theme properties 200
Conclusion 203
Chapter 9: Managing State 204
What is state? 204
What goes in a StatefulWidget? 206
The most important rule about state! 207
Passing state down 208
Lifting state back up 209
An example of state management 210
When should we use state? 215
Advanced state management 217
InheritedWidget 217
BLoC 217
ScopedModel 218
Hooks 218
Provider 219
Redux 219
Whoa! That’s a lot of packages! 220
Conclusion 220
Part III: Above and Beyond 221
Chapter 10: Your Flutter App Can Work with Files 222
Including libraries in your Flutter app 223
Finding a library 223
Adding it to pubspec.yaml 225
Importing the library 225
Using the library 226
Futures, async, and await 226
Why would it wait? 227
How do we get the data from a Future? 228
await 229
async 230
Including a file with your app 231
Writing a file 233
And reading it! 234
Using JSON 235
Writing your app’s memory to JSON 236
Reading JSON into your app’s memory 237
Shared preferences 238
To write preferences 239
To read preferences 239
Conclusion 240
Chapter 11: Making RESTful API Calls with HTTP 241
What is an API call? 242
The flavors of API requests 242
Making an HTTP GET or DELETE request 244
Making an HTTP PUT, POST, or PATCH request 245
HTTP responses to widgets 246
Brute force – The easy way 247
FutureBuilder – The clean way 248
StreamBuilder 250
Strongly typed classes 252
Create a business class 252
Write a .fromJSON() method 253
Use .fromJSON() to hydrate the object 254
One big example 254
Setting up 256
Create the Flutter app 257
Making a strongly typed business class 257
PeopleList.dart 258
A GET request in Flutter 261
A DELETE request in Flutter 261
PeopleUpsert.dart 262
A POST and PUT request in Flutter 266
Conclusion 268
Chapter 12: Using Firebase with Flutter 269
Introducing Firebase 270
Cloud Firestore 271
Cloud Functions 272
Authentication 273
Setting up Firebase itself 273
(1) Creating a Firebase project 274
(2) Creating the database 277
(3) Creating an iOS app 281
(4) Creating an Android app 287
Install the google-services.json file 289
Adding to the gradle files 290
(5) Adding FlutterFire plugins 291
Using Firestore 292
To get a collection 293
To query 295
To upsert 295
To delete 296
Where to go from here 297
Appendix A:Dart Language Overview 300
What is Dart? 300
Expected features – Dart Cheatsheet 301
Data types 301
Arrays/lists 302
Conditional expressions 302
Looping 303
Classes 303
Class constructors 304
Unexpected things about Dart 304
Type inference 305
final and const 305
Variables are initialized to null 306
String interpolation with $ 307
Multiline strings 307
Spread operator 307
Map< foo, bar>
Functions are objects 308
Big arrow/Fat arrow 309
Named function parameters 309
Omitting “new” and “this.” 310
Class constructor parameter shorthand 311
Private class members 312
Mixins 312
The cascade operator (..) 313
No overloading 314
Named constructors 314
Index 316
Erscheint lt. Verlag | 4.12.2019 |
---|---|
Zusatzinfo | XXV, 309 p. 128 illus., 126 illus. in color. |
Sprache | englisch |
Themenwelt | Informatik ► Betriebssysteme / Server ► Macintosh / Mac OS X |
Mathematik / Informatik ► Informatik ► Netzwerke | |
Informatik ► Programmiersprachen / -werkzeuge ► Mac / Cocoa Programmierung | |
Informatik ► Software Entwicklung ► Mobile- / App-Entwicklung | |
Schlagworte | Android • app development • Flutter • Ios • Mobile Development • programming |
ISBN-10 | 1-4842-5181-4 / 1484251814 |
ISBN-13 | 978-1-4842-5181-2 / 9781484251812 |
Haben Sie eine Frage zum Produkt? |
Größe: 6,3 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich