万本电子书0元读

万本电子书0元读

顶部广告

Flutter for Beginners电子书

售       价:¥

24人正在读 | 0人评论 9.8

作       者:Alessandro Biessek

出  版  社:Packt Publishing

出版时间:2019-09-12

字       数:52.2万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
A step-by-step guide to learning Flutter and Dart 2 for creating Android and iOS mobile applications Key Features * Get up to speed with the basics of Dart programming and delve into Flutter development * Understand native SDK and third-party libraries for building Android and iOS applications using Flutter * Package and deploy your Flutter apps to achieve native-like performance Book Description Google Flutter is a cross-platform mobile platform that makes it easier to write secure and high-performance native apps for iOS and Android. This book begins by introducing you to the Flutter framework and basics of Dart. You’ll learn to set up the development environment to get started with your Flutter project. The book will guide you through designing the user interface and user input functions for your app. As you progress, you’ll explore the navigator widget to manage your app routes and understand how to add transitions between screens. You’ll then get to grips with developing your own plugin and discover how to structure good plugin code. The book will help you display a map from the Flutter app, add markers and interactions to it, and use the Google Places API. You’ll build on your knowledge by not only adding tests to create a bug-free app, but also preparing it for deployment on Apple's App Store and Google Play. In later chapters, you’ll learn to improve the user experience with advanced features such as map integrations, platform-specific code with native programming languages, and personalized animation options for designing intuitive UIs. By the end of this book, you’ll be well-versed with Dart programming and have the skills to develop your own mobile apps or build a career as a Dart and Flutter app developer. What you will learn * Understand the fundamentals of the Dart programming language * Explore the core concepts of the Flutter UI and how it compiles for multiple platforms * Develop Flutter plugins and widgets and understand how to structure good plugin code * Style your apps with widgets and learn the difference between stateful and stateless widgets * Add animation to your UI using Flutter's AnimatedBuilder component * Integrate your native code into your Flutter codebase for native app performance Who this book is for This book is for developers looking to learn Google's revolutionary framework, Flutter from scratch. No knowledge of Flutter or Dart is required. However, basic programming language knowledge will be helpful.
目录展开

Dedication

About Packt

Why subscribe?

Packt.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Section 1: Introduction to Dart

An Introduction to Dart

Getting started with Dart

The evolution of Dart

How Dart works

Dart VM and JavaScript compilation

Hands-on Dart

DartPad

Dart development tools

Hello world

Understanding why Flutter uses Dart

Adding productivity

Compiling Flutter apps and hot reload

Easy learning

Maturity

Introducing the structure of the Dart language

Dart operators

Arithmetic operators

Increment and decrement operators

Equality and relational operators

Type checking and casting

Logical operators

Bits manipulation

Null-safe and null-aware operators

Dart types and variables

final and const

Built-in types

Numbers

BigInt

Booleans

Collections

Strings

String interpolation

Literals

Type inference – bringing dynamism to the show

Control flows and looping

Functions

Function parameters

Data structures, collections, and generics

Generics

When and why to use generics

Generics and Dart literals

Introduction to OOP in Dart

Dart OOP features

Objects and classes

Encapsulation

Inheritance and composition

Abstraction

Polymorphism

Summary

Further reading

Intermediate Dart Programming

Dart classes and constructors

The enum type

The cascade notation

Constructors

Named constructors

Factory constructors

Field accessors – getters and setters

Static fields and methods

Class inheritance

The toString() method

Interfaces, abstract classes, and mixins

Abstract classes

Interfaces

Mixins – adding behavior to a class

Callable classes, top-level functions, and variables

Callable classes

Top-level functions and variables

Understanding Dart libraries and packages

Importing and using a library

Importing show and hide

Importing prefixes to libraries

Importing path variants

Creating Dart libraries

Library member privacy

The library definition

A single-file library

Splitting libraries into multiple files

A multiple-file library – the export statement

Dart packages

Application packages versus library packages

Package structures

Stagehand – the Dart project generator

The pubspec file

Package dependencies – pub

Specifying dependencies

The version constraint

The source constraint

Introducing async programming with Futures and Isolates

Dart Futures

Dart Isolates

Introducing unit testing with Dart

The Dart test package

Writing unit tests

Summary

An Introduction to Flutter

Comparisons with other mobile app development frameworks

The problems Flutter wants to solve

Differences between existing frameworks

High performance

Full control of the UI

Dart

