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
Flutterの Bottom Navigation による画面遷移について
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
txmn
August 28, 2018
Programming
6.1k
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Flutterの Bottom Navigation による画面遷移について
Flutter Meetup Tokyo #4 の初心者枠LT
txmn
August 28, 2018
Other Decks in Programming
See All in Programming
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
210
What's New in Android 2026
veronikapj
0
260
テーブルをDELETEした
yuzneri
0
140
AIが無かった頃の素敵な出会いの話
codmoninc
1
410
the container ship “Apple Silicon”@WWDC26 Recap -Japan-\(region).swift
shingangan
0
120
関東Kaggler会_NVIDIA_Nemotron_コンペ_振り返り
rick_ds
0
520
Lean は証明の正しさを確認するためだけのツールって思ってませんか?
inoueasei
1
150
VibeCodingからAgenticWorkflowへ
starfish719
0
390
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
300
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
790
変わらないものが、変わるものを決める — 意図駆動開発 × イベントソーシング × イミュータブル | What Doesn't Change Decides What Can — IDD × Event Sourcing × Immutability
tomohisa
0
1.5k
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
500
Featured
See All Featured
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
210
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
119
120k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.7k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.7k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
270
My Coaching Mixtape
mlcsv
0
220
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
380
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Visualization
eitanlees
152
17k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
850
Designing for Performance
lara
611
70k
Paper Plane
katiecoart
PRO
2
52k
Transcript
Flutterの Bottom Navigation による画面遷移について Flutter Meetup Tokyo #4 Beginner Lightning
Talk
About Me • txmn / Haruki Watanabe • 株式会社フォニム •
サーバーサイドエンジニア(Rails) • フロントでReactやVue使ったり… • 既存WEBサービスのスマホアプリを作りたい • スマホアプリ開発経験無し • 一瞬 React Native x Expo に寄り道してFlutterへ • UdacityのGoogle公式のコースで学習。ちょうど1週間くらい。 Twitter
Bottom Navigation を実装したい! https://material.io/design/components/bottom-navigation.html
Navigator class でとりあえずやってみる Push pushReplacement •
Navigator.popで戻れる • “<” が自動でつく(下図参照) • 一方通行 • とりあえずこっち使うか…
しかし… たくさん問題があります • その都度新しいWidgetをbuildすることの負担 • 特にWidget内部でAPIを用いる場合など • タブ切り替え時にWidget内部の状態を維持して おきたい •
Twitterなどメジャーなアプリと同様 • 遷移時の挙動がMaterial Design ガイドラインに 反する • “ Don’t. Avoid using lateral (left-and-right) motion to transition between views.”
解決策をググってみる https://github.com/bizz84/nested-navigation-demo-flutter ありがとうございます
じっさいにやってみる 左図のようなアプリを考える • Scaffold • body • それぞれのtab itemに対応するWidget •
TabNavigator(※custom widget) • bottomNavigationBar • items 1. Home 2. Search 3. Bookmark 4. Message 5. Account
Step 1 : building all and offstage
• それぞれのタブに対応するWidget(以下①)を全て生成する • この時、①内部でも基本的にNavigatorを使うことになるので、アプリ全体で一意に Navigatorを定めるためにGlobalKey<NavigatorState>を①に流し込む • 変数currentTabの初期値をhomeに設定する • Offstage class を用いてcurrentTab以外の全てのタブをoffstageにする • Offstage(offstage: bool) で隠すことが出来る。 • cssのdisplay:none的な感じ。ちなみにoffstage(n:舞台裏)
Step 2 : stacking all • Step 1で作成したそれぞれのタブに対応するWidgetを全て1つに重ねる • Stack
Classでラップするだけで良い
Step 1, 2のそれぞれのコード部分抜粋 主にOffstageとNavigator key部分 Stackと①全生成について
Step 3 : Android back button handler • iOSには無いがAndroidにはback buttonがある
• そこでユーザーがpop先のRouteを 失った時に備えて、WillPopScope Classを用いて、事前にコールバック 先を登録しておく
実際の画面
まとめ • 非表示のWidgetをStackで重ねておいて、タブ選択時に表示をする というのはとても新鮮でした。 • iOS/AndroidのネイティブAppではどのようにBottom Navigationの 遷移を対応しているのか非常に気になりました。 • 拙い発表でしたが、最後までご清聴頂きありがとうございました。