Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
FlutterでGoogle Mapsを触ってみた - potatotips #76
Search
idonuntius
November 17, 2021
Programming
1.4k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
FlutterでGoogle Mapsを触ってみた - potatotips #76
idonuntius
November 17, 2021
More Decks by idonuntius
See All by idonuntius
Appleの標準アプリで使われている半モーダルビューについて
ikustan
0
530
iOSのUXについて考えてみた
ikustan
0
110
Human Interface Guidelinesを参考にApp Storeを見てみた
ikustan
0
440
Other Decks in Programming
See All in Programming
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
230
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
230
新卒PdEのリアル
ryu1013
1
480
How I Stole PSI from Android Studio - DroidKaigi2026
worker8
0
100
Swift愛好会と私(ウホーイ) / Swift Fan Club and Uhooi
uhooi
0
150
Vibes Containers 〜AIで変わるコンテナ設計と運用〜
tkikuc
3
520
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
430
『寄り添うラジオ』をAIで作る 体験価値から逆算した、会話しないUXと品質設計
theoriatec2024
3
150
AIの中の人になってみる
htkym
0
170
「AI時代、配布するPythonコードをどう守るか: 難読化の実験と判断軸」 #PyconJP2026
pkshadeck
PRO
2
190
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
130
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
120
Featured
See All Featured
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
410
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
490
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
270
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
690
Side Projects
sachag
456
43k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
290
Git: the NoSQL Database
bkeepers
PRO
432
67k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2.8k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
190
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
300
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
230
Transcript
FlutterでGoogle Mapsを 触ってみた potatotips #82 いどぬん / Natsuki Idota
自己紹介 • 名前 いどぬん / Natsuki Idota • 会社 株式会社Mobility
Technologies / Flutter • サービス Twitter: @idonuntius Github: idonuntius
本題 サンプルは下記URL https://github.com/idonuntius/GoogleMapsExample_Flutter
紹介 1. マップ 2. マーカー 3. ポリライン
紹介 4. ポリゴン 5. サークル
導入方法(1. APIの取得) 1. https://mapsplatform.google.com/ にアクセスし、「Get started」をクリック 2. 必要事項を入力 3. 「自分のAPIキー」をコピー
導入方法(2. Flutter側の設定) pubspec.yamlのdependenciesにgoogle_maps_flutterを追加
導入方法(3. iOS側の設定) AppDelegate.swiftを開き 1. 「import GoogleMaps」を追加 2. 「GMSServices.provideAPIKey(APIKey)」を追加 1 2
導入方法(4. Android側の設定) AndroidManifest.xmlを開き、「com.google.android.geo.API_KEY」を追加
使用方法(最速実装)
使用方法(GoogleMapクラスの主なオプション) オプション 説明 デフォルト値 initialCameraPosition マップのカメラの初期位置 onMapCreated マップが使用可能な状態になったとき(生成時)のコールバックメソッド mapType マップの種類
MapType.normal scrollGesturesEnabled スクロールジェスチャーに反応するかどうかを指定 true onCameraMove ドラッグやピンチのジェスチャ操作など状態変更時に発生。 地図(カメラ)の中心の緯度と 経度を取得 markers 地図上に配置するマーカー polylines 地図上に表示するポリライン polygons 地図上に表示するポリゴン circles 地図上に表示するサークル
使用方法(GoogleMapの主なオプション) オプション 説明 デフォルト値 initialCameraPosition マップのカメラの初期位置 onMapCreated マップが使用可能な状態になったとき(生成時)のコールバックメソッド mapType マップの種類
MapType.normal scrollGesturesEnabled スクロールジェスチャーに反応するかどうかを指定 true onCameraMove ドラッグやピンチのジェスチャ操作など状態変更時に発生。 地図(カメラ)の中心の緯度と 経度を取得 markers 地図上に配置するマーカー polylines 地図上に表示するポリライン polygons 地図上に表示するポリゴン circles 地図上に表示するサークル
マップの種類(MapType) 1. none 2. normal 3. satellite (衛生) 4. terrain
(地形) 5. hibrid (衛星画像+ラベル/ オーバーレイ)
マーカーの表示
Markerクラスの主なオプション オプション 説明 デフォルト値 markerId マーカーID position マーカーの位置。LatLngで指定 LatLng(0.0, 0.0)
icon マーカーのアイコン BitmapDescriptor.defaultMarker infoWindow タップ時に表示される情報ウィンドウ InfoWindow.noText anchor マーカーのpositionに配置されるiconの位置 (0.0, 0.0)の場合は画像の左上、 (1.0, 1.0)の場合は画像の右下 Offset(0.5, 1.0) rotation マーカーの回転 0.0 onTap マーカーのタップイベントを受け取るためのコールバック 他にもドラックイベントを受け取るためのコールバックなどがあります
Markerクラスの主なオプション オプション 説明 デフォルト値 markerId マーカーID position マーカーの位置。LatLngで指定 LatLng(0.0, 0.0)
icon マーカーのアイコン BitmapDescriptor.defaultMarker infoWindow タップ時に表示される情報ウィンドウ InfoWindow.noText anchor マーカーのpositionに配置されるiconの位置 (0.0, 0.0)の場合は画像の左上、 (1.0, 1.0)の場合は画像の右下 Offset(0.5, 1.0) rotation マーカーの回転 0.0 onTap マーカーのタップイベントを受け取るためのコールバック 他にもドラックイベントを受け取るためのコールバックなどがあります
マーカーのアイコン 1. 色の変更 「hubBlue」以外にもさまざまな色が定義されています。 また「defaultMarkerWithHue」には0~360の値を指定 できるので自分の好きな色に変更ができます。
マーカーのアイコン 2. 画像に変更 1. pubspec.yamlにリソースを追加 2. 画像の設定
マーカーのアイコン 2. 画像に変更 1. pubspec.yamlにリソースを追加 2. 画像の設定 ローカルの画像を取得するための 「fromAssetImage」メソッドが Future<BitmapDescriptor>型のた
め「FutureBuilder」を使用する
マーカーのアイコン 2. 画像に変更 1. pubspec.yamlにリソースを追加 2. 画像の設定 取得した画像を設定
マーカーのアイコン 2. 画像に変更
マーカーの情報ウィンドウ その他にも「anchor」や「onTap」の オプションがあります。
ポリライン
ポリライン
ポリライン マップ生成時にカメラを移動させて、 ポリライン全体を表示させることも可能
Polylineクラスの主なオプション オプション 説明 デフォルト値 polylineId ポリラインID points ポリラインの座標。LatLngのListで指定 <LatLng>[] patterns
ポリラインのストロークパターン <PatternItem>[] color ポリラインの色 Colors.black width ポリラインの幅 10 onTap タップイベントを受け取るためのコールバック
Polylineクラスの主なオプション オプション 説明 デフォルト値 polylineId ポリラインID points ポリラインの座標。LatLngのListで指定 <LatLng>[] patterns
ポリラインのストロークパターン <PatternItem>[] color ポリラインの色 Colors.black width ポリラインの幅 10 onTap タップイベントを受け取るためのコールバック
ポリラインのパターン
ポリラインのパターン 但し、Androidでしか使えません。 iOSはissue化されており、まだ実装中みたいです。 https://github.com/flutter/flutter/issues/60083
応用 1. マーカー + Timer 2. マーカー + ポリライン
まとめ • FlutterのGoogle Mapsではマーカーやポリラインなどを使って色々な表示ができそ う • またそれらを組み合わせることで様々な用途に使えそう
ありがとうございました