SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
Intro to Flutter
Eason Pai
2017
What is Flutter?
● “Flutter is a new project to help developers build high-performance,
high-fidelity, mobile apps for iOS and Android from a single codebase.”
-- https://flutter.io/ (翻譯:寫一次爽跑雙平台 (again!?))
● Features (Summarized):
○ Performance (AOT Compiling, Flutter Framework)
○ Highly productive and fast development (Hot Reload)
● Well documented FAQ: https://flutter.io/faq/
● Try “Flutter Gallery” on official Android App at Play Store
Flutter Architecture
● Flutter System Architecture (2015)
Feature: AOT Compiling
● AOT compiling Dart for iOS Android (Dart Developer Summit 2016) [Youtube]
○ iOS Restriction: Cannot JIT (Dart VM) (2015)
○ Apply to Android for >3X Faster startup, Speed and Size enhancement (2016)
● Compare to React Native?
Getting Interesting? (1)
● Discusses
○ from Android/iOS developers
■ Sam Lu
○ from UX Designers
■ FAQ: Tips and tools for getting started in user
experience design (aka UX): “I’m still very new to
prototyping but my team uses Flutter which is an
open-sourced framework for building cross-platform
UIs—learning how to use it has been challenging
because it’s my first programming experience but
extremely rewarding. ”(UX @Google)
● Dart is 17 at TIOBE Index for January 2017
Getting Interesting? (2)
● Learnings from building a CRM app at Google (Dart Developer
Summit 2016)
○ Web App
■ Google built it’s own CRM system, big project that
including Customer, Revenue, Planning, Collaboration
function
■ 3 years running, 30 Dart Developers, 800 AngularDart
Components
■ 0% → 100% in 6 months (3 years ago, with ng1)
○ Mobile App
■ demo video (The same bug on both Android/iOS XD)
■ Experience: Productive, Fun, Easy, Fidelity, Write
once, Share with web
● Functional-Reactive Framework & React-like
○ Functional Reactive Programming?
■ 30 天精通 RxJS (01):認識 RxJS:“Functional Reactive Programming 是一種編程範式
(programming paradigm)... RxJS 確實是 Functional Programming 跟 Reactive
Programming 的結合,但能不能稱為 Functional Reactive Programming (FRP) 一直有爭
議”
● “Functional Programming,那就是 用 function 來思考我們的問題,以及撰寫程式 ”
● “Reactive Programming 簡單來說就是 當變數或資源發生變動時,由變數或資源自
動告訴我發生變動了 ”
● Flutter FAQ:“The Flutter framework uses a functional-reactive style programming model, whose
performance depends heavily on the underlying memory allocator efficiently handling small,
short-lived allocations. The functional-reactive style was developed in languages with this property
and does not work efficiently in languages that lack this facility.” (翻譯:夠快才能叫做FR)
Flutter Framework (1)
Flutter Quick Start
● Flutter Setup
○ SDK → iOS Setup, Android Setup → IDE (IntelliJ, Atom)
■ flutter doctor
○ Mac or Linux Only. Windows support is planned.
○ Android 4.1 (API level 16) or higher.
● Getting Started with Flutter
○ Create project
○ Hot Reload
Feature:
Hot Reload
● Flutter Hot Reload (Dart Developer Summit 2016) [Youtube]
● Hello World
● To see more widges,
○ check the official Android app Flutter Gallery
○ or the list on web https://flutter.io/widgets/
Flutter Framework (2)
import 'package:flutter/material.dart';
void main() {
runApp(new Center(child: new Text('Hello, world!')));
}
● Custom Widget
● Widgets
○ Any of the widgets will extend
StatefulWidget or StatelessWidget
○ StatelessWidget
■ All member is final
■ It’s state cannot be changed
→ Immutability
■ Example: Text
Flutter Framework (3) void main() {
runApp(new MyWidget("Hello Cool App"));
}
class MyWidget extends StatelessWidget {
final String hello;
MyWidget(this.hello);
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(hello)
),
body: new Center(
child: new Text('A Text Widget')),
);
}
}
Flutter Framework (4)
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Center(
child: new Text(
'Button tapped $_counter time${ _counter == 1 ? '' : 's' }.',
),
),
floatingActionButton: new FloatingActionButton(
onPressed: _incrementCounter,
),
);
}
}
● StatefulWidget
○ is a Mutable Widget, state can be
changed
○ Example : A list of items. This list will
contain the items internally, items grow
when data retrieved from server
Flutter Framework (5)
● StatefulWidget
○ "狀態是否可變"比較攏統,對於身為view tier的 solution
來說,”狀態”指的是"view是否可以被重繪"
○ StatelessWidget一旦被 new 就無法再被更新,只能用暴
力法重新 new 一次
○ 繪圖機制效率地只畫有變動的部分,不需要整個view
tree都更新一次
○ "view是否可以被重繪"" 就是透過上述兩種不一樣的
Class API 限制你更新繪圖的能力 ( setState(λ) )
○ Performance?
■ no worries, createState() taking care of it
List
Item
Item
λ
Accessing Platforms
● 目前只能用在ARM-based CPU
○ 包括 android emulator!
○ 但其他CPU的支援問題也不大
○ 已經可產生對應各CPU架構的so,只是在
package tool chain 中還沒動態地把so檔
加進去
● 可以跟現有的android, ios
framework 共用 UI & Code
○ 官方有範例 hello_service 可
以跑起來
○ Accessing Platform and
Third-Party Services in Flutter
Thanks
歡迎到FB社團 Dartisian@tw一起討論
https://www.facebook.com/groups/Dart.tw/

