Slide 1

Slide 1 text

ਓؾαʔϏεΛFlutter WebͰ 
 ϦϓϨʔε͢Δͱ Ͳ͏ͳΔͷ͔ FlutterKaigi 2022 @koji-1009/2022-11-16 1

Slide 2

Slide 2 text

ࣗݾ঺հ • एٶߒ࢘/@koji-1009(GitHub) • ελσΟϓϥεגࣜձࣾ • ϞόΠϧΫϥΠΞϯτνʔϜ ςοΫϦʔυ • Google for Startups Accelerator Mentor 2

Slide 3

Slide 3 text

ࣗݾ঺հ • FlutterʹUIͷϚΠΫϩαʔϏε։ൃΛಋೖ͠ɺ 
 ѹ౗తͳDXΛ࣮ݱ͠Α͏ʂ • FlutterKaigi 2021 day 2 • Flutter Webͷ։ൃΛߦ͏ͨΊͷ஌ݟʢϦϙδτϦ෼ׂʣ 3

Slide 4

Slide 4 text

ελσΟϓϥεגࣜձࣾ • Mission • ֶ ぶ ت び Λ͢ べ ͯͷਓ΁ • Value • Dive to Learn - ֶशऀͷͨΊʹ΍Ζ͏ • Fail Forward - ど Μ ど Μࣦഊ͠Α͏ • Far Together - ҧ͍ʹ׮༰ で ͋Ζ͏ 4

Slide 5

Slide 5 text

ελσΟϓϥεגࣜձࣾ • 2010೥૑ۀͷEdTechاۀ • αʔϏε • toC޲͚: Studyplus • toB޲͚: Studyplus for School 5

Slide 6

Slide 6 text

ελσΟϓϥεͱFlutter • 2019೥9݄ϦϦʔεͷPortoʹͯFlutterΛ࠾༻ • Portoͷػೳ͸2021೥͔ΒStudyplusʹ౷߹ • 2021೥12݄͔ΒStudyplusʹ΋Add-to-appͰར༻ • 2023೥ʹKotlin/Swift͔ΒFlutter΁શ໘తʹҠߦ༧ఆ 6

Slide 7

Slide 7 text

໨࣍ • Flutter Webͷ঺հ • Flutter Webͷ࠾༻ࣄྫ • Flutter Webͷಛ௃ • ׆༻ͷͨΊͷ޻෉ • Flutter WebΛ࠾༻͢ΔͱͲ͏ͳΔ͔ 7

Slide 8

Slide 8 text

Flutter Web 8

Slide 9

Slide 9 text

Flutter Web • Flutter 2.0.0͔Βstable • fl utter build webίϚϯυʹΑΓSPAΛੜ੒ • Dart੡ͷύοέʔδͰ͋Ε͹ར༻Մೳ • શͯͷύοέʔδ͕࢖͑ΔΘ͚Ͱ͸ͳ͍ • Windowؔ਺΍JSϥΠϒϥϦΛಡΈࠐΜͰར༻Ͱ͖Δ΋ͷ΋͋Δ 9

Slide 10

Slide 10 text

Flutter Web • Navigator 2ͱ૊Έ߹ΘͤΔ͜ͱʹΑΓϒϥ΢βͷಈ࡞ʹରԠ • CanvasKitͱHTMLͷ2ͭͷϨϯμϦϯάϞʔυ • Flutter 3.3Ͱ͸SEOʹ՝୊ΞϦ • SSR΍SSG͸2022೥࣌఺Ͱਖ਼ࣜαϙʔτ͞Εͣ • ಈతͳΞϓϦέʔγϣϯ޲͚ 10

Slide 11

Slide 11 text

https://docs. fl utter.dev/development/platform-integration/web/faq#search- engine-optimization-seo In general, Flutter is geared towards dynamic application experiences. Flutter’s web support is no exception. Flutter web prioritizes performance, fi delity, and consistency. This means application output does not align with what search engines need to properly index. For web content that is static or document-like, we recommend using HTML—just like we do on fl utter.dev, dart.dev, and pub.dev. You should also consider separating your primary application experience —created in Flutter—from your landing page, marketing content, and help content—created using search-engine optimized HTML. 11

Slide 12

Slide 12 text

Flutter Webͷ࠾༻ࣄྫ

Slide 13

Slide 13 text

࠾༻ࣄྫ • WebΞϓϦέʔγϣϯͷ։ൃʹFlutterΛ࠾༻ • Ұ෦ͷސ٬޲͚ΞϓϦέʔγϣϯ͸ϦϦʔεࡁΈ • Ұൠ޲͚ͷΞϓϦέʔγϣϯΛ։ൃத • ϞόΠϧΫϥΠΞϯτνʔϜ͕։ൃΛओಋ • ςοΫϦʔυ + AndroidΤϯδχΞ 2໊ + iOSΤϯδχΞ 2໊ 13

Slide 14

Slide 14 text

