Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
DartとFlutterでアプリ開発
Search
ken
July 05, 2019
Programming
0
1.3k
DartとFlutterでアプリ開発
2019/07/05
「宮城アプリ開発勉強会 #1」の資料です。
Dart/Flutterに興味はあるけどやった事無い、という皆さんに向けて、
こんな感じだよー、という雰囲気の資料です。
ken
July 05, 2019
Tweet
Share
Other Decks in Programming
See All in Programming
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
CSC307 Lecture 02
javiergs
PRO
1
780
CSC307 Lecture 03
javiergs
PRO
1
490
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.9k
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
180
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
200
AWS re:Invent 2025参加 直前 Seattle-Tacoma Airport(SEA)におけるハードウェア紛失インシデントLT
tetutetu214
2
120
ノイジーネイバー問題を解決する 公平なキューイング
occhi
0
110
Package Management Learnings from Homebrew
mikemcquaid
0
230
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
200
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
1
980
Featured
See All Featured
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
380
Leo the Paperboy
mayatellez
4
1.4k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
430
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
430
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.9k
Why Our Code Smells
bkeepers
PRO
340
58k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
170
Making Projects Easy
brettharned
120
6.6k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
120
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
200
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
120
Transcript
DartとFlutterで アプリ開発 宮城アプリ開発勉強会 2019/07/05
⾃⼰紹介 ๏ 佐藤健(さとうけん) • フリーランスのプログラマ ๏ ⾔語 • Flash/ActionScript •
TypeScript ๏ 趣味 • スラックライン(楽しいよ) • トランポリン(ハマるよ)
Dart? JavaScriptの代替になりたかった プログラミング⾔語
Flutter? iOS/Androidアプリ開発の Dart⽤フレームワーク
Dart、誕⽣ ๏ Googleが開発 ๏ 2011年初公開 • JavaScriptの代替として新規開発 • DartVMで動作する •
DartVMはいずれChromeに統合される • …はずだったのだが…
Dart、⽅向転換 ๏ 2015年 DartVMのChrome統合を断念 • JavaScriptへコンパイルする形へ ๏ 2017年 TypeScriptがGoogle社内標準⾔語に Ͳ͏ߟ͑ͯɺ
%BSUɺ͜ͷ··ফ͑ΔͩΖɻɻɻ
๏ 2018年2⽉ 突然の再起動 • 22⽇ Dart2の発表 • 27⽇ Flutter(Beta)の発表 ๏
2018年12⽉ • 4⽇ Flutter1.0 リリース ๏ 2019年7⽉現在 • Dart2.4.0(2019-06-27) • Flutter 1.5.4-hotfix.2 • 開発版は1.7.11が最新 Dart、再起動 ٸʹ׆ൃʹͳͬͨʜ
๏ Androidアプリが作れる ๏ iOSアプリが作れる ๏ 同じソースコードで両⽅作れる • iOSっぽいUIパーツも⽤意されている Flutter、概要 ಉ͡ιʔείʔυͰ࡞ΕΔΑɻ
ͪΖΜͦΕͳΓͷखؒඞཁ͚ͩͲͶɻ w w w
Flutter、余談 ๏ Fuchsia(フクシア、フクシャ、フューシャ) • Googleが開発中の新しいOS(謎) • UIとアプリはDart/Flutterで作成
Dart/Flutter、開発環境 ๏ Dartを試すだけなら • https://dartpad.dartlang.org/ ๏ きちんと環境を構築するなら • AndroidStudio もしくは
VSCode • https://flutter.dev/ • 「Get Started」の通り 1.FlutterSDKを落としてパス通す 2.flutter doctorコマンドの⾔う事聞く
Dart/Flutter Don't Think. Feel.
Flutter、画⾯構築 ๏ 画⾯の全てはWidget ๏ Widgetは基本的には2種類 • StatelessWidget • StatefulWidget ๏
全てのWidgetは上記2種の継承クラス
サンプルコード import 'package:flutter/material.dart'; void main() { return runApp(MyApp()); } class
MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Hello World App'), ), body: Center( child: Text( 'Hello World', style: TextStyle( color: Colors.green, fontSize: 90, ), ), ), ), ); } }
サンプルコード(1) import 'package:flutter/material.dart'; void main() { return runApp(MyApp()); } class
MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return (লུ) } } ๏ main関数が最初に呼ばれる ๏ ‘new’は省略可能 ๏ runApp関数にWidgetのインスタンスを渡す ๏ アプリルートのWidgetに
サンプルコード(2) class MyApp extends StatelessWidget { @override Widget build(BuildContext context)
{ return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Hello World App'), ), body: (লུ) ), ); } } ๏ MaterialAppWidget ๏ ScaffoldWidget ๏ AppBarWidget ๏ TextWidget
サンプルコード(3) class MyApp extends StatelessWidget { @override Widget build(BuildContext context)
{ return MaterialApp( home: Scaffold( appBar: (লུ), body: Center( child: Text( 'Hello World', style: TextStyle( color: Colors.green, fontSize: 90, ), ), ), ), ); } }
レイアウト(配置の調整) Center( child: Text( 'Hello World', style: TextStyle((লུ)), ), )
Align( alignment: Alignment.bottomRight, child: Text( 'Hello World', style: TextStyle((লུ)), ), )
レイアウト(縦に並べる) Center( child: Text( 'Hello World', style: TextStyle((লུ)), ), )
Column( children: <Widget>[ Text( 'Hello World', style: TextStyle((লུ)), ), Text( 'Hello World', style: TextStyle((লུ)), ), ], ),
レイアウト(横に並べる) Center( child: Text( 'Hello World', style: TextStyle((লུ)), ), )
Row( children: <Widget>[ Text( 'Hello World', style: TextStyle((লུ)), ), Text( 'Hello World', style: TextStyle((লུ)), ), ], ),
画像を表⽰ Center( child: Image.network( 'http://jinten.net/logo.jpg', ), )
ボタン Center( child: RaisedButton( child: Text( 'Ϙλϯ', style: TextStyle(fontSize: 20),
), onPressed: () { print('Button pressed!!'); }, ), ),
ダイアログ onPressed: () { showDialog( context: context, builder: (BuildContext context)
{ return AlertDialog( title: Text('λΠτϧ'), content: Text('ຊจຊจຊจຊจ'), actions: <Widget>[ FlatButton( child: Text('Cancel'), onPressed: () {}, ), FlatButton( child: Text('OK'), onPressed: () {}, ), ], ); }, ); },
ダイアログ(iOS⾵) onPressed: () { showDialog( context: context, builder: (BuildContext context)
{ return CupertinoAlertDialog( title: Text('λΠτϧ'), content: Text('ຊจຊจຊจຊจ'), actions: <Widget>[ CupertinoButton( child: Text('Cancel'), onPressed: () {}, ), CupertinoButton( child: Text('OK'), onPressed: () {}, ), ], ); }, ); },
Dartパッケージの追加 ๏ https://pub.dev
Dart/Flutterの 良い所・悪い所
良い! ๏ 並べる系レイアウトなら⾮常に簡単 ๏ よくあるUIパーツなら⽤意されてる • pub.dev探せばそこそこのモノは⾒つかる ๏ Googleが開発している •
Googleサービス/プロダクトとの⾼い親和性 • firebaseとか ๏ (少なくとも今は)とても活発 ๏ AndroidとiOSのどちらにも対応できる • 将来的にはWeb, Desktop, RaspberryPi, 他 w w (PPE
悪い… ๏ ⾃由なレイアウトには対応しづらい • ゲームとか ๏ まだまだ新しい • 情報が少ない •
知名度が低い ๏ 「AndroidとiOSをワンソースで」の暴⾛ ๏ iOS⾵のUIという罠 ๏ ネストが深くなりがち ๏ スタンダートな設計などが確⽴されていない w #BE
まとめ %BSU'MVUUFSɺ ࠓɺ·͞ʹաظʹ͋Δͷͩʂ ৽͍͠Ϟϊ͖ͳΒ ৮ͬͯΈΔՁΞϦʂ