Mais conteúdo relacionado

Mais procurados

What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?Sergi Martínez
 
Building beautiful apps using google flutter
Building beautiful apps using google flutterBuilding beautiful apps using google flutter
Building beautiful apps using google flutterAhmed Abu Eldahab
 
INTRODUCTION TO FLUTTER.pdf
INTRODUCTION TO FLUTTER.pdfINTRODUCTION TO FLUTTER.pdf
INTRODUCTION TO FLUTTER.pdfAdarshMathuri
 
Getting started with flutter
Getting started with flutterGetting started with flutter
Getting started with flutterrihannakedy
 
Flutter festival - Write your first Flutter application
Flutter festival - Write your first Flutter applicationFlutter festival - Write your first Flutter application
Flutter festival - Write your first Flutter applicationApoorv Pandey
 
Mobile development with Flutter
Mobile development with FlutterMobile development with Flutter
Mobile development with FlutterAwok
 
The magic of flutter
The magic of flutterThe magic of flutter
The magic of flutterShady Selim
 
Introduction to Flutter.pptx
Introduction to Flutter.pptxIntroduction to Flutter.pptx
Introduction to Flutter.pptxDiffouoFopaEsdras
 
Introduction to Flutter
Introduction to FlutterIntroduction to Flutter
Introduction to FlutterApoorv Pandey
 
Flutter latest updates and features 2022
Flutter latest updates and features 2022Flutter latest updates and features 2022
Flutter latest updates and features 2022Ahmed Abu Eldahab
 
Flutter session 01
Flutter session 01Flutter session 01
Flutter session 01DSC IEM
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastBartosz Kosarzycki
 
Flutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | EdurekaFlutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | EdurekaEdureka!
 

Mais procurados (20)

What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?
 
Building beautiful apps using google flutter
Building beautiful apps using google flutterBuilding beautiful apps using google flutter
Building beautiful apps using google flutter
 
Flutter Intro
Flutter IntroFlutter Intro
Flutter Intro
 
INTRODUCTION TO FLUTTER.pdf
INTRODUCTION TO FLUTTER.pdfINTRODUCTION TO FLUTTER.pdf
INTRODUCTION TO FLUTTER.pdf
 