Flutter Web࠾༻ͷϞνϕʔγϣϯ • ϛογϣϯ΍Ϗδωε໨తͱ։ൃ্ͷ੍໿ͷဃ཭ • ϓϥοτϑΥʔϜ͝ͱͷ։ൃ͸ຊ࣭తͳ໨తͰ͸ͳ͍ • ΑΓૣ͘ɺΑΓ޿͍؀ڥʹ޲͚ͨαʔϏεల։ • ΞΫηγϏϦςΟ • ݹ͍୺຤΍OSͰ΋ར༻Ͱ͖ΔαʔϏε΁ 14

Slide 15

Slide 15 text

Flutter Webͷ࠾༻໨త • MobileͷΑ͏ʹWebΞϓϦέʔγϣϯ͕࡞ΕΔ • MobileΤϯδχΞ͕WebΞϓϦέʔγϣϯΛ։ൃͰ͖Δ 15

Slide 16

Slide 16 text

MobileͷΑ͏ͳWebΞϓϦέʔγϣϯ • WebΞϓϦέʔγϣϯʹMobileతͳίϯϙʔωϯτΛ࣋ͪࠐΊΔ • ListView΍ButtonɺSpinnerɺը໘ભҠͳͲ • LongTap΍Hoverঢ়ଶͳͲʹରԠ • Ϛ΢εɺࢦɺλονϖϯʹରԠ • Dark Theme΋ඪ४αϙʔτ 16

Slide 17

Slide 17 text

ෳ਺ϓϥοτϑΥʔϜʹରԠͰ͖ΔΤϯδχΞ • ΤϯδχΞͷ࠾༻͕ඇৗʹ೉͍͠ • MobileΞϓϦέʔγϣϯ։ൃ͕Ͱ͖ΔΤϯδχΞ͸رগ • طଘϝϯόʔͷطଘεΩϧͷԆ௕ઢ্ͰWebʹରԠ͍ͨ͠ • υϝΠϯ஌ࣝ΋े෼ͳͨΊɺ׆༂Ͱ͖Δૉ஍͸े෼ʹ͋Δ • (௕ظతʹ͸ҭ੒΍࠾༻Λ͢Δ΂͖) 17

Slide 18

Slide 18 text

Flutter Web΁ͷ఍߅ײ • Flutter Web΁औΓ૊Ή͜ͱࣗମ͸఍߅ײͳ͠ • ։ൃ͢ΔͨΊͷ஌ݟ͕଍Γͳ͍ͨΊෆ҆ • DartͷίʔυΛϨϏϡʔ͢Δ஌ݟ΍ࣗ৴ • WebʹରԠ͢ΔͨΊͷϥΠϒϥϦ΍ઃܭ 18

Slide 19

Slide 19 text

Flutter WebΛޮՌతʹ׆༻͢Δ޻෉ • FlutterΛར༻ͯ͠։ൃ͢ΔνʔϜʹม͑Δ • MobileͱWebͷ։ൃϦϙδτϦΛ෼͚Δ • MobileͱWebͷମݧΛ౷Ұ͢Δ 19

Slide 20

Slide 20 text

FlutterΛར༻ͯ͠։ൃ͢ΔνʔϜʹม͑Δ • طଘͷAndroid/iOSΞϓϦέʔγϣϯ։ൃΛ࠷খݶʹ͢Δ • ։ൃλεΫΛػೳ୯ҐͰ෼ׂ͢Δ • 2 approve͕mergeͷ৚݅ʹͳΔΑ͏มߋ͢Δ 20

Slide 21

Slide 21 text

։ൃϦϙδτϦͷ෼ׂ • MobileͱWebʹ߹ΘͤΔͨΊʹɺ։ൃΛ෼͚Δ • Navigation routes͕Web͸MobileͱҟͳΔ • ը໘ͷॎԣൺͷύλʔϯ͕MobileΑΓଟ͍ • MobileͱWebͷϦϙδτϦ͕ಉҰͩͱɺDeployʹࠔΔ • Web͸”ଈ࣌”ʹ”ແ৹ࠪ”ͰDeployͰ͖Δ 21

Slide 22

Slide 22 text

UIΛڞ༗͢ΔͨΊͷϦϙδτϦ෼ׂ • Flutter͸ɺUI(Widget)ϨϕϧͰΞϓϦέʔγϣϯΛ෼ׂͰ͖Δ • 2021೥౓ͷൃද͸ɺUIϨϕϧͷϦϙδτϦ෼ׂΛఏҊ • WebͱMobileͰڞ༗͍ͨ͠UIΛϦϙδτϦԽ • 1ͭͷػೳվળΛɺෳ਺ͷΞϓϦέʔγϣϯʹ൓өͤ͞Δ࢓૊Έ

Slide 23

Slide 23 text

UIΛڞ༗͢ΔͨΊͷϦϙδτϦ෼ׂ 'MVUUFS8FCΞϓϦ " 'MVUUFS.PCJMFΞϓϦ 'MVUUFS8FCΞϓϦ # 6* .PEVMF 6* .PEVMF 6* .PEVMF -PHJD .PEVMF -PHJD .PEVMF -PHJD .PEVMF 6* .PEVMF 6* .PEVMF -PHJD .PEVMF 6* .PEVMF

