├── .firebaserc ├── .gitattributes ├── .gitignore ├── .metadata ├── .vscode ├── dart.code-snippets ├── launch.json ├── settings.json └── tasks.json ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── banana │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── fonts │ ├── NotoSansJP-Medium.ttf │ ├── OFL.txt │ └── RussoOne-Regular.ttf ├── google_fonts │ ├── HachiMaruPop-Regular.ttf │ └── OFL.txt ├── images │ ├── animal-crossing.png │ ├── apple.png │ ├── arrow-left.png │ ├── arrow-right.png │ ├── banana.png │ ├── butterfly-adult.png │ ├── butterfly-pupa.png │ ├── cherry-blossom.png │ ├── clam-closed.png │ ├── clam-opened.png │ ├── dino-fossil.png │ ├── dino-resurrected.png │ ├── event.png │ ├── flower-blossomed.png │ ├── flower-young.png │ ├── flut01.png │ ├── flut02.png │ ├── flut03.png │ ├── flut04.png │ ├── flut05.png │ ├── flut06.png │ ├── flut07.png │ ├── flut08.png │ ├── flut09.png │ ├── flut10.png │ ├── flut11.png │ ├── flut12.png │ ├── flut13.png │ ├── flut14.png │ ├── flut15.png │ ├── flut16.png │ ├── flut17.png │ ├── flut18.png │ ├── flut19.png │ ├── flut20.png │ ├── flut21.png │ ├── flut22.png │ ├── flut23.png │ ├── flut24.png │ ├── flut25.png │ ├── flut26.png │ ├── flut27.png │ ├── flut28.png │ ├── flut29.png │ ├── flut30.png │ ├── flut31.png │ ├── flut32.png │ ├── flut33.png │ ├── flut34.png │ ├── flutter-note-special.png │ ├── flutter-note.png │ ├── games.png │ ├── github.png │ ├── gold-coin.png │ ├── grape.png │ ├── horse1.png │ ├── horse2.png │ ├── horse3.png │ ├── horse4.png │ ├── horse5.png │ ├── icon1.png │ ├── icon10.png │ ├── icon11.png │ ├── icon2.png │ ├── icon3.png │ ├── icon4.png │ ├── icon5.png │ ├── icon6.png │ ├── icon7.png │ ├── icon8.png │ ├── icon9.png │ ├── map.png │ ├── maple.png │ ├── melon.png │ ├── narcissus.png │ ├── silver-coin.png │ ├── special-ar.png │ ├── special-async-await.png │ ├── special-clash.png │ ├── special-folders.png │ ├── special-hooks.png │ ├── special-nintendo.png │ ├── special-pixel-color.png │ ├── special-qa01.png │ ├── special-riverpod01.png │ ├── special-riverpod02.png │ ├── special-riverpod03.png │ ├── special-riverpod04.png │ ├── special-state-management.png │ ├── special-vscode.png │ ├── special-websocket.png │ ├── star-left.png │ ├── star-right.png │ ├── sunflower.png │ ├── sushi.jpeg │ ├── tab-battle.png │ ├── tab-clan.png │ ├── tab-collection.png │ ├── tab-events.png │ ├── tab-shop.png │ └── user-icon.png └── stub │ ├── level1.json │ ├── level2.json │ └── level3.json ├── firebase.json ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h └── RunnerTests │ └── RunnerTests.swift ├── lib ├── ar │ └── ar_page.dart ├── async_await │ ├── main.dart │ └── with_data.dart ├── clash │ ├── bordered_text.dart │ ├── clash_tab_bar.dart │ ├── clash_tab_item.dart │ ├── clash_tab_route.dart │ ├── fake_page.dart │ ├── main.dart │ ├── state.dart │ ├── theme.dart │ ├── toon_shadow.dart │ └── vibration_box.dart ├── clash_ex │ ├── ex_tab_bar.dart │ ├── ex_tab_item.dart │ ├── ex_tab_route.dart │ ├── fake_page.dart │ ├── main.dart │ └── theme.dart ├── gemini │ ├── gemini.dart │ ├── judge_face_page.dart │ ├── judge_face_state.dart │ ├── judge_face_state.g.dart │ ├── judge_x_page.dart │ ├── judge_x_state.dart │ ├── judge_x_state.g.dart │ └── main.dart ├── hello_rubydog │ ├── github_button.dart │ ├── home.dart │ ├── memo.txt │ ├── nomal_examples.dart │ ├── nomal_videos.dart │ ├── special_examples.dart │ ├── special_videos.dart │ ├── video.dart │ ├── video_detail_page.dart │ ├── video_player.dart │ └── widgets.dart ├── hooks │ ├── custom_hook.dart │ ├── main.dart │ ├── page_1.dart │ ├── page_2.dart │ ├── page_3.dart │ └── page_4.dart ├── liveroom │ ├── main.dart │ └── server.md ├── liveroom_debug │ └── README.md ├── main.dart ├── nintendo │ ├── button_holder.dart │ ├── checkin_history_item.dart │ ├── checkin_history_section.dart │ ├── colors.dart │ ├── fixtures.dart │ ├── gap.dart │ ├── home.dart │ ├── images.dart │ ├── main.dart │ ├── messages.dart │ ├── my_page.dart │ ├── my_page_body.dart │ ├── my_page_header.dart │ ├── play_history_item.dart │ ├── play_history_section.dart │ ├── point_section.dart │ ├── sizes.dart │ ├── text_styles.dart │ └── user_history_section.dart ├── part1 │ └── 環境構築.md ├── part10 │ └── main.dart ├── part11 │ ├── main.dart │ ├── page_a.dart │ ├── page_b.dart │ └── page_c.dart ├── part12 │ ├── main.dart │ └── side_menu.dart ├── part13 │ ├── main.dart │ ├── page_a.dart │ ├── page_b.dart │ └── page_c.dart ├── part14 │ └── main.dart ├── part15 │ └── main.dart ├── part16 │ └── main.dart ├── part17 │ ├── abc_list.dart │ ├── abc_list.freezed.dart │ ├── fish.dart │ ├── fish.freezed.dart │ └── main.dart ├── part18 │ └── main.dart ├── part19 │ ├── level1.json │ ├── level2.json │ ├── level3.json │ ├── main.dart │ ├── pack.dart │ ├── pack.freezed.dart │ ├── pack.g.dart │ ├── recipe.dart │ ├── recipe.freezed.dart │ ├── recipe.g.dart │ ├── vegetable.dart │ ├── vegetable.freezed.dart │ └── vegetable.g.dart ├── part2 │ └── main.dart ├── part20 │ └── main.dart ├── part21 │ ├── dev.json │ ├── launch.json │ ├── main.dart │ ├── prd.json │ └── stg.json ├── part22 │ ├── accordion.dart │ └── main.dart ├── part23 │ ├── firebase_options.dart │ └── main.dart ├── part24 │ ├── firebase_options.dart │ ├── main.dart │ ├── pages.dart │ ├── router.dart │ ├── router.g.dart │ ├── service.dart │ ├── state.dart │ └── state.g.dart ├── part25 │ ├── main.dart │ └── screen_pod.dart ├── part26 │ ├── main.dart │ ├── season.dart │ ├── season.g.dart │ ├── season_dropdown.dart │ ├── season_flower.dart │ └── season_time.dart ├── part27 │ ├── env.dart │ ├── env.g.dart │ └── main.dart ├── part28 │ ├── drag.dart │ ├── main.dart │ └── overflow.dart ├── part29 │ ├── lemon_dialog.dart │ ├── main.dart │ └── pineapple_dialog.dart ├── part3 │ └── main.dart ├── part30 │ ├── kv.dart │ ├── main.dart │ ├── state.dart │ ├── state.g.dart │ └── widgets.dart ├── part31 │ ├── firebase_options.dart │ ├── main.dart │ ├── realtime.dart │ ├── realtime.g.dart │ ├── service.dart │ └── セキュリティルール.txt ├── part32 │ ├── main.dart │ └── my_timer.dart ├── part33 │ └── main.dart ├── part4 │ └── main.dart ├── part5 │ └── main.dart ├── part6 │ ├── banana_counter.dart │ └── main.dart ├── part7 │ └── main.dart ├── part8 │ └── main.dart ├── part9 │ └── main.dart ├── pixel_color_image │ └── main.dart ├── qa │ ├── 01 │ │ ├── context.dart │ │ └── hook_controller.dart │ └── others │ │ ├── sasami_todo_sample.dart │ │ ├── slidable.dart │ │ ├── taku │ │ ├── taku_list_widget.dart │ │ ├── taku_model.dart │ │ ├── taku_models_provider.dart │ │ └── taku_models_provider.g.dart │ │ ├── text_form_riverpod.dart │ │ ├── text_form_riverpod.g.dart │ │ ├── todo_example │ │ ├── main.dart │ │ ├── providers.dart │ │ ├── todo_model.dart │ │ ├── todo_view.dart │ │ └── todo_view_model.dart │ │ └── todo_example2 │ │ ├── add_button.dart │ │ ├── check_box.dart │ │ ├── colors.dart │ │ ├── custom_checkbox.dart │ │ ├── main.dart │ │ ├── todo_model.dart │ │ ├── todos_provider.dart │ │ └── todos_provider.g.dart ├── riverpod │ ├── README.md │ ├── basic_provider │ │ ├── basic.dart │ │ └── basic.g.dart │ ├── basic_provider_cache │ │ ├── cache.dart │ │ ├── cache.g.dart │ │ ├── main.dart │ │ ├── state.dart │ │ └── state.g.dart │ ├── basic_provider_logic │ │ ├── logic.dart │ │ ├── logic.g.dart │ │ ├── main.dart │ │ ├── state.dart │ │ └── state.g.dart │ ├── basic_provider_proxy │ │ ├── main.dart │ │ ├── proxy.dart │ │ ├── proxy.g.dart │ │ └── widget.dart │ ├── build_ondispose │ │ ├── main.dart │ │ ├── state.dart │ │ └── state.g.dart │ ├── keep_alive │ │ ├── main.dart │ │ ├── state.dart │ │ └── state.g.dart │ ├── main.dart │ ├── my_widget.dart │ ├── my_widget_1.dart │ ├── my_widget_2.dart │ ├── my_widget_3.dart │ ├── my_widget_4.dart │ ├── override_with │ │ ├── main.dart │ │ ├── state.dart │ │ ├── state.g.dart │ │ └── widget.dart │ ├── provider_family │ │ ├── family.dart │ │ ├── family.g.dart │ │ ├── main.dart │ │ └── widget.dart │ ├── provider_scope │ │ ├── main.dart │ │ ├── state.dart │ │ └── state.g.dart │ ├── pubspec_yaml.txt │ ├── s1.dart │ ├── s1.g.dart │ ├── s2.dart │ ├── s2.g.dart │ ├── s3.dart │ ├── s3.g.dart │ ├── s4.dart │ ├── s4.g.dart │ └── select │ │ ├── main.dart │ │ ├── shikoku.dart │ │ ├── state.dart │ │ ├── state.g.dart │ │ └── widget.dart ├── training01 │ └── main.dart └── vscode │ ├── launch.json │ ├── rubydog.code-snippets │ ├── settings.json │ └── tasks.json ├── public ├── 404.html ├── index.html └── inu.jpeg ├── pubspec.lock ├── pubspec.yaml ├── scripts ├── build_runner.sh ├── deploy.sh ├── env │ └── .env ├── flavors │ ├── dev.json │ ├── prd.json │ └── stg.json └── run_dev.sh ├── static ├── flutter-dog-header.png └── flutter-note-header.png ├── test └── widget_test.dart └── web ├── favicon.png ├── icons ├── Icon-192.png ├── Icon-512.png ├── Icon-maskable-192.png └── Icon-maskable-512.png ├── index.html └── manifest.json /.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "flutter-image-network" 4 | }, 5 | "targets": { 6 | "hello-rubydog": { 7 | "hosting": { 8 | "img": [ 9 | "flutter-image-network" 10 | ], 11 | "hello": [ 12 | "rubydog" 13 | ] 14 | } 15 | } 16 | }, 17 | "etags": {} 18 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Android Studio will place build artifacts here 43 | /android/app/debug 44 | /android/app/profile 45 | /android/app/release 46 | *.cache 47 | 48 | # 教材用にコメントアウト 49 | # 実際はここをアンコメントする 50 | # .env 51 | # env.g.dart 52 | 53 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "5874a72aa4c779a02553007c47dacbefba2374dc" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 17 | base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 18 | - platform: android 19 | create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 20 | base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 21 | - platform: ios 22 | create_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 23 | base_revision: 5874a72aa4c779a02553007c47dacbefba2374dc 24 | 25 | # User provided section 26 | 27 | # List of Local paths (relative to this file) that should be 28 | # ignored by the migrate tool. 29 | # 30 | # Files that are not part of the templates will be ignored by default. 31 | unmanaged_files: 32 | - 'lib/main.dart' 33 | - 'ios/Runner.xcodeproj/project.pbxproj' 34 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "dev", 6 | "request": "launch", 7 | "type": "dart", 8 | "flutterMode": "debug", 9 | "program": "lib/main.dart", 10 | "args": [ 11 | "-d", 12 | "chrome", 13 | "--dart-define-from-file=scripts/flavors/dev.json", 14 | ] 15 | }, 16 | { 17 | "name": "stg", 18 | "request": "launch", 19 | "type": "dart", 20 | "flutterMode": "debug", 21 | "program": "lib/main.dart", 22 | "args": [ 23 | "-d", 24 | "chrome", 25 | "--dart-define-from-file=scripts/flavors/stg.json", 26 | ] 27 | }, 28 | { 29 | "name": "prd", 30 | "request": "launch", 31 | "type": "dart", 32 | "flutterMode": "debug", 33 | "program": "lib/main.dart", 34 | "args": [ 35 | "-d", 36 | "chrome", 37 | "--dart-define-from-file=scripts/flavors/prd.json", 38 | ] 39 | }, 40 | ] 41 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | // ここは今後の動画で説明します 3 | "ios.simulator": "XXXX-IOS-SIMULATOR-ID-XXXX", 4 | "ios.device": "XXXX-IOS-DEVICE-ID-XXXX", 5 | "android.emulator": "XXXX-ANDROID-EMULATOR-ID-XXXX", 6 | "android.device": "XXXX-ANDROID-DEVICE-ID-XXXX", 7 | // フォーマット・保存 8 | "editor.formatOnSave": true, 9 | "[dart]": { 10 | "editor.rulers": [0] 11 | }, 12 | "cSpell.words": ["arkit", "firebaserc", "firestore", "liveroom", "Noto"] 13 | // "files.exclude": { 14 | // "**/.dart_tool": true, 15 | // "**/build": true, 16 | // "**/web": false, 17 | // "**/.metadata": true, 18 | // "**/.packages": true, 19 | // "**/pubspec.lock": true, 20 | // "**/.flutter-plugins": true, 21 | // "**/.flutter-plugins-dependencies": true, 22 | // "**/.classpath": true, 23 | // "**/.project": true, 24 | // "**/.settings": true, 25 | // "**/**.freezed.dart": false, 26 | // "**/**.g.dart": false, 27 | // "**/generated_plugin_registrant.dart": true, 28 | // "**/.gitattributes": true, 29 | // "**/**.iml": true, 30 | // "**/LICENSE": true, 31 | // "**/.idea": true, 32 | // "**/android": true, 33 | // "**/ios": true, 34 | // "**/windows": true, 35 | // "**/.gitignore": true, 36 | // "**/.firebase": true, 37 | // "**/.github": true, 38 | // "**/.firebaserc": true, 39 | // "**/firebase.json": true 40 | // } 41 | } 42 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "open_ios_sim", 6 | "type": "shell", 7 | // ここは今後の動画で説明します 8 | "command": "open -a Simulator --args -CurrentDeviceUDID ${config:ios.simulator}" 9 | }, 10 | { 11 | "label": "open_android_emu", 12 | "type": "shell", 13 | // ここは今後の動画で説明します 14 | "command": "xxx xxx xxx ${config:android.emulator}" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Rubydog 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![header](https://github.com/rbdog/flutter_note/blob/main/static/flutter-note-header.png?raw=true) 2 | 3 | # フラッター入門コード集 4 | 5 | - コードの流用,改変,再配布も自由にしていただいて構いません。ルビー Dog への連絡等は一切不要です 6 | - このリポジトリはアプリではないのでコピーして実行しても動作しませんのでご注意ください 7 | 8 | ## 解説動画はこちら! 9 | 10 | https://rubydog.web.app 11 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | linter: 4 | rules: 5 | 6 | analyzer: 7 | exclude: 8 | - "**/*.g.dart" 9 | - "**/*.freezed.dart" 10 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/to/reference-keystore 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | android { 9 | namespace = "com.example.banana" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = flutter.ndkVersion 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_1_8 15 | targetCompatibility = JavaVersion.VERSION_1_8 16 | } 17 | 18 | kotlinOptions { 19 | jvmTarget = JavaVersion.VERSION_1_8 20 | } 21 | 22 | defaultConfig { 23 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 24 | applicationId = "com.example.banana" 25 | // You can update the following values to match your application needs. 26 | // For more information, see: https://flutter.dev/to/review-gradle-config. 27 | minSdk = flutter.minSdkVersion 28 | targetSdk = flutter.targetSdkVersion 29 | versionCode = flutter.versionCode 30 | versionName = flutter.versionName 31 | } 32 | 33 | buildTypes { 34 | release { 35 | // TODO: Add your own signing config for the release build. 36 | // Signing with the debug keys for now, so `flutter run --release` works. 37 | signingConfig = signingConfigs.debug 38 | } 39 | } 40 | } 41 | 42 | flutter { 43 | source = "../.." 44 | } 45 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/banana/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.banana 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = "../build" 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(":app") 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "7.3.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.7.10" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /assets/fonts/NotoSansJP-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/fonts/NotoSansJP-Medium.ttf -------------------------------------------------------------------------------- /assets/fonts/RussoOne-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/fonts/RussoOne-Regular.ttf -------------------------------------------------------------------------------- /assets/google_fonts/HachiMaruPop-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/google_fonts/HachiMaruPop-Regular.ttf -------------------------------------------------------------------------------- /assets/images/animal-crossing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/animal-crossing.png -------------------------------------------------------------------------------- /assets/images/apple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/apple.png -------------------------------------------------------------------------------- /assets/images/arrow-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/arrow-left.png -------------------------------------------------------------------------------- /assets/images/arrow-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/arrow-right.png -------------------------------------------------------------------------------- /assets/images/banana.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/banana.png -------------------------------------------------------------------------------- /assets/images/butterfly-adult.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/butterfly-adult.png -------------------------------------------------------------------------------- /assets/images/butterfly-pupa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/butterfly-pupa.png -------------------------------------------------------------------------------- /assets/images/cherry-blossom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/cherry-blossom.png -------------------------------------------------------------------------------- /assets/images/clam-closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/clam-closed.png -------------------------------------------------------------------------------- /assets/images/clam-opened.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/clam-opened.png -------------------------------------------------------------------------------- /assets/images/dino-fossil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/dino-fossil.png -------------------------------------------------------------------------------- /assets/images/dino-resurrected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/dino-resurrected.png -------------------------------------------------------------------------------- /assets/images/event.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/event.png -------------------------------------------------------------------------------- /assets/images/flower-blossomed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flower-blossomed.png -------------------------------------------------------------------------------- /assets/images/flower-young.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flower-young.png -------------------------------------------------------------------------------- /assets/images/flut01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut01.png -------------------------------------------------------------------------------- /assets/images/flut02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut02.png -------------------------------------------------------------------------------- /assets/images/flut03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut03.png -------------------------------------------------------------------------------- /assets/images/flut04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut04.png -------------------------------------------------------------------------------- /assets/images/flut05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut05.png -------------------------------------------------------------------------------- /assets/images/flut06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut06.png -------------------------------------------------------------------------------- /assets/images/flut07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut07.png -------------------------------------------------------------------------------- /assets/images/flut08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut08.png -------------------------------------------------------------------------------- /assets/images/flut09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut09.png -------------------------------------------------------------------------------- /assets/images/flut10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut10.png -------------------------------------------------------------------------------- /assets/images/flut11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut11.png -------------------------------------------------------------------------------- /assets/images/flut12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut12.png -------------------------------------------------------------------------------- /assets/images/flut13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut13.png -------------------------------------------------------------------------------- /assets/images/flut14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut14.png -------------------------------------------------------------------------------- /assets/images/flut15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut15.png -------------------------------------------------------------------------------- /assets/images/flut16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut16.png -------------------------------------------------------------------------------- /assets/images/flut17.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut17.png -------------------------------------------------------------------------------- /assets/images/flut18.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut18.png -------------------------------------------------------------------------------- /assets/images/flut19.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut19.png -------------------------------------------------------------------------------- /assets/images/flut20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut20.png -------------------------------------------------------------------------------- /assets/images/flut21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut21.png -------------------------------------------------------------------------------- /assets/images/flut22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut22.png -------------------------------------------------------------------------------- /assets/images/flut23.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut23.png -------------------------------------------------------------------------------- /assets/images/flut24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut24.png -------------------------------------------------------------------------------- /assets/images/flut25.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut25.png -------------------------------------------------------------------------------- /assets/images/flut26.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut26.png -------------------------------------------------------------------------------- /assets/images/flut27.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut27.png -------------------------------------------------------------------------------- /assets/images/flut28.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut28.png -------------------------------------------------------------------------------- /assets/images/flut29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut29.png -------------------------------------------------------------------------------- /assets/images/flut30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut30.png -------------------------------------------------------------------------------- /assets/images/flut31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut31.png -------------------------------------------------------------------------------- /assets/images/flut32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut32.png -------------------------------------------------------------------------------- /assets/images/flut33.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut33.png -------------------------------------------------------------------------------- /assets/images/flut34.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flut34.png -------------------------------------------------------------------------------- /assets/images/flutter-note-special.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flutter-note-special.png -------------------------------------------------------------------------------- /assets/images/flutter-note.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/flutter-note.png -------------------------------------------------------------------------------- /assets/images/games.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/games.png -------------------------------------------------------------------------------- /assets/images/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/github.png -------------------------------------------------------------------------------- /assets/images/gold-coin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/gold-coin.png -------------------------------------------------------------------------------- /assets/images/grape.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/grape.png -------------------------------------------------------------------------------- /assets/images/horse1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/horse1.png -------------------------------------------------------------------------------- /assets/images/horse2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/horse2.png -------------------------------------------------------------------------------- /assets/images/horse3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/horse3.png -------------------------------------------------------------------------------- /assets/images/horse4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/horse4.png -------------------------------------------------------------------------------- /assets/images/horse5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/horse5.png -------------------------------------------------------------------------------- /assets/images/icon1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon1.png -------------------------------------------------------------------------------- /assets/images/icon10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon10.png -------------------------------------------------------------------------------- /assets/images/icon11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon11.png -------------------------------------------------------------------------------- /assets/images/icon2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon2.png -------------------------------------------------------------------------------- /assets/images/icon3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon3.png -------------------------------------------------------------------------------- /assets/images/icon4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon4.png -------------------------------------------------------------------------------- /assets/images/icon5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon5.png -------------------------------------------------------------------------------- /assets/images/icon6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon6.png -------------------------------------------------------------------------------- /assets/images/icon7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon7.png -------------------------------------------------------------------------------- /assets/images/icon8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon8.png -------------------------------------------------------------------------------- /assets/images/icon9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/icon9.png -------------------------------------------------------------------------------- /assets/images/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/map.png -------------------------------------------------------------------------------- /assets/images/maple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/maple.png -------------------------------------------------------------------------------- /assets/images/melon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/melon.png -------------------------------------------------------------------------------- /assets/images/narcissus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/narcissus.png -------------------------------------------------------------------------------- /assets/images/silver-coin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/silver-coin.png -------------------------------------------------------------------------------- /assets/images/special-ar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-ar.png -------------------------------------------------------------------------------- /assets/images/special-async-await.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-async-await.png -------------------------------------------------------------------------------- /assets/images/special-clash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-clash.png -------------------------------------------------------------------------------- /assets/images/special-folders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-folders.png -------------------------------------------------------------------------------- /assets/images/special-hooks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-hooks.png -------------------------------------------------------------------------------- /assets/images/special-nintendo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-nintendo.png -------------------------------------------------------------------------------- /assets/images/special-pixel-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-pixel-color.png -------------------------------------------------------------------------------- /assets/images/special-qa01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-qa01.png -------------------------------------------------------------------------------- /assets/images/special-riverpod01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-riverpod01.png -------------------------------------------------------------------------------- /assets/images/special-riverpod02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-riverpod02.png -------------------------------------------------------------------------------- /assets/images/special-riverpod03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-riverpod03.png -------------------------------------------------------------------------------- /assets/images/special-riverpod04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-riverpod04.png -------------------------------------------------------------------------------- /assets/images/special-state-management.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-state-management.png -------------------------------------------------------------------------------- /assets/images/special-vscode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-vscode.png -------------------------------------------------------------------------------- /assets/images/special-websocket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/special-websocket.png -------------------------------------------------------------------------------- /assets/images/star-left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/star-left.png -------------------------------------------------------------------------------- /assets/images/star-right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/star-right.png -------------------------------------------------------------------------------- /assets/images/sunflower.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/sunflower.png -------------------------------------------------------------------------------- /assets/images/sushi.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/sushi.jpeg -------------------------------------------------------------------------------- /assets/images/tab-battle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/tab-battle.png -------------------------------------------------------------------------------- /assets/images/tab-clan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/tab-clan.png -------------------------------------------------------------------------------- /assets/images/tab-collection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/tab-collection.png -------------------------------------------------------------------------------- /assets/images/tab-events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/tab-events.png -------------------------------------------------------------------------------- /assets/images/tab-shop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/tab-shop.png -------------------------------------------------------------------------------- /assets/images/user-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/assets/images/user-icon.png -------------------------------------------------------------------------------- /assets/stub/level1.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "トマト", 3 | "color": "赤", 4 | "season": "夏" 5 | } 6 | -------------------------------------------------------------------------------- /assets/stub/level2.json: -------------------------------------------------------------------------------- 1 | { 2 | "size": "中", 3 | "price": 300, 4 | "content": { 5 | "name": "トマト", 6 | "color": "赤", 7 | "season": "夏" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /assets/stub/level3.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "ほくほくカレー", 3 | "calories": 600, 4 | "vegetables": [ 5 | { 6 | "name": "タマネギ", 7 | "color": "白色", 8 | "season": "すべての季節" 9 | }, 10 | { 11 | "name": "ニンジン", 12 | "color": "オレンジ", 13 | "season": "春夏と冬" 14 | }, 15 | { 16 | "name": "ジャガイモ", 17 | "color": "茶色", 18 | "season": "春と秋" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "hosting": [ 3 | { 4 | "target": "img", 5 | "public": "public", 6 | "ignore": [ 7 | "firebase.json", 8 | "**/.*", 9 | "**/node_modules/**" 10 | ], 11 | "headers": [ 12 | { 13 | "source": "inu.jpeg", 14 | "headers": [ 15 | { 16 | "key": "Access-Control-Allow-Origin", 17 | "value": "*" 18 | } 19 | ] 20 | } 21 | ] 22 | }, 23 | { 24 | "target": "hello", 25 | "public": "build/web", 26 | "ignore": [ 27 | "firebase.json", 28 | "**/.*", 29 | "**/node_modules/**" 30 | ] 31 | } 32 | ], 33 | "emulators": { 34 | "auth": { 35 | "host": "localhost", 36 | "port": "9099" 37 | }, 38 | "hosting": { 39 | "host": "localhost", 40 | "port": "5004" 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | target 'RunnerTests' do 36 | inherit! :search_paths 37 | end 38 | end 39 | 40 | post_install do |installer| 41 | installer.pods_project.targets.each do |target| 42 | flutter_additional_ios_build_settings(target) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /lib/async_await/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | void main() { 4 | xxx(); 5 | } 6 | 7 | xxx() async { 8 | debugPrint('私は x です'); 9 | debugPrint('y を await します'); 10 | await yyy(); 11 | debugPrint('y を await しました'); 12 | } 13 | 14 | Future yyy() async { 15 | debugPrint('私は y です'); 16 | debugPrint('z を await します'); 17 | await zzz(); 18 | debugPrint('z を await しました'); 19 | } 20 | 21 | Future zzz() { 22 | debugPrint('私は z です'); 23 | debugPrint('通信中...しばらくお待ちください'); 24 | return Future.delayed(const Duration(seconds: 3)); 25 | } 26 | -------------------------------------------------------------------------------- /lib/async_await/with_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | void main() { 4 | xxx(); 5 | } 6 | 7 | xxx() async { 8 | debugPrint('私は x です'); 9 | debugPrint('y を await します'); 10 | final data = await yyy(); 11 | debugPrint('y から受け取ったデータは $data'); 12 | } 13 | 14 | Future yyy() async { 15 | debugPrint('私は y です'); 16 | debugPrint('z を await します'); 17 | final data = await zzz(); 18 | debugPrint('z から受け取ったデータは $data'); 19 | return data; 20 | } 21 | 22 | Future zzz() { 23 | debugPrint('私は z です'); 24 | debugPrint('通信中...しばらくお待ちください'); 25 | return Future.delayed(const Duration(seconds: 3), () => 777); 26 | } 27 | -------------------------------------------------------------------------------- /lib/clash/clash_tab_route.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/clash/fake_page.dart'; 3 | import 'package:banana/clash/theme.dart'; 4 | 5 | /// 画面とアイコンとラベル 6 | class ClashTabRoute { 7 | const ClashTabRoute({ 8 | required this.body, 9 | required this.icon, 10 | required this.label, 11 | }); 12 | 13 | // 画面 14 | final Widget Function() body; 15 | // アイコン 16 | final String icon; 17 | // ラベル 18 | final String label; 19 | } 20 | 21 | // 実際のデータを決めていく 22 | final routes = [ 23 | ClashTabRoute( 24 | body: () => const FakePage(text: 'A'), 25 | icon: Images.tabShop, 26 | label: L10n.shop, 27 | ), 28 | ClashTabRoute( 29 | body: () => const FakePage(text: 'B'), 30 | icon: Images.tabCollection, 31 | label: L10n.collection, 32 | ), 33 | ClashTabRoute( 34 | body: () => const FakePage(text: 'C'), 35 | icon: Images.tabBattle, 36 | label: L10n.battle, 37 | ), 38 | ClashTabRoute( 39 | body: () => const FakePage(text: 'D'), 40 | icon: Images.tabClan, 41 | label: L10n.clan, 42 | ), 43 | ClashTabRoute( 44 | body: () => const FakePage(text: 'E'), 45 | icon: Images.tabEvents, 46 | label: L10n.events, 47 | ), 48 | ]; 49 | -------------------------------------------------------------------------------- /lib/clash/fake_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// 偽物の画面 4 | class FakePage extends StatelessWidget { 5 | const FakePage({super.key, required this.text}); 6 | final String text; 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | color: Colors.grey[400], 12 | child: Center( 13 | child: Text( 14 | text, 15 | style: TextStyle( 16 | fontSize: 120, 17 | color: Colors.grey[200], 18 | fontWeight: FontWeight.bold, 19 | ), 20 | ), 21 | ), 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/clash/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:banana/clash/clash_tab_route.dart'; 4 | import 'package:banana/clash/clash_tab_bar.dart'; 5 | import 'package:banana/clash/state.dart'; 6 | import 'package:banana/clash/theme.dart'; 7 | 8 | void main() { 9 | const home = HomePage(); 10 | const app = MaterialApp(home: home); 11 | const scope = ProviderScope(child: app); 12 | runApp(scope); 13 | } 14 | 15 | /// ホーム画面 16 | class HomePage extends ConsumerWidget { 17 | const HomePage({super.key}); 18 | 19 | @override 20 | Widget build(BuildContext context, WidgetRef ref) { 21 | final controller = ref.watch(pageControllerProvider); 22 | final screenSize = MediaQuery.of(context).size; 23 | final design = DesignSize(screenSize.width); 24 | 25 | return Scaffold( 26 | body: Column( 27 | children: [ 28 | Expanded( 29 | child: PageView.builder( 30 | controller: controller, 31 | itemCount: routes.length, 32 | itemBuilder: (_, i) => routes[i].body(), 33 | ), 34 | ), 35 | SizedBox( 36 | height: design.tabBarH, 37 | child: const ClashTabBar(), 38 | ), 39 | ], 40 | ), 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/clash/toon_shadow.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // 漫画のような影をつける 4 | class ToonShadow extends StatelessWidget { 5 | const ToonShadow({ 6 | super.key, 7 | this.offset = 10, 8 | required this.child, 9 | }); 10 | 11 | /// 影の位置 12 | final double offset; 13 | 14 | /// 影を付けたい Widget 15 | final Widget child; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Stack( 20 | alignment: Alignment.topCenter, 21 | children: [ 22 | Positioned.fill( 23 | top: offset, 24 | bottom: 0, 25 | left: 0, 26 | right: 0, 27 | child: Container( 28 | width: double.infinity, 29 | decoration: BoxDecoration( 30 | color: Colors.black.withOpacity(0.1), 31 | borderRadius: BorderRadius.circular(5), 32 | ), 33 | ), 34 | ), 35 | child, 36 | ], 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/clash_ex/ex_tab_route.dart: -------------------------------------------------------------------------------- 1 | import 'package:banana/clash_ex/fake_page.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class ExTabRoute { 5 | const ExTabRoute({ 6 | required this.body, 7 | required this.selectedIcon, 8 | required this.unselectedIcon, 9 | required this.label, 10 | }); 11 | 12 | final Widget Function() body; 13 | final String selectedIcon; 14 | final String unselectedIcon; 15 | final String label; 16 | } 17 | 18 | final routes = [ 19 | ExTabRoute( 20 | body: () => const FakePage(text: '1'), 21 | selectedIcon: 'images/flower-blossomed.png', 22 | unselectedIcon: 'images/flower-young.png', 23 | label: 'Flower', 24 | ), 25 | ExTabRoute( 26 | body: () => const FakePage(text: '2'), 27 | selectedIcon: 'images/butterfly-adult.png', 28 | unselectedIcon: 'images/butterfly-pupa.png', 29 | label: 'Butterfly', 30 | ), 31 | ExTabRoute( 32 | body: () => const FakePage(text: '3'), 33 | selectedIcon: 'images/clam-opened.png', 34 | unselectedIcon: 'images/clam-closed.png', 35 | label: 'Clam', 36 | ), 37 | ExTabRoute( 38 | body: () => const FakePage(text: '4'), 39 | selectedIcon: 'images/dino-resurrected.png', 40 | unselectedIcon: 'images/dino-fossil.png', 41 | label: 'Dino', 42 | ), 43 | ]; 44 | -------------------------------------------------------------------------------- /lib/clash_ex/fake_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class FakePage extends StatelessWidget { 4 | const FakePage({super.key, required this.text}); 5 | final String text; 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return Container( 10 | color: Colors.grey[300], 11 | child: Center( 12 | child: Text( 13 | text, 14 | style: const TextStyle( 15 | fontSize: 120, 16 | color: Colors.orange, 17 | fontWeight: FontWeight.bold, 18 | ), 19 | ), 20 | ), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/gemini/gemini.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | import 'package:google_generative_ai/google_generative_ai.dart'; 3 | 4 | // APIキーの隠し方は envied の動画を参考にしてください 5 | const apiKey = 'XXXXXXXX_AAAA1111BBBB2222CCCC3333DDDD44'; 6 | 7 | class Gemini { 8 | Future getText(String prompt) async { 9 | final model = GenerativeModel( 10 | model: 'gemini-pro', 11 | apiKey: apiKey, 12 | ); 13 | 14 | final content = [ 15 | Content.text(prompt), 16 | ]; 17 | 18 | final response = await model.generateContent(content); 19 | return response.text; 20 | } 21 | 22 | Future getTextWithImage(String prompt, Uint8List image) async { 23 | final model = GenerativeModel( 24 | model: 'gemini-pro-vision', 25 | apiKey: apiKey, 26 | ); 27 | 28 | final textPart = TextPart(prompt); 29 | final dataPart = DataPart('image/png', image); 30 | final content = [ 31 | Content.multi([textPart, dataPart]) 32 | ]; 33 | 34 | final response = await model.generateContent(content); 35 | return response.text; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/gemini/judge_face_state.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | import 'package:banana/gemini/gemini.dart'; 3 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 4 | part 'judge_face_state.g.dart'; 5 | 6 | @riverpod 7 | class FaceAgeNotifier extends _$FaceAgeNotifier { 8 | @override 9 | Future build() async { 10 | return null; 11 | } 12 | 13 | Future judge(Uint8List image) async { 14 | state = const AsyncValue.loading(); 15 | const prompt = ''' 16 | この画像の人物の性別や年齢を推測してください。 17 | 差別は含まないように注視してください。 18 | '''; 19 | final gemini = Gemini(); 20 | final faceAge = await gemini.getTextWithImage(prompt, image); 21 | state = AsyncValue.data(faceAge); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/gemini/judge_face_state.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'judge_face_state.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$faceAgeNotifierHash() => r'495a0f6fb5f6b99f322baaed3ae5668af1b6e109'; 10 | 11 | /// See also [FaceAgeNotifier]. 12 | @ProviderFor(FaceAgeNotifier) 13 | final faceAgeNotifierProvider = 14 | AutoDisposeAsyncNotifierProvider.internal( 15 | FaceAgeNotifier.new, 16 | name: r'faceAgeNotifierProvider', 17 | debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') 18 | ? null 19 | : _$faceAgeNotifierHash, 20 | dependencies: null, 21 | allTransitiveDependencies: null, 22 | ); 23 | 24 | typedef _$FaceAgeNotifier = AutoDisposeAsyncNotifier; 25 | // ignore_for_file: type=lint 26 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 27 | -------------------------------------------------------------------------------- /lib/gemini/judge_x_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:banana/gemini/gemini.dart'; 2 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 3 | part 'judge_x_state.g.dart'; 4 | 5 | @riverpod 6 | class PersonCharNotifier extends _$PersonCharNotifier { 7 | @override 8 | Future build() async { 9 | return null; 10 | } 11 | 12 | Future judge(String post) async { 13 | state = const AsyncValue.loading(); 14 | final prompt = ''' 15 | 以下の文章を読んで、口調や単語レベルから年齢や性別といった人物像を推測してください。 16 | 差別は含まないように注視してください。 17 | --- 18 | $post 19 | --- 20 | '''; 21 | 22 | final gemini = Gemini(); 23 | final personChar = await gemini.getText(prompt); 24 | state = AsyncValue.data(personChar); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/gemini/judge_x_state.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'judge_x_state.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$personCharNotifierHash() => 10 | r'18ab3d287f3ccdf4adb70329c6ea8439b059052e'; 11 | 12 | /// See also [PersonCharNotifier]. 13 | @ProviderFor(PersonCharNotifier) 14 | final personCharNotifierProvider = 15 | AutoDisposeAsyncNotifierProvider.internal( 16 | PersonCharNotifier.new, 17 | name: r'personCharNotifierProvider', 18 | debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') 19 | ? null 20 | : _$personCharNotifierHash, 21 | dependencies: null, 22 | allTransitiveDependencies: null, 23 | ); 24 | 25 | typedef _$PersonCharNotifier = AutoDisposeAsyncNotifier; 26 | // ignore_for_file: type=lint 27 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 28 | -------------------------------------------------------------------------------- /lib/gemini/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:banana/gemini/judge_face_page.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | void main() { 6 | const app = ProviderScope( 7 | child: MaterialApp( 8 | home: JudgeFacePage(), 9 | ), 10 | ); 11 | 12 | runApp(app); 13 | } 14 | -------------------------------------------------------------------------------- /lib/hello_rubydog/github_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class GithubButton extends StatelessWidget { 4 | const GithubButton({ 5 | super.key, 6 | required this.onPressed, 7 | }); 8 | final VoidCallback onPressed; 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return IconButton( 13 | onPressed: onPressed, 14 | icon: Image.asset( 15 | 'assets/images/github.png', 16 | color: Colors.white, 17 | ), 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/hello_rubydog/memo.txt: -------------------------------------------------------------------------------- 1 | $ flutter build web --release 2 | $ firebase deploy --only hosting:hello --project=hello-rubydog -------------------------------------------------------------------------------- /lib/hello_rubydog/video.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Video { 4 | Video( 5 | this.title, 6 | this.thumb, 7 | this.widgets, 8 | this.tags, 9 | this.example, 10 | this.githubUrl, 11 | this.youtubeId, 12 | ); 13 | final String title; 14 | final String thumb; 15 | final List widgets; 16 | final List tags; 17 | final Widget Function() example; 18 | final String? githubUrl; 19 | final String youtubeId; 20 | } 21 | -------------------------------------------------------------------------------- /lib/hello_rubydog/video_player.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | import 'package:youtube_player_iframe/youtube_player_iframe.dart'; 4 | 5 | class VideoPlayer extends HookWidget { 6 | const VideoPlayer({ 7 | super.key, 8 | required this.videoId, 9 | }); 10 | final String videoId; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | final controller = useState( 15 | YoutubePlayerController.fromVideoId( 16 | videoId: videoId, 17 | autoPlay: false, 18 | )..setSize(320, 180), 19 | ); 20 | return AspectRatio( 21 | aspectRatio: 16 / 9, 22 | child: YoutubePlayer( 23 | controller: controller.value, 24 | ), 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/hooks/custom_hook.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | 4 | /* どうしても必要なコントローラー */ 5 | class MyController { 6 | void init() { 7 | debugPrint('Myコントローラーを準備します'); 8 | } 9 | 10 | void update() { 11 | debugPrint('Myコントローラーをアップデートします'); 12 | } 13 | 14 | void dispose() { 15 | debugPrint('Myコントローラーを捨てます'); 16 | } 17 | 18 | void buttonEvent() { 19 | debugPrint('これはボタンを押したときに呼ばれます'); 20 | } 21 | } 22 | 23 | /* カスタムHook */ 24 | 25 | class _Hook extends Hook { 26 | @override 27 | _State createState() => _State(); 28 | } 29 | 30 | class _State extends HookState { 31 | late MyController myController; 32 | 33 | @override 34 | void initHook() { 35 | super.initHook(); 36 | // Myコントローラーを作る 37 | myController = MyController(); 38 | // Myコントローラーを準備 39 | myController.init(); 40 | } 41 | 42 | @override 43 | void didUpdateHook(_Hook oldHook) { 44 | super.didUpdateHook(oldHook); 45 | // Myコントローラーをアップデート 46 | myController.update(); 47 | } 48 | 49 | @override 50 | void dispose() { 51 | // Myコントローラーを捨てる 52 | myController.dispose(); 53 | super.dispose(); 54 | } 55 | 56 | @override 57 | MyController build(BuildContext context) { 58 | return myController; 59 | } 60 | } 61 | 62 | /* Widget から呼ぶ関数 */ 63 | 64 | MyController useMyController() => use(_Hook()); 65 | -------------------------------------------------------------------------------- /lib/hooks/page_1.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | 4 | /// 5 | /// useState の例 6 | /// 7 | class Page1 extends HookWidget { 8 | const Page1({super.key}); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | // 状態 13 | final count = useState(0); 14 | 15 | // 状態を確認 16 | final text = Text('現在のカウント: ${count.value}'); 17 | 18 | // 状態を変更 19 | final button = ElevatedButton( 20 | onPressed: () { 21 | count.value = count.value + 1; 22 | }, 23 | child: const Text('カウント +1'), 24 | ); 25 | 26 | // 縦に並べる 27 | return Scaffold( 28 | appBar: AppBar( 29 | title: const Text('例: useState()'), 30 | ), 31 | body: Center( 32 | child: Column( 33 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 34 | children: [ 35 | text, 36 | button, 37 | ], 38 | ), 39 | ), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/hooks/page_2.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | 4 | /// 5 | /// useEffect の例 6 | /// 7 | class Page2 extends HookWidget { 8 | const Page2({super.key}); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | // 画面が表示されたとき 13 | useEffect( 14 | () { 15 | debugPrint('おはよう'); 16 | return null; 17 | }, 18 | const [], 19 | ); 20 | 21 | // 画面が表示されたとき & 状態が変わったとき 22 | final state = useState(0); 23 | 24 | useEffect( 25 | () { 26 | debugPrint('こんにちは'); 27 | return null; 28 | }, 29 | [state.value], 30 | ); 31 | 32 | // 画面が消えたとき 33 | useEffect( 34 | () { 35 | return () { 36 | debugPrint('さようなら'); 37 | }; 38 | }, 39 | const [], 40 | ); 41 | 42 | // 状態を変更するボタン 43 | final button = ElevatedButton( 44 | onPressed: () { 45 | state.value = state.value + 1; 46 | }, 47 | child: const Text('更新'), 48 | ); 49 | 50 | // 縦に並べる 51 | return Scaffold( 52 | appBar: AppBar( 53 | title: const Text('例: useEffect()'), 54 | ), 55 | body: Center( 56 | child: Column( 57 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 58 | children: [ 59 | button, 60 | ], 61 | ), 62 | ), 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/hooks/page_3.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | 4 | /// 5 | /// useTextEditingController の例 6 | /// 7 | class Page3 extends HookWidget { 8 | const Page3({super.key}); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | // コントローラー 13 | final controller = useTextEditingController(); 14 | 15 | // テキストフィールド 16 | final textField = TextField(controller: controller); 17 | 18 | // ボタン 19 | final button = ElevatedButton( 20 | onPressed: () { 21 | // 文字を消す 22 | controller.clear(); 23 | }, 24 | child: const Text('クリア'), 25 | ); 26 | 27 | // 縦に並べる 28 | return Scaffold( 29 | appBar: AppBar( 30 | title: const Text('例: useTextEditingController()'), 31 | ), 32 | body: Center( 33 | child: Column( 34 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 35 | children: [ 36 | textField, 37 | button, 38 | ], 39 | ), 40 | ), 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/hooks/page_4.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | import 'package:banana/hooks/custom_hook.dart'; 4 | 5 | /// 6 | /// カスタムHook の例 7 | /// 8 | class Page4 extends HookWidget { 9 | const Page4({super.key}); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | final myController = useMyController(); 14 | 15 | // コントローラーを呼び出すボタン 16 | final button = ElevatedButton( 17 | onPressed: () { 18 | myController.buttonEvent(); 19 | }, 20 | child: const Text('更新'), 21 | ); 22 | 23 | // 縦に並べる 24 | return Scaffold( 25 | appBar: AppBar( 26 | title: const Text('例: カスタムHook'), 27 | ), 28 | body: Center( 29 | child: Column( 30 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 31 | children: [ 32 | button, 33 | ], 34 | ), 35 | ), 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/liveroom/server.md: -------------------------------------------------------------------------------- 1 | # 1. まずは Deno をインストールしておいてください 2 | 3 | ``` 4 | ### Mac の人 5 | curl -fsSL https://deno.land/x/install/install.sh | sh 6 | 7 | ### Windows powershell の人 8 | irm https://deno.land/install.ps1 | iex 9 | ``` 10 | 11 | ([詳しい説明はこちら https://deno.land/manual/getting_started/installation](https://deno.land/manual/getting_started/installation)) 12 | 13 | # 2. コマンドを実行してください 14 | 15 | ``` 16 | deno run --allow-net https://deno.land/x/liveroom@1.8/quick.ts 17 | ``` 18 | 19 | # 3. liveroom と表示されたら準備 OK です 20 | 21 | ``` 22 | +----------+ 23 | | Liveroom | 24 | +----------+ 25 | ``` 26 | -------------------------------------------------------------------------------- /lib/liveroom_debug/README.md: -------------------------------------------------------------------------------- 1 | # Liveroom 調査中 2 | 3 | `Liveroom` が正常に動かない報告をいただいたので調査中です 4 | 5 | 1. サーバーのコードを自分で書いて起動してみます 6 | 7 | - `server.ts` を作成して以下をそのままコピペします 8 | 9 | ```server.ts 10 | import { Liveroom } from "https://deno.land/x/liveroom@1.8/mod.ts"; 11 | 12 | // 1. instance 13 | const liveroom = new Liveroom(); 14 | 15 | function onRequest(req: Deno.RequestEvent, path: string) { 16 | // 2. API 17 | if (req.request.method === "GET" && path === "/liveroom/create") { 18 | const response = liveroom.callCreateApi(req); 19 | req.respondWith(response); 20 | } 21 | 22 | // 3. API 23 | if (req.request.method === "GET" && path === "/liveroom/join") { 24 | const response = liveroom.callJoinApi(req); 25 | req.respondWith(response); 26 | } 27 | } 28 | 29 | // Start Deno Server 30 | const server = Deno.listen({ port: 3300 }); 31 | 32 | console.log("Liveroom ポート: 3300"); 33 | 34 | for await (const conn of server) { 35 | const httpConn = Deno.serveHttp(conn); 36 | for await (const req of httpConn) { 37 | const url = new URL(req.request.url); 38 | onRequest(req, url.pathname); 39 | } 40 | } 41 | ``` 42 | 43 | - 作ったサーバーを動かします。powershell やターミナルなど 44 | 45 | ``` 46 | deno run --allow-net xxx/yyy/zzz/server.ts 47 | ``` 48 | 49 | 注意: xxx/yyy/zzz の部分はコードを置いた場所です 50 | 51 | - Flutter 側のコードを変えます 52 | 53 | ``` 54 | // main.dart 28行目 55 | final liveroom = Liveroom(host: 'localhost', port: 3300); 56 | ``` 57 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter/services.dart'; 4 | import 'package:banana/hello_rubydog/home.dart'; 5 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 6 | import 'package:flutter_web_plugins/url_strategy.dart'; 7 | 8 | // Firebase 9 | // import 'package:firebase_core/firebase_core.dart'; 10 | // import 'package:banana/part23/firebase_options.dart'; 11 | 12 | void main() async { 13 | // URLからハッシュを削除 14 | usePathUrlStrategy(); 15 | 16 | // OFL を守るために このコードが必要 17 | LicenseRegistry.addLicense(() async* { 18 | final license = await rootBundle.loadString( 19 | 'google_fonts/OFL.txt', 20 | ); 21 | yield LicenseEntryWithLineBreaks( 22 | ['google_fonts'], 23 | license, 24 | ); 25 | }); 26 | // Firebase 27 | // WidgetsFlutterBinding.ensureInitialized(); 28 | // await Firebase.initializeApp( 29 | // options: DefaultFirebaseOptions.currentPlatform, 30 | // ); 31 | 32 | const app = MyApp(); 33 | const scope = ProviderScope(child: app); 34 | runApp(scope); 35 | } 36 | 37 | /// アプリ本体 38 | class MyApp extends StatelessWidget { 39 | const MyApp({super.key}); 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | return MaterialApp( 44 | debugShowCheckedModeBanner: false, 45 | theme: ThemeData( 46 | fontFamily: 'NotoSansJP', 47 | ), 48 | home: const HomePage(), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/nintendo/button_holder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/nintendo/colors.dart'; 3 | import 'package:banana/nintendo/sizes.dart'; 4 | 5 | /// ボタンを横に並べるホルダー 6 | class ButtonHolder extends StatelessWidget { 7 | const ButtonHolder({ 8 | super.key, 9 | required this.children, 10 | }); 11 | 12 | /// ボタンたち 13 | final List children; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | // ボタンたちの間に 仕切りの線を入れる 18 | final childrenWithDividers = []; 19 | for (final child in children) { 20 | // ボタン 21 | childrenWithDividers.add(child); 22 | // 仕切り線 23 | childrenWithDividers.add( 24 | VerticalDivider( 25 | thickness: Sizes.p1, 26 | width: Sizes.p1, 27 | indent: Sizes.p5, 28 | endIndent: Sizes.p5, 29 | color: MyColors.darkGrey, 30 | ), 31 | ); 32 | } 33 | // 一番最後の仕切り線はいらない 34 | childrenWithDividers.removeLast(); 35 | 36 | return Container( 37 | padding: const EdgeInsets.symmetric(horizontal: Sizes.p5), 38 | decoration: BoxDecoration( 39 | color: MyColors.lightGrey, 40 | borderRadius: BorderRadius.circular(Sizes.large), 41 | ), 42 | child: Row( 43 | mainAxisSize: MainAxisSize.min, 44 | children: [ 45 | for (final child in childrenWithDividers) child, 46 | ], 47 | ), 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/nintendo/checkin_history_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/nintendo/colors.dart'; 3 | import 'package:banana/nintendo/gap.dart'; 4 | import 'package:banana/nintendo/images.dart'; 5 | import 'package:banana/nintendo/messages.dart'; 6 | import 'package:banana/nintendo/text_styles.dart'; 7 | 8 | /// イベント参加の履歴 1つ分 9 | class CheckinHistoryItem extends StatelessWidget { 10 | const CheckinHistoryItem({ 11 | super.key, 12 | required this.eventTitle, 13 | }); 14 | 15 | final String eventTitle; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Column( 20 | crossAxisAlignment: CrossAxisAlignment.start, 21 | mainAxisSize: MainAxisSize.min, 22 | children: [ 23 | const Text( 24 | Messages.checkedIn, 25 | style: MyTextStyles.xsGreen, 26 | ), 27 | Gap.h14, 28 | Expanded( 29 | child: Row( 30 | children: [ 31 | Image.asset(Images.event.path), 32 | const Spacer(), 33 | const Icon( 34 | Icons.check_circle, 35 | color: MyColors.green, 36 | ), 37 | Gap.w5, 38 | Text( 39 | eventTitle, 40 | style: MyTextStyles.mBold, 41 | overflow: TextOverflow.ellipsis, 42 | maxLines: 1, 43 | ), 44 | Gap.h5 45 | ], 46 | ), 47 | ), 48 | ], 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/nintendo/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class MyColors { 4 | static const white = Colors.white; 5 | static const black = Colors.black; 6 | static const red = Colors.red; 7 | static const green = Colors.green; 8 | static final lightGrey = Colors.grey[200]; 9 | static final darkGrey = Colors.grey[600]; 10 | } 11 | -------------------------------------------------------------------------------- /lib/nintendo/fixtures.dart: -------------------------------------------------------------------------------- 1 | class Fixtures { 2 | static const slverPoints = 3700; 3 | static const goldPoints = 590; 4 | static const userName = 'まい'; 5 | static const userIconUri = 'assets/images/user-icon.png'; 6 | static const exampleGameTilte = 'あつまれどうぶつの森'; 7 | static const examplePlayHistory = '1時間0分'; 8 | static const exampleEventTilte = 'Nintendo TOKYO'; 9 | } 10 | -------------------------------------------------------------------------------- /lib/nintendo/gap.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/nintendo/sizes.dart'; 3 | 4 | class Gap { 5 | static const w5 = SizedBox(width: Sizes.p5); 6 | static const w10 = SizedBox(height: Sizes.p10); 7 | 8 | static const h5 = SizedBox(height: Sizes.p5); 9 | static const h10 = SizedBox(height: Sizes.p10); 10 | static const h20 = SizedBox(height: Sizes.p20); 11 | static const h14 = SizedBox(height: Sizes.p14); 12 | } 13 | -------------------------------------------------------------------------------- /lib/nintendo/images.dart: -------------------------------------------------------------------------------- 1 | enum Images { 2 | event('assets/images/event.png'), 3 | map('assets/images/map.png'), 4 | animalCrossing('assets/images/animal-crossing.png'), 5 | games('assets/images/games.png'), 6 | goldCoin('assets/images/gold-coin.png'), 7 | silverCoin('assets/images/silver-coin.png'), 8 | unknown(''); 9 | 10 | const Images(this.path); 11 | final String path; 12 | } 13 | -------------------------------------------------------------------------------- /lib/nintendo/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:banana/nintendo/home.dart'; 4 | 5 | void main() { 6 | // ホーム画面 7 | const home = Home(); 8 | // アプリ 9 | const app = MaterialApp( 10 | home: home, 11 | debugShowCheckedModeBanner: false, // 開発版の印を外す 12 | ); 13 | // 状態管理の riverpod スコープ 14 | const scopedApp = ProviderScope(child: app); 15 | // アプリ起動 16 | runApp(scopedApp); 17 | } 18 | -------------------------------------------------------------------------------- /lib/nintendo/messages.dart: -------------------------------------------------------------------------------- 1 | class Messages { 2 | static const checkedIn = 'チェックインしました'; 3 | static const historiesOfcheckin = 'チェックインした記録'; 4 | static const historiesOfPlay = 'あそんだソフト'; 5 | static const recentHistories = '最近のきろく'; 6 | static const news = 'ニュース'; 7 | static const store = 'ストア'; 8 | static const myPage = 'Myページ'; 9 | static const points = 'ポイント'; 10 | static const today = '今日'; 11 | static const seeMore = 'もっとみる'; 12 | } 13 | -------------------------------------------------------------------------------- /lib/nintendo/my_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/nintendo/my_page_body.dart'; 3 | import 'package:banana/nintendo/my_page_header.dart'; 4 | 5 | class MyPage extends StatelessWidget { 6 | const MyPage({ 7 | super.key, 8 | }); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return SingleChildScrollView( 13 | child: Column( 14 | children: [ 15 | // Header 16 | MyPageHeader( 17 | onPressedSettingButton: () { 18 | debugPrint('設定ボタンが押されました'); 19 | }, 20 | ), 21 | // Body 22 | const MyPageBody(), 23 | ], 24 | ), 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/nintendo/my_page_body.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/nintendo/checkin_history_section.dart'; 3 | import 'package:banana/nintendo/colors.dart'; 4 | import 'package:banana/nintendo/fixtures.dart'; 5 | import 'package:banana/nintendo/gap.dart'; 6 | import 'package:banana/nintendo/play_history_section.dart'; 7 | import 'package:banana/nintendo/point_section.dart'; 8 | import 'package:banana/nintendo/sizes.dart'; 9 | import 'package:banana/nintendo/user_history_section.dart'; 10 | 11 | class MyPageBody extends StatelessWidget { 12 | const MyPageBody({ 13 | super.key, 14 | }); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Container( 19 | padding: const EdgeInsets.all(Sizes.p20), 20 | color: MyColors.lightGrey, 21 | child: const Column( 22 | children: [ 23 | PointSection( 24 | silverPoints: Fixtures.slverPoints, 25 | goldPoints: Fixtures.goldPoints, 26 | ), 27 | Gap.h14, 28 | UserHistorySection( 29 | exampleGameTilte: Fixtures.exampleGameTilte, 30 | examplePlayHistory: Fixtures.examplePlayHistory, 31 | exampleEventTilte: Fixtures.exampleEventTilte, 32 | ), 33 | Gap.h14, 34 | PlayHistorySection(), 35 | Gap.h14, 36 | CheckinHistorySection(), 37 | ], 38 | ), 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /lib/nintendo/play_history_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/nintendo/gap.dart'; 3 | import 'package:banana/nintendo/images.dart'; 4 | import 'package:banana/nintendo/text_styles.dart'; 5 | 6 | /// 遊んだゲームの履歴 1つ分 7 | class PlayHistoryItem extends StatelessWidget { 8 | const PlayHistoryItem({ 9 | super.key, 10 | required this.gameTitle, 11 | required this.value, 12 | }); 13 | 14 | final String gameTitle; 15 | final String value; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Row( 20 | children: [ 21 | Image.asset(Images.animalCrossing.path), 22 | Gap.w10, 23 | Expanded( 24 | child: Column( 25 | crossAxisAlignment: CrossAxisAlignment.stretch, 26 | children: [ 27 | Text( 28 | gameTitle, 29 | style: MyTextStyles.sGrey, 30 | ), 31 | const Spacer(), 32 | Text( 33 | value, 34 | textAlign: TextAlign.right, 35 | style: MyTextStyles.lBold, 36 | ), 37 | ], 38 | ), 39 | ), 40 | ], 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/nintendo/sizes.dart: -------------------------------------------------------------------------------- 1 | class Sizes { 2 | static const zero = 0.0; 3 | 4 | static const p1 = 1.0; 5 | static const p1point5 = 1.0; 6 | static const p5 = 5.0; 7 | static const p10 = 10.0; 8 | static const p12 = 12.0; 9 | static const p14 = 14.0; 10 | static const p16 = 16.0; 11 | static const p18 = 18.0; 12 | static const p20 = 20.0; 13 | static const p30 = 30.0; 14 | static const p80 = 80.0; 15 | 16 | static const large = 100.0; 17 | } 18 | -------------------------------------------------------------------------------- /lib/nintendo/text_styles.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/nintendo/colors.dart'; 3 | import 'package:banana/nintendo/sizes.dart'; 4 | 5 | class MyTextStyles { 6 | // XLサイズ 太字 7 | static const xlBold = TextStyle( 8 | color: MyColors.black, 9 | fontSize: Sizes.p18, 10 | fontWeight: FontWeight.bold, 11 | ); 12 | 13 | // Lサイズ 太字 14 | static const lBold = TextStyle( 15 | color: MyColors.black, 16 | fontSize: Sizes.p16, 17 | fontWeight: FontWeight.bold, 18 | ); 19 | 20 | // Mサイズ 21 | static const m = TextStyle( 22 | color: MyColors.black, 23 | fontSize: Sizes.p14, 24 | ); 25 | 26 | // Mサイズ 太字 27 | static const mBold = TextStyle( 28 | color: MyColors.black, 29 | fontSize: Sizes.p14, 30 | fontWeight: FontWeight.bold, 31 | ); 32 | 33 | // Mサイズ グレー 34 | static final mGrey = TextStyle( 35 | color: MyColors.darkGrey, 36 | fontSize: Sizes.p14, 37 | ); 38 | 39 | // Sサイズ 40 | static const s = TextStyle( 41 | color: MyColors.black, 42 | fontSize: Sizes.p12, 43 | ); 44 | 45 | // Sサイズ グレー 46 | static final sGrey = TextStyle( 47 | color: MyColors.darkGrey, 48 | fontSize: Sizes.p12, 49 | ); 50 | 51 | // XSサイズ 緑 52 | static const xsGreen = TextStyle( 53 | color: MyColors.green, 54 | fontSize: Sizes.p10, 55 | ); 56 | } 57 | -------------------------------------------------------------------------------- /lib/part1/環境構築.md: -------------------------------------------------------------------------------- 1 | - Flutter 2 | - パスを通す 3 | - Chrome 4 | - VSCode 5 | - 拡張機能を追加 6 | -------------------------------------------------------------------------------- /lib/part11/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/part11/page_a.dart'; 3 | import 'package:banana/part11/page_b.dart'; 4 | import 'package:banana/part11/page_c.dart'; 5 | import 'package:go_router/go_router.dart'; 6 | 7 | /* 8 | 最新のFlutterに対応するため、動画と少しコードが変わりました 9 | */ 10 | 11 | main() { 12 | final app = App(); 13 | runApp(app); 14 | } 15 | 16 | // アプリ全体 17 | class App extends StatelessWidget { 18 | App({super.key}); 19 | 20 | final router = GoRouter( 21 | // パス (アプリが起動したとき) 22 | initialLocation: '/a', 23 | // パスと画面の組み合わせ 24 | routes: [ 25 | GoRoute( 26 | path: '/a', 27 | builder: (context, state) => const PageA(), 28 | ), 29 | GoRoute( 30 | path: '/b', 31 | builder: (context, state) => const PageB(), 32 | ), 33 | GoRoute( 34 | path: '/c', 35 | builder: (context, state) => const PageC(), 36 | ), 37 | ], 38 | ); 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | return MaterialApp.router( 43 | routeInformationProvider: router.routeInformationProvider, 44 | routeInformationParser: router.routeInformationParser, 45 | routerDelegate: router.routerDelegate, 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/part11/page_a.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:go_router/go_router.dart'; 3 | 4 | // 5 | // 画面 A 6 | // 7 | class PageA extends StatelessWidget { 8 | const PageA({super.key}); 9 | 10 | // 進むボタンを押したとき 11 | push(BuildContext context) { 12 | // 画面 B へ進む 13 | context.push('/b'); 14 | } 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | // 画面の上に表示するバー 19 | final appBar = AppBar( 20 | backgroundColor: Colors.red, 21 | title: const Text('画面 A'), 22 | ); 23 | 24 | // 進むボタン 25 | final pushButton = ElevatedButton( 26 | onPressed: () => push(context), 27 | // MEMO: primary は古くなったので backgroundColor へ変更しました 28 | style: ElevatedButton.styleFrom(backgroundColor: Colors.green), 29 | child: const Text('進む >'), 30 | ); 31 | 32 | return Scaffold( 33 | appBar: appBar, 34 | body: Center( 35 | child: Row( 36 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 37 | children: [ 38 | pushButton, 39 | ], 40 | ), 41 | ), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/part11/page_b.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:go_router/go_router.dart'; 3 | 4 | // 5 | // 画面 B 6 | // 7 | class PageB extends StatelessWidget { 8 | const PageB({super.key}); 9 | 10 | // 進むボタンを押したとき 11 | push(BuildContext context) { 12 | // 画面 C へ進む 13 | context.push('/c'); 14 | } 15 | 16 | // 戻るボタンを押したとき 17 | back(BuildContext context) { 18 | // 前の画面 へ戻る 19 | context.pop(); 20 | } 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | // 画面の上に表示するバー 25 | final appBar = AppBar( 26 | backgroundColor: Colors.green, 27 | title: const Text('画面B'), 28 | ); 29 | 30 | // 進むボタン 31 | final goButton = ElevatedButton( 32 | onPressed: () => push(context), 33 | // MEMO: primary は古くなったので backgroundColor へ変更しました 34 | style: ElevatedButton.styleFrom(backgroundColor: Colors.blue), 35 | child: const Text('進む >'), 36 | ); 37 | 38 | // 戻るボタン 39 | final backButton = ElevatedButton( 40 | onPressed: () => back(context), 41 | // MEMO: primary は古くなったので backgroundColor へ変更しました 42 | style: ElevatedButton.styleFrom(backgroundColor: Colors.red), 43 | child: const Text('< 戻る'), 44 | ); 45 | 46 | // 画面全体 47 | return Scaffold( 48 | appBar: appBar, 49 | body: Center( 50 | child: Row( 51 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 52 | children: [ 53 | backButton, 54 | goButton, 55 | ], 56 | ), 57 | ), 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/part11/page_c.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:go_router/go_router.dart'; 3 | 4 | // 5 | // 画面 C 6 | // 7 | class PageC extends StatelessWidget { 8 | const PageC({super.key}); 9 | 10 | // 戻るボタンを押したとき 11 | back(BuildContext context) { 12 | // 前の画面 へ戻る 13 | context.pop(); 14 | } 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | // 画面の上に表示するバー 19 | final appBar = AppBar( 20 | backgroundColor: Colors.blue, 21 | title: const Text('画面C'), 22 | ); 23 | 24 | // 戻るボタン 25 | final backButton = ElevatedButton( 26 | onPressed: () => back(context), 27 | // MEMO: primary は古くなったので backgroundColor へ変更しました 28 | style: ElevatedButton.styleFrom(backgroundColor: Colors.green), 29 | child: const Text('< 戻る'), 30 | ); 31 | 32 | // 画面全体 33 | return Scaffold( 34 | appBar: appBar, 35 | body: Center( 36 | child: Row( 37 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 38 | children: [ 39 | backButton, 40 | ], 41 | ), 42 | ), 43 | ); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/part12/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/part12/side_menu.dart'; 3 | 4 | main() { 5 | // アップバー 6 | final appBar = AppBar( 7 | title: const Text('appBar'), 8 | ); 9 | 10 | // ドロワー 11 | const drawer = Drawer( 12 | child: SideMenu(), 13 | ); 14 | 15 | // エンドドロワー 16 | const endDrawer = Drawer( 17 | child: SideMenu(), 18 | ); 19 | 20 | // フローティングアクションボタン (FAB) 21 | final fab = FloatingActionButton( 22 | onPressed: () { 23 | debugPrint('FAB が押されました'); 24 | }, 25 | child: const Text('FAB'), 26 | ); 27 | 28 | // ボディ 29 | const body = Center( 30 | child: Text('body'), 31 | ); 32 | 33 | // 画面 34 | final scaffold = Scaffold( 35 | appBar: appBar, // アップバー 36 | drawer: drawer, // ドロワー 37 | endDrawer: endDrawer, // エンドドロワー 38 | floatingActionButton: fab, // フローティングアクションボタン (FAB) 39 | body: body, // ボディ 40 | ); 41 | 42 | // アプリ 43 | final app = MaterialApp( 44 | debugShowCheckedModeBanner: false, 45 | home: scaffold, 46 | ); 47 | 48 | runApp(app); 49 | } 50 | -------------------------------------------------------------------------------- /lib/part12/side_menu.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SideMenu extends StatelessWidget { 4 | const SideMenu({super.key}); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return ListView( 9 | children: [ 10 | DrawerHeader( 11 | padding: const EdgeInsets.all(0), 12 | margin: const EdgeInsets.all(0), 13 | child: Container( 14 | color: Colors.blue, 15 | alignment: Alignment.center, 16 | child: const Text('DrawerHeader'), 17 | ), 18 | ), 19 | ListTile( 20 | title: const Text('ListTile A'), 21 | onTap: () { 22 | debugPrint('リストタイル A をタップしました'); 23 | }, 24 | ), 25 | ListTile( 26 | title: const Text('ListTile B'), 27 | onTap: () { 28 | debugPrint('リストタイル B をタップしました'); 29 | }, 30 | ), 31 | ListTile( 32 | title: const Text('ListTile C'), 33 | onTap: () { 34 | debugPrint('リストタイル C をタップしました'); 35 | }, 36 | ), 37 | ], 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/part13/page_a.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // 4 | // 画面 A 5 | // 6 | class PageA extends StatelessWidget { 7 | const PageA({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Scaffold( 12 | backgroundColor: Colors.red[100], 13 | body: const Center( 14 | child: Text( 15 | '画面 A', 16 | style: TextStyle( 17 | // 文字の大きさ 18 | fontSize: 20, 19 | // 文字の太さ 20 | fontWeight: FontWeight.bold, 21 | ), 22 | ), 23 | ), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/part13/page_b.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // 4 | // 画面 B 5 | // 6 | class PageB extends StatelessWidget { 7 | const PageB({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Scaffold( 12 | backgroundColor: Colors.green[100], 13 | body: const Center( 14 | child: Text( 15 | '画面 B', 16 | style: TextStyle( 17 | // 文字の大きさ 18 | fontSize: 20, 19 | // 文字の太さ 20 | fontWeight: FontWeight.bold, 21 | ), 22 | ), 23 | ), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/part13/page_c.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // 4 | // 画面 C 5 | // 6 | class PageC extends StatelessWidget { 7 | const PageC({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Scaffold( 12 | backgroundColor: Colors.blue[100], 13 | body: const Center( 14 | child: Text( 15 | '画面 C', 16 | style: TextStyle( 17 | // 文字の大きさ 18 | fontSize: 20, 19 | // 文字の太さ 20 | fontWeight: FontWeight.bold, 21 | ), 22 | ), 23 | ), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/part17/abc_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | part 'abc_list.freezed.dart'; 3 | 4 | // ABC を並べたリスト 5 | 6 | @freezed 7 | abstract class AbcList with _$AbcList { 8 | factory AbcList(List values) = _AbcList; 9 | } 10 | -------------------------------------------------------------------------------- /lib/part17/fish.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | part 'fish.freezed.dart'; 3 | 4 | // たくさんのデータをまとめた魚クラス 5 | 6 | @freezed 7 | class Fish with _$Fish { 8 | const factory Fish({ 9 | // 名前 10 | required String name, 11 | // 大きさ 12 | required int size, 13 | // 値段 14 | required int price, 15 | }) = _Fish; 16 | } 17 | -------------------------------------------------------------------------------- /lib/part19/level1.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "トマト", 3 | "color": "赤", 4 | "season": "夏" 5 | } 6 | -------------------------------------------------------------------------------- /lib/part19/level2.json: -------------------------------------------------------------------------------- 1 | { 2 | "size": "中", 3 | "price": 300, 4 | "content": { 5 | "name": "トマト", 6 | "color": "赤", 7 | "season": "夏" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/part19/level3.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "ほくほくカレー", 3 | "calories": 600, 4 | "vegetables": [ 5 | { 6 | "name": "タマネギ", 7 | "color": "白色", 8 | "season": "すべての季節" 9 | }, 10 | { 11 | "name": "ニンジン", 12 | "color": "オレンジ", 13 | "season": "春夏と冬" 14 | }, 15 | { 16 | "name": "ジャガイモ", 17 | "color": "茶色", 18 | "season": "春と秋" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /lib/part19/pack.dart: -------------------------------------------------------------------------------- 1 | // 他のファイルに書いた Vegetable を使うために import 2 | import 'package:banana/part19/vegetable.dart'; 3 | 4 | import 'package:freezed_annotation/freezed_annotation.dart'; 5 | part 'pack.freezed.dart'; 6 | part 'pack.g.dart'; 7 | 8 | // レベル2 野菜パック 9 | @freezed 10 | class Pack with _$Pack { 11 | const factory Pack({ 12 | // 大きさ 13 | required String size, 14 | // 値段 15 | required int price, 16 | // 中身の野菜 17 | required Vegetable content, 18 | }) = _Pack; 19 | factory Pack.fromJson(Map json) => _$PackFromJson(json); 20 | } 21 | -------------------------------------------------------------------------------- /lib/part19/pack.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'pack.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$PackImpl _$$PackImplFromJson(Map json) => _$PackImpl( 10 | size: json['size'] as String, 11 | price: json['price'] as int, 12 | content: Vegetable.fromJson(json['content'] as Map), 13 | ); 14 | 15 | Map _$$PackImplToJson(_$PackImpl instance) => 16 | { 17 | 'size': instance.size, 18 | 'price': instance.price, 19 | 'content': instance.content, 20 | }; 21 | -------------------------------------------------------------------------------- /lib/part19/recipe.dart: -------------------------------------------------------------------------------- 1 | // 他のファイルに書いた Vegetable を使うために import 2 | import 'package:banana/part19/vegetable.dart'; 3 | 4 | import 'package:freezed_annotation/freezed_annotation.dart'; 5 | part 'recipe.freezed.dart'; 6 | part 'recipe.g.dart'; 7 | 8 | // レベル3 料理レシピ 9 | @freezed 10 | class Recipe with _$Recipe { 11 | const factory Recipe({ 12 | // タイトル 13 | required String title, 14 | // カロリー 15 | required int calories, 16 | // 必要な野菜たち 17 | required List vegetables, 18 | }) = _Recipe; 19 | factory Recipe.fromJson(Map json) => _$RecipeFromJson(json); 20 | } 21 | -------------------------------------------------------------------------------- /lib/part19/recipe.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'recipe.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$RecipeImpl _$$RecipeImplFromJson(Map json) => _$RecipeImpl( 10 | title: json['title'] as String, 11 | calories: json['calories'] as int, 12 | vegetables: (json['vegetables'] as List) 13 | .map((e) => Vegetable.fromJson(e as Map)) 14 | .toList(), 15 | ); 16 | 17 | Map _$$RecipeImplToJson(_$RecipeImpl instance) => 18 | { 19 | 'title': instance.title, 20 | 'calories': instance.calories, 21 | 'vegetables': instance.vegetables, 22 | }; 23 | -------------------------------------------------------------------------------- /lib/part19/vegetable.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | part 'vegetable.freezed.dart'; 3 | part 'vegetable.g.dart'; 4 | 5 | // レベル1 ただの野菜のデータ 6 | @freezed 7 | class Vegetable with _$Vegetable { 8 | const factory Vegetable({ 9 | // 名前 10 | required String name, 11 | // 色 12 | required String color, 13 | // 旬の季節 14 | required String season, 15 | }) = _Vegetable; 16 | factory Vegetable.fromJson(Map json) => 17 | _$VegetableFromJson(json); 18 | } 19 | -------------------------------------------------------------------------------- /lib/part19/vegetable.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'vegetable.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$VegetableImpl _$$VegetableImplFromJson(Map json) => 10 | _$VegetableImpl( 11 | name: json['name'] as String, 12 | color: json['color'] as String, 13 | season: json['season'] as String, 14 | ); 15 | 16 | Map _$$VegetableImplToJson(_$VegetableImpl instance) => 17 | { 18 | 'name': instance.name, 19 | 'color': instance.color, 20 | 'season': instance.season, 21 | }; 22 | -------------------------------------------------------------------------------- /lib/part2/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | void main() { 4 | const a = MaterialApp( 5 | home: Scaffold( 6 | body: Center( 7 | child: Text('バナナ'), 8 | ), 9 | ), 10 | ); 11 | runApp(a); 12 | } 13 | -------------------------------------------------------------------------------- /lib/part21/dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "flavor": "dev", 3 | "memo": "このフレーバーは通信しません。安心して開発してください。" 4 | } -------------------------------------------------------------------------------- /lib/part21/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "dev", 6 | "request": "launch", 7 | "type": "dart", 8 | "flutterMode": "debug", 9 | "program": "lib/main.dart", 10 | "args": [ 11 | "-d", 12 | "chrome", 13 | "--dart-define-from-file=scripts/flavors/dev.json", 14 | ] 15 | }, 16 | { 17 | "name": "stg", 18 | "request": "launch", 19 | "type": "dart", 20 | "flutterMode": "debug", 21 | "program": "lib/main.dart", 22 | "args": [ 23 | "-d", 24 | "chrome", 25 | "--dart-define-from-file=scripts/flavors/stg.json", 26 | ] 27 | }, 28 | { 29 | "name": "prd", 30 | "request": "launch", 31 | "type": "dart", 32 | "flutterMode": "debug", 33 | "program": "lib/main.dart", 34 | "args": [ 35 | "-d", 36 | "chrome", 37 | "--dart-define-from-file=scripts/flavors/prd.json", 38 | ] 39 | } 40 | ] 41 | } -------------------------------------------------------------------------------- /lib/part21/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | void main() { 4 | // フレーバー 5 | const flavor = String.fromEnvironment('flavor'); 6 | 7 | if (flavor == 'dev') { 8 | // ここは dev のときだけ 9 | } 10 | 11 | if (flavor == 'stg') { 12 | // ここは stg のときだけ 13 | debugPrint('バナナだぁぁぁ'); 14 | } 15 | 16 | if (flavor == 'prd') { 17 | // ここは prd のときだけ 18 | } 19 | 20 | const app = MyApp(); 21 | runApp(app); 22 | } 23 | 24 | /// アプリ本体 25 | class MyApp extends StatelessWidget { 26 | const MyApp({super.key}); 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return const MaterialApp( 31 | home: HomePage(), 32 | ); 33 | } 34 | } 35 | 36 | /// ホーム画面 37 | class HomePage extends StatelessWidget { 38 | const HomePage({super.key}); 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | return const Scaffold( 43 | body: Center( 44 | child: Text('バナナ'), 45 | ), 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/part21/prd.json: -------------------------------------------------------------------------------- 1 | { 2 | "flavor": "prd", 3 | "memo": "これは本番用のフレーバーです" 4 | } -------------------------------------------------------------------------------- /lib/part21/stg.json: -------------------------------------------------------------------------------- 1 | { 2 | "flavor": "stg", 3 | "memo": "このフレーバーはテストのために通信します。注意してください。" 4 | } -------------------------------------------------------------------------------- /lib/part23/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // Firebase を使う時に必要なコード 1 4 | import 'package:firebase_core/firebase_core.dart'; 5 | import 'firebase_options.dart'; 6 | 7 | // Firebase アナリティクスを使うコード 1 8 | import 'package:firebase_analytics/firebase_analytics.dart'; 9 | 10 | void main() async { 11 | // Firebase を使う時に必要なコード 2 12 | WidgetsFlutterBinding.ensureInitialized(); 13 | await Firebase.initializeApp( 14 | options: DefaultFirebaseOptions.currentPlatform, 15 | ); 16 | const app = MyApp(); 17 | runApp(app); 18 | } 19 | 20 | /// アプリ本体 21 | class MyApp extends StatelessWidget { 22 | const MyApp({super.key}); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return const MaterialApp( 27 | debugShowCheckedModeBanner: false, 28 | home: HomePage(), 29 | ); 30 | } 31 | } 32 | 33 | /// ホーム画面 34 | class HomePage extends StatelessWidget { 35 | const HomePage({super.key}); 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | // 画面 40 | return Scaffold( 41 | body: Center( 42 | // ボタン 43 | child: ElevatedButton( 44 | // 押されたとき 45 | onPressed: () { 46 | // Firebase アナリティクスを使うコード 2 47 | FirebaseAnalytics.instance.logEvent( 48 | name: 'ボタンが押されました', 49 | ); 50 | }, 51 | child: const Text('ボタン'), 52 | ), 53 | ), 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/part24/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/part24/router.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:firebase_core/firebase_core.dart'; 5 | import 'firebase_options.dart'; 6 | 7 | /// メイン関数 8 | void main() async { 9 | // Firebase の準備 10 | WidgetsFlutterBinding.ensureInitialized(); 11 | await Firebase.initializeApp( 12 | options: DefaultFirebaseOptions.currentPlatform, 13 | ); 14 | 15 | // アプリを動かす 16 | const app = MyApp(); 17 | const scope = ProviderScope(child: app); 18 | runApp(scope); 19 | } 20 | -------------------------------------------------------------------------------- /lib/part24/router.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'router.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$routerHash() => r'de1714d4d84fff2b2764248f0f521a3c0c0433fb'; 10 | 11 | /// --------------------------------------------------------- 12 | /// GoRouter >> router/router.dart 13 | /// --------------------------------------------------------- 14 | /// 15 | /// Copied from [router]. 16 | @ProviderFor(router) 17 | final routerProvider = AutoDisposeProvider.internal( 18 | router, 19 | name: r'routerProvider', 20 | debugGetCreateSourceHash: 21 | const bool.fromEnvironment('dart.vm.product') ? null : _$routerHash, 22 | dependencies: null, 23 | allTransitiveDependencies: null, 24 | ); 25 | 26 | typedef RouterRef = AutoDisposeProviderRef; 27 | // ignore_for_file: type=lint 28 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 29 | -------------------------------------------------------------------------------- /lib/part24/service.dart: -------------------------------------------------------------------------------- 1 | import 'package:google_sign_in/google_sign_in.dart'; 2 | import 'package:firebase_auth/firebase_auth.dart'; 3 | 4 | /// 通信の流れをまとめておくサービスクラス 5 | class AuthService { 6 | /// サインイン 7 | Future signIn() async { 8 | /* Google OAuth と通信 */ 9 | 10 | // あらかじめ登録しておいたクライアントID 11 | const clientId = 'xxxxx.apps.googleusercontent.com'; 12 | 13 | // アプリが知りたい情報 14 | const scopes = [ 15 | 'openid', // 他サービス連携用のID 16 | 'profile', // 住所や電話番号 17 | 'email', // メールアドレス 18 | ]; 19 | 20 | // Googleでサインイン の画面へ飛ばす 21 | final request = GoogleSignIn(clientId: clientId, scopes: scopes); 22 | final response = await request.signIn(); 23 | 24 | // 受け取ったデータの中からアクセストークンを取り出す 25 | final authn = await response?.authentication; 26 | final accessToken = authn?.accessToken; 27 | 28 | // アクセストークンが null だったら中止 29 | if (accessToken == null) { 30 | return; 31 | } 32 | 33 | /* Firebase と通信 */ 34 | 35 | // Firebaseへアクセストークンを送る 36 | final oAuthCredential = GoogleAuthProvider.credential( 37 | accessToken: accessToken, 38 | ); 39 | await FirebaseAuth.instance.signInWithCredential( 40 | oAuthCredential, 41 | ); 42 | 43 | /* Googleサインインを使わないときは これだけで十分 */ 44 | 45 | // await FirebaseAuth.instance.signInWithEmailAndPassword( 46 | // email: 'ここにメールアドレス', 47 | // password: 'ここにパスワード', 48 | // ); 49 | } 50 | 51 | /// サインアウト 52 | Future signOut() async { 53 | await FirebaseAuth.instance.signOut(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/part26/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/part26/season_dropdown.dart'; 3 | import 'package:banana/part26/season_flower.dart'; 4 | import 'package:banana/part26/season_time.dart'; 5 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 6 | 7 | void main() { 8 | const app = MyApp(); 9 | const scope = ProviderScope(child: app); 10 | runApp(scope); 11 | } 12 | 13 | /// アプリ本体 14 | class MyApp extends StatelessWidget { 15 | const MyApp({super.key}); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return const MaterialApp( 20 | home: HomePage(), 21 | ); 22 | } 23 | } 24 | 25 | /// ホーム画面 26 | class HomePage extends StatelessWidget { 27 | const HomePage({super.key}); 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return const Scaffold( 32 | body: Center( 33 | child: Column( 34 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 35 | children: [ 36 | // ドロップダウン 37 | SeasonDropdown(), 38 | // 季節ごとの時間帯 39 | SeasonTime(), 40 | // 季節ごとの花 41 | SeasonFlower(), 42 | ], 43 | ), 44 | ), 45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/part26/season.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 'season.g.dart'; 3 | 4 | /// 季節 5 | enum Season { 6 | spring, // 春 7 | summer, // 夏 8 | autumn, // 秋 9 | winter, // 冬 10 | } 11 | 12 | /// 季節を状態管理 13 | @riverpod 14 | class SeasonNotifier extends _$SeasonNotifier { 15 | @override 16 | Season build() { 17 | // 春からスタート 18 | return Season.spring; 19 | } 20 | 21 | /// 季節を変更する 22 | void updateSeason(Season season) { 23 | state = season; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/part26/season.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'season.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$seasonNotifierHash() => r'b9bb3ba7916d435e2ae5774315261bcbe544784f'; 10 | 11 | /// 季節を状態管理 12 | /// 13 | /// Copied from [SeasonNotifier]. 14 | @ProviderFor(SeasonNotifier) 15 | final seasonNotifierProvider = 16 | AutoDisposeNotifierProvider.internal( 17 | SeasonNotifier.new, 18 | name: r'seasonNotifierProvider', 19 | debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') 20 | ? null 21 | : _$seasonNotifierHash, 22 | dependencies: null, 23 | allTransitiveDependencies: null, 24 | ); 25 | 26 | typedef _$SeasonNotifier = AutoDisposeNotifier; 27 | // ignore_for_file: type=lint 28 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 29 | -------------------------------------------------------------------------------- /lib/part26/season_dropdown.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/part26/season.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | /// 季節を選ぶドロップダウン 6 | class SeasonDropdown extends ConsumerWidget { 7 | const SeasonDropdown({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context, WidgetRef ref) { 11 | // 今の季節 12 | final season = ref.watch(seasonNotifierProvider); 13 | 14 | /// 選択肢たち 15 | const items = [ 16 | DropdownMenuItem( 17 | value: Season.spring, 18 | child: Text('ハル'), 19 | ), 20 | DropdownMenuItem( 21 | value: Season.summer, 22 | child: Text('ナツ'), 23 | ), 24 | DropdownMenuItem( 25 | value: Season.autumn, 26 | child: Text('アキ'), 27 | ), 28 | DropdownMenuItem( 29 | value: Season.winter, 30 | child: Text('フユ'), 31 | ), 32 | ]; 33 | 34 | /// ドロップダウン本体 35 | return DropdownButton( 36 | value: season, // 現在の季節 37 | items: items, // すべての選択肢たち 38 | onChanged: (newSeason) { 39 | // 状態管理 --> 季節を変更 40 | final notifier = ref.read(seasonNotifierProvider.notifier); 41 | notifier.updateSeason(newSeason!); 42 | }, 43 | focusColor: Colors.transparent, // 余計な影をなくす 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/part26/season_flower.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/part26/season.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | /// 季節ごとの花 6 | class SeasonFlower extends ConsumerWidget { 7 | const SeasonFlower({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context, WidgetRef ref) { 11 | /// 選択中の季節 12 | final season = ref.watch(seasonNotifierProvider); 13 | 14 | // 画像 15 | return Image.asset( 16 | switch (season) { 17 | Season.spring => 'images/cherry-blossom.png', 18 | Season.summer => 'images/sunflower.png', 19 | Season.autumn => 'images/maple.png', 20 | Season.winter => 'images/narcissus.png', 21 | }, 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/part26/season_time.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/part26/season.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | /// 季節ごとの時間帯 6 | class SeasonTime extends ConsumerWidget { 7 | const SeasonTime({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context, WidgetRef ref) { 11 | // 選択中の季節 12 | final season = ref.watch(seasonNotifierProvider); 13 | 14 | // テキスト 15 | return Text( 16 | switch (season) { 17 | Season.spring => 'あけぼの', 18 | Season.summer => 'よる', 19 | Season.autumn => 'ゆうぐれ', 20 | Season.winter => 'つとめて', 21 | }, 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/part27/env.dart: -------------------------------------------------------------------------------- 1 | import 'package:envied/envied.dart'; 2 | part 'env.g.dart'; 3 | 4 | // ------------------------------------ 5 | // 6 | // ***重要*** 7 | // String の明記が必須になった。 8 | // 9 | // - 前 10 | // => static final pass1 = _Env.pass1; 11 | // - 後 12 | // => static final String pass1 = _Env.pass1; 13 | // 14 | // ------------------------------------ 15 | 16 | @Envied(path: 'scripts/env/.env') 17 | abstract class Env { 18 | @EnviedField(varName: 'PASSWORD_1', obfuscate: true) 19 | static final String pass1 = _Env.pass1; 20 | @EnviedField(varName: 'PASSWORD_2', obfuscate: true) 21 | static final String pass2 = _Env.pass2; 22 | } 23 | -------------------------------------------------------------------------------- /lib/part27/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/part27/env.dart'; 3 | 4 | void main() { 5 | const app = MyApp(); 6 | runApp(app); 7 | } 8 | 9 | /// アプリ本体 10 | class MyApp extends StatelessWidget { 11 | const MyApp({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return const MaterialApp( 16 | home: HomePage(), 17 | ); 18 | } 19 | } 20 | 21 | /// ホーム画面 22 | class HomePage extends StatelessWidget { 23 | const HomePage({super.key}); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Scaffold( 28 | body: Center( 29 | child: Text(Env.pass1), 30 | ), 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/part28/drag.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | 4 | // 手で掴んで動かせる Widget 5 | // * 位置のずれは別の記事で説明 6 | 7 | void main() { 8 | const app = MyApp(); 9 | runApp(app); 10 | } 11 | 12 | class MyApp extends StatelessWidget { 13 | const MyApp({super.key}); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return const MaterialApp( 18 | home: Scaffold( 19 | body: Center( 20 | child: ExampleDrag(), 21 | ), 22 | ), 23 | ); 24 | } 25 | } 26 | 27 | class ExampleDrag extends HookWidget { 28 | const ExampleDrag({super.key}); 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | // 動かす位置の状態管理 33 | final offset = useState(Offset.zero); 34 | 35 | // スタック 36 | return Stack( 37 | children: [ 38 | Positioned( 39 | left: offset.value.dx, 40 | top: offset.value.dy, 41 | 42 | // これの説明は別の記事 43 | child: GestureDetector( 44 | onVerticalDragUpdate: (details) { 45 | final pos = details.localPosition; 46 | offset.value = pos; 47 | }, 48 | onHorizontalDragUpdate: (details) { 49 | final pos = details.localPosition; 50 | offset.value = pos; 51 | }, 52 | child: Container( 53 | width: 100, 54 | height: 100, 55 | color: Colors.green, 56 | ), 57 | ), 58 | ), 59 | ], 60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/part28/overflow.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // 右上にはみ出すように見える Widget 4 | 5 | void main() { 6 | const app = MyApp(); 7 | runApp(app); 8 | } 9 | 10 | // アプリ 11 | class MyApp extends StatelessWidget { 12 | const MyApp({super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return const MaterialApp( 17 | home: Scaffold( 18 | body: Center( 19 | child: ExampleOverflow(), 20 | ), 21 | ), 22 | ); 23 | } 24 | } 25 | 26 | class ExampleOverflow extends StatelessWidget { 27 | const ExampleOverflow({super.key}); 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | // 32 | // スタック 33 | // 34 | final stack = Stack( 35 | clipBehavior: Clip.none, 36 | children: [ 37 | // 真ん中の Widget 38 | Container( 39 | margin: const EdgeInsets.all(40), 40 | color: Colors.blue, 41 | ), 42 | 43 | // 右上の Widget 44 | Align( 45 | alignment: Alignment.topRight, 46 | child: Container( 47 | width: 80, 48 | height: 80, 49 | decoration: const BoxDecoration( 50 | color: Colors.red, 51 | shape: BoxShape.circle, 52 | ), 53 | ), 54 | ), 55 | ], 56 | ); 57 | 58 | // 59 | // スタックの大きさと色 60 | // 61 | return Container( 62 | width: 300, 63 | height: 300, 64 | color: Colors.yellow, 65 | child: stack, 66 | ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/part29/lemon_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// レモン ダイアログ 4 | class LemonDialog extends StatelessWidget { 5 | const LemonDialog({super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return AlertDialog( 10 | title: const Text('レモン'), 11 | content: const Text('唐揚げにかけてもいいですか?'), 12 | actions: [ 13 | // ボタン 14 | TextButton( 15 | onPressed: () { 16 | // ダイアログを閉じる 17 | Navigator.pop(context, 'A'); 18 | }, 19 | child: const Text('キャンセル'), 20 | ), 21 | // ボタン 22 | TextButton( 23 | onPressed: () { 24 | // ダイアログを閉じる 25 | Navigator.pop(context, 'B'); 26 | }, 27 | child: const Text('OK'), 28 | ), 29 | ], 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/part29/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/part29/lemon_dialog.dart'; 3 | import 'package:banana/part29/pineapple_dialog.dart'; 4 | 5 | void main() { 6 | const app = MyApp(); 7 | runApp(app); 8 | } 9 | 10 | /// アプリ本体 11 | class MyApp extends StatelessWidget { 12 | const MyApp({super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return const MaterialApp(home: HomePage()); 17 | } 18 | } 19 | 20 | /// ホーム画面 21 | class HomePage extends StatelessWidget { 22 | const HomePage({super.key}); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return Scaffold( 27 | body: Center( 28 | // ボタン 29 | child: ElevatedButton( 30 | onPressed: () async { 31 | // レモンダイアログを表示: showDialog 32 | // 閉じるのを待つ: await 33 | // 回答を受け取る: answer 34 | final answer = await showDialog( 35 | context: context, 36 | builder: (_) => const LemonDialog(), 37 | ); 38 | 39 | // 回答を確認 40 | debugPrint(answer); 41 | 42 | // パイナップルダイアログを表示 43 | if (!context.mounted) return; 44 | showDialog( 45 | context: context, 46 | builder: (_) => const PineappleDialog(), 47 | ); 48 | }, 49 | child: const Text('開く'), 50 | ), 51 | ), 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/part29/pineapple_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// パイナップル ダイアログ 4 | class PineappleDialog extends StatelessWidget { 5 | const PineappleDialog({super.key}); 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return AlertDialog( 10 | title: const Text('パイナップル'), 11 | content: const Text('ピザに乗せてもいいですか?'), 12 | actions: [ 13 | // ボタン 14 | TextButton( 15 | onPressed: () { 16 | // ダイアログを閉じる 17 | Navigator.pop(context, 'A'); 18 | }, 19 | child: const Text('キャンセル'), 20 | ), 21 | // ボタン 22 | TextButton( 23 | onPressed: () { 24 | // ダイアログを閉じる 25 | Navigator.pop(context, 'B'); 26 | }, 27 | child: const Text('OK'), 28 | ), 29 | ], 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/part3/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /* 4 | 5 | 2023年 最新の Flutter で 6 | カラムとローが const に対応しました🎉 7 | 8 | 動画の中ではまだ対応していないと言っていましたが 9 | このファイルでは修正してあります 10 | 11 | */ 12 | 13 | void main() { 14 | // カラム 15 | const col = Column( 16 | mainAxisAlignment: MainAxisAlignment.center, 17 | crossAxisAlignment: CrossAxisAlignment.center, 18 | children: [ 19 | Text('レモン'), 20 | Text('りんご'), 21 | Text('ブドウ'), 22 | ], 23 | ); 24 | 25 | // ロー 26 | const row = Row( 27 | mainAxisAlignment: MainAxisAlignment.center, 28 | crossAxisAlignment: CrossAxisAlignment.center, 29 | children: [col, col, col], 30 | ); 31 | 32 | // アプリ 33 | const app = MaterialApp( 34 | home: Scaffold( 35 | body: Center( 36 | child: row, 37 | ), 38 | ), 39 | ); 40 | 41 | runApp(app); 42 | } 43 | -------------------------------------------------------------------------------- /lib/part30/kv.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | 3 | // ドリンクを保存する 4 | Future saveDrink(String value) async { 5 | // パッケージを使う 6 | final prefs = await SharedPreferences.getInstance(); 7 | // キーとバリューを保存 8 | await prefs.setString( 9 | 'drink', 10 | value, 11 | ); 12 | } 13 | 14 | /// ドリンクを取り出す 15 | Future loadDrink() async { 16 | // パッケージを使う 17 | final prefs = await SharedPreferences.getInstance(); 18 | // キーを使って探す 19 | final value = prefs.getString('drink'); 20 | // 見つからなければ お水 にする 21 | return value ?? 'お水'; 22 | } 23 | -------------------------------------------------------------------------------- /lib/part30/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | import 'package:banana/part30/widgets.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | 6 | void main() { 7 | const app = MyApp(); 8 | const scope = ProviderScope(child: app); 9 | runApp(scope); 10 | } 11 | 12 | /// アプリ本体 13 | class MyApp extends StatelessWidget { 14 | const MyApp({super.key}); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return const MaterialApp( 19 | home: HomePage(), 20 | ); 21 | } 22 | } 23 | 24 | /// ホーム画面 25 | class HomePage extends HookWidget { 26 | const HomePage({super.key}); 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | final controller = useTextEditingController(); 31 | 32 | return Scaffold( 33 | body: Column( 34 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 35 | children: [ 36 | // ドリンクを表示 37 | const DrinkText(), 38 | // ドリンクを編集 39 | DrinkTextField(controller: controller), 40 | // ドリンクを保存 41 | DrinkSaveButton(controller: controller), 42 | ], 43 | ), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/part30/state.dart: -------------------------------------------------------------------------------- 1 | import 'package:banana/part30/kv.dart'; 2 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 3 | part 'state.g.dart'; 4 | 5 | // ドリンクの状態管理 6 | 7 | @riverpod 8 | class DrinkNotifier extends _$DrinkNotifier { 9 | @override 10 | Future build() async { 11 | // KV から取り出す 12 | return loadDrink(); // 最初のデータ 13 | } 14 | 15 | // ドリンクを変更 16 | Future updateDrink(String drink) async { 17 | // KV に保存 18 | await saveDrink(drink); 19 | // 状態を変更 20 | state = AsyncData(drink); 21 | } 22 | } 23 | 24 | // 25 | // ヒント: AsyncValue.data は AsyncData にリニューアルされました 26 | // -------------------------------------------------------------------------------- /lib/part30/state.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'state.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$drinkNotifierHash() => r'b058b43801d5aaf750fb38611665d8ff236b7462'; 10 | 11 | /// See also [DrinkNotifier]. 12 | @ProviderFor(DrinkNotifier) 13 | final drinkNotifierProvider = 14 | AutoDisposeAsyncNotifierProvider.internal( 15 | DrinkNotifier.new, 16 | name: r'drinkNotifierProvider', 17 | debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') 18 | ? null 19 | : _$drinkNotifierHash, 20 | dependencies: null, 21 | allTransitiveDependencies: null, 22 | ); 23 | 24 | typedef _$DrinkNotifier = AutoDisposeAsyncNotifier; 25 | // ignore_for_file: type=lint 26 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 27 | -------------------------------------------------------------------------------- /lib/part31/realtime.dart: -------------------------------------------------------------------------------- 1 | import 'package:cloud_firestore/cloud_firestore.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 5 | part 'realtime.g.dart'; 6 | 7 | /// J-POP の数を監視 8 | @riverpod 9 | Stream jpopCount(JpopCountRef ref) { 10 | final db = FirebaseFirestore.instance; 11 | 12 | // データベースを監視 13 | final snapshots = db 14 | .collection('songs') 15 | .where('genre', isEqualTo: 'J-POP') // J-POPのみ 16 | .snapshots(); 17 | 18 | // docs: 曲たち 19 | // length: 曲数 20 | return snapshots.map( 21 | (snapshot) => snapshot.docs.length, 22 | ); 23 | } 24 | 25 | /// J-POP の数を表示 26 | class JpopCount extends ConsumerWidget { 27 | const JpopCount({super.key}); 28 | 29 | @override 30 | Widget build(BuildContext context, WidgetRef ref) { 31 | final count = ref.watch(jpopCountProvider); 32 | return switch (count) { 33 | // 通信が終わったら テキスト 34 | AsyncData(:final value) => Text('J-POP: $value 曲'), 35 | // 通信中は グルグル 36 | AsyncValue() => const CircularProgressIndicator(), 37 | }; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/part31/realtime.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'realtime.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$jpopCountHash() => r'a8f6976bdf6323515fa0c024d1b4d88750578c93'; 10 | 11 | /// J-POP の数を監視 12 | /// 13 | /// Copied from [jpopCount]. 14 | @ProviderFor(jpopCount) 15 | final jpopCountProvider = AutoDisposeStreamProvider.internal( 16 | jpopCount, 17 | name: r'jpopCountProvider', 18 | debugGetCreateSourceHash: 19 | const bool.fromEnvironment('dart.vm.product') ? null : _$jpopCountHash, 20 | dependencies: null, 21 | allTransitiveDependencies: null, 22 | ); 23 | 24 | typedef JpopCountRef = AutoDisposeStreamProviderRef; 25 | // ignore_for_file: type=lint 26 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 27 | -------------------------------------------------------------------------------- /lib/part31/セキュリティルール.txt: -------------------------------------------------------------------------------- 1 | rules_version = '2'; 2 | service cloud.firestore { 3 | match /databases/{db}/documents { 4 | match /{coll}/{doc} { 5 | allow create: if true; // 新しいデータ追加してOK 6 | allow read: if true; // 誰でもデータを見てOK 7 | allow update: if true; // データを変更してOK 8 | allow delete: if true; // データを削除してOK 9 | } 10 | } 11 | } 12 | 13 | // true --> OK 14 | // false --> 禁止 15 | -------------------------------------------------------------------------------- /lib/part33/main.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/lib/part33/main.dart -------------------------------------------------------------------------------- /lib/part4/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // 準備 4 | // 好きな画像を用意 5 | // assets/images に画像を追加 6 | // pubspec.yaml を編集 asstes パスを書く 7 | 8 | void main() { 9 | // 画像 10 | /* 動かす環境によっては 'assets/images/sushi.jpeg' にしないと映りません */ 11 | final img = Image.asset( 12 | 'images/sushi.jpeg', 13 | ); 14 | 15 | // ロー 16 | final row = Row( 17 | mainAxisAlignment: MainAxisAlignment.center, 18 | crossAxisAlignment: CrossAxisAlignment.center, 19 | children: [img, img, img], 20 | ); 21 | 22 | // アプリ 23 | final a = MaterialApp( 24 | home: Scaffold( 25 | body: Center( 26 | child: row, 27 | ), 28 | ), 29 | ); 30 | 31 | runApp(a); 32 | } 33 | -------------------------------------------------------------------------------- /lib/part5/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | void main() { 4 | // 画像 5 | final img = Image.asset( 6 | 'images/sushi.jpeg', 7 | ); 8 | 9 | // 小さいコンテナ 10 | final smallCon = Container( 11 | color: Colors.deepOrange, // オレンジ色 12 | width: 50, 13 | height: 50, 14 | ); 15 | 16 | // 縦に並べるカラム 17 | final col = Column( 18 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 19 | children: [ 20 | smallCon, // 小さいコンテナ 21 | img, // 画像 22 | smallCon, // 小さいコンテナ 23 | ], 24 | ); 25 | 26 | // 大きいコンテナ 27 | final bigCon = Container( 28 | color: Colors.blue, // 青色 29 | width: 400, 30 | height: 400, 31 | alignment: Alignment.centerLeft, 32 | padding: const EdgeInsets.all(20), 33 | child: col, // 中にカラムを丸ごと入れる 34 | ); 35 | 36 | // アプリ 37 | final a = MaterialApp( 38 | home: Scaffold( 39 | body: Center( 40 | child: bigCon, // 大きいコンテナを表示する 41 | ), 42 | ), 43 | ); 44 | runApp(a); 45 | } 46 | -------------------------------------------------------------------------------- /lib/part6/banana_counter.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // バナナカウンター 4 | class BananaCounter extends StatelessWidget { 5 | // バナナの数 6 | final int number; 7 | const BananaCounter({ 8 | super.key, 9 | required this.number, 10 | }); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | // バナナの画像 15 | final banana = Image.asset('images/banana.png'); 16 | 17 | // 数字の部分 18 | final text = Text( 19 | '$number', 20 | style: const TextStyle( 21 | color: Colors.yellow, // 文字の色 22 | fontSize: 50, // 文字の大きさ 23 | ), 24 | ); 25 | 26 | // 横に並べる 27 | final row = Row( 28 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 29 | children: [ 30 | banana, 31 | text, 32 | ], 33 | ); 34 | 35 | // 色と大きさを決める 36 | final con = Container( 37 | width: 300, // 横幅 38 | height: 100, // 高さ 39 | padding: const EdgeInsets.all(12), 40 | decoration: BoxDecoration( 41 | color: Colors.black87, // 背景の色 42 | borderRadius: BorderRadius.circular(12), // 角を少し丸くする 43 | ), 44 | child: row, 45 | ); 46 | 47 | // 表示するWidgetを決定する 48 | return con; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/part6/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/part6/banana_counter.dart'; 3 | 4 | void main() { 5 | // バナナカウンターを使う 6 | const bnn = BananaCounter( 7 | number: 888, 8 | ); 9 | 10 | // アプリ 11 | const a = MaterialApp( 12 | home: Scaffold( 13 | body: Center( 14 | child: bnn, 15 | ), 16 | ), 17 | ); 18 | runApp(a); 19 | } 20 | -------------------------------------------------------------------------------- /lib/part7/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /* 4 | 最新のFlutterに対応するため、動画と少しコードが変わりました 5 | */ 6 | 7 | void main() { 8 | // ボタンを押したら呼ばれる関数 9 | xxxx() { 10 | debugPrint('これから通信を始めます'); 11 | debugPrint('通信中です'); 12 | debugPrint('通信が終わりました'); 13 | } 14 | 15 | // ボタン本体 16 | final button = ElevatedButton( 17 | onPressed: xxxx, 18 | style: ElevatedButton.styleFrom( 19 | // MEMO: primary は古くなったので backgroundColor へ変更しました 20 | backgroundColor: Colors.green, 21 | ), 22 | child: const Text('押してみて'), 23 | ); 24 | 25 | // アプリ 26 | final a = MaterialApp( 27 | home: Scaffold( 28 | body: Center( 29 | child: button, 30 | ), 31 | ), 32 | ); 33 | 34 | runApp(a); 35 | } 36 | -------------------------------------------------------------------------------- /lib/pixel_color_image/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:pixel_color_image/pixel_color_image.dart'; 3 | 4 | // マウスがホバリングしているとき 5 | void onHover(int x, int y, Color color) async { 6 | debugPrint('ホバー中 x: $x, y: $y, color: $color'); 7 | } 8 | 9 | // タップされたとき 10 | void onTap(int x, int y, Color color) async { 11 | debugPrint('タップされました x: $x, y: $y, color: $color'); 12 | } 13 | 14 | // 表示する画像を加工したいとき 15 | Widget buildImage(BuildContext context, Image image) { 16 | return image; 17 | } 18 | 19 | // プレビューと画像を繋ぐための ref 20 | final ref = PixelColorRef(); 21 | 22 | // main 23 | void main() { 24 | // ピクセルカラー読み取りWidget 25 | final img = PixelColor.assetImage( 26 | ref: ref, 27 | // 画像はここにあります 28 | // assets/images フォルダへおいてください 29 | // https://github.com/rbdog/banana/blob/main/assets/images/banana.png 30 | path: 'assets/images/banana.png', 31 | onHover: onHover, 32 | onTap: onTap, 33 | buildImage: buildImage, 34 | ); 35 | 36 | // カラープレビュー 37 | final preview = PixelColorPreview( 38 | ref: ref, 39 | ); 40 | 41 | // アプリ 42 | final app = MaterialApp( 43 | // 画面 44 | home: Scaffold( 45 | backgroundColor: Colors.grey, 46 | // 真ん中 47 | body: Center( 48 | // カラム 49 | child: Column( 50 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 51 | children: [ 52 | // カラープレビュー 53 | preview, 54 | // 画像 55 | img, 56 | ], 57 | ), 58 | ), 59 | ), 60 | ); 61 | 62 | // アプリを実行 63 | runApp(app); 64 | } 65 | -------------------------------------------------------------------------------- /lib/qa/01/hook_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_hooks/flutter_hooks.dart'; 3 | 4 | void main() { 5 | const app = MyApp(); 6 | runApp(app); 7 | } 8 | 9 | class MyApp extends StatelessWidget { 10 | const MyApp({super.key}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return const MaterialApp(home: HomePage()); 15 | } 16 | } 17 | 18 | class HomePage extends StatelessWidget { 19 | const HomePage({super.key}); 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return const Scaffold( 24 | body: Center( 25 | child: MyWidget(), 26 | ), 27 | ); 28 | } 29 | } 30 | 31 | class MyWidget extends HookWidget { 32 | const MyWidget({super.key}); 33 | 34 | @override 35 | Widget build(BuildContext context) { 36 | // コントローラー 37 | final controller = useTextEditingController(); 38 | final text = useState('_____'); 39 | return Column( 40 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 41 | children: [ 42 | SizedBox( 43 | width: 200, 44 | child: TextFormField(controller: controller), 45 | ), 46 | ElevatedButton( 47 | onPressed: () { 48 | text.value = controller.text; 49 | }, 50 | child: const Text('決定'), 51 | ), 52 | Text(text.value), 53 | ], 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/qa/others/taku/taku_list_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:banana/qa/others/taku/taku_models_provider.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | class TakuListWidget extends ConsumerWidget { 6 | final String userId; 7 | const TakuListWidget({super.key, required this.userId}); 8 | 9 | @override 10 | Widget build(BuildContext context, WidgetRef ref) { 11 | // 卓モデルたち(AsyncValue) 12 | final asyncTakuList = ref.watch(takuModelsNotifierProvider); 13 | 14 | if (asyncTakuList.hasError) { 15 | return const Text('エラーのときに出すWidget'); 16 | } 17 | if (!asyncTakuList.hasValue) { 18 | return const Text('データ準備中に出すWidget'); 19 | } 20 | 21 | // 卓モデルたち 22 | final takuList = asyncTakuList.value!; 23 | 24 | /* 注意: ここで serviceを呼んだりしないこと */ 25 | // build は予期せず何回も呼ばれることがあります 26 | // build の中でfirestoreからのデータを準備してはいけません 27 | // 代わりに taku_models_provider.dart ファイルを編集してください 28 | 29 | return Text('普通のリストWidget $takuList'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/qa/others/taku/taku_model.dart: -------------------------------------------------------------------------------- 1 | /// Takuモデル 2 | class TakuModel { 3 | const TakuModel({ 4 | required this.id, 5 | required this.xxx, 6 | }); 7 | 8 | /// ID 9 | final String id; 10 | 11 | /// 何か他のデータ 12 | final String xxx; 13 | } 14 | -------------------------------------------------------------------------------- /lib/qa/others/taku/taku_models_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:banana/qa/others/taku/taku_model.dart'; 2 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 3 | part 'taku_models_provider.g.dart'; 4 | 5 | typedef TakuModelList = List; 6 | 7 | @riverpod 8 | class TakuModelsNotifier extends _$TakuModelsNotifier { 9 | @override 10 | Future build() async { 11 | // 最初に表示するデータ (ここで firebase からとってきたりする) 12 | const initialModels = [ 13 | TakuModel(id: 'ID_001', xxx: 'ここはID以外のデータ'), 14 | TakuModel(id: 'ID_002', xxx: 'ここはID以外のデータ'), 15 | TakuModel(id: 'ID_003', xxx: 'ここはID以外のデータ'), 16 | ]; 17 | return initialModels; 18 | } 19 | 20 | /// 新しい Taku を追加する 21 | Future addNewTaku(TakuModel newModel) async { 22 | // エラーチェック 23 | if (state.value == null) { 24 | // エラー 25 | throw Exception( 26 | 'まだ最初のデータがないのに追加しようとしました', 27 | ); 28 | } 29 | 30 | /* ここでserviceクラスを呼び出してfirebaseと通信したり */ 31 | 32 | // 古いモデルたち 33 | final oldModels = state.value!; 34 | // 新しいモデルたち (List.of でコピーしてから使う) 35 | final newModels = List.of(oldModels); 36 | // データに追加 37 | newModels.add(newModel); 38 | 39 | // 状態を上書き 40 | state = AsyncValue.data(newModels); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/qa/others/taku/taku_models_provider.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'taku_models_provider.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$takuModelsNotifierHash() => 10 | r'b0a572de6963bf517533cc732ead1eea9fabb44a'; 11 | 12 | /// See also [TakuModelsNotifier]. 13 | @ProviderFor(TakuModelsNotifier) 14 | final takuModelsNotifierProvider = AutoDisposeAsyncNotifierProvider< 15 | TakuModelsNotifier, TakuModelList>.internal( 16 | TakuModelsNotifier.new, 17 | name: r'takuModelsNotifierProvider', 18 | debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') 19 | ? null 20 | : _$takuModelsNotifierHash, 21 | dependencies: null, 22 | allTransitiveDependencies: null, 23 | ); 24 | 25 | typedef _$TakuModelsNotifier = AutoDisposeAsyncNotifier; 26 | // ignore_for_file: type=lint 27 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 28 | -------------------------------------------------------------------------------- /lib/qa/others/text_form_riverpod.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'text_form_riverpod.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$textNotifierHash() => r'13d317c5fd238710c716ac65960298cc23d6a99c'; 10 | 11 | /// ----------------------------------------------------------- 12 | /// ノティファイヤー & 自動で作られるプロバイダー - 文字を保存しておく 13 | /// ----------------------------------------------------------- 14 | /// 15 | /// Copied from [TextNotifier]. 16 | @ProviderFor(TextNotifier) 17 | final textNotifierProvider = 18 | AutoDisposeNotifierProvider.internal( 19 | TextNotifier.new, 20 | name: r'textNotifierProvider', 21 | debugGetCreateSourceHash: 22 | const bool.fromEnvironment('dart.vm.product') ? null : _$textNotifierHash, 23 | dependencies: null, 24 | allTransitiveDependencies: null, 25 | ); 26 | 27 | typedef _$TextNotifier = AutoDisposeNotifier; 28 | // ignore_for_file: type=lint 29 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 30 | -------------------------------------------------------------------------------- /lib/qa/others/todo_example/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/qa/others/todo_example/todo_view.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | void main() { 6 | const view = TodoView(); 7 | const app = MaterialApp(home: view); 8 | const scope = ProviderScope(child: app); 9 | runApp(scope); 10 | } 11 | -------------------------------------------------------------------------------- /lib/qa/others/todo_example/providers.dart: -------------------------------------------------------------------------------- 1 | // riverpod で使うプロバイダーを書いておくファイル 2 | 3 | import 'package:banana/qa/others/todo_example/todo_model.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | import 'package:banana/qa/others/todo_example/todo_view_model.dart'; 6 | 7 | /// ビューモデルを入れておくプロバイダー 8 | final todoViewModelProvider = StateNotifierProvider( 9 | (ref) { 10 | /// 画面を表示したときに、最初から出ている Todo たち 11 | const initialTodos = [ 12 | TodoModel(id: '0', memo: 'これは適当なメモです0'), 13 | TodoModel(id: '1', memo: 'これは適当なメモです0'), 14 | TodoModel(id: '2', memo: 'これは適当なメモです0'), 15 | ]; 16 | return TodoViewModel(initialTodos); 17 | }, 18 | ); 19 | -------------------------------------------------------------------------------- /lib/qa/others/todo_example/todo_model.dart: -------------------------------------------------------------------------------- 1 | // 2 | // できれば freezed で作った方が安全 3 | // 4 | 5 | /// Todo 1つ分のデータを入れておくクラス 6 | class TodoModel { 7 | const TodoModel({ 8 | required this.id, 9 | required this.memo, 10 | }); 11 | 12 | /// ID 13 | final String id; 14 | 15 | /// Todo の中に書くメモ 16 | final String memo; 17 | } 18 | 19 | // typedef を使えば List と書く代わりに TodoList とかけるようになる 20 | // これで <> が少し減ってスッキリしたコードになる 21 | typedef TodoList = List; 22 | -------------------------------------------------------------------------------- /lib/qa/others/todo_example/todo_view_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:banana/qa/others/todo_example/todo_model.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | 4 | // ビューモデル 5 | class TodoViewModel extends StateNotifier { 6 | TodoViewModel(super._state); 7 | 8 | /// Todo を追加する 9 | void addTodo(TodoModel newTodo) { 10 | // 追加前の Todo たち 11 | final oldTodos = List.of(state); 12 | // 追加後の Todo たち 13 | final newtodos = [...oldTodos, newTodo]; // 一番最後に新しい Todo を追加 14 | // ステートを新しいものへ変更 15 | state = newtodos; 16 | } 17 | 18 | /// Todo を削除する 19 | void removeTodo(String targetId) { 20 | // 削除前のTodoたち 21 | final oldTodos = List.of(state); 22 | // IDを取り除く 23 | oldTodos.removeWhere((todo) { 24 | return todo.id == targetId; // ここでターゲットになったTodoが削除される 25 | }); 26 | // 削除後の Todo たち 27 | final newTodos = oldTodos; // もう削除された後なので new, old は同じ 28 | // ステートを新しいものへ変更 29 | state = newTodos; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/qa/others/todo_example2/add_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:banana/qa/others/todo_example2/todos_provider.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | /// addボタン 6 | class AddButton extends ConsumerWidget { 7 | const AddButton({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context, WidgetRef ref) { 11 | return FloatingActionButton( 12 | // 追加マークのアイコンを使う 13 | child: const Icon(Icons.add), 14 | // ボタンを押したとき 15 | onPressed: () { 16 | // ノティファイアーを使ってデータを変える 17 | final notifier = ref.read(todoModelsNotifierProvider.notifier); 18 | // 新しいTodoを追加する 19 | notifier.addNewTodo(); 20 | }, 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/qa/others/todo_example2/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /* このファイルは真似しなくてOK */ 4 | class BrandColor { 5 | static const darkGrey = Colors.grey; 6 | } 7 | -------------------------------------------------------------------------------- /lib/qa/others/todo_example2/custom_checkbox.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// カスタマイズしたチェックボックス 4 | class CustomCheckbox extends StatelessWidget { 5 | const CustomCheckbox({ 6 | super.key, 7 | this.activeColor = Colors.blue, 8 | this.padding = const EdgeInsets.all(8), 9 | this.onTapTitle, 10 | this.onLongPressTitle, 11 | required this.title, 12 | required this.value, 13 | required this.onChanged, 14 | }); 15 | 16 | final Color activeColor; 17 | final EdgeInsets padding; 18 | final Widget title; 19 | final bool value; 20 | final ValueChanged onChanged; 21 | final VoidCallback? onTapTitle; 22 | final VoidCallback? onLongPressTitle; 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return InkWell( 27 | onTap: onTapTitle, 28 | onLongPress: onLongPressTitle, 29 | child: Padding( 30 | padding: padding, 31 | child: Row( 32 | children: [ 33 | InkWell( 34 | onTap: () => onChanged(!value), 35 | child: Checkbox( 36 | activeColor: activeColor, 37 | value: value, 38 | onChanged: (newValue) { 39 | onChanged(newValue!); 40 | }, 41 | ), 42 | ), 43 | Expanded( 44 | child: title, 45 | ), 46 | ], 47 | ), 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/qa/others/todo_example2/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:banana/qa/others/todo_example2/check_box.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | /* このファイルは真似しなくてOK */ 6 | void main() { 7 | const page = CheckBox(); 8 | const app = MaterialApp(home: page); 9 | const scope = ProviderScope(child: app); 10 | runApp(scope); 11 | } 12 | -------------------------------------------------------------------------------- /lib/qa/others/todo_example2/todo_model.dart: -------------------------------------------------------------------------------- 1 | /// ToDoモデル 2 | class TodoModel { 3 | const TodoModel({ 4 | required this.id, 5 | required this.memo, 6 | required this.isChecked, 7 | }); 8 | 9 | /// ID ('A'とか'B'とか他と被らないもの) 10 | final String id; 11 | 12 | /// メモ 13 | final String memo; 14 | 15 | /// チェックされているかどうか (true | false) 16 | final bool isChecked; 17 | } 18 | -------------------------------------------------------------------------------- /lib/qa/others/todo_example2/todos_provider.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'todos_provider.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$todoModelsNotifierHash() => 10 | r'42514d97db9d405d31e7c62b98bbd6cf440f7747'; 11 | 12 | /// See also [TodoModelsNotifier]. 13 | @ProviderFor(TodoModelsNotifier) 14 | final todoModelsNotifierProvider = 15 | AutoDisposeNotifierProvider>.internal( 16 | TodoModelsNotifier.new, 17 | name: r'todoModelsNotifierProvider', 18 | debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') 19 | ? null 20 | : _$todoModelsNotifierHash, 21 | dependencies: null, 22 | allTransitiveDependencies: null, 23 | ); 24 | 25 | typedef _$TodoModelsNotifier = AutoDisposeNotifier>; 26 | // ignore_for_file: type=lint 27 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 28 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider/basic.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 'basic.g.dart'; 3 | 4 | // basicProvider 5 | 6 | @riverpod 7 | int basic(BasicRef ref) { 8 | return 123; 9 | } 10 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider/basic.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'basic.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$basicHash() => r'c2aec842b120cb9c3f79c5d64d86fe342225ce10'; 10 | 11 | /// See also [basic]. 12 | @ProviderFor(basic) 13 | final basicProvider = AutoDisposeProvider.internal( 14 | basic, 15 | name: r'basicProvider', 16 | debugGetCreateSourceHash: 17 | const bool.fromEnvironment('dart.vm.product') ? null : _$basicHash, 18 | dependencies: null, 19 | allTransitiveDependencies: null, 20 | ); 21 | 22 | typedef BasicRef = AutoDisposeProviderRef; 23 | // ignore_for_file: type=lint 24 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 25 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_cache/cache.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:banana/riverpod/basic_provider_cache/state.dart'; 4 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 5 | 6 | part 'cache.g.dart'; 7 | 8 | // 平均点 9 | 10 | @Riverpod(keepAlive: true) 11 | int cacheAverage(CacheAverageRef ref) { 12 | debugPrint('平均点を計算します'); 13 | final scores = ref.watch(scoreNotifierProvider); 14 | final average = scores.reduce((a, b) => a + b) / scores.length; 15 | return average.toInt(); 16 | } 17 | 18 | // 最高点 19 | 20 | @Riverpod(keepAlive: true) 21 | int cacheMax(CacheMaxRef ref) { 22 | debugPrint('最大を計算します'); 23 | final scores = ref.watch(scoreNotifierProvider); 24 | final maxScore = scores.reduce(max); 25 | return maxScore; 26 | } 27 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_cache/cache.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'cache.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$cacheAverageHash() => r'2dfd97b1ecf97746e610f34f9dcdd0518b88e05b'; 10 | 11 | /// See also [cacheAverage]. 12 | @ProviderFor(cacheAverage) 13 | final cacheAverageProvider = Provider.internal( 14 | cacheAverage, 15 | name: r'cacheAverageProvider', 16 | debugGetCreateSourceHash: 17 | const bool.fromEnvironment('dart.vm.product') ? null : _$cacheAverageHash, 18 | dependencies: null, 19 | allTransitiveDependencies: null, 20 | ); 21 | 22 | typedef CacheAverageRef = ProviderRef; 23 | String _$cacheMaxHash() => r'ca223d0238025e6ce148a4610a09ac8223d6b130'; 24 | 25 | /// See also [cacheMax]. 26 | @ProviderFor(cacheMax) 27 | final cacheMaxProvider = Provider.internal( 28 | cacheMax, 29 | name: r'cacheMaxProvider', 30 | debugGetCreateSourceHash: 31 | const bool.fromEnvironment('dart.vm.product') ? null : _$cacheMaxHash, 32 | dependencies: null, 33 | allTransitiveDependencies: null, 34 | ); 35 | 36 | typedef CacheMaxRef = ProviderRef; 37 | // ignore_for_file: type=lint 38 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 39 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_cache/state.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 'state.g.dart'; 3 | 4 | @Riverpod(keepAlive: true) 5 | class ScoreNotifier extends _$ScoreNotifier { 6 | @override 7 | List build() { 8 | // 5教科の点数 9 | return [ 10 | // 国語 11 | 91, 12 | // 数学 13 | 85, 14 | // 理科 15 | 88, 16 | // 社会 17 | 94, 18 | // 英語 19 | 92, 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_cache/state.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'state.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$scoreNotifierHash() => r'2a3613fe7be14039a69511a8498d7fc36b674d17'; 10 | 11 | /// See also [ScoreNotifier]. 12 | @ProviderFor(ScoreNotifier) 13 | final scoreNotifierProvider = 14 | NotifierProvider>.internal( 15 | ScoreNotifier.new, 16 | name: r'scoreNotifierProvider', 17 | debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') 18 | ? null 19 | : _$scoreNotifierHash, 20 | dependencies: null, 21 | allTransitiveDependencies: null, 22 | ); 23 | 24 | typedef _$ScoreNotifier = Notifier>; 25 | // ignore_for_file: type=lint 26 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 27 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_logic/logic.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 3 | import 'package:banana/riverpod/basic_provider_logic/state.dart'; 4 | part 'logic.g.dart'; 5 | 6 | @riverpod 7 | String logic(LogicRef ref) { 8 | // 年齢 9 | final age = ref.watch(ageNotifierProvider); 10 | 11 | debugPrint('これからお酒が飲めるかどうかチェックします'); 12 | 13 | late String text; 14 | if (age < 20) { 15 | text = '飲んではいけません。'; 16 | } else { 17 | text = 'ひゃっはー、飲める、飲めるぜーーーー!!!!'; 18 | } 19 | 20 | return text; 21 | } 22 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_logic/logic.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'logic.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$logicHash() => r'0e1e63667df130237bee82d55de9cc7f7b22f72c'; 10 | 11 | /// See also [logic]. 12 | @ProviderFor(logic) 13 | final logicProvider = AutoDisposeProvider.internal( 14 | logic, 15 | name: r'logicProvider', 16 | debugGetCreateSourceHash: 17 | const bool.fromEnvironment('dart.vm.product') ? null : _$logicHash, 18 | dependencies: null, 19 | allTransitiveDependencies: null, 20 | ); 21 | 22 | typedef LogicRef = AutoDisposeProviderRef; 23 | // ignore_for_file: type=lint 24 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 25 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_logic/state.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 'state.g.dart'; 3 | 4 | // 年齢 5 | 6 | @riverpod 7 | class AgeNotifier extends _$AgeNotifier { 8 | @override 9 | int build() { 10 | // 0 歳からスタート 11 | return 0; 12 | } 13 | 14 | // データを変更する関数 15 | void updateState() { 16 | final oldState = state; 17 | final newState = oldState + 1; 18 | state = newState; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_logic/state.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'state.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$ageNotifierHash() => r'296c6c51ab9f7d06a71350cb6a2d81da97b8beda'; 10 | 11 | /// See also [AgeNotifier]. 12 | @ProviderFor(AgeNotifier) 13 | final ageNotifierProvider = 14 | AutoDisposeNotifierProvider.internal( 15 | AgeNotifier.new, 16 | name: r'ageNotifierProvider', 17 | debugGetCreateSourceHash: 18 | const bool.fromEnvironment('dart.vm.product') ? null : _$ageNotifierHash, 19 | dependencies: null, 20 | allTransitiveDependencies: null, 21 | ); 22 | 23 | typedef _$AgeNotifier = AutoDisposeNotifier; 24 | // ignore_for_file: type=lint 25 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 26 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_proxy/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:banana/riverpod/basic_provider_proxy/widget.dart'; 4 | 5 | void main() { 6 | const app = MayApp(); 7 | const scope = ProviderScope(child: app); 8 | runApp(scope); 9 | } 10 | 11 | class MayApp extends StatelessWidget { 12 | const MayApp({super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return const MaterialApp( 17 | home: Scaffold( 18 | body: Center( 19 | child: MyWidget(), 20 | ), 21 | ), 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_proxy/proxy.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 'proxy.g.dart'; 3 | 4 | @riverpod 5 | class P1Notifier extends _$P1Notifier { 6 | @override 7 | String build() { 8 | return 'み'; 9 | } 10 | 11 | // データを変更する 12 | void updateState() { 13 | state = 'よ'; 14 | } 15 | } 16 | 17 | @riverpod 18 | class P2Notifier extends _$P2Notifier { 19 | @override 20 | String build() { 21 | return 'つ'; 22 | } 23 | } 24 | 25 | @riverpod 26 | class P3Notifier extends _$P3Notifier { 27 | @override 28 | String build() { 29 | return 'ば'; 30 | } 31 | } 32 | 33 | // proxyProvider 34 | 35 | @riverpod 36 | String proxy(ProxyRef ref) { 37 | final p1 = ref.watch(p1NotifierProvider); 38 | final p2 = ref.watch(p2NotifierProvider); 39 | final p3 = ref.watch(p3NotifierProvider); 40 | 41 | return p1 + p2 + p3; 42 | } 43 | -------------------------------------------------------------------------------- /lib/riverpod/basic_provider_proxy/widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:banana/riverpod/basic_provider_proxy/proxy.dart'; 4 | 5 | // ウィジェット 6 | class MyWidget extends ConsumerWidget { 7 | const MyWidget({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context, WidgetRef ref) { 11 | final proxy = ref.watch(proxyProvider); 12 | 13 | final button = FloatingActionButton( 14 | onPressed: () { 15 | // P1 を 変更する 16 | final notifier = ref.read(p1NotifierProvider.notifier); 17 | notifier.updateState(); 18 | }, 19 | child: const Icon(Icons.refresh), 20 | ); 21 | return Scaffold( 22 | floatingActionButton: button, 23 | body: Center( 24 | child: Text(proxy), 25 | ), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/riverpod/build_ondispose/state.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 3 | part 'state.g.dart'; 4 | 5 | @riverpod 6 | class CountNotifier extends _$CountNotifier { 7 | @override 8 | int build() { 9 | // 最初のデータを準備する 10 | debugPrint('誰かにwatchされたのでデータを準備します'); 11 | 12 | // データが捨てられた時のことを決めておく 13 | ref.onDispose(() { 14 | debugPrint('誰にもwatchされなくなったのでデータを捨てます'); 15 | }); 16 | 17 | return 0; 18 | } 19 | 20 | // データを変更する関数 21 | void updateState() { 22 | final oldState = state; 23 | final newState = oldState + 1; 24 | state = newState; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/riverpod/build_ondispose/state.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'state.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$countNotifierHash() => r'b8b8bd1bbc162f7117603b9ef3c3fb8c7efeaee9'; 10 | 11 | /// See also [CountNotifier]. 12 | @ProviderFor(CountNotifier) 13 | final countNotifierProvider = 14 | AutoDisposeNotifierProvider.internal( 15 | CountNotifier.new, 16 | name: r'countNotifierProvider', 17 | debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') 18 | ? null 19 | : _$countNotifierHash, 20 | dependencies: null, 21 | allTransitiveDependencies: null, 22 | ); 23 | 24 | typedef _$CountNotifier = AutoDisposeNotifier; 25 | // ignore_for_file: type=lint 26 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 27 | -------------------------------------------------------------------------------- /lib/riverpod/keep_alive/state.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 3 | part 'state.g.dart'; 4 | 5 | @Riverpod(keepAlive: true) 6 | class CountNotifier extends _$CountNotifier { 7 | @override 8 | int build() { 9 | // 最初のデータを準備する 10 | debugPrint('誰かにwatchされたのでデータを準備します'); 11 | 12 | // データが捨てられた時のことを決めておく 13 | ref.onDispose(() { 14 | debugPrint('誰にもwatchされなくなったのでデータを捨てます'); 15 | }); 16 | 17 | return 0; 18 | } 19 | 20 | // データを変更する関数 21 | void updateState() { 22 | final oldState = state; 23 | final newState = oldState + 1; 24 | state = newState; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/riverpod/keep_alive/state.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'state.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$countNotifierHash() => r'8958d22d3fcb0ea031d64dbaef608bd22ed5e0a2'; 10 | 11 | /// See also [CountNotifier]. 12 | @ProviderFor(CountNotifier) 13 | final countNotifierProvider = NotifierProvider.internal( 14 | CountNotifier.new, 15 | name: r'countNotifierProvider', 16 | debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') 17 | ? null 18 | : _$countNotifierHash, 19 | dependencies: null, 20 | allTransitiveDependencies: null, 21 | ); 22 | 23 | typedef _$CountNotifier = Notifier; 24 | // ignore_for_file: type=lint 25 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 26 | -------------------------------------------------------------------------------- /lib/riverpod/main.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: unused_import 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:banana/riverpod/my_widget.dart'; 5 | import 'package:banana/riverpod/my_widget_1.dart'; 6 | import 'package:banana/riverpod/my_widget_2.dart'; 7 | import 'package:banana/riverpod/my_widget_3.dart'; 8 | import 'package:banana/riverpod/my_widget_4.dart'; 9 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 10 | 11 | void main() { 12 | const app = MyApp(); 13 | const scope = ProviderScope(child: app); 14 | runApp(scope); 15 | } 16 | 17 | class MyApp extends StatelessWidget { 18 | const MyApp({super.key}); 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return const MaterialApp( 23 | home: Scaffold( 24 | body: Center( 25 | child: MyWidget(), 26 | // child: MyWidget1(), 27 | // child: MyWidget2(), 28 | // child: MyWidget3(), 29 | // child: MyWidget4(), 30 | ), 31 | ), 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/riverpod/my_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | 4 | class MyWidget extends ConsumerWidget { 5 | const MyWidget({ 6 | super.key, 7 | }); 8 | 9 | @override 10 | Widget build(BuildContext context, WidgetRef ref) { 11 | // ここで ref.watch など 12 | return const Text('ここにデータが入ります'); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/riverpod/my_widget_1.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/riverpod/s1.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | class MyWidget1 extends ConsumerWidget { 6 | const MyWidget1({ 7 | super.key, 8 | }); 9 | 10 | @override 11 | Widget build(BuildContext context, WidgetRef ref) { 12 | // S1 watch 13 | final s1 = ref.watch(s1NotifierProvider); 14 | // S1 listen 15 | ref.listen( 16 | s1NotifierProvider, 17 | (oldState, newState) { 18 | // スナックバーを表示 19 | ScaffoldMessenger.of(context).showSnackBar( 20 | const SnackBar( 21 | content: Text('S1データが変更されました'), 22 | ), 23 | ); 24 | }, 25 | ); 26 | // S1 テキスト 27 | final s1Text = Text('$s1'); 28 | // S1 ボタン 29 | final s1Button = ElevatedButton( 30 | onPressed: () { 31 | // S1 ノティファイアを呼ぶ 32 | final notifier = ref.read(s1NotifierProvider.notifier); 33 | // S1 データを変更 34 | notifier.updateState(); 35 | }, 36 | child: const Text('+1'), 37 | ); 38 | 39 | // 縦に並べる 40 | return Column( 41 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 42 | children: [ 43 | s1Text, 44 | s1Button, 45 | ], 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/riverpod/my_widget_2.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/riverpod/s2.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | class MyWidget2 extends ConsumerWidget { 6 | const MyWidget2({ 7 | super.key, 8 | }); 9 | 10 | @override 11 | Widget build(BuildContext context, WidgetRef ref) { 12 | // S2 watch 13 | final s2 = ref.watch(s2NotifierProvider); 14 | 15 | // ListView 16 | final listView = ListView.builder( 17 | itemCount: s2.length, 18 | itemBuilder: (_, index) { 19 | // index番目の文字 20 | final text = Text(s2[index]); 21 | return Card(child: text); 22 | }, 23 | ); 24 | 25 | // ボタン 26 | final button = FloatingActionButton( 27 | onPressed: () { 28 | // S2 Notifier 29 | final notifier = ref.read(s2NotifierProvider.notifier); 30 | // データを変更 31 | notifier.updateState(); 32 | }, 33 | child: const Icon(Icons.add), 34 | ); 35 | 36 | // 縦に並べる 37 | return Scaffold( 38 | floatingActionButton: button, 39 | body: listView, 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/riverpod/my_widget_3.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/riverpod/s3.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | class MyWidget3 extends ConsumerWidget { 6 | const MyWidget3({ 7 | super.key, 8 | }); 9 | 10 | @override 11 | Widget build(BuildContext context, WidgetRef ref) { 12 | // S3 watch 13 | final s3 = ref.watch(s3NotifierProvider); 14 | // S3 AsyncValue 15 | final s3Text = s3.when( 16 | loading: () => const Text('準備中...'), 17 | error: (e, s) => Text('エラー $e'), 18 | data: (d) => Text(d), 19 | ); 20 | // S3 ボタン 21 | final s3Button = ElevatedButton( 22 | onPressed: () { 23 | // S3 ノティファイアを呼ぶ 24 | final notifier = ref.read(s3NotifierProvider.notifier); 25 | // S3 データを変更 26 | notifier.updateState(); 27 | }, 28 | child: const Text('変更'), 29 | ); 30 | 31 | // 縦に並べる 32 | return Column( 33 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 34 | children: [ 35 | s3Text, 36 | s3Button, 37 | ], 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/riverpod/my_widget_4.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:banana/riverpod/s4.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | 5 | class MyWidget4 extends ConsumerWidget { 6 | const MyWidget4({ 7 | super.key, 8 | }); 9 | 10 | @override 11 | Widget build(BuildContext context, WidgetRef ref) { 12 | // S4 watch 13 | final s4 = ref.watch(s4NotifierProvider); 14 | // S3 AsyncValue 15 | final s4Text = s4.when( 16 | loading: () => const Text('準備中'), 17 | error: (e, s) => Text('エラー $e'), 18 | data: (d) => Text(d), 19 | ); 20 | // S4 ボタン 21 | final s4Button = ElevatedButton( 22 | onPressed: () { 23 | // S4 ノティファイアを呼ぶ 24 | final notifier = ref.read(s4NotifierProvider.notifier); 25 | // S4 データを変更 26 | notifier.updateState(); 27 | }, 28 | child: const Text('受信'), 29 | ); 30 | 31 | // 縦に並べる 32 | return Column( 33 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 34 | children: [ 35 | // 横に並べる 36 | s4Text, s4Button, 37 | ], 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/riverpod/override_with/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:banana/riverpod/override_with/state.dart'; 4 | import 'package:banana/riverpod/override_with/widget.dart'; 5 | 6 | void main() { 7 | const app = MyApp(); 8 | 9 | final scope = ProviderScope( 10 | overrides: [ 11 | // ここに偽物のデータを使いたいプロバイダーたち 12 | 13 | appleProvider.overrideWith((ref) { 14 | return '毒りんご'; 15 | }), 16 | ], 17 | child: app, 18 | ); 19 | runApp(scope); 20 | } 21 | 22 | class MyApp extends StatelessWidget { 23 | const MyApp({super.key}); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return const MaterialApp( 28 | home: Scaffold( 29 | body: Center( 30 | child: MyWidget(), 31 | ), 32 | ), 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/riverpod/override_with/state.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 'state.g.dart'; 3 | 4 | // 本物 5 | 6 | @riverpod 7 | String apple(AppleRef ref) { 8 | return 'りんご'; 9 | } 10 | -------------------------------------------------------------------------------- /lib/riverpod/override_with/state.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'state.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$appleHash() => r'6e4f7de9ec95863045593403521e4d0882cc2fbc'; 10 | 11 | /// See also [apple]. 12 | @ProviderFor(apple) 13 | final appleProvider = AutoDisposeProvider.internal( 14 | apple, 15 | name: r'appleProvider', 16 | debugGetCreateSourceHash: 17 | const bool.fromEnvironment('dart.vm.product') ? null : _$appleHash, 18 | dependencies: null, 19 | allTransitiveDependencies: null, 20 | ); 21 | 22 | typedef AppleRef = AutoDisposeProviderRef; 23 | // ignore_for_file: type=lint 24 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 25 | -------------------------------------------------------------------------------- /lib/riverpod/override_with/widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:banana/riverpod/override_with/state.dart'; 4 | 5 | class MyWidget extends ConsumerWidget { 6 | const MyWidget({super.key}); 7 | 8 | @override 9 | Widget build(BuildContext context, WidgetRef ref) { 10 | // りんご ? 11 | final apple = ref.watch(appleProvider); 12 | 13 | return Text(apple); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /lib/riverpod/provider_family/family.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 'family.g.dart'; 3 | 4 | @riverpod 5 | int family(FamilyRef ref, String id) { 6 | if (id == '日本') { 7 | return 3; 8 | } 9 | 10 | if (id == 'アメリカ') { 11 | return 2; 12 | } 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /lib/riverpod/provider_family/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:banana/riverpod/provider_family/widget.dart'; 4 | 5 | void main() { 6 | const app = MayApp(); 7 | const scope = ProviderScope(child: app); 8 | runApp(scope); 9 | } 10 | 11 | class MayApp extends StatelessWidget { 12 | const MayApp({super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return const MaterialApp( 17 | home: Scaffold( 18 | body: Center( 19 | child: MyWidget(), 20 | ), 21 | ), 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/riverpod/provider_family/widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:banana/riverpod/provider_family/family.dart'; 4 | 5 | class MyWidget extends ConsumerWidget { 6 | const MyWidget({super.key}); 7 | 8 | @override 9 | Widget build(BuildContext context, WidgetRef ref) { 10 | final japan = ref.watch(familyProvider('日本')); 11 | final usa = ref.watch(familyProvider('アメリカ')); 12 | 13 | // WBC優勝おめでとう! 14 | final wbcScore = Row( 15 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 16 | children: [ 17 | Text('$japan'), 18 | Text('$usa'), 19 | ], 20 | ); 21 | 22 | return wbcScore; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/riverpod/provider_scope/state.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 'state.g.dart'; 3 | 4 | @riverpod 5 | class TestNotifier extends _$TestNotifier { 6 | @override 7 | int build() { 8 | return 50; 9 | } 10 | 11 | void plus() { 12 | final oldState = state; 13 | final newState = oldState + 1; 14 | state = newState; 15 | } 16 | 17 | void minus() { 18 | final oldState = state; 19 | final newState = oldState - 1; 20 | state = newState; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/riverpod/provider_scope/state.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'state.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$testNotifierHash() => r'11ed7357e11e837ddec3df733c16754b0d81dc1e'; 10 | 11 | /// See also [TestNotifier]. 12 | @ProviderFor(TestNotifier) 13 | final testNotifierProvider = 14 | AutoDisposeNotifierProvider.internal( 15 | TestNotifier.new, 16 | name: r'testNotifierProvider', 17 | debugGetCreateSourceHash: 18 | const bool.fromEnvironment('dart.vm.product') ? null : _$testNotifierHash, 19 | dependencies: null, 20 | allTransitiveDependencies: null, 21 | ); 22 | 23 | typedef _$TestNotifier = AutoDisposeNotifier; 24 | // ignore_for_file: type=lint 25 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 26 | -------------------------------------------------------------------------------- /lib/riverpod/pubspec_yaml.txt: -------------------------------------------------------------------------------- 1 | name: my_app 2 | description: Riverpodの勉強 3 | publish_to: "none" 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: ">=2.17.0 <3.0.0" 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | flutter_riverpod: 12 | flutter_hooks: 13 | riverpod_annotation: 14 | firebase_analytics: 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | flutter_lints: ^1.0.0 20 | build_runner: 21 | riverpod_generator: 2.1.4 22 | 23 | flutter: 24 | -------------------------------------------------------------------------------- /lib/riverpod/s1.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 's1.g.dart'; 3 | 4 | @riverpod 5 | class S1Notifier extends _$S1Notifier { 6 | @override 7 | int build() { 8 | // 最初のデータ 9 | return 0; 10 | } 11 | 12 | // データを変更する関数 13 | void updateState() { 14 | // 変更前のデータ 15 | final oldState = state; 16 | // 変更後のデータ 17 | final newState = oldState + 1; 18 | // データを上書き 19 | state = newState; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/riverpod/s1.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 's1.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$s1NotifierHash() => r'50807122c169d62988d5d4499fe8db162e4931b5'; 10 | 11 | /// See also [S1Notifier]. 12 | @ProviderFor(S1Notifier) 13 | final s1NotifierProvider = 14 | AutoDisposeNotifierProvider.internal( 15 | S1Notifier.new, 16 | name: r's1NotifierProvider', 17 | debugGetCreateSourceHash: 18 | const bool.fromEnvironment('dart.vm.product') ? null : _$s1NotifierHash, 19 | dependencies: null, 20 | allTransitiveDependencies: null, 21 | ); 22 | 23 | typedef _$S1Notifier = AutoDisposeNotifier; 24 | // ignore_for_file: type=lint 25 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 26 | -------------------------------------------------------------------------------- /lib/riverpod/s2.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 's2.g.dart'; 3 | 4 | @riverpod 5 | class S2Notifier extends _$S2Notifier { 6 | @override 7 | List build() { 8 | // 最初のデータ 9 | return ['A', 'B', 'C', 'D']; 10 | } 11 | 12 | // データを変更する関数 13 | void updateState() { 14 | // 変更前のデータ 15 | final oldState = state; 16 | // 変更後のデータ 17 | final newState = [...oldState, 'X']; 18 | // データを上書き 19 | state = newState; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/riverpod/s2.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 's2.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$s2NotifierHash() => r'ff09137a1153d9eb83b7281a8df842b4a15d3c1d'; 10 | 11 | /// See also [S2Notifier]. 12 | @ProviderFor(S2Notifier) 13 | final s2NotifierProvider = 14 | AutoDisposeNotifierProvider>.internal( 15 | S2Notifier.new, 16 | name: r's2NotifierProvider', 17 | debugGetCreateSourceHash: 18 | const bool.fromEnvironment('dart.vm.product') ? null : _$s2NotifierHash, 19 | dependencies: null, 20 | allTransitiveDependencies: null, 21 | ); 22 | 23 | typedef _$S2Notifier = AutoDisposeNotifier>; 24 | // ignore_for_file: type=lint 25 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 26 | -------------------------------------------------------------------------------- /lib/riverpod/s3.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | part 's3.g.dart'; 3 | 4 | @riverpod 5 | class S3Notifier extends _$S3Notifier { 6 | @override 7 | Future build() async { 8 | // 3秒まつ 9 | const sec3 = Duration(seconds: 3); 10 | await Future.delayed(sec3); 11 | // 最初のデータ 12 | return '最初のデータ'; 13 | } 14 | 15 | // データを変更する関数 16 | void updateState() async { 17 | // データを上書き 18 | state = const AsyncValue.loading(); 19 | // 3秒まつ 20 | const sec3 = Duration(seconds: 3); 21 | await Future.delayed(sec3); 22 | // データを上書き 23 | state = const AsyncValue.data('新しいデータ'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/riverpod/s3.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 's3.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$s3NotifierHash() => r'149224841406b70e6734f9dcbb51f056c2feb46d'; 10 | 11 | /// See also [S3Notifier]. 12 | @ProviderFor(S3Notifier) 13 | final s3NotifierProvider = 14 | AutoDisposeAsyncNotifierProvider.internal( 15 | S3Notifier.new, 16 | name: r's3NotifierProvider', 17 | debugGetCreateSourceHash: 18 | const bool.fromEnvironment('dart.vm.product') ? null : _$s3NotifierHash, 19 | dependencies: null, 20 | allTransitiveDependencies: null, 21 | ); 22 | 23 | typedef _$S3Notifier = AutoDisposeAsyncNotifier; 24 | // ignore_for_file: type=lint 25 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 26 | -------------------------------------------------------------------------------- /lib/riverpod/s4.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 3 | part 's4.g.dart'; 4 | 5 | @riverpod 6 | class S4Notifier extends _$S4Notifier { 7 | @override 8 | Stream build() { 9 | // 1秒ごとに通知を受け取る stream 10 | final controller = StreamController(); 11 | const sec1 = Duration(seconds: 1); 12 | final timer = Timer.periodic(sec1, (t) { 13 | controller.add('メッセージが${t.tick}件届きました'); 14 | }); 15 | // 4秒後にストップ 16 | const sec4 = Duration(seconds: 4); 17 | Future.delayed(sec4, () { 18 | timer.cancel(); 19 | controller.sink.close(); 20 | }); 21 | return controller.stream; 22 | } 23 | 24 | // データを変更する関数 25 | void updateState() async { 26 | // 1秒まつ 27 | const sec1 = Duration(seconds: 1); 28 | await Future.delayed(sec1); 29 | // データを上書き 30 | state = const AsyncValue.data('メッセージが55件届きました'); 31 | // 1秒まつ 32 | await Future.delayed(sec1); 33 | // データを上書き 34 | state = const AsyncValue.data('メッセージが99件届きました'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/riverpod/s4.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 's4.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$s4NotifierHash() => r'a1c3249eca553d6fb1023cd6651496e539d959f2'; 10 | 11 | /// See also [S4Notifier]. 12 | @ProviderFor(S4Notifier) 13 | final s4NotifierProvider = 14 | AutoDisposeStreamNotifierProvider.internal( 15 | S4Notifier.new, 16 | name: r's4NotifierProvider', 17 | debugGetCreateSourceHash: 18 | const bool.fromEnvironment('dart.vm.product') ? null : _$s4NotifierHash, 19 | dependencies: null, 20 | allTransitiveDependencies: null, 21 | ); 22 | 23 | typedef _$S4Notifier = AutoDisposeStreamNotifier; 24 | // ignore_for_file: type=lint 25 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 26 | -------------------------------------------------------------------------------- /lib/riverpod/select/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:banana/riverpod/select/widget.dart'; 4 | 5 | void main() { 6 | const app = MayApp(); 7 | const scope = ProviderScope(child: app); 8 | runApp(scope); 9 | } 10 | 11 | class MayApp extends StatelessWidget { 12 | const MayApp({super.key}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return const MaterialApp( 17 | home: Scaffold( 18 | body: Center( 19 | child: MyWidget(), 20 | ), 21 | ), 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lib/riverpod/select/shikoku.dart: -------------------------------------------------------------------------------- 1 | // freezed 使えばもっと短く書ける 2 | 3 | // 四国 4 | class Shikoku { 5 | const Shikoku({ 6 | required this.kagawa, 7 | required this.tokushima, 8 | required this.kochi, 9 | required this.ehime, 10 | }); 11 | 12 | // 香川 13 | final int kagawa; 14 | // 徳島 15 | final int tokushima; 16 | // 高知 17 | final int kochi; 18 | // 愛媛 19 | final int ehime; 20 | 21 | /// copyWith 22 | Shikoku copyWith({ 23 | int? kagawa, 24 | int? tokushima, 25 | int? kochi, 26 | int? ehime, 27 | }) { 28 | return Shikoku( 29 | kagawa: kagawa ?? this.kagawa, 30 | tokushima: tokushima ?? this.tokushima, 31 | kochi: kochi ?? this.kochi, 32 | ehime: ehime ?? this.ehime, 33 | ); 34 | } 35 | 36 | /// == 37 | @override 38 | bool operator ==(Object other) { 39 | return other is Shikoku && 40 | other.runtimeType == runtimeType && 41 | other.kagawa == kagawa && 42 | other.tokushima == tokushima && 43 | other.kochi == kochi && 44 | other.ehime == ehime; 45 | } 46 | 47 | /// hashCode 48 | @override 49 | int get hashCode { 50 | return Object.hash( 51 | runtimeType, 52 | kagawa, 53 | tokushima, 54 | kochi, 55 | ehime, 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/riverpod/select/state.dart: -------------------------------------------------------------------------------- 1 | import 'package:riverpod_annotation/riverpod_annotation.dart'; 2 | import 'package:banana/riverpod/select/shikoku.dart'; 3 | part 'state.g.dart'; 4 | 5 | @riverpod 6 | class ShikokuNotifier extends _$ShikokuNotifier { 7 | @override 8 | Shikoku build() { 9 | // 人口 10 | return const Shikoku( 11 | kagawa: 93, 12 | tokushima: 70, 13 | kochi: 69, 14 | ehime: 130, 15 | ); 16 | } 17 | 18 | void updateKagawa() { 19 | final oldState = state; 20 | final newState = oldState.copyWith( 21 | kagawa: oldState.kagawa + 1, 22 | ); 23 | state = newState; 24 | } 25 | 26 | void updateTokushima() { 27 | final oldState = state; 28 | final newState = oldState.copyWith( 29 | tokushima: oldState.tokushima + 1, 30 | ); 31 | state = newState; 32 | } 33 | 34 | void updateKochi() { 35 | final oldState = state; 36 | final newState = oldState.copyWith( 37 | kochi: oldState.kochi + 1, 38 | ); 39 | state = newState; 40 | } 41 | 42 | void updateEhime() { 43 | final oldState = state; 44 | final newState = oldState.copyWith( 45 | ehime: oldState.ehime + 1, 46 | ); 47 | state = newState; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/riverpod/select/state.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'state.dart'; 4 | 5 | // ************************************************************************** 6 | // RiverpodGenerator 7 | // ************************************************************************** 8 | 9 | String _$shikokuNotifierHash() => r'a66b2696dadca7d0a82afa5612db6f7b9a79b6a6'; 10 | 11 | /// See also [ShikokuNotifier]. 12 | @ProviderFor(ShikokuNotifier) 13 | final shikokuNotifierProvider = 14 | AutoDisposeNotifierProvider.internal( 15 | ShikokuNotifier.new, 16 | name: r'shikokuNotifierProvider', 17 | debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') 18 | ? null 19 | : _$shikokuNotifierHash, 20 | dependencies: null, 21 | allTransitiveDependencies: null, 22 | ); 23 | 24 | typedef _$ShikokuNotifier = AutoDisposeNotifier; 25 | // ignore_for_file: type=lint 26 | // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member 27 | -------------------------------------------------------------------------------- /lib/vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | // ここは今後の動画で説明します 3 | "ios.simulator": "XXXX-IOS-SIMULATOR-ID-XXXX", 4 | "ios.device": "XXXX-IOS-DEVICE-ID-XXXX", 5 | "android.emulator": "XXXX-ANDROID-EMULATOR-ID-XXXX", 6 | "android.device": "XXXX-ANDROID-DEVICE-ID-XXXX", 7 | 8 | // フォーマット・保存 9 | "editor.formatOnSave": true, 10 | 11 | "[dart]": { 12 | "editor.rulers": [0] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "open_ios_sim", 6 | "type": "shell", 7 | // ここは今後の動画で説明します 8 | "command": "open -a Simulator --args -CurrentDeviceUDID ${config:ios.simulator}" 9 | }, 10 | { 11 | "label": "open_android_emu", 12 | "type": "shell", 13 | // ここは今後の動画で説明します 14 | "command": "xxx xxx xxx ${config:android.emulator}" 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /public/inu.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/public/inu.jpeg -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: banana 2 | description: Flutter入門 3 | publish_to: "none" 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: ^3.0.0 8 | 9 | dependencies: 10 | google_generative_ai: 11 | file_picker: 12 | arkit_plugin: 13 | flutter: 14 | sdk: flutter 15 | flutter_riverpod: 16 | flutter_hooks: 17 | riverpod_annotation: 18 | google_fonts: 19 | flutter_slidable: 20 | json_annotation: 21 | freezed_annotation: 22 | liveroom: 23 | percent_indicator: 24 | go_router: 25 | pixel_color_image: 26 | web_socket_channel: 27 | firebase_core: 28 | firebase_analytics: 29 | firebase_auth: 30 | google_sign_in: 31 | device_preview_minus: # device_preview が開発停止したため代わりに使う 32 | envied: 33 | shared_preferences: 34 | cloud_firestore: 35 | intl: 36 | youtube_player_iframe: 37 | url_launcher: 38 | flutter_web_plugins: 39 | sdk: flutter 40 | 41 | dev_dependencies: 42 | freezed: 43 | build_runner: 44 | json_serializable: 45 | flutter_test: 46 | sdk: flutter 47 | flutter_lints: 48 | riverpod_generator: 49 | envied_generator: 50 | 51 | flutter: 52 | uses-material-design: true 53 | assets: 54 | - assets/images/ 55 | - assets/google_fonts/ 56 | - assets/fonts/ 57 | - assets/stub/ 58 | fonts: 59 | - family: NotoSansJP 60 | fonts: 61 | - asset: assets/fonts/NotoSansJP-Medium.ttf 62 | -------------------------------------------------------------------------------- /scripts/build_runner.sh: -------------------------------------------------------------------------------- 1 | flutter pub run build_runner build --delete-conflicting-outputs -------------------------------------------------------------------------------- /scripts/deploy.sh: -------------------------------------------------------------------------------- 1 | firebase deploy --only hosting:hello --project=hello-rubydog -------------------------------------------------------------------------------- /scripts/env/.env: -------------------------------------------------------------------------------- 1 | PASSWORD_1=メイタンテイコナン 2 | PASSWORD_2=ワンピース 3 | -------------------------------------------------------------------------------- /scripts/flavors/dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "flavor": "dev", 3 | "memo": "このフレーバーは通信しません。安心して開発してください。" 4 | } -------------------------------------------------------------------------------- /scripts/flavors/prd.json: -------------------------------------------------------------------------------- 1 | { 2 | "flavor": "prd", 3 | "memo": "これは本番用のフレーバーです" 4 | } -------------------------------------------------------------------------------- /scripts/flavors/stg.json: -------------------------------------------------------------------------------- 1 | { 2 | "flavor": "stg", 3 | "memo": "このフレーバーはテストのために通信します。注意してください。" 4 | } -------------------------------------------------------------------------------- /scripts/run_dev.sh: -------------------------------------------------------------------------------- 1 | flutter run --debug -d chrome --dart-define-from-file=scripts/flavors/dev.json -------------------------------------------------------------------------------- /static/flutter-dog-header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/static/flutter-dog-header.png -------------------------------------------------------------------------------- /static/flutter-note-header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/static/flutter-note-header.png -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | void main() {} 2 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rbdog/flutter_note/7c609b2b78cf5b431095fbe8ec945fc2001e3d8f/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Flutter動画一覧", 3 | "short_name": "Flutter動画一覧", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "ルビーDogのFlutter動画をまとめたサイトです", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } --------------------------------------------------------------------------------