Getting started with flutter
Getting started with flutterGetting started with flutter
Getting started with flutter
 
Flutter Bootcamp
Flutter BootcampFlutter Bootcamp
Flutter Bootcamp
 
Flutter festival - Write your first Flutter application
Flutter festival - Write your first Flutter applicationFlutter festival - Write your first Flutter application
Flutter festival - Write your first Flutter application
 
Mobile development with Flutter
Mobile development with FlutterMobile development with Flutter
Mobile development with Flutter
 
The magic of flutter
The magic of flutterThe magic of flutter
The magic of flutter
 
Creating Apps with .NET MAUI
Creating Apps with .NET MAUICreating Apps with .NET MAUI
Creating Apps with .NET MAUI
 
Flutter
FlutterFlutter
Flutter
 
Flutter
FlutterFlutter
Flutter
 
Flutter introduction
Flutter introductionFlutter introduction
Flutter introduction
 
Introduction to Flutter.pptx
Introduction to Flutter.pptxIntroduction to Flutter.pptx
Introduction to Flutter.pptx
 
Hello Flutter
Hello FlutterHello Flutter
Hello Flutter
 
Introduction to Flutter
Introduction to FlutterIntroduction to Flutter
Introduction to Flutter
 
Flutter latest updates and features 2022
Flutter latest updates and features 2022Flutter latest updates and features 2022
Flutter latest updates and features 2022
 
Flutter session 01
Flutter session 01Flutter session 01
Flutter session 01
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
 
Flutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | EdurekaFlutter Tutorial For Beginners | Edureka
Flutter Tutorial For Beginners | Edureka
 

Semelhante a Intro to Flutter

20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React NativeEric Deng
 
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud RunDesigning flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Runwesley chun
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Toolsbarciszewski
 
Rapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTRapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTManuel Carrasco Moñino
 
Introduction to html5 game programming with ImpactJs
Introduction to html5 game programming with ImpactJsIntroduction to html5 game programming with ImpactJs
Introduction to html5 game programming with ImpactJsLuca Galli
 
Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDKdigitaljoni
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]GDSC UofT Mississauga
 
GoogleDSC_ GHRCE_ flutter_firebase.pptx
GoogleDSC_ GHRCE_  flutter_firebase.pptxGoogleDSC_ GHRCE_  flutter_firebase.pptx
GoogleDSC_ GHRCE_ flutter_firebase.pptxGoogleDeveloperStude22
 
Advanced Dagger talk from 360andev
Advanced Dagger talk from 360andevAdvanced Dagger talk from 360andev
Advanced Dagger talk from 360andevMike Nakhimovich
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyKhor SoonHin
 
Google's serverless journey: past to present
Google's serverless journey: past to presentGoogle's serverless journey: past to present
Google's serverless journey: past to presentwesley chun
 
Flutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textFlutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textToma Velev
 
Apache Flex and the imperfect Web
Apache Flex and the imperfect WebApache Flex and the imperfect Web
Apache Flex and the imperfect Webmasuland
 
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Loïc Knuchel
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2JooinK
 
Deep dive into Android async operations
Deep dive into Android async operationsDeep dive into Android async operations
Deep dive into Android async operationsMateusz Grzechociński
 

Semelhante a Intro to Flutter (20)

20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
 
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud RunDesigning flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
Designing flexible apps deployable to App Engine, Cloud Functions, or Cloud Run
 
Gwt.create
Gwt.createGwt.create
Gwt.create
 
GWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO ToolsGWT - Building Rich Internet Applications Using OO Tools
GWT - Building Rich Internet Applications Using OO Tools
 
Rapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWTRapid and Reliable Developing with HTML5 & GWT
Rapid and Reliable Developing with HTML5 & GWT
 