Being backed by Google

Fuchsia OS and Flutter

Open source framework

Developer resources and tooling

Flutter compilation (Dart)

Development compilation

Release compilation

Supported platforms

Flutter rendering

Web-based technologies

Framework and OEM widgets

Flutter – rendering by itself

Widgets introduction

Composability

Immutability

Everything is a widget

The widget tree

Hello Flutter

pubspec file

Running the generated project

lib/main.dart file

Flutter run

Summary

Section 2: The Flutter User Interface - Everything is a Widget

Widgets: Building Layouts in Flutter

Stateful versus stateless widgets

Stateless widgets

Stateful widgets

Stateful and stateless widgets in code

Stateless widget in code

Stateful widgets in code

Inherited widgets

Widget key property

Built-in widgets

Basic widgets

The Text widget

The Image widget

Material Design and iOS Cupertino widgets

Buttons

Scaffold

Dialogs

Text fields

Selection widgets

Date and time pickers

Other components

Understanding built-in layout widgets

Containers

Styling and positioning

Other widgets (gestures, animations, and transformations)

Creating a UI with widgets (favor manager app)

The app screens

The app code

Favors app home screen

The layout code

The request favor screen

The layout code

Creating custom widgets

Summary

Handling User Input and Gestures

Handling user gestures

Pointers

Gestures

Tap

Double tap

Press and hold

Drag, pan, and scale

Horizontal drag

Vertical drag

Pan

Scale

Gestures in material widgets

Input widgets

FormField and TextField

Using a controller

Accessing FormField state

Form

Accessing Form state

Using a key

Using InheritedWidget

Validating Input (Forms)

Validating user input

Custom input and FormField

Creating custom inputs

Custom input widget example

Creating an Input widget

Turn the widget into a FormField widget

Putting it all together

Favors screen

Tap gestures on the favor tab

Tap gestures on FavorCards

Making FavorsPage a StatefulWidget

Refuse action handling

Do action handling

Tap on Request a favor button

The Requesting a favor screen

The close button

The SAVE button

Validating input using the Form widget

Summary

Theming and Styling

Theme widgets

Theme widget

ThemeData

Brightness

Theming in practice

Platform class

Material Design

MaterialApp widget

Scaffold widget

Custom theme

iOS Cupertino

CupertinoApp

Cupertino in practice

Using custom fonts

Importing fonts to the Flutter project

Overriding the default font in the app

Dynamic styling with MediaQuery and LayoutBuilder

LayoutBuilder

MediaQuery

MediaQuery example

Additional responsive classes

Summary

Routing: Navigating between Screens

Understanding the Navigator widget

Navigator

Overlay

Navigation stack/history

Route

RouteSettings

MaterialPageRoute and CupertinoPageRoute

Putting it all together

The WidgetsApp way

Named routes

Moving to named routes

Arguments

Retrieving results from Route

Screen transitions

PageRouteBuilder

Custom transitions in practice

Hero animations

The Hero widget

Implementing Hero transitions

Summary

Section 3: Developing Fully Featured Apps

Firebase Plugins

Firebase overview

Setting up Firebase

Connecting the Flutter app to Firebase

Configuring an Android app

Configuring iOS app

FlutterFire

Adding the FlutterFire dependency to the Flutter project

Firebase authentication

Enabling Authentication services in Firebase

Authentication screen

Logging in with Firebase

Sending verification code

Verifying the SMS code

Updating the profile and login status

NoSQL database with Cloud Firestore

Enabling Cloud Firestore on Firebase

Cloud Firestore and Flutter

Loading favors from Firestore

Updating favors on Firebase

Saving a favor on Firebase

Cloud Storage with Firebase Storage

Introduction to Firebase Storage

Adding Flutter Storage dependencies

Uploading files to Firebase

Ads with Firebase AdMob

AdMob account

Creating an AdMob account

AdMob in Flutter

Side note on Android

Side note on iOS

Showing ads in Flutter

ML with Firebase ML Kit

Adding ML Kit to Flutter

Using the label detector in Flutter

Summary

Developing Your Own Flutter Plugin

Creating a package/plugin project

Flutter packages versus Dart packages

Starting a Dart package project

Starting a Flutter plugin package

A plugin project structure

MethodChannel

Implementing the Android plugin

Implementing the iOS plugin

The Dart API

An example of plugin package

Using the plugin

Adding documentation to the package

Documentation files

Library documentation

Generating documentation

