FlutterKaigi2021
by
Koji Wakamiya
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
FlutterʹUIϚΠΫϩαʔϏε։ൃΛಋೖ͠ɺ ѹతͳDXΛ࣮ݱ͠Α͏ʂ Koji Wakamiya(@koji-1009) / FlutterKaigi 2021
Slide 2
Slide 2 text
ࣗݾհ • Koji Wakamiya • @koji-1009(GitHub) • Flutter/Android/iOS • Tech lead(mobile client/Studyplus, inc.)
Slide 3
Slide 3 text
ࣗݾհ • Flutterͷঢ়ଶཧͱViewͷߋ৽ • FlutterͰPluginΛۦͯ͠ߴʹ։ൃ͢Δ • "σβΠϯγεςϜ"ͷաͳҰൠԽͱͦͷରԠʹ͍ͭͯ • fl utter_auth_ui(pub.dev)
Slide 4
Slide 4 text
Studyplus, inc. • ֶशهཧΞϓϦ Studyplus • ࢀߟॻαϒεΫΞϓϦ Porto
Slide 5
Slide 5 text
Studyplus, inc. • Studyplus • Kotlin or Swift + Add-to-App(Dart) • Porto • Dart
Slide 6
Slide 6 text
FlutterͰ࠷ߴͷDX
Slide 7
Slide 7 text
ͳͥDX(Developer Experience)? • ΞϓϦέʔγϣϯ͕େ͖͘ͳͬͨ࣌ͷ։ൃମݧΛߟ͍͑ͨ • FlutterΛ࠾༻͢Δ͜ͱͷϝϦοτΛߋʹཧ͍ͨ͠
Slide 8
Slide 8 text
FlutterͷDX • ҰൠʹޠΒΕ͍ͯΔͷ • એݴతUI • Hot Reload • ϚϧνϓϥοτϑΥʔϜ
Slide 9
Slide 9 text
FlutterͷDX • ҰൠʹޠΒΕ͍ͯͳ͍ͷ • σϑΝΫτελϯμʔυͷগͳ͞ • ഁյతͳมߋͷଟ͞ • εέʔϧͰ͖Δ։ൃख๏
Slide 10
Slide 10 text
FlutterͷDX • ҰൠʹޠΒΕ͍ͯͳ͍ͷ • σϑΝΫτελϯμʔυͷগͳ͞ • ഁյతͳมߋͷଟ͞ • εέʔϧͰ͖Δ։ൃख๏
Slide 11
Slide 11 text
Agenda • લɿFlutterͷ։ൃΛߟ͑Δ • ϚΠΫϩαʔϏε • FlutterͱFlutter Package&Plugin • Package&PluginͱGit Repository
Slide 12
Slide 12 text
Agenda • ޙɿ࣮αϯϓϧʹΑΔߟ • ࣮ྫ • ։ൃͷਐΊํ • ׂʹ͍ͭͯͷߟ
Slide 13
Slide 13 text
Flutterͷ։ൃΛߟ͑Δ FlutterͰͲ͏͍ͬͨ։ൃΛ͢Δͱ৺Α͍ͷ͔
Slide 14
Slide 14 text
৺Α͍։ൃͷఆٛ • मਖ਼ػೳ։ൃ͕༰қ • ϦϦʔε͕༰қ • ΤϯδχΞͷࢀՃ͕༰қ
Slide 15
Slide 15 text
࡞ޙͷΞϓϦέʔγϣϯ • मਖ਼ػೳ։ൃ͕༰қ • ϦϦʔε͕༰қ • ΤϯδχΞͷࢀՃ͕༰қ
Slide 16
Slide 16 text
ػೳ։ൃ͕͘ଓ͍ͨΞϓϦέʔγϣϯ • मਖ਼ػೳ։ൃ͕༰қʁ • ϦϦʔε͕༰қʁ • ΤϯδχΞͷࢀՃ͕༰қʁ
Slide 17
Slide 17 text
͘ଓ͍ͨΞϓϦέʔγϣϯͷݕ౼ • ෳϓϥοτϑΥʔϜରԠ • ଟػೳͳΞϓϦέʔγϣϯ
Slide 18
Slide 18 text
ҭͬͨΞϓϦέʔγϣϯͷݕ౼ • ෳϓϥοτϑΥʔϜରԠ • ଟػೳͳΞϓϦέʔγϣϯ
Slide 19
Slide 19 text
ෳϓϥοτϑΥʔϜͷ՝ • ϦϦʔεαΠΫϧ • ετΞ৹ࠪͷ༗ແ͞ͳͲ • ϓϥοτϑΥʔϜݻ༗ͷ࣮ • iOSͷAppClipsAndroidͷSlicesͳͲ
Slide 20
Slide 20 text
ෳϓϥοτϑΥʔϜͷ՝ • ରԠϓϥοτϑΥʔϜ͕૿͑Δͨͼʹݕ౼͕ඞཁ • FlutterͷΈతʹղܾ͕͍͠ • ରԠϓϥοτϑΥʔϜ͝ͱʹׂͰ͖ΔΈ͕ඞཁ
Slide 21
Slide 21 text
ҭͬͨΞϓϦέʔγϣϯͷݕ౼ • ෳϓϥοτϑΥʔϜରԠ • ଟػೳͳΞϓϦέʔγϣϯ
Slide 22
Slide 22 text
ଟػೳΞϓϦέʔγϣϯͷͭΒ͞ • ཁ݅ͷෳࡶੑ͕ίʔυʹө͞Εͯ͠·͏ • ॲཧ͕ෳࡶʹͳΔ • ίʔυྔ͕େ͖͘ͳΔ
Slide 23
Slide 23 text
ଟػೳΞϓϦέʔγϣϯͷͭΒ͞ • ը໘ભҠ͕ෳࡶʹͳΓɺ։ൃதͷը໘͕දࣔ͠ʹ͘͘ͳΔ • UIͷදࣔ݅Λ͑Δͷ͕͘͠ͳΔ • ڞ௨͢ΔWidgetͱͦ͏Ͱͳ͍Widgetͷஅ͕͘͠ͳΔ
Slide 24
Slide 24 text
ҭͬͨΞϓϦέʔγϣϯͱ͖߹͏ • Presentation Domain Separation • ΞϓϦέʔγϣϯΛదʹׂ͢Δ • ׂͨ͠ίʔυΛཧ͍͢͠ঢ়ଶʹอͭ • νʔϜʹ߹ΘͤͨڥΛ࡞Δ
Slide 25
Slide 25 text
ϚΠΫϩαʔϏε
Slide 26
Slide 26 text
ϚΠΫϩαʔϏε(microservice) • ϚΠΫϩαʔϏεͱɺΞϓϦέʔγϣϯ։ൃͷख๏·ͨ ΞʔΩςΫνϟɻΞϓϦέʔγϣϯͷߏཁૉΛಠཱͨ͠αʔ Ϗε܈(ϚΠΫϩαʔϏε)͚ɺ࿈ܞͤ͞Δख๏Ͱ͢ɻ • https://www.redhat.com/ja/topics/microservices
Slide 27
Slide 27 text
ϚΠΫϩαʔϏεͷߟ • मਖ਼ػೳ։ൃ͕༰қ • ϦϦʔε͕༰қ • ΤϯδχΞͷࢀՃ͕༰қ
Slide 28
Slide 28 text
मਖ਼ػೳ։ൃ͕༰қ • ґଘ͕ؔཧ͞ΕΔ • Өڹ͕ݶఆత͔Ͳ͏͔͕Θ͔Δ • αʔϏε୯ମͰಈ࡞νΣοΫ͕Մೳ
Slide 29
Slide 29 text
ϦϦʔε͕༰қ • αʔϏε୯ମͰϦϦʔεͷੋඇΛఆͰ͖Δ • αʔϏε୯ମͰසΛཧͰ͖Δ • αʔϏεΛ౷߹͢ΔଆͱΓͤΔ • ։ൃϦϦʔεͱࢢϦϦʔε
Slide 30
Slide 30 text
ΤϯδχΞͷࢀՃ͕༰қ • ࠷ॳ͔ΒFlutterͷશͯΛ֮͑ͳͯ͘ྑ͍ • ୲͢ΔػೳɺൣғΛߜΔ͜ͱ͕Ͱ͖Δ • ϑϨʔϜϫʔΫʹஈ֊తʹ׳ΕΔ͜ͱ͕Ͱ͖Δ • Pure DartͳLogic͔Β୲͢ΔͳͲ
Slide 31
Slide 31 text
FlutterͰϚΠΫϩαʔϏε։ൃՄೳ͔ʁ • ΞϓϦέʔγϣϯ͔ΒϚΠΫϩαʔϏεΛநग़͢Δ • ΞϓϦέʔγϣϯͷLogicΛಠཱͤ͞Δ • ΞϓϦέʔγϣϯͷWidgetΛಠཱͤ͞Δ • ίʔυϕʔεΛಠཱͨ͠୯ҐͰѻ͏
Slide 32
Slide 32 text
FlutterͱFlutter Package&Plugin
Slide 33
Slide 33 text
Flutterͷίʔυྨ • Pure Dart • freezed, riverpod • Flutter Widget • gap, in fi nite_scroll_pagenation • Method Channel • fi rebase_auth, shared_preferences
Slide 34
Slide 34 text
FlutterΞϓϦͷׂํ๏ • Flutter Application • fl utter create —template app • Dart(Flutter) Package • fl utter create —template package • Method Channel (Plugin) • fl utter create —template plugin
Slide 35
Slide 35 text
FlutterΞϓϦͷׂํ๏ • ΞϓϦέʔγϣϯͱͯ͠ߏ͍ͨ͠ • Flutter Application • ϩδοΫɺදࣔͰׂ͍ͨ͠ • Dart(Flutter) Package • ϓϥοτϑΥʔϜ͝ͱͷ࣮Λ͍ͨ͠ • Method Channel (Plugin)
Slide 36
Slide 36 text
Package&PluginͱGit Repository
Slide 37
Slide 37 text
FlutterͷPluginͷཧ • pub.dev • PrivateͳڥͰར༻Ͱ͖Δpub.devͳ͍ • GitHub PackagesDartʹະରԠ(2021.11ݱࡏ) • PrivateͳPluginΛ͢Δڥ͕ඞཁ
Slide 38
Slide 38 text
FlutterͷPluginͷཧ • FlutterGit RepositoryΛ׆༻Մೳ • pubspec.yamlʹgitͱͯ͠Ճ • BranchTagΛࢦఆ͢Δ͜ͱՄೳ • https://dart.dev/tools/pub/dependencies
Slide 39
Slide 39 text
Git RepositoryͷϝϦοτ • BranchΛ͚Δ͜ͱͰɺෳػೳΛฒߦͯ͠։ൃͰ͖Δ • Git TagΛར༻ͨ͠ɺػೳͷόʔδϣχϯά͕Ͱ͖Δ • Git RepositoryͷΞΫηεݖݶΛస༻Ͱ͖Δ
Slide 40
Slide 40 text
Git RepositoryͷσϝϦοτ • Pluginͷґଘؔղܾʹ੍͕͋Δ • ʮΑΓ৽͍͠ʯόʔδϣϯͷਪҠ͕ಈ࡞͠ͳ͍ • Git RepositoryͷΞΫηεʹ͕ඞཁʹͳΔ͜ͱ͕͋Δ • GitHub ActionsͰར༻͢ΔࡍʹSSH Keyͷઃఆ͕ඞཁͳͲ
Slide 41
Slide 41 text
࣮ݱͰ͖Δͷʁ
Slide 42
Slide 42 text
࣮αϯϓϧʹΑΔߟ ϚΠΫϩαʔϏε։ൃΛͲͷΑ͏ʹಋೖ͢Δ͔
Slide 43
Slide 43 text
࣮ྫ
Slide 44
Slide 44 text
࣮αϯϓϧ • 4ͭͷPackageͰߏ͞ΕΔApplication • খنͳΞϓϦͷͨΊɺׂ͠ͳ͍ํ͕։ൃ͍ • ։ൃ͕ਐΜͩ࣌ɺ֦ு͍͔͢͠Ͳ͏͔ͷࢀߟʹ • https://github.com/koji-1009/kaigi_project_2021
Slide 45
Slide 45 text
࣮αϯϓϧ • Application • kaigi_project_2021 • Package • kaigi_plugin_a_2021 => Theme • kaigi_plugin_b_2021 => HomePage • kaigi_plugin_c_2021 => ScreenName • kaigi_plugin_d_2021 => ScreenCounter
Slide 46
Slide 46 text
࣮αϯϓϧ(࣮ߦ࣌) QSPKFDU@ QMVHJO@C QMVHJO@D QMVHJO@E QMVHJO@B
Slide 47
Slide 47 text
࣮αϯϓϧ(࣮ߦ࣌) QSPKFDU@ )PNF1BHF 4DSFFO/BNF 4DSFFO$PVOUFS 5IFNF
Slide 48
Slide 48 text
࣮αϯϓϧ(։ൃ࣌) )PNF1BHF 4DSFFO/BNF 4DSFFO$PVOUFS 5IFNF
Slide 49
Slide 49 text
࣮αϯϓϧͷҙਤ • PackageͱApplicationͷؔੑΛදݱ • ApplicationͱPackageͷ྆ํ͕ɺPackageʹґଘ • Package͝ͱʹӨڹΛ༩͑Δൣғ͕ҟͳΔ • exampleΞϓϦέʔγϣϯʹΑΔPackageͷಈ࡞νΣοΫ
Slide 50
Slide 50 text
։ൃͷਐΊํ
Slide 51
Slide 51 text
ߏ • kaigi_project_2021 • apkipaʹ౷߹ • ΞϓϦέʔγϣϯݻ༗ͷ࣮ͳͲ • ΞϓϦΞΠίϯͷઃఆ • URLεΩʔϚͷઃఆ
Slide 52
Slide 52 text
ߏ • Theme(plugin_a) • ΞϓϦͷςʔϚWidget • LightThemeͱDarkThemeΛ • ଞͷશͯͷUI Package͕ґଘ
Slide 53
Slide 53 text
ߏ • HomePage(plugin_b) • plugin_cͱplugin_dΛཧ • pathͱrouteͷ౷߹
Slide 54
Slide 54 text
ߏ • Screen(plugin_c, plugin_d) • Themeplugin_aΛө • ΞϓϦͷಠཱͨ͠Widget
Slide 55
Slide 55 text
ϦϦʔεͷํ QSPKFDU@ QMVHJO@C QMVHJO@D QMVHJO@E QMVHJO@B 1.0.0 1.0.0 1.0.0 1.0.0 1.0.0
Slide 56
Slide 56 text
ϦϦʔεͷํ QMVHJO@C QMVHJO@D QMVHJO@E QMVHJO@B feature/dark_theme 1.0.0 1.0.0 1.0.0
Slide 57
Slide 57 text
ϦϦʔεͷํ QSPKFDU@ QMVHJO@C QMVHJO@D QMVHJO@E QMVHJO@B 1.1.0 1.0.0 1.0.0 1.0.0 1.1.0
Slide 58
Slide 58 text
ϦϦʔεͷํ QSPKFDU@ QMVHJO@C QMVHJO@D QMVHJO@E QMVHJO@B 1.1.0 1.0.1 1.0.1 1.0.0 1.1.1
Slide 59
Slide 59 text
ϦϦʔεͷॊೈੑ • ApplicationͰऔΓࠐ·ͳ͚ΕɺࢢʹϦϦʔε͞Εͳ͍ • pubspec.yamlʹࢦఆ͞ΕΔTagBranchͰίϯτϩʔϧ • ϦϙδτϦͷ࠷৽ΛݟΔɺΑ͏ͳࢦఆՄೳ • mainΛ͋͑ͯࢦఆ͠ɺৗʹ࠷৽Λऔಘ͢ΔͳͲ
Slide 60
Slide 60 text
ׂʹ͍ͭͯͷߟ
Slide 61
Slide 61 text
ׂ͢Δ͖αΠζ • ApplicationΛׂʹࡍݶ͕ͳ͍ • ʮ1 class=1 Packageʯ·Ͱ͍͘ͱΓ͗͢ײ • ͨͩ͠Themeͷ߹దͳҹ • ߋ৽ස͕ߴ͍ͷΛׂ͠ɺ͍ͷΛ·ͱΊΔͳͲ
Slide 62
Slide 62 text
ׂ͢Δ͖αΠζ • ͜ΕҎ্ׂෆՄೳ • Theme Widget • Constants
Slide 63
Slide 63 text
ׂ͢Δ͖αΠζ • ϏδωεϩδοΫ • ෳͷWidgetͰ͍ճ͢߹ • ͍·Θ͞ͳ͍ͷͰ͋ΕɺWidgetͷதʹด͓ͯ͘͡ • PDS͕Ͱ͖͍ͯΕɺΓ͠༰қ
Slide 64
Slide 64 text
ׂ͢Δ͖αΠζ • Route • Package͝ͱʹRouteʹରԠ͢ΔPathΛఏڙʁ • ϓϥοτϑΥʔϜ͝ͱʹҟͳΔRouteΛ࣮ݱʁ • Navigator 2ͷϥούʔϥΠϒϥϦʹґଘ
Slide 65
Slide 65 text
ׂ͢Δ͖αΠζ • έʔεόΠέʔε͕ͩɺ෦తʹׂΛࢼ͢͜ͱͰ͖Δ • Add-to-AppͱFlutterΞϓϦͰWidgetΛڞ௨ʹ͢ΔͳͲ • Add-to-AppͰՃ͢ΔWidgetΛׂ͓ͯ͘͠ͱྑ͍ • ݕূ൛ΞϓϦέʔγϣϯΛAndroidͰ༻ҙ͍͢͠
Slide 66
Slide 66 text
·ͱΊ
Slide 67
Slide 67 text
ຊηογϣϯͷఏҊ • FlutterͷϚΠΫϩαʔϏε։ൃΛఏҊ • ΞϓϦέʔγϣϯΛPackage&Pluginͷू߹ମͱΈͳ͢ • UIͱϩδοΫΛFlutter Package&Pluginʹׂ • PrivateͳGit RepositoryΛར༻
Slide 68
Slide 68 text
Thank you!