Introduction to html5 game programming with ImpactJs
Introduction to html5 game programming with ImpactJsIntroduction to html5 game programming with ImpactJs
Introduction to html5 game programming with ImpactJs
 
Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDK
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
GoogleDSC_ GHRCE_ flutter_firebase.pptx
GoogleDSC_ GHRCE_  flutter_firebase.pptxGoogleDSC_ GHRCE_  flutter_firebase.pptx
GoogleDSC_ GHRCE_ flutter_firebase.pptx
 
React Workshop
React WorkshopReact Workshop
React Workshop
 
React native
React nativeReact native
React native
 
Advanced Dagger talk from 360andev
Advanced Dagger talk from 360andevAdvanced Dagger talk from 360andev
Advanced Dagger talk from 360andev
 
Drools & jBPM Workshop London 2013
Drools & jBPM Workshop London 2013Drools & jBPM Workshop London 2013
Drools & jBPM Workshop London 2013
 
From Back to Front: Rails To React Family
From Back to Front: Rails To React FamilyFrom Back to Front: Rails To React Family
From Back to Front: Rails To React Family
 
Google's serverless journey: past to present
Google's serverless journey: past to presentGoogle's serverless journey: past to present
Google's serverless journey: past to present
 
Flutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textFlutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - text
 
Apache Flex and the imperfect Web
Apache Flex and the imperfect WebApache Flex and the imperfect Web
Apache Flex and the imperfect Web
 
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
Ionic2, les développeurs web à l'assaut du mobile, BDX I/O le 21/10/2016
 
Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2Javascript as a target language - GWT KickOff - Part 2/2
Javascript as a target language - GWT KickOff - Part 2/2
 
Deep dive into Android async operations
Deep dive into Android async operationsDeep dive into Android async operations
Deep dive into Android async operations
 

Último

Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312wphillips114
 
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...nishasame66
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsChandrakantDivate1
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesChandrakantDivate1
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsChandrakantDivate1
 

Último (6)

Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312
 
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s Tools
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and Layouts
 