Publishing a package

Plugin project development recommendations

Summary

Accessing Device Features from the Flutter App

Launching a URL from the app

Displaying a link

The flutter_linkify plugin

Launching a URL

The url_launcher plugin

Managing app permissions

Managing permissions on Flutter

Using the permission_handler plugin

Importing a contact from the phone

Importing a contact with contact_picker

Contact permission with permission_handler

Contact permission on Android

Contact permission on iOS

Checking and requesting permission in Flutter (permission_handler)

Integrating the phone's camera

Taking pictures with image_picker

Camera permission with permission_handler

Camera permission on Android

Camera permission on iOS

Requesting camera permission in Flutter (permission_handler)

Summary

Platform Views and Map Integration

Displaying a map

Platform views

Enabling platform views on iOS

Creating a platform view widget

Creating an Android view

Creating an iOS view

Usage of a platform view widget

Getting started with the google_maps_flutter plugin

Displaying a map with the google_maps_flutter plugin

Enabling the Maps API on Google Cloud Console

Google Maps API integration on Android

Google Maps API integration on iOS

Displaying a map on Flutter

Adding markers to the map

The Marker class

Adding markers in the GoogleMap widget

Adding map interactions

Adding markers dynamically

GoogleMapController

Getting GoogleMapController

Animating a map camera to a location

Using the Google Places API

Enabling the Google Places API

Getting started with the google_maps_webservice plugin

Getting a place address using the google_maps_webservice plugin

Summary

Section 4: Advanced Flutter - Resources to Complex Apps

Testing, Debugging, and Deployment

Flutter testing – unit and widget testing

Widget tests

The flutter_test package

The testWidgets function

Widget test example

Debugging Flutter apps

Observatory

Additional debugging features

DevTools

Profiling Flutter apps

The Observatory profiler

Profile mode

Performance overlay

Inspecting the Flutter widget tree

Widget inspector

The Flutter inspector in DevTools

Preparing apps for deployment

Release mode

Releasing apps for Android

AndroidManifest and build.gradle

AndroidManifest – permissions

AndroidManifest – meta tags

AndroidManifest – application name and icon

build.gradle – application ID and versions

build.gradle – signing the app

Releasing apps for iOS

App Store Connect

Xcode

Xcode – application details and Bundle ID

Xcode – AdMob

Xcode – signing the app

Summary

Improving User Experience

Accessibility in Flutter and adding translations to apps

Flutter's support for accessibility

Flutter internationalization

The intl package

The intl_translation package

The flutter_localizations package

Adding localizations to a Flutter app

Dependencies

The AppLocalization class

Generating .arb files with intl_translation

Using translated resources

Communication between native and Flutter with platform channels

Platform channel

Message codecs

Creating background processes

The Flutter compute() function

SendPort and ReceivePort

IsolateNameServer

A compute() example

Full background process

Init the calculation

The background isolate

Adding Android-specific code to run Dart code in the background

The HandsOnBackgroundProcessPlugin class

The BackgroundProcessService class

The PluginRegistrantCallback property

Adding iOS-specific code to run Dart code in the background

The SwiftHandsOnBackgroundProcessPlugin class

Summary

Widget Graphic Manipulations

Transforming widgets with the Transform class

The Transform widget

Understanding the Matrix4 class

Exploring the types of transformations

Rotate transformation

Scale transformation

Translate transformation

Composed transformations

Applying transformations to your widgets

Rotating widgets

Scaling widgets

Translating widgets

Applying multiple transformations

Using custom painters and canvas

The Canvas class

Canvas transformations

Canvas ClipRect

Methods

The Paint object

The CustomPaint widget

CustomPaint construction details

The CustomPainter object

The paint method

The shouldRepaint method

A practical example

Defining a widget

Defining CustomPainter

Overriding the shouldRepaint method

Overriding the paint method

The radial chart variant

Defining a widget

Defining CustomPainter

Summary

Animations

Introducing Animations

The Animation<T> class

AnimationController

TickerProvider and Ticker

CurvedAnimation

Tween

Using animations

Rotate animation

Scale animation

Translate animation

Multiple transformations and custom Tween

Custom Tween

Using AnimatedBuilder

The AnimatedBuilder class

Revisiting our animation

Using AnimatedWidget

The AnimatedWidget class

Rewriting the animation with AnimatedWidget

Summary

Other Books You May Enjoy

Leave a review - let other readers know what you think

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部