SlideShare a Scribd company logo
Flutter Forward Extended
Taipei
Flutter Forward 回顧
Organizer
GDG 高雄
房志剛
房志剛
任職圈圈科技 App 工程師
畢業於 中山大學資訊工程研究所
GDG 高雄 Organizer
高科校務通 v3 和 中山校務通作者
原生 Android 2年 Flutter 4年
GitHub Facebook
Flutter 3.7
Impeller 預覽版
生態系統
Dart 3.0 Alpha
Flutter 下一步
+
+
+
+
+
Flutter Forward
Holobooth
https://holobooth.flutter.dev/
加強 Material 3 支援
Impeller 預覽版
Method Channel 支援 isolates
DevTools 更新
Widget 更新
+
+
+
+
+
Flutter 3.7
iOS 平台功能更新
+
● Badge
● BottomAppBar
● Filled and Filled Tonal
buttons
● SegmentedButton
● Checkbox
● Divider
● Menus
● DropdownMenu
● Drawer and
NavigationDrawer
加強 Material 3 支援
● ProgressIndicator
● Radio buttons
● Slider
● SnackBar
● TabBar
● TextFields and
InputDecorator
● Banner
新增與修改元件
加強 Material 3 支援
●預設仍使用 Material 2
●新參數 colorSchemeSeed 配合顏色設計
●但目前針對 Meterial 2 棄用沒有提及
●Feature Tracker
互動網頁
●在 macOS 可使用 PlatformMenuBar (3.3 支援)
●全平台可使用 MenuBar
○ 子元素可使用自訂元件
○ 或使用官方提供的 MenuItemButton 及
SubmenuButton
●參考文件
Menu bars and cascading menus
●iOS 已可在 stable channel 使用
●Android 版本仍在開發
●Web 及 Desktop 尚未有明確計畫
Impeller 預覽版
●從去年 Flutter 3.3 開始實驗的新的渲染引擎
●目標是取代現有的 Skia,再最佳化 iOS 的首次卡頓問題
●更有效的能在離線階段編譯對應平台所需的著色器語言
●目標主要有
○ 可預測效能
○ 可檢測
○ 可移植
○ 有效使用現代圖形 API (Metal 和 Vulkan)
○ 有效利用並行 (Concurrency)
什麼是 Impeller ?
●現行使用的 SkSL(Skia shading language)為 GLSL 的變體,著色
器都需要在第一次運行時根據裝置編譯
●自從 Apple 2019年公告全面棄用 OpenGL,加速 Flutter 在 1.17 版支
援 Metal API,第一次啟用的卡頓問題已非常嚴重
●Flutter 1.20 版本中为 OpenGL 後端 實現 SkSL 預熱機制
●Flutter 2.5 版本支援 Metal 後端的 SkSL 預熱機制
●最終讓 Flutter 在 2022年思考要替換底層的渲染引擎
為何需要替換?
●著色器採用 GLSL 4.60 (OpenGL Shading Language)
●透過第一階段的編譯 (Impeller Shader Compiler)轉換成
支援 SPIR-V 的格式
●第二階段再透過 SPIR-V 轉換平台的 Shader
Language(ex. iOS/macOS 的 Metal API)
Impeller 怎麼運作
SPIR-V (Standard Portable Intermediate Representation)
使用 Impeller 的 App - Wonderous
iOS 下載
啟用 Impeller
Android 在 AndroidManifest.xml 中 <application> 的底下
iOS 在 Info.plist 中 <dict> 的底下
flutter run 加上 --enable-impeller
<key>FLTEnableImpeller</key>
<true/>
<meta-data
android:name="io.flutter.embedding.android.EnableImpeller"
android:value="true" />
Hotfixes in Flutter 3.7
https://github.com/flutter/flutter/wiki/Hotfixes-
to-the-Stable-Channel
●App 設定驗證
○ 版本號
○ Display Name (App 名稱)
○ Bundle Identifier
○ iOS Deployment Target
●資源檔驗證
○ App icon
○ Launch Image (第一次開啟的過場圖案)
iOS 發布驗證
●記憶體檢查工具
●Frame 分析工具
DevTools 更新
●記憶體檢查工具
●Frame 分析工具
DevTools 更新
●自訂內容選單
●TextField 文字放大鏡
●CupertinoListSection
●CupertinoListTile
●滾動改善
Widget 更新
●TextField 可透過參數
contextMenuBuilder 設定
●不支援 Android App Actions
●可透過 ContextMenuController
另外支援其他 Widget
●完整範例
自訂內容選單
●TextField 可透過參數
contextMenuBuilder 設定
●不支援 Android App Actions
●可透過 ContextMenuController
另外支援其他 Widget
●完整範例
自訂內容選單
Android iOS
TextField 文字放大鏡
CupertinoListSection CupertinoListTile
iOS like Widget 更新
●修正許多相關的 issues
●像是 Scrollbars 及 DraggableScrollableSheet
●改善 macOS 平台的滾動體驗
●新增 AnimatedGrid 和 SliverAnimatedGrid
滾動改善
全域選取改善
現在可使用鍵盤快捷鍵 shift+right 做選取變動
flutter_adaptive_scaffold 套件
Flutter 官方維護響應式 Scaffold
●套件 Swift 遷移
●Bitcode 棄用
●iOS PlatformView BackdropFilter
iOS 平台功能更新
●將官方第一優先(1P)套件實作從 Objective-C 遷移至 Swift
●以下套件
○ quick_actions
○ ios_platform_images
○ url_launcher
○ google_sign_in
○ local_auth
○ video_player
○ in_app_purchase
○ image_picker
○ google_maps_flutter
○ camera
○ webview_flutter
套件 Swift 遷移
●watchOS 及 tvOS App 在 Xcode 14 不再要求使用 bitcode
●預設將不會開啟 bitcode
●透過 Add-to-app 遷移
Bitcode 棄用
●BackdropFilter 效果可影響 iOS 原生畫面
●右側以原生文字元件及 Google Map 為例
iOS PlatformView BackdropFilter
●完整名稱為 Custom Fragment Shaders
●讓指定 UI 使用自訂的著色器
●可把自訂的 GLSL shaders 定義在 pubspec.yaml
●目前不支援網頁版
●官方另外提供 flutter_shaders 提供相關的工具類
●可參考 官方文件
●Demo
自訂片段著色器改進
●多國語言國際化工具與文件更新
●Platform Method Channels 可使用在任何 isolate
●記憶體管理改進
●棄用 macOS 10.11 到 10.13 支援,最低支援版本為 10.14 Mojave
●Hot reload 支援字型資源檔
●減少 iOS 動畫卡頓 (會啟用 CADisplayLink 參數)
●Windows 支援深色 title bars
Flutter 3.7 其他更新
遷移 Windows 支援深色 title bars
Dart 2.19 - Isolate.spawn(以前)
Dart 2.19 - Isolate.run(現在)
FlutterFlow
widgetbook
PUPG Mobile
Google classroom
Software supply chain security
+
+
+
+
+
Flutter 生態系統
FlutterFlow
FlutterFlow - i18n
widgetbook
PUPG Mobile - 社區模塊(社群功能)
Google Classroom
Google 自家產品使用 Flutter 開發
軟體供應鏈安全
軟體供應鏈安全 - Dependabot
軟體供應鏈安全 - GitHub Security Advisories
軟體供應鏈安全 - 套件 Hash 檢查
軟體供應鏈安全 - 上傳 Pub GitHub Action 整合
Flutter Forward Extended in Google Developer Taipei
100% sound null safety
加入更多語法
直接調用平台函式庫
支援更多平台架構
+
+
+
+
Dart 3.0
●Dart 3 強制使用 sound null safety
●針對已相容的套件 pub 修改套件標示
100% sound null safety
Null Safety
int getAge(Animal a) {
return a.age;
}
Dart 1 Dart 2: Sound types
Null Safety
int getAge(Animal a) {
return a.age;
}
Dart 2: Sound types
Dart 2.12: Sound null safety
Null Safety - Dart 3.0
int getAge(Animal a) {
return a.age;
}
加入更多語法 - Record
(double x, double y) geoLocation(String name) {
if (name == 'Nairobi') {
return (-1.2921, 36.8219);
} else { ... }
}
void main(List<String> arguments) {
final (lat, long) = geoLocation('Nairobi');
print('Current location: $lat, $long');
}
加入更多語法 - sealed class
sealed class Shape {
}
class Square implements Shape {
final double length;
Square(this.length);
}
class Circle implements Shape {
final double radius;
Circle(this.radius);
}
double calculateArea(Shape shape) => switch
(shape) {
Square(length: var l) => l * l,
Circle(radius: var r) => math.pi * r * r
};
加入更多語法 - Control Flow
ListTile(
title: const Text('Welcome'),
enabled: hasNextStep,
subtitle: hasNextStep ? const Text('Tap to advance') : null,
onTap: hasNextStep ? (){ advace(); } : null,
trailing: hasNextStep ? null : const Icon(Icons.stop),
),
加入更多語法 - Control Flow
ListTile(
title: const Text('Welcome'),
enabled: hasNextStep,
if(hasNextStep)...(
subtitle: const Text('Tap to advance'),
onTap: (){ advace(); },
) else ...(
trailing: const Icon(Icons.stop),
),
),
加入更多語法 - Control Flow
var json = {'user': ['Ray', 13]};
var name = json['user']![0];
var age = json['user']![1];
var json = { 'user': ['Ray', 13]};
var {'user': [ name, age]} = json;
Before
After
加入更多語法 - Control Flow
var json = { 'user': ['Ray', 13]};
var { 'user': [ name, age]} = json;
加入更多語法 - Control Flow
switch(json) {
case {'user': [String name, int age]}:
print('User $name is $age years old');
break;
default:
throw 'unknown message';
}
if (json is Map<String, dynamic> &&
json.length == 1 &&
json.containsKey('key')) {
var user = json['user'];
if (user is List<dynamic> &&
user.length == 2 &&
user[0] is String &&
user[1] is int) {
var name = user[0] as String;
var age = user[1] as int;
print('User $name is $age years old');
}
}
var json = { 'user': ['Ray', 13]};
Before
After
加入更多語法 - Usable Switch
switch(charCode) {
case slash when nextCharCode == slash:
skipComment();
case slash || star || plus || minus:
opearator();
case >= digit0 && <= digit9:
number();
}
直接調用平台函式庫 - C FFI
●FFI,Foreign function interface
●目前已支援 Swift/Objective-C 在 iOS/macOS
●Java/Kotlin 調用 Jetpack 函式庫 或 Android 函式庫
直接調用平台函式庫 - 雙平台
支援更多指令集架構
●RISC-V on Linux
●WebAssembly
支援更多指令集架構
RISC-V 架構支援
電腦運行 Dart Console App 在 ClockworkPi
Dart2Wasm on Flutter Web
https://flutterweb-wasm.web.app/
Flutter Web Time to load
Impeller 雙平台穩定版
網頁版 Element embedding
支援更多指令集架構
Dart 3.0
+
+
+
+
Flutter 下一步
3D with Flutter
Flutter Web Element embedding
https://flutter-forward-demos.web.app/#/
●Custom asset transformers
●Efficient 2D scrolling widgets (e.g. tables and trees)
●Platform Views on macOS and Windows
●Drag and drop
●Wireless debugging on iOS
●Custom "flutter create" templates
Flutter Roadmap 2023 - Features
GitHub 最多 thumbs-up issues
●Code Push
●穿戴式裝置與車用系統整合
●SEO on web
●透過 Homebrew 安裝 Flutter
Flutter Roadmap 2023 - Non-goals
Dash
Dash?
● https://medium.com/flutter/whats-new-in-flutter-3-7-38cbea71133c
●https://medium.com/flutter/whats-next-for-flutter-b94ce089f49c
●https://medium.com/dartlang/dart-3-alpha-f1458fb9d232
●https://medium.com/dartlang/better-isolate-management-with-isolate-run-
547ef3d6459b
●https://github.com/flutter/flutter/wiki/Roadmap
●https://zonble.medium.com/flutter-forward-%E6%91%98%E8%A6%81-
9ba3655eb392
參考資料
●https://github.com/flutter/engine/tree/main/impeller#try-impeller-in-flutter
●https://www.khronos.org/api/spir
●https://zh.wikipedia.org/zh-hant/GLSL
●https://blog.csdn.net/Taobaojishu/article/details/124358237
●https://zhuanlan.zhihu.com/p/556941399
參考資料
THANK YOU!

More Related Content

PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
PDF
導入 Flutter 前你應該知道的事
PDF
初窺 Flutter 開發.pdf
PDF
給 iOS 工程師的 Flutter 開發
PDF
Flutter 踩雷心得
PDF
Flutter實作概述 | GDSC NYCU
PDF
Flutter實作概述 | GDSC NYCU
PDF
KSDG_007_Web 編程另闢蹊徑-GWT,Dart,TypeScript介紹與比較
2024 Trend Updates: What Really Works In SEO & Content Marketing
導入 Flutter 前你應該知道的事
初窺 Flutter 開發.pdf
給 iOS 工程師的 Flutter 開發
Flutter 踩雷心得
Flutter實作概述 | GDSC NYCU
Flutter實作概述 | GDSC NYCU
KSDG_007_Web 編程另闢蹊徑-GWT,Dart,TypeScript介紹與比較
Ad

Flutter Forward Extended in Google Developer Taipei