Intro to Flutter

  • 2. What is Flutter? ● “Flutter is a new project to help developers build high-performance, high-fidelity, mobile apps for iOS and Android from a single codebase.” -- https://flutter.io/ (翻譯:寫一次爽跑雙平台 (again!?)) ● Features (Summarized): ○ Performance (AOT Compiling, Flutter Framework) ○ Highly productive and fast development (Hot Reload) ● Well documented FAQ: https://flutter.io/faq/ ● Try “Flutter Gallery” on official Android App at Play Store
  • 3. Flutter Architecture ● Flutter System Architecture (2015)
  • 4. Feature: AOT Compiling ● AOT compiling Dart for iOS Android (Dart Developer Summit 2016) [Youtube] ○ iOS Restriction: Cannot JIT (Dart VM) (2015) ○ Apply to Android for >3X Faster startup, Speed and Size enhancement (2016) ● Compare to React Native?
  • 5. Getting Interesting? (1) ● Discusses ○ from Android/iOS developers ■ Sam Lu ○ from UX Designers ■ FAQ: Tips and tools for getting started in user experience design (aka UX): “I’m still very new to prototyping but my team uses Flutter which is an open-sourced framework for building cross-platform UIs—learning how to use it has been challenging because it’s my first programming experience but extremely rewarding. ”(UX @Google) ● Dart is 17 at TIOBE Index for January 2017
  • 6. Getting Interesting? (2) ● Learnings from building a CRM app at Google (Dart Developer Summit 2016) ○ Web App ■ Google built it’s own CRM system, big project that including Customer, Revenue, Planning, Collaboration function ■ 3 years running, 30 Dart Developers, 800 AngularDart Components ■ 0% → 100% in 6 months (3 years ago, with ng1) ○ Mobile App ■ demo video (The same bug on both Android/iOS XD) ■ Experience: Productive, Fun, Easy, Fidelity, Write once, Share with web
  • 7. ● Functional-Reactive Framework & React-like ○ Functional Reactive Programming? ■ 30 天精通 RxJS (01):認識 RxJS:“Functional Reactive Programming 是一種編程範式 (programming paradigm)... RxJS 確實是 Functional Programming 跟 Reactive Programming 的結合,但能不能稱為 Functional Reactive Programming (FRP) 一直有爭 議” ● “Functional Programming,那就是 用 function 來思考我們的問題,以及撰寫程式 ” ● “Reactive Programming 簡單來說就是 當變數或資源發生變動時,由變數或資源自 動告訴我發生變動了 ” ● Flutter FAQ:“The Flutter framework uses a functional-reactive style programming model, whose performance depends heavily on the underlying memory allocator efficiently handling small, short-lived allocations. The functional-reactive style was developed in languages with this property and does not work efficiently in languages that lack this facility.” (翻譯:夠快才能叫做FR) Flutter Framework (1)
  • 8. Flutter Quick Start ● Flutter Setup ○ SDK → iOS Setup, Android Setup → IDE (IntelliJ, Atom) ■ flutter doctor ○ Mac or Linux Only. Windows support is planned. ○ Android 4.1 (API level 16) or higher. ● Getting Started with Flutter ○ Create project ○ Hot Reload
  • 9. Feature: Hot Reload ● Flutter Hot Reload (Dart Developer Summit 2016) [Youtube]
  • 10. ● Hello World ● To see more widges, ○ check the official Android app Flutter Gallery ○ or the list on web https://flutter.io/widgets/ Flutter Framework (2) import 'package:flutter/material.dart'; void main() { runApp(new Center(child: new Text('Hello, world!'))); }
  • 11. ● Custom Widget ● Widgets ○ Any of the widgets will extend StatefulWidget or StatelessWidget ○ StatelessWidget ■ All member is final ■ It’s state cannot be changed → Immutability ■ Example: Text Flutter Framework (3) void main() { runApp(new MyWidget("Hello Cool App")); } class MyWidget extends StatelessWidget { final String hello; MyWidget(this.hello); @override Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text(hello) ), body: new Center( child: new Text('A Text Widget')), ); } }
  • 12. Flutter Framework (4) class MyHomePage extends StatefulWidget { MyHomePage({Key key, this.title}) : super(key: key); final String title; @override _MyHomePageState createState() => new _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { int _counter = 0; void _incrementCounter() { setState(() { _counter++; }); } @override Widget build(BuildContext context) { return new Scaffold( body: new Center( child: new Text( 'Button tapped $_counter time${ _counter == 1 ? '' : 's' }.', ), ), floatingActionButton: new FloatingActionButton( onPressed: _incrementCounter, ), ); } } ● StatefulWidget ○ is a Mutable Widget, state can be changed ○ Example : A list of items. This list will contain the items internally, items grow when data retrieved from server
  • 13. Flutter Framework (5) ● StatefulWidget ○ "狀態是否可變"比較攏統,對於身為view tier的 solution 來說,”狀態”指的是"view是否可以被重繪" ○ StatelessWidget一旦被 new 就無法再被更新,只能用暴 力法重新 new 一次 ○ 繪圖機制效率地只畫有變動的部分,不需要整個view tree都更新一次 ○ "view是否可以被重繪"" 就是透過上述兩種不一樣的 Class API 限制你更新繪圖的能力 ( setState(λ) ) ○ Performance? ■ no worries, createState() taking care of it List Item Item λ
  • 14. Accessing Platforms ● 目前只能用在ARM-based CPU ○ 包括 android emulator! ○ 但其他CPU的支援問題也不大 ○ 已經可產生對應各CPU架構的so,只是在 package tool chain 中還沒動態地把so檔 加進去 ● 可以跟現有的android, ios framework 共用 UI & Code ○ 官方有範例 hello_service 可 以跑起來 ○ Accessing Platform and Third-Party Services in Flutter