Slide 24

Slide 24 text

MobileͱWebͷମݧΛ౷Ұ • Phone/Tablet/Desktopͷҧ͍ΛBreakpointͰ੔ཧ • ը໘ͷԣ෯ͷҧ͍ΛϨΠΞ΢τͱMarginͰௐ੔ • ϨΠΞ΢τΛܾఆ͢Δେ࿮͕ɺදࣔWidgetͷݟ͑ํΛ֬ఆ • Widgetͷ֎෦͔ΒPaddingΛௐ੔Մೳʹ͢Δ • ListViewΛPaddingͰׅΔॲཧΛͳ͘͢ 24

Slide 25

Slide 25 text

Paddingͷௐ੔ class HogeWidget extends StatelessWidget { const HogeWidget({super.key}); @override Widget build(BuildContext context) { return const Padding( padding: EdgeInsets.symmetric( horizontal: 16, ), child: InnerWidget() ); } }

Slide 26

Slide 26 text

Paddingͷௐ੔ class HogeWidget extends StatelessWidget { const HogeWidget({super.key}); @override Widget build(BuildContext context) { final margin = calculateMargin(context); return Padding( padding: EdgeInsets.symmetric( horizontal: margin, ), child: const InnerWidget() ); } double calculateMargin(BuildContext context) { if (MediaQuery.of(context).size.width < 600) { return 16; } else { return 32; } } } ը໘෯ʹΑΔmarginରԠ

Slide 27

Slide 27 text

Paddingͷௐ੔ class HogeWidget extends StatelessWidget { const HogeWidget({super.key}); @override Widget build(BuildContext context) { final margin = calculateMargin(context); return InnerWidget( margin: margin, ); } double calculateMargin(BuildContext context) { if (MediaQuery.of(context).size.width < 600) { return 16; } else { return 32; } } } Widgetͷ಺෦Padding

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Paddingͷௐ੔ class InnerWidget extends StatelessWidget { const InnerWidget({ super.key, required this.margin, }); final double margin; @override Widget build(BuildContext context) { return ListView.builder( padding: EdgeInsets.symmetric( horizontal: margin, ), itemBuilder: (context, index) => ListTile( title: Text(‘$index’), ), ); } } ֎෦͔Βͷࢦఆ

Slide 30

Slide 30 text

Paddingͷௐ੔ class InnerWidget extends StatelessWidget { const InnerWidget({ super.key, required this.margin, }); final double margin; @override Widget build(BuildContext context) { return ListView.builder( itemBuilder: (context, index) => ListTile( contentPadding: EdgeInsets.symmetric( horizontal: margin, ), title: Text(‘$index’), ), ); } } λονྖҬͷௐ੔

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Flutter WebΛ 
 ࠾༻͢ΔͱͲ͏ͳΔͷ͔ 32

Slide 33

Slide 33 text

Flutter Webͷҹ৅ • FontͷରԠΛؚΊɺݸผʹղফ͢Δ΂͖՝୊͕ଟ͍ • MobileͰಈ͍͍ͯͯ΋ɺWebͰಈ͘ͱ͸ݶΒͳ͍ • ϚϧνεϨουͷར༻ʹݸผͷ࣮૷͕ඞཁ • ը໘ͷଟ༷ͳαΠζɺಈతͳαΠζมߋ΁ͷରԠ • MobileͱWebͰPadding͕ҟͳΔWidget 33

Slide 34

Slide 34 text

Flutter Webͷҹ৅ • ύϑΥʔϚϯε͸े෼ʹ࣮༻త • ֤छϥΠϒϥϦαϙʔτ͸ॏཁͳ΋ͷΛ֬ೝ͢Ε͹OK • Firebase͸௥͍͍͖ͭͯͨ • Pure DartͰ͸ͳ͍ϥΠϒϥϦ͸ݸผʹ൑அඞਢ 34

Slide 35

Slide 35 text

૯࿦ • Ϧιʔεͷগͳ͍νʔϜͰ͸બ୒ࢶʹͳΓ͏Δ • ϞόΠϧΤϯδχΞ͕ଟ͍νʔϜͳΒݕ౼ͯ͠΋Α͍ • Ϧιʔε͕५୔Ͱ͋Ε͹ɺ͋͑ͯબ୒ͤͣͱ΋Α͍ • PWAΛؚΊͨϞόΠϧϑΝʔετͳ։ൃʹϚον͢Δ • ϓϥοτϑΥʔϜΛލ͍ͩ࠷େެ໿਺తͳ։ൃʹϚον 35

Slide 36

Slide 36 text

૯࿦ • αʔϏε։ൃʹूதͰ͖ΔνʔϜʹͳΔ • όάमਖ਼΍ػೳվળ͕͠΍͍͢ • ػೳ։ൃͷػೳͷ͋Γํʹूத͠΍͍͢ • FlutterΛ࠷େݶʹ׆༻͠΍͘͢ͳΔ • Mobile޲͚ͷ։ൃΛͦͷ··Webʹల։Մೳ 36

Slide 37

Slide 37 text

Thanks! 37