├── .gitattributes ├── .gitignore ├── CODE_SNIPPETS.md ├── LICENSE ├── README.md ├── assets └── screenshots.png ├── space_flight_news_with_code_gen ├── .gitignore ├── .metadata ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── space_flight_news │ │ │ │ │ └── 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 │ └── images │ │ ├── linked.png │ │ └── rocket.png ├── build.yaml ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── Podfile │ ├── Podfile.lock │ ├── 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 │ ├── app.dart │ ├── di │ │ ├── di_api_module.dart │ │ ├── di_app_module.dart │ │ ├── di_container.dart │ │ ├── di_initializer.config.dart │ │ └── di_initializer.dart │ ├── domain │ │ ├── api │ │ │ ├── api.dart │ │ │ ├── api.g.dart │ │ │ └── data │ │ │ │ ├── article_details.dart │ │ │ │ ├── articles_list.dart │ │ │ │ ├── articles_list_per_launch.dart │ │ │ │ ├── data_interceptor.dart │ │ │ │ └── failure_interceptor.dart │ │ ├── converter │ │ │ └── int_to_string_converter.dart │ │ └── model │ │ │ ├── article.dart │ │ │ ├── article.freezed.dart │ │ │ ├── article.g.dart │ │ │ ├── space_launch.dart │ │ │ ├── space_launch.freezed.dart │ │ │ └── space_launch.g.dart │ ├── localization │ │ ├── build_context_extension.dart │ │ ├── localizations.dart │ │ └── translations │ │ │ ├── translations.i69n.dart │ │ │ ├── translations.i69n.yaml │ │ │ ├── translations_uk.i69n.dart │ │ │ └── translations_uk.i69n.yaml │ ├── main.dart │ ├── navigation │ │ ├── navigator.dart │ │ └── router │ │ │ ├── router.dart │ │ │ └── router.gr.dart │ ├── presentation │ │ ├── article_details │ │ │ ├── article_details_page.dart │ │ │ └── bloc │ │ │ │ ├── article_details_bloc.dart │ │ │ │ ├── article_details_event.dart │ │ │ │ └── article_details_state.dart │ │ ├── articles_list │ │ │ ├── articles_list_page.dart │ │ │ └── bloc │ │ │ │ ├── articles_list_bloc.dart │ │ │ │ ├── articles_list_event.dart │ │ │ │ └── articles_list_state.dart │ │ ├── assets │ │ │ └── assets.gen.dart │ │ └── widgets │ │ │ ├── page_content_error.dart │ │ │ └── page_content_loading.dart │ ├── space_flight_news.dart │ └── util │ │ ├── dio_setup.dart │ │ └── launcher.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── app_icon_1024.png │ │ │ │ ├── app_icon_128.png │ │ │ │ ├── app_icon_16.png │ │ │ │ ├── app_icon_256.png │ │ │ │ ├── app_icon_32.png │ │ │ │ ├── app_icon_512.png │ │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ │ └── MainMenu.xib │ │ ├── Configs │ │ │ ├── AppInfo.xcconfig │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements │ └── RunnerTests │ │ └── RunnerTests.swift ├── pubspec.lock ├── pubspec.yaml ├── test │ ├── articles_list.feature │ ├── articles_list_test.dart │ └── step │ │ ├── api_is_mocked_to_fail.dart │ │ ├── api_is_mocked_to_succeed.dart │ │ ├── di_is_initialized.dart │ │ └── i_run_the_app.dart ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h └── space_flight_news_without_code_gen ├── .gitignore ├── .metadata ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── space_flight_news │ │ │ │ └── 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 └── images │ ├── linked.png │ └── rocket.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── 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 ├── app.dart ├── di │ ├── di_api_module.dart │ ├── di_app_module.dart │ ├── di_container.dart │ └── di_initializer.dart ├── domain │ ├── api │ │ ├── api.dart │ │ └── data │ │ │ ├── article_details.dart │ │ │ ├── articles_list.dart │ │ │ ├── articles_list_per_launch.dart │ │ │ ├── data_interceptor.dart │ │ │ └── failure_interceptor.dart │ ├── converter │ │ └── int_to_string_converter.dart │ └── model │ │ ├── article.dart │ │ └── space_launch.dart ├── localization │ ├── build_context_extension.dart │ ├── localizations.dart │ └── translations │ │ ├── translations.dart │ │ └── translations_uk.dart ├── main.dart ├── navigation │ ├── navigator.dart │ └── router │ │ └── router.dart ├── presentation │ ├── article_details │ │ ├── article_details_page.dart │ │ └── bloc │ │ │ ├── article_details_bloc.dart │ │ │ ├── article_details_event.dart │ │ │ └── article_details_state.dart │ ├── articles_list │ │ ├── articles_list_page.dart │ │ └── bloc │ │ │ ├── articles_list_bloc.dart │ │ │ ├── articles_list_event.dart │ │ │ └── articles_list_state.dart │ ├── assets │ │ └── assets.dart │ └── widgets │ │ ├── page_content_error.dart │ │ └── page_content_loading.dart └── util │ ├── dio_setup.dart │ └── launcher.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements └── RunnerTests │ └── RunnerTests.swift ├── pubspec.lock ├── pubspec.yaml ├── test ├── act │ ├── i_run_the_app.dart │ ├── i_tap_text.dart │ └── i_wait.dart ├── arrange │ ├── api_is_mocked_to_fail.dart │ ├── api_is_mocked_to_succeed.dart │ └── di_is_initialized.dart ├── articles_list_test.dart └── assert │ ├── i_see_multiple_texts.dart │ ├── i_see_text.dart │ └── i_see_widget.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.gitattributes: -------------------------------------------------------------------------------- 1 | **/*.g.dart linguist-generated 2 | **/*.freezed.dart linguist-generated 3 | **/*.config.dart linguist-generated 4 | **/*.gr.dart linguist-generated 5 | **/*.gen.dart linguist-generated 6 | **/*.i69n.dart linguist-generated 7 | **/feature/*_test.dart linguist-generated 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /CODE_SNIPPETS.md: -------------------------------------------------------------------------------- 1 | Configure your IDE to help you declare [freezed](https://pub.dev/packages/freezed) serializable models in the fastest way possible. 2 | 3 | ## VSCode 4 | 5 | For configuring VSCode with Code Snippets, check out [this video tutorial](https://youtu.be/71Bv134b_M4). 6 | 7 | #### Code Snippet 8 | 9 | ```json 10 | { 11 | "Serializable freezed model": { 12 | "prefix": "fmodel", 13 | "description": "Declare a serializable freezed model", 14 | "body": [ 15 | "import 'package:freezed_annotation/freezed_annotation.dart';", 16 | "", 17 | "part '${TM_FILENAME_BASE}.freezed.dart';", 18 | "part '${TM_FILENAME_BASE}.g.dart';", 19 | "", 20 | "@freezed", 21 | "class ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g} with _$${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g} {", 22 | " const factory ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}({", 23 | " ${0}", 24 | " }) = _${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g};", 25 | "", 26 | " factory ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}.fromJson(Map json) => ", 27 | " _$${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}FromJson(json);", 28 | "}" 29 | ] 30 | } 31 | } 32 | ``` 33 | 34 | ## Android Studio / IntelliJ IDEA 35 | 36 | For configuring Android Studio or IntelliJ IDEA with Live Template, check out [this video tutorial](https://youtu.be/_upGewxWNZ4). 37 | 38 | #### Live Template 39 | 40 | **Text:** 41 | 42 | ```dart 43 | import 'package:freezed_annotation/freezed_annotation.dart'; 44 | 45 | part '$FILE_NAME$.freezed.dart'; 46 | part '$FILE_NAME$.g.dart'; 47 | 48 | @freezed 49 | class $CLASS_NAME$ with _$$$CLASS_NAME$ { 50 | const factory $CLASS_NAME$ ({ 51 | $END$ 52 | }) = _$CLASS_NAME$; 53 | 54 | factory $CLASS_NAME$.fromJson(Map json) => 55 | _$$$CLASS_NAME$FromJson(json); 56 | } 57 | ``` 58 | 59 | **Variables:** 60 | 61 | | Name | Value | 62 | |------|-------| 63 | | `FILE_NAME` | `fileNameWithoutExtension()` | 64 | | `CLASS_NAME` | `capitalize(camelCase(fileNameWithoutExtension()))` | 65 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Anna Leushchenko 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 | # Code generation for productive Dart and Flutter development 2 | 3 | Source code of the mobile application that displays a list of recent spaceflight-related news obtained from [Spaceflight News API](https://thespacedevs.com/snapi). 4 | 5 | ![](assets/screenshots.png) 6 | 7 | This application is implemented twice: [without code generation](space_flight_news_without_code_gen/) and [with code generation](space_flight_news_with_code_gen/). The goal of this project is to demonstrate the usage of various code-generating packages and some maintenance best practices. 8 | -------------------------------------------------------------------------------- /assets/screenshots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/assets/screenshots.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/.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: "41456452f29d64e8deb623a3c927524bcf9f111b" 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: 41456452f29d64e8deb623a3c927524bcf9f111b 17 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 18 | - platform: android 19 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 20 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 21 | - platform: ios 22 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 23 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 24 | - platform: linux 25 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 26 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 27 | - platform: macos 28 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 29 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 30 | - platform: web 31 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 32 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 33 | - platform: windows 34 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 35 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | analyzer: 4 | errors: 5 | invalid_annotation_target: ignore 6 | exclude: 7 | - '**/*.config.dart' 8 | - '**/*.freezed.dart' 9 | - '**/*.g.dart' 10 | - '**/*.gen.dart' 11 | - '**/*.gr.dart' 12 | - '**/*.i69n.dart' 13 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/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/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace "com.example.space_flight_news" 27 | compileSdkVersion flutter.compileSdkVersion 28 | ndkVersion flutter.ndkVersion 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "com.example.space_flight_news" 46 | // You can update the following values to match your application needs. 47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 48 | minSdkVersion flutter.minSdkVersion 49 | targetSdkVersion flutter.targetSdkVersion 50 | versionCode flutterVersionCode.toInteger() 51 | versionName flutterVersionName 52 | } 53 | 54 | buildTypes { 55 | release { 56 | // TODO: Add your own signing config for the release build. 57 | // Signing with the debug keys for now, so `flutter run --release` works. 58 | signingConfig signingConfigs.debug 59 | } 60 | } 61 | } 62 | 63 | flutter { 64 | source '../..' 65 | } 66 | 67 | dependencies {} 68 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/kotlin/com/example/space_flight_news/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.space_flight_news 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | google() 16 | mavenCentral() 17 | } 18 | } 19 | 20 | rootProject.buildDir = '../build' 21 | subprojects { 22 | project.buildDir = "${rootProject.buildDir}/${project.name}" 23 | } 24 | subprojects { 25 | project.evaluationDependsOn(':app') 26 | } 27 | 28 | tasks.register("clean", Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/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.5-all.zip 6 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/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 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | repositories { 14 | google() 15 | mavenCentral() 16 | gradlePluginPortal() 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false 21 | } 22 | } 23 | 24 | plugins { 25 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 26 | id "com.android.application" version "7.3.0" apply false 27 | } 28 | 29 | include ":app" 30 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/assets/images/linked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/assets/images/linked.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/assets/images/rocket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/assets/images/rocket.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/build.yaml: -------------------------------------------------------------------------------- 1 | targets: 2 | $default: 3 | builders: 4 | json_serializable: 5 | options: 6 | include_if_null: false 7 | explicit_to_json: true 8 | generate_for: 9 | - lib/domain**/*.dart 10 | bdd_widget_test|featureBuilder: 11 | options: 12 | include: package:bdd_widget_test/bdd_options.yaml 13 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/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 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/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 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/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 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - url_launcher_ios (0.0.1): 4 | - Flutter 5 | 6 | DEPENDENCIES: 7 | - Flutter (from `Flutter`) 8 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | Flutter: 12 | :path: Flutter 13 | url_launcher_ios: 14 | :path: ".symlinks/plugins/url_launcher_ios/ios" 15 | 16 | SPEC CHECKSUMS: 17 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 18 | url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 19 | 20 | PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 21 | 22 | COCOAPODS: 1.14.3 23 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 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 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/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 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/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. -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | SFNews 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | space_flight_news 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/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 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_localizations/flutter_localizations.dart'; 3 | import 'package:space_flight_news/di/di_container.dart'; 4 | import 'package:space_flight_news/localization/localizations.dart'; 5 | import 'package:space_flight_news/navigation/router/router.dart'; 6 | import 'package:barrel_files_annotation/barrel_files_annotation.dart'; 7 | 8 | @includeInBarrelFile 9 | class SpaceFlightNewsApp extends StatelessWidget { 10 | const SpaceFlightNewsApp({super.key}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return MaterialApp.router( 15 | routerConfig: diContainer().config(), 16 | theme: ThemeData( 17 | colorScheme: ColorScheme.fromSeed( 18 | brightness: Brightness.dark, 19 | seedColor: Colors.black, 20 | primary: Colors.amberAccent, 21 | surface: const Color(0xFF102A43), 22 | ), 23 | scaffoldBackgroundColor: const Color(0xFF243B53), 24 | ), 25 | supportedLocales: SpaceFlightNewsLocalizations.supportedLocales, 26 | localizationsDelegates: const [ 27 | GlobalMaterialLocalizations.delegate, 28 | GlobalCupertinoLocalizations.delegate, 29 | GlobalWidgetsLocalizations.delegate, 30 | SpaceFlightNewsLocalizations.delegate, 31 | ], 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/di/di_api_module.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | import 'package:space_flight_news/util/dio_setup.dart'; 4 | 5 | @module 6 | abstract class DIApiModule { 7 | @lazySingleton 8 | Dio createDio() => Dio()..setUpForDemo(); 9 | 10 | @prod 11 | @dev 12 | @Named('SpaceFlightNewsBaseUrl') 13 | String get baseUrl => 'https://api.spaceflightnewsapi.net/v3'; 14 | 15 | @test 16 | @Named('SpaceFlightNewsBaseUrl') 17 | String get testBaseUrl => 'https://mock'; 18 | } 19 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/di/di_app_module.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | 4 | @module 5 | abstract class DIAppModule { 6 | @lazySingleton 7 | GlobalKey get key => GlobalKey(); 8 | } 9 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/di/di_container.dart: -------------------------------------------------------------------------------- 1 | import 'package:get_it/get_it.dart'; 2 | 3 | final diContainer = GetIt.instance; 4 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/di/di_initializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:get_it/get_it.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | import 'package:space_flight_news/di/di_initializer.config.dart'; 4 | 5 | @injectableInit 6 | GetIt initDI(GetIt getIt, String environment) => 7 | getIt.init(environment: environment); 8 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/domain/api/api.dart: -------------------------------------------------------------------------------- 1 | import 'package:barrel_files_annotation/barrel_files_annotation.dart'; 2 | import 'package:dio/dio.dart'; 3 | import 'package:injectable/injectable.dart'; 4 | import 'package:retrofit/retrofit.dart'; 5 | import 'package:space_flight_news/domain/model/article.dart'; 6 | 7 | part 'api.g.dart'; 8 | 9 | @includeInBarrelFile 10 | @injectable 11 | @RestApi() 12 | abstract class SpaceFlightNewsApi { 13 | @factoryMethod 14 | factory SpaceFlightNewsApi( 15 | Dio dio, { 16 | @Named('SpaceFlightNewsBaseUrl') String baseUrl, 17 | }) = _SpaceFlightNewsApi; 18 | 19 | @GET('/articles') 20 | Future> getArticles(); 21 | 22 | @GET('/articles/{id}') 23 | Future
getArticle(@Path('id') String articledId); 24 | 25 | @GET('/articles/launch/{id}') 26 | Future> getArticlesByLaunch({ 27 | @Path('id') required String launchId, 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/domain/api/data/data_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:space_flight_news/domain/api/data/article_details.dart'; 5 | import 'package:space_flight_news/domain/api/data/articles_list.dart'; 6 | import 'package:space_flight_news/domain/api/data/articles_list_per_launch.dart'; 7 | 8 | class SpaceFlightNewsDataInterceptor extends Interceptor { 9 | @override 10 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) { 11 | final uri = Uri.parse(options.path); 12 | if (uri.pathSegments.isNotEmpty && uri.pathSegments.first == 'articles') { 13 | switch (uri.pathSegments.length) { 14 | case 1: 15 | return handler.resolve( 16 | Response( 17 | requestOptions: options, 18 | data: jsonDecode(articlesListJsonString), 19 | ), 20 | ); 21 | case 2: 22 | final articleId = uri.pathSegments.last; 23 | return handler.resolve( 24 | Response( 25 | requestOptions: options, 26 | data: jsonDecode(articleDetailsJsonStrings[articleId]!), 27 | ), 28 | ); 29 | case 3: 30 | final launchId = 31 | uri.pathSegments[1] == 'launch' ? uri.pathSegments[2] : null; 32 | if (launchId != null) { 33 | return handler.resolve( 34 | Response( 35 | requestOptions: options, 36 | data: jsonDecode(articlesListPerLaunchJsonStrings[launchId]!), 37 | ), 38 | ); 39 | } 40 | } 41 | } 42 | 43 | super.onRequest(options, handler); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/domain/api/data/failure_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | class SpaceFlightNewsFailureInterceptor extends Interceptor { 4 | @override 5 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) { 6 | handler.reject(DioException(requestOptions: options)); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/domain/converter/int_to_string_converter.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | class IntToStringConverter implements JsonConverter { 4 | const IntToStringConverter(); 5 | 6 | @override 7 | String fromJson(int json) => '$json'; 8 | 9 | @override 10 | int toJson(String object) => int.parse(object); 11 | } 12 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/domain/model/article.dart: -------------------------------------------------------------------------------- 1 | import 'package:space_flight_news/domain/converter/int_to_string_converter.dart'; 2 | import 'package:space_flight_news/domain/model/space_launch.dart'; 3 | import 'package:freezed_annotation/freezed_annotation.dart'; 4 | 5 | part 'article.freezed.dart'; 6 | part 'article.g.dart'; 7 | 8 | @freezed 9 | class Article with _$Article { 10 | const factory Article({ 11 | @IntToStringConverter() required String id, 12 | required String title, 13 | String? url, 14 | @JsonKey(name: 'imageUrl') Uri? image, 15 | String? newsSite, 16 | String? summary, 17 | DateTime? publishedAt, 18 | @Default([]) List launches, 19 | }) = _Article; 20 | 21 | factory Article.fromJson(Map json) => 22 | _$ArticleFromJson(json); 23 | } 24 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/domain/model/article.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'article.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$ArticleImpl _$$ArticleImplFromJson(Map json) => 10 | _$ArticleImpl( 11 | id: const IntToStringConverter().fromJson(json['id'] as int), 12 | title: json['title'] as String, 13 | url: json['url'] as String?, 14 | image: json['imageUrl'] == null 15 | ? null 16 | : Uri.parse(json['imageUrl'] as String), 17 | newsSite: json['newsSite'] as String?, 18 | summary: json['summary'] as String?, 19 | publishedAt: json['publishedAt'] == null 20 | ? null 21 | : DateTime.parse(json['publishedAt'] as String), 22 | launches: (json['launches'] as List?) 23 | ?.map((e) => SpaceLaunch.fromJson(e as Map)) 24 | .toList() ?? 25 | const [], 26 | ); 27 | 28 | Map _$$ArticleImplToJson(_$ArticleImpl instance) { 29 | final val = { 30 | 'id': const IntToStringConverter().toJson(instance.id), 31 | 'title': instance.title, 32 | }; 33 | 34 | void writeNotNull(String key, dynamic value) { 35 | if (value != null) { 36 | val[key] = value; 37 | } 38 | } 39 | 40 | writeNotNull('url', instance.url); 41 | writeNotNull('imageUrl', instance.image?.toString()); 42 | writeNotNull('newsSite', instance.newsSite); 43 | writeNotNull('summary', instance.summary); 44 | writeNotNull('publishedAt', instance.publishedAt?.toIso8601String()); 45 | val['launches'] = instance.launches.map((e) => e.toJson()).toList(); 46 | return val; 47 | } 48 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/domain/model/space_launch.dart: -------------------------------------------------------------------------------- 1 | import 'package:freezed_annotation/freezed_annotation.dart'; 2 | 3 | part 'space_launch.freezed.dart'; 4 | part 'space_launch.g.dart'; 5 | 6 | @freezed 7 | class SpaceLaunch with _$SpaceLaunch { 8 | const factory SpaceLaunch({ 9 | required String id, 10 | }) = _SpaceLaunch; 11 | 12 | factory SpaceLaunch.fromJson(Map json) => 13 | _$SpaceLaunchFromJson(json); 14 | } 15 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/domain/model/space_launch.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'space_launch.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$SpaceLaunchImpl _$$SpaceLaunchImplFromJson(Map json) => 10 | _$SpaceLaunchImpl( 11 | id: json['id'] as String, 12 | ); 13 | 14 | Map _$$SpaceLaunchImplToJson(_$SpaceLaunchImpl instance) => 15 | { 16 | 'id': instance.id, 17 | }; 18 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/localization/build_context_extension.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:space_flight_news/localization/localizations.dart'; 3 | import 'package:space_flight_news/localization/translations/translations.i69n.dart'; 4 | 5 | extension BuildContextX on BuildContext { 6 | String get languageCode => Localizations.localeOf(this).toLanguageTag(); 7 | 8 | Translations get translations => SpaceFlightNewsLocalizations.of(this); 9 | } 10 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/localization/localizations.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:space_flight_news/localization/translations/translations.i69n.dart'; 3 | import 'package:space_flight_news/localization/translations/translations_uk.i69n.dart'; 4 | 5 | final _translations = { 6 | 'en': () => const Translations(), 7 | 'uk': () => const Translations_uk(), 8 | }; 9 | 10 | class SpaceFlightNewsLocalizations { 11 | const SpaceFlightNewsLocalizations(this.translations); 12 | 13 | final Translations translations; 14 | 15 | static const LocalizationsDelegate delegate = 16 | _SpaceFlightNewsLocalizationsDelegate(); 17 | 18 | static final List supportedLocales = 19 | _translations.keys.map((x) => Locale(x)).toList(); 20 | 21 | static Translations of(BuildContext context) => 22 | Localizations.of( 23 | context, SpaceFlightNewsLocalizations)! 24 | .translations; 25 | } 26 | 27 | class _SpaceFlightNewsLocalizationsDelegate 28 | extends LocalizationsDelegate { 29 | const _SpaceFlightNewsLocalizationsDelegate(); 30 | 31 | @override 32 | bool isSupported(Locale locale) => 33 | _translations.keys.contains(locale.languageCode); 34 | 35 | @override 36 | Future load(Locale locale) => Future.value( 37 | SpaceFlightNewsLocalizations(_translations[locale.languageCode]!())); 38 | 39 | @override 40 | bool shouldReload(LocalizationsDelegate old) => 41 | false; 42 | } 43 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/localization/translations/translations.i69n.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: unused_element, unused_field, camel_case_types, annotate_overrides, prefer_single_quotes 2 | // GENERATED FILE, do not edit! 3 | import 'package:i69n/i69n.dart' as i69n; 4 | 5 | String get _languageCode => 'en'; 6 | String get _localeName => 'en'; 7 | 8 | String _plural(int count, 9 | {String? zero, 10 | String? one, 11 | String? two, 12 | String? few, 13 | String? many, 14 | String? other}) => 15 | i69n.plural(count, _languageCode, 16 | zero: zero, one: one, two: two, few: few, many: many, other: other); 17 | String _ordinal(int count, 18 | {String? zero, 19 | String? one, 20 | String? two, 21 | String? few, 22 | String? many, 23 | String? other}) => 24 | i69n.ordinal(count, _languageCode, 25 | zero: zero, one: one, two: two, few: few, many: many, other: other); 26 | String _cardinal(int count, 27 | {String? zero, 28 | String? one, 29 | String? two, 30 | String? few, 31 | String? many, 32 | String? other}) => 33 | i69n.cardinal(count, _languageCode, 34 | zero: zero, one: one, two: two, few: few, many: many, other: other); 35 | 36 | class Translations implements i69n.I69nMessageBundle { 37 | const Translations(); 38 | String get error => "Something went wrong"; 39 | String on(String date) => "on $date"; 40 | String publishedBy(String who) => "Published by $who"; 41 | String get relatedArticles => "View related articles"; 42 | String get retry => "Retry"; 43 | String get title => "Space Flight News"; 44 | Object operator [](String key) { 45 | var index = key.indexOf('.'); 46 | if (index > 0) { 47 | return (this[key.substring(0, index)] 48 | as i69n.I69nMessageBundle)[key.substring(index + 1)]; 49 | } 50 | switch (key) { 51 | case 'error': 52 | return error; 53 | case 'on': 54 | return on; 55 | case 'publishedBy': 56 | return publishedBy; 57 | case 'relatedArticles': 58 | return relatedArticles; 59 | case 'retry': 60 | return retry; 61 | case 'title': 62 | return title; 63 | default: 64 | return key; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/localization/translations/translations.i69n.yaml: -------------------------------------------------------------------------------- 1 | error: 'Something went wrong' 2 | on(String date): 'on $date' 3 | publishedBy(String who): 'Published by $who' 4 | relatedArticles: 'View related articles' 5 | retry: 'Retry' 6 | title: 'Space Flight News' 7 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/localization/translations/translations_uk.i69n.yaml: -------------------------------------------------------------------------------- 1 | error: 'Щось пішло не за планом' 2 | on(String date): '$date' 3 | publishedBy(String who): 'Оприлюднено $who' 4 | relatedArticles: 'Переглянути повʼязані новини' 5 | retry: 'Спробувати ще' 6 | title: 'Новини космічних польотів' 7 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | import 'package:space_flight_news/app.dart'; 4 | import 'package:space_flight_news/di/di_container.dart'; 5 | import 'package:space_flight_news/di/di_initializer.dart'; 6 | 7 | void main() { 8 | initDI(diContainer, Environment.prod); 9 | runApp(const SpaceFlightNewsApp()); 10 | } 11 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/navigation/navigator.dart: -------------------------------------------------------------------------------- 1 | import 'package:injectable/injectable.dart'; 2 | import 'package:space_flight_news/navigation/router/router.dart'; 3 | 4 | @injectable 5 | class SpaceFlightNewsNavigator { 6 | const SpaceFlightNewsNavigator(this._router); 7 | 8 | final SpaceFlightNewsRouter _router; 9 | 10 | Future goToArticlesList(String launchId) => 11 | _router.pushNamed('/articles?launchId=$launchId'); 12 | 13 | Future goToArticleDetails(String articleId) => 14 | _router.pushNamed('/article/$articleId'); 15 | } 16 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/navigation/router/router.dart: -------------------------------------------------------------------------------- 1 | import 'package:auto_route/auto_route.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:injectable/injectable.dart'; 4 | import 'package:space_flight_news/presentation/article_details/article_details_page.dart'; 5 | import 'package:space_flight_news/presentation/articles_list/articles_list_page.dart'; 6 | 7 | part 'router.gr.dart'; 8 | 9 | @lazySingleton 10 | @AutoRouterConfig() 11 | class SpaceFlightNewsRouter extends _$SpaceFlightNewsRouter { 12 | SpaceFlightNewsRouter(GlobalKey navigatorKey) 13 | : super(navigatorKey: navigatorKey); 14 | 15 | @override 16 | List get routes => [ 17 | AutoRoute( 18 | page: ArticlesListRoute.page, 19 | path: '/articles', 20 | initial: true, 21 | ), 22 | AutoRoute( 23 | page: ArticleDetailsRoute.page, 24 | path: '/article/:articleId', 25 | ), 26 | ]; 27 | } 28 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/presentation/article_details/bloc/article_details_event.dart: -------------------------------------------------------------------------------- 1 | part of 'article_details_bloc.dart'; 2 | 3 | sealed class ArticleDetailsEvent {} 4 | 5 | class LoadArticleDetailsEvent implements ArticleDetailsEvent { 6 | const LoadArticleDetailsEvent(); 7 | } 8 | 9 | class RetryArticleDetailsEvent implements ArticleDetailsEvent { 10 | const RetryArticleDetailsEvent(); 11 | } 12 | 13 | class OpenArticlesArticleDetailsEvent implements ArticleDetailsEvent { 14 | const OpenArticlesArticleDetailsEvent(this.launchId); 15 | 16 | final String launchId; 17 | } 18 | 19 | class ReadArticleArticleDetailsEvent implements ArticleDetailsEvent { 20 | const ReadArticleArticleDetailsEvent(); 21 | } 22 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/presentation/article_details/bloc/article_details_state.dart: -------------------------------------------------------------------------------- 1 | part of 'article_details_bloc.dart'; 2 | 3 | sealed class ArticleDetailsState {} 4 | 5 | class InitialArticleDetailsState implements ArticleDetailsState { 6 | const InitialArticleDetailsState(); 7 | } 8 | 9 | class ContentArticleDetailsState implements ArticleDetailsState { 10 | const ContentArticleDetailsState({required this.article}); 11 | 12 | final Article article; 13 | } 14 | 15 | class LoadingArticleDetailsState implements ArticleDetailsState { 16 | const LoadingArticleDetailsState(); 17 | } 18 | 19 | class ErrorArticleDetailsState implements ArticleDetailsState { 20 | const ErrorArticleDetailsState(); 21 | } 22 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/presentation/articles_list/bloc/articles_list_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_bloc/flutter_bloc.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | import 'package:space_flight_news/domain/api/api.dart'; 4 | import 'package:space_flight_news/domain/model/article.dart'; 5 | import 'package:space_flight_news/navigation/navigator.dart'; 6 | 7 | part 'articles_list_event.dart'; 8 | part 'articles_list_state.dart'; 9 | 10 | @injectable 11 | class ArticlesListBloc extends Bloc { 12 | ArticlesListBloc( 13 | this._api, 14 | this._navigator, 15 | @factoryParam this._launchId, 16 | ) : super(const InitialArticlesListState()) { 17 | on( 18 | (event, emit) => switch (event) { 19 | LoadArticlesListEvent() => _onLoad(event, emit), 20 | RetryArticlesListEvent() => _onRetry(event, emit), 21 | OpenDetailsArticlesListEvent() => _onOpenDetails(event, emit), 22 | }, 23 | ); 24 | 25 | add(const LoadArticlesListEvent()); 26 | } 27 | 28 | final SpaceFlightNewsApi _api; 29 | final SpaceFlightNewsNavigator _navigator; 30 | 31 | final String? _launchId; 32 | 33 | Future _onLoad( 34 | LoadArticlesListEvent event, 35 | Emitter emit, 36 | ) async { 37 | if (state is LoadingArticlesListState) { 38 | return; 39 | } 40 | 41 | emit(const LoadingArticlesListState()); 42 | 43 | try { 44 | final articles = _launchId != null 45 | ? await _api.getArticlesByLaunch(launchId: _launchId) 46 | : await _api.getArticles(); 47 | emit(ContentArticlesListState(articles: articles)); 48 | } on Exception { 49 | emit(const ErrorArticlesListState()); 50 | } 51 | } 52 | 53 | Future _onRetry( 54 | RetryArticlesListEvent event, 55 | Emitter emit, 56 | ) async { 57 | add(const LoadArticlesListEvent()); 58 | } 59 | 60 | Future _onOpenDetails( 61 | OpenDetailsArticlesListEvent event, 62 | Emitter emit, 63 | ) async { 64 | await _navigator.goToArticleDetails(event.articleId); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/presentation/articles_list/bloc/articles_list_event.dart: -------------------------------------------------------------------------------- 1 | part of 'articles_list_bloc.dart'; 2 | 3 | sealed class ArticlesListEvent {} 4 | 5 | class LoadArticlesListEvent implements ArticlesListEvent { 6 | const LoadArticlesListEvent(); 7 | } 8 | 9 | class RetryArticlesListEvent implements ArticlesListEvent { 10 | const RetryArticlesListEvent(); 11 | } 12 | 13 | class OpenDetailsArticlesListEvent implements ArticlesListEvent { 14 | const OpenDetailsArticlesListEvent(this.articleId); 15 | 16 | final String articleId; 17 | } 18 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/presentation/articles_list/bloc/articles_list_state.dart: -------------------------------------------------------------------------------- 1 | part of 'articles_list_bloc.dart'; 2 | 3 | sealed class ArticlesListState {} 4 | 5 | class InitialArticlesListState implements ArticlesListState { 6 | const InitialArticlesListState(); 7 | } 8 | 9 | class ContentArticlesListState implements ArticlesListState { 10 | const ContentArticlesListState({ 11 | this.articles = const
[], 12 | }); 13 | 14 | final List
articles; 15 | } 16 | 17 | class LoadingArticlesListState implements ArticlesListState { 18 | const LoadingArticlesListState(); 19 | } 20 | 21 | class ErrorArticlesListState implements ArticlesListState { 22 | const ErrorArticlesListState(); 23 | } 24 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/presentation/widgets/page_content_error.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:space_flight_news/localization/build_context_extension.dart'; 3 | 4 | class PageContentError extends StatelessWidget { 5 | const PageContentError({ 6 | super.key, 7 | this.onRetry, 8 | }); 9 | 10 | final VoidCallback? onRetry; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Container( 15 | padding: const EdgeInsets.all(16.0), 16 | alignment: Alignment.center, 17 | child: Column( 18 | crossAxisAlignment: CrossAxisAlignment.center, 19 | mainAxisSize: MainAxisSize.min, 20 | children: [ 21 | Text( 22 | context.translations.error, 23 | textAlign: TextAlign.center, 24 | ), 25 | if (onRetry != null) 26 | Padding( 27 | padding: const EdgeInsets.only(top: 16.0), 28 | child: ElevatedButton( 29 | onPressed: onRetry, 30 | child: Text(context.translations.retry), 31 | ), 32 | ), 33 | ], 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/presentation/widgets/page_content_loading.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class PageContentLoading extends StatelessWidget { 4 | const PageContentLoading({super.key}); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return const Padding( 9 | padding: EdgeInsets.all(16.0), 10 | child: Center( 11 | child: CircularProgressIndicator(), 12 | ), 13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/space_flight_news.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | export 'package:space_flight_news/app.dart' show SpaceFlightNewsApp; 4 | export 'package:space_flight_news/domain/api/api.dart' show SpaceFlightNewsApi; 5 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/util/dio_setup.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:space_flight_news/domain/api/data/data_interceptor.dart'; 3 | 4 | // For demo purposes only! Do not repeat this in real life! 5 | 6 | const _mockAPIData = false; 7 | // const _mockAPIData = true; 8 | 9 | extension DioX on Dio { 10 | Dio setUpForDemo() { 11 | if (_mockAPIData) { 12 | interceptors.add(SpaceFlightNewsDataInterceptor()); 13 | } 14 | return this; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/lib/util/launcher.dart: -------------------------------------------------------------------------------- 1 | import 'package:injectable/injectable.dart'; 2 | import 'package:url_launcher/url_launcher.dart'; 3 | 4 | @injectable 5 | class Launcher { 6 | const Launcher(); 7 | 8 | Future launch(String link) async { 9 | try { 10 | final url = Uri.parse(link); 11 | await launchUrl(url); 12 | } catch (_) {} 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 14 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_linux 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import url_launcher_macos 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FlutterMacOS (1.0.0) 3 | - url_launcher_macos (0.0.1): 4 | - FlutterMacOS 5 | 6 | DEPENDENCIES: 7 | - FlutterMacOS (from `Flutter/ephemeral`) 8 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 9 | 10 | EXTERNAL SOURCES: 11 | FlutterMacOS: 12 | :path: Flutter/ephemeral 13 | url_launcher_macos: 14 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 15 | 16 | SPEC CHECKSUMS: 17 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 18 | url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 19 | 20 | PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 21 | 22 | COCOAPODS: 1.12.1 23 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = space_flight_news 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.spaceFlightNews 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | com.apple.security.network.client 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 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 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: space_flight_news 2 | description: Space Flight News 3 | publish_to: none 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: ^3.2.0 8 | flutter: ^3.16.0 9 | 10 | dependencies: 11 | auto_route: 7.8.4 12 | barrel_files_annotation: 0.1.1 13 | dio: 5.4.0 14 | flutter: 15 | sdk: flutter 16 | flutter_bloc: 8.1.3 17 | flutter_localizations: 18 | sdk: flutter 19 | freezed_annotation: 2.4.1 20 | get_it: 7.6.7 21 | i69n: 2.1.0 22 | injectable: 2.3.2 23 | intl: 0.18.1 24 | json_annotation: 4.8.1 25 | retrofit: 4.0.3 26 | url_launcher: 6.2.4 27 | 28 | dev_dependencies: 29 | auto_route_generator: 7.3.2 30 | barrel_files: 0.1.1 31 | bdd_widget_test: 1.6.4 32 | build_runner: 2.4.8 33 | flutter_gen_runner: 5.4.0 34 | injectable_generator: 2.4.1 35 | flutter_lints: 3.0.1 36 | flutter_test: 37 | sdk: flutter 38 | freezed: 2.4.6 39 | json_serializable: 6.7.1 40 | retrofit_generator: 8.0.6 41 | 42 | flutter: 43 | uses-material-design: true 44 | 45 | assets: 46 | - assets/images/ 47 | 48 | flutter_gen: 49 | output: lib/presentation/assets 50 | assets: 51 | outputs: 52 | package_parameter_enabled: true 53 | 54 | dependency_overrides: 55 | file: 6.1.4 56 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/test/articles_list.feature: -------------------------------------------------------------------------------- 1 | import 'package:space_flight_news/presentation/article_details/article_details_page.dart'; 2 | 3 | Feature: Articles list 4 | 5 | Background: 6 | Given di is initialized 7 | 8 | Scenario: Articles list first loading succeeded 9 | Given API is mocked to succeed 10 | And I run the app 11 | Then I see {'Space Flight News'} text 12 | And I see {'UK launches consultation on Virgin Orbit launch'} text 13 | And I see multiple {'SpaceNews, 7/22/2022'} texts 14 | 15 | Scenario: Articles list first loading failed 16 | Given API is mocked to fail 17 | And I run the app 18 | Then I see {'Space Flight News'} text 19 | And I see {'Something went wrong'} text 20 | And I see {'Retry'} text 21 | 22 | Scenario: Articles list first loading failed but second succeeded 23 | Given API is mocked to fail 24 | And I run the app 25 | And I see {'Retry'} text 26 | When API is mocked to succeed 27 | And I tap {'Retry'} text 28 | And I wait 29 | Then I see {'UK launches consultation on Virgin Orbit launch'} text 30 | And I see multiple {'SpaceNews, 7/22/2022'} texts 31 | 32 | Scenario: Article details open on tap 33 | Given API is mocked to succeed 34 | And I run the app 35 | When I tap {'UK launches consultation on Virgin Orbit launch'} text 36 | And I wait 37 | Then I see {ArticleDetailsPage} widget 38 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/test/step/api_is_mocked_to_fail.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:space_flight_news/di/di_container.dart'; 4 | import 'package:space_flight_news/domain/api/data/failure_interceptor.dart'; 5 | 6 | Future apiIsMockedToFail(WidgetTester tester) async { 7 | final interceptors = diContainer().interceptors; 8 | interceptors.clear(); 9 | interceptors.add(SpaceFlightNewsFailureInterceptor()); 10 | } 11 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/test/step/api_is_mocked_to_succeed.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:space_flight_news/di/di_container.dart'; 4 | import 'package:space_flight_news/domain/api/data/data_interceptor.dart'; 5 | 6 | Future apiIsMockedToSucceed(WidgetTester tester) async { 7 | final interceptors = diContainer().interceptors; 8 | interceptors.clear(); 9 | interceptors.add(SpaceFlightNewsDataInterceptor()); 10 | } 11 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/test/step/di_is_initialized.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:injectable/injectable.dart'; 3 | import 'package:space_flight_news/di/di_container.dart'; 4 | import 'package:space_flight_news/di/di_initializer.dart'; 5 | 6 | Future diIsInitialized(WidgetTester tester) async { 7 | await diContainer.reset(); 8 | initDI(diContainer, Environment.test); 9 | } 10 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/test/step/i_run_the_app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:space_flight_news/app.dart'; 3 | 4 | Future iRunTheApp(WidgetTester tester) async { 5 | await tester.pumpWidget(const SpaceFlightNewsApp()); 6 | await tester.pumpAndSettle(); 7 | } 8 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/web/favicon.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/web/icons/Icon-192.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/web/icons/Icon-512.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | space_flight_news 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "space_flight_news", 3 | "short_name": "space_flight_news", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 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 | } 36 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | UrlLauncherWindowsRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 14 | } 15 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_windows 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"space_flight_news", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_with_code_gen/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length <= 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /space_flight_news_with_code_gen/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/.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: "41456452f29d64e8deb623a3c927524bcf9f111b" 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: 41456452f29d64e8deb623a3c927524bcf9f111b 17 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 18 | - platform: android 19 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 20 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 21 | - platform: ios 22 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 23 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 24 | - platform: linux 25 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 26 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 27 | - platform: macos 28 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 29 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 30 | - platform: web 31 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 32 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 33 | - platform: windows 34 | create_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 35 | base_revision: 41456452f29d64e8deb623a3c927524bcf9f111b 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/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/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace "com.example.space_flight_news" 27 | compileSdkVersion flutter.compileSdkVersion 28 | ndkVersion flutter.ndkVersion 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "com.example.space_flight_news" 46 | // You can update the following values to match your application needs. 47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 48 | minSdkVersion flutter.minSdkVersion 49 | targetSdkVersion flutter.targetSdkVersion 50 | versionCode flutterVersionCode.toInteger() 51 | versionName flutterVersionName 52 | } 53 | 54 | buildTypes { 55 | release { 56 | // TODO: Add your own signing config for the release build. 57 | // Signing with the debug keys for now, so `flutter run --release` works. 58 | signingConfig signingConfigs.debug 59 | } 60 | } 61 | } 62 | 63 | flutter { 64 | source '../..' 65 | } 66 | 67 | dependencies {} 68 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/kotlin/com/example/space_flight_news/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.space_flight_news 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 10 | } 11 | } 12 | 13 | allprojects { 14 | repositories { 15 | google() 16 | mavenCentral() 17 | } 18 | } 19 | 20 | rootProject.buildDir = '../build' 21 | subprojects { 22 | project.buildDir = "${rootProject.buildDir}/${project.name}" 23 | } 24 | subprojects { 25 | project.evaluationDependsOn(':app') 26 | } 27 | 28 | tasks.register("clean", Delete) { 29 | delete rootProject.buildDir 30 | } 31 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/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.5-all.zip 6 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/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 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | repositories { 14 | google() 15 | mavenCentral() 16 | gradlePluginPortal() 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false 21 | } 22 | } 23 | 24 | plugins { 25 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 26 | id "com.android.application" version "7.3.0" apply false 27 | } 28 | 29 | include ":app" 30 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/assets/images/linked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/assets/images/linked.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/assets/images/rocket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/assets/images/rocket.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/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 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/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 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/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 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - url_launcher_ios (0.0.1): 4 | - Flutter 5 | 6 | DEPENDENCIES: 7 | - Flutter (from `Flutter`) 8 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | Flutter: 12 | :path: Flutter 13 | url_launcher_ios: 14 | :path: ".symlinks/plugins/url_launcher_ios/ios" 15 | 16 | SPEC CHECKSUMS: 17 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 18 | url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812 19 | 20 | PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 21 | 22 | COCOAPODS: 1.14.3 23 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 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 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/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 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/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. -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | SFNews 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | space_flight_news 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/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 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_localizations/flutter_localizations.dart'; 3 | import 'package:space_flight_news/di/di_container.dart'; 4 | import 'package:space_flight_news/localization/localizations.dart'; 5 | import 'package:space_flight_news/navigation/router/router.dart'; 6 | 7 | class SpaceFlightNewsApp extends StatelessWidget { 8 | const SpaceFlightNewsApp({super.key}); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return MaterialApp( 13 | navigatorKey: diContainer>(), 14 | initialRoute: SpaceFlightNewsRouter.initialRoute, 15 | onGenerateRoute: diContainer().onGenerateRoute, 16 | theme: ThemeData( 17 | colorScheme: ColorScheme.fromSeed( 18 | brightness: Brightness.dark, 19 | seedColor: Colors.black, 20 | primary: Colors.amberAccent, 21 | surface: const Color(0xFF102A43), 22 | ), 23 | scaffoldBackgroundColor: const Color(0xFF243B53), 24 | ), 25 | supportedLocales: SpaceFlightNewsLocalizations.supportedLocales, 26 | localizationsDelegates: const [ 27 | GlobalMaterialLocalizations.delegate, 28 | GlobalCupertinoLocalizations.delegate, 29 | GlobalWidgetsLocalizations.delegate, 30 | SpaceFlightNewsLocalizations.delegate, 31 | ], 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/di/di_api_module.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:space_flight_news/util/dio_setup.dart'; 3 | 4 | abstract class DIApiModule { 5 | static Dio createDio() => Dio()..setUpForDemo(); 6 | 7 | static String get baseUrl => 'https://api.spaceflightnewsapi.net/v3'; 8 | 9 | static String get testBaseUrl => 'https://mock'; 10 | } 11 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/di/di_app_module.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | abstract class DIAppModule { 4 | static GlobalKey get key => GlobalKey(); 5 | } 6 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/di/di_container.dart: -------------------------------------------------------------------------------- 1 | import 'package:get_it/get_it.dart'; 2 | 3 | final diContainer = GetIt.instance; 4 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/di/di_initializer.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:get_it/get_it.dart'; 4 | import 'package:space_flight_news/di/di_api_module.dart'; 5 | import 'package:space_flight_news/di/di_app_module.dart'; 6 | import 'package:space_flight_news/domain/api/api.dart'; 7 | import 'package:space_flight_news/navigation/navigator.dart'; 8 | import 'package:space_flight_news/navigation/router/router.dart'; 9 | import 'package:space_flight_news/presentation/article_details/bloc/article_details_bloc.dart'; 10 | import 'package:space_flight_news/presentation/articles_list/bloc/articles_list_bloc.dart'; 11 | import 'package:space_flight_news/util/launcher.dart'; 12 | 13 | enum Environment { dev, test, prod } 14 | 15 | GetIt initDI(GetIt getIt, Environment environment) => 16 | _initGetIt(getIt, environment: environment); 17 | 18 | GetIt _initGetIt(GetIt getIt, {Environment? environment}) => getIt 19 | ..registerLazySingleton(() => DIApiModule.createDio()) 20 | ..registerFactory(() => SpaceFlightNewsApi( 21 | getIt(), 22 | baseUrl: getIt(instanceName: 'SpaceFlightNewsBaseUrl'), 23 | )) 24 | ..registerLazySingleton( 25 | () => environment == Environment.test 26 | ? DIApiModule.testBaseUrl 27 | : DIApiModule.baseUrl, 28 | instanceName: 'SpaceFlightNewsBaseUrl', 29 | ) 30 | ..registerFactoryParam((String? launchId, _) => ArticlesListBloc( 31 | getIt(), 32 | getIt(), 33 | launchId, 34 | )) 35 | ..registerFactoryParam((String articleId, _) => ArticleDetailsBloc( 36 | getIt(), 37 | getIt(), 38 | getIt(), 39 | articleId, 40 | )) 41 | ..registerLazySingleton(() => DIAppModule.key) 42 | ..registerLazySingleton(() => SpaceFlightNewsRouter( 43 | getIt>(), 44 | )) 45 | ..registerFactory(() => SpaceFlightNewsNavigator( 46 | getIt(), 47 | )) 48 | ..registerFactory(() => const Launcher()); 49 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/domain/api/api.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:space_flight_news/domain/model/article.dart'; 3 | 4 | class SpaceFlightNewsApi { 5 | const SpaceFlightNewsApi( 6 | Dio dio, { 7 | String? baseUrl, 8 | }) : _dio = dio, 9 | _baseUrl = baseUrl; 10 | 11 | final Dio _dio; 12 | final String? _baseUrl; 13 | 14 | Future> getArticles() async { 15 | final response = await _dio.fetch>( 16 | _buildGetRequestOptions('/articles'), 17 | ); 18 | final json = response.data!; 19 | final articles = json 20 | .map((dynamic i) => Article.fromJson(i as Map)) 21 | .toList(); 22 | return articles; 23 | } 24 | 25 | Future
getArticle(String articledId) async { 26 | final response = await _dio.fetch>( 27 | _buildGetRequestOptions('/articles/$articledId'), 28 | ); 29 | final json = response.data!; 30 | final article = Article.fromJson(json); 31 | return article; 32 | } 33 | 34 | Future> getArticlesByLaunch({required String launchId}) async { 35 | final response = await _dio.fetch>( 36 | _buildGetRequestOptions('/articles/launch/$launchId'), 37 | ); 38 | final json = response.data!; 39 | final articles = json 40 | .map((dynamic i) => Article.fromJson(i as Map)) 41 | .toList(); 42 | return articles; 43 | } 44 | 45 | RequestOptions _buildGetRequestOptions(String path) => 46 | Options(method: 'GET').compose( 47 | BaseOptions(baseUrl: _baseUrl ?? _dio.options.baseUrl), 48 | path, 49 | ); 50 | } 51 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/domain/api/data/data_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:space_flight_news/domain/api/data/article_details.dart'; 5 | import 'package:space_flight_news/domain/api/data/articles_list.dart'; 6 | import 'package:space_flight_news/domain/api/data/articles_list_per_launch.dart'; 7 | 8 | class SpaceFlightNewsDataInterceptor extends Interceptor { 9 | @override 10 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) { 11 | final uri = Uri.parse(options.path); 12 | if (uri.pathSegments.isNotEmpty && uri.pathSegments.first == 'articles') { 13 | switch (uri.pathSegments.length) { 14 | case 1: 15 | return handler.resolve( 16 | Response( 17 | requestOptions: options, 18 | data: jsonDecode(articlesListJsonString), 19 | ), 20 | ); 21 | case 2: 22 | final articleId = uri.pathSegments.last; 23 | return handler.resolve( 24 | Response( 25 | requestOptions: options, 26 | data: jsonDecode(articleDetailsJsonStrings[articleId]!), 27 | ), 28 | ); 29 | case 3: 30 | final launchId = 31 | uri.pathSegments[1] == 'launch' ? uri.pathSegments[2] : null; 32 | if (launchId != null) { 33 | return handler.resolve( 34 | Response( 35 | requestOptions: options, 36 | data: jsonDecode(articlesListPerLaunchJsonStrings[launchId]!), 37 | ), 38 | ); 39 | } 40 | } 41 | } 42 | 43 | super.onRequest(options, handler); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/domain/api/data/failure_interceptor.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | 3 | class SpaceFlightNewsFailureInterceptor extends Interceptor { 4 | @override 5 | void onRequest(RequestOptions options, RequestInterceptorHandler handler) { 6 | handler.reject(DioException(requestOptions: options)); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/domain/converter/int_to_string_converter.dart: -------------------------------------------------------------------------------- 1 | class IntToStringConverter { 2 | const IntToStringConverter(); 3 | 4 | String fromJson(int json) => '$json'; 5 | 6 | int toJson(String object) => int.parse(object); 7 | } 8 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/domain/model/space_launch.dart: -------------------------------------------------------------------------------- 1 | class SpaceLaunch { 2 | const SpaceLaunch({ 3 | required this.id, 4 | }); 5 | 6 | final String id; 7 | 8 | static SpaceLaunch fromJson(Map json) => SpaceLaunch( 9 | id: json['id'] as String, 10 | ); 11 | 12 | @override 13 | bool operator ==(Object other) => 14 | identical(this, other) || 15 | other is SpaceLaunch && 16 | runtimeType == other.runtimeType && 17 | id == other.id; 18 | 19 | @override 20 | int get hashCode => id.hashCode; 21 | 22 | SpaceLaunch copyWith({ 23 | String? id, 24 | }) => 25 | SpaceLaunch( 26 | id: id ?? this.id, 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/localization/build_context_extension.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:space_flight_news/localization/localizations.dart'; 3 | import 'package:space_flight_news/localization/translations/translations.dart'; 4 | 5 | extension BuildContextX on BuildContext { 6 | String get languageCode => Localizations.localeOf(this).toLanguageTag(); 7 | 8 | Translations get translations => SpaceFlightNewsLocalizations.of(this); 9 | } 10 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/localization/localizations.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:space_flight_news/localization/translations/translations.dart'; 3 | import 'package:space_flight_news/localization/translations/translations_uk.dart'; 4 | 5 | final _translations = { 6 | 'en': () => const Translations(), 7 | 'uk': () => const Translations_uk(), 8 | }; 9 | 10 | class SpaceFlightNewsLocalizations { 11 | const SpaceFlightNewsLocalizations(this.translations); 12 | 13 | final Translations translations; 14 | 15 | static const LocalizationsDelegate delegate = 16 | _SpaceFlightNewsLocalizationsDelegate(); 17 | 18 | static final List supportedLocales = 19 | _translations.keys.map((x) => Locale(x)).toList(); 20 | 21 | static Translations of(BuildContext context) => 22 | Localizations.of( 23 | context, SpaceFlightNewsLocalizations)! 24 | .translations; 25 | } 26 | 27 | class _SpaceFlightNewsLocalizationsDelegate 28 | extends LocalizationsDelegate { 29 | const _SpaceFlightNewsLocalizationsDelegate(); 30 | 31 | @override 32 | bool isSupported(Locale locale) => 33 | _translations.keys.contains(locale.languageCode); 34 | 35 | @override 36 | Future load(Locale locale) => Future.value( 37 | SpaceFlightNewsLocalizations(_translations[locale.languageCode]!())); 38 | 39 | @override 40 | bool shouldReload(LocalizationsDelegate old) => 41 | false; 42 | } 43 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/localization/translations/translations.dart: -------------------------------------------------------------------------------- 1 | class Translations { 2 | const Translations(); 3 | 4 | String on(String date) => 'on $date'; 5 | 6 | String publishedBy(String who) => 'Published by $who'; 7 | 8 | String get relatedArticles => 'View related articles'; 9 | 10 | String get title => 'Space Flight News'; 11 | 12 | String get error => 'Something went wrong'; 13 | 14 | String get retry => 'Retry'; 15 | } 16 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/localization/translations/translations_uk.dart: -------------------------------------------------------------------------------- 1 | import 'package:space_flight_news/localization/translations/translations.dart'; 2 | 3 | // ignore: camel_case_types 4 | class Translations_uk extends Translations { 5 | const Translations_uk(); 6 | 7 | @override 8 | String on(String date) => date; 9 | 10 | @override 11 | String publishedBy(String who) => 'Оприлюднено $who'; 12 | 13 | @override 14 | String get relatedArticles => 'Переглянути повʼязані новини'; 15 | 16 | @override 17 | String get title => 'Новини космічних польотів'; 18 | 19 | @override 20 | String get error => 'Щось пішло не за планом'; 21 | 22 | @override 23 | String get retry => 'Спробувати ще'; 24 | } 25 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:space_flight_news/app.dart'; 3 | import 'package:space_flight_news/di/di_container.dart'; 4 | import 'package:space_flight_news/di/di_initializer.dart'; 5 | 6 | void main() { 7 | initDI(diContainer, Environment.prod); 8 | runApp(const SpaceFlightNewsApp()); 9 | } 10 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/navigation/navigator.dart: -------------------------------------------------------------------------------- 1 | import 'package:space_flight_news/navigation/router/router.dart'; 2 | 3 | class SpaceFlightNewsNavigator { 4 | const SpaceFlightNewsNavigator(this._router); 5 | 6 | final SpaceFlightNewsRouter _router; 7 | 8 | Future goToArticlesList(String launchId) => 9 | _router.pushNamed('/articles?launchId=$launchId'); 10 | 11 | Future goToArticleDetails(String articleId) => 12 | _router.pushNamed('/article/$articleId'); 13 | } 14 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/navigation/router/router.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:space_flight_news/presentation/article_details/article_details_page.dart'; 3 | import 'package:space_flight_news/presentation/articles_list/articles_list_page.dart'; 4 | 5 | class SpaceFlightNewsRouter { 6 | const SpaceFlightNewsRouter(this._navigatorKey); 7 | 8 | final GlobalKey _navigatorKey; 9 | 10 | static const initialRoute = '/articles'; 11 | 12 | Future pushNamed(String routeName) => 13 | _navigatorKey.currentState!.pushNamed(routeName); 14 | 15 | Route? onGenerateRoute(RouteSettings settings) { 16 | if (settings.name == null) { 17 | return null; 18 | } 19 | 20 | final uri = Uri.parse(settings.name!); 21 | final pathSegments = uri.pathSegments; 22 | if (pathSegments.isEmpty) { 23 | return null; 24 | } 25 | 26 | if (pathSegments.first == 'articles') { 27 | return MaterialPageRoute( 28 | builder: (context) => ArticlesListPage( 29 | launchId: uri.queryParameters['launchId'], 30 | ), 31 | ); 32 | } 33 | 34 | if (pathSegments.first == 'article' && pathSegments.length == 2) { 35 | return MaterialPageRoute( 36 | builder: (context) => ArticleDetailsPage( 37 | articleId: pathSegments[1], 38 | ), 39 | ); 40 | } 41 | 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/presentation/article_details/bloc/article_details_event.dart: -------------------------------------------------------------------------------- 1 | part of 'article_details_bloc.dart'; 2 | 3 | sealed class ArticleDetailsEvent {} 4 | 5 | class LoadArticleDetailsEvent implements ArticleDetailsEvent { 6 | const LoadArticleDetailsEvent(); 7 | } 8 | 9 | class RetryArticleDetailsEvent implements ArticleDetailsEvent { 10 | const RetryArticleDetailsEvent(); 11 | } 12 | 13 | class OpenArticlesArticleDetailsEvent implements ArticleDetailsEvent { 14 | const OpenArticlesArticleDetailsEvent(this.launchId); 15 | 16 | final String launchId; 17 | } 18 | 19 | class ReadArticleArticleDetailsEvent implements ArticleDetailsEvent { 20 | const ReadArticleArticleDetailsEvent(); 21 | } 22 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/presentation/article_details/bloc/article_details_state.dart: -------------------------------------------------------------------------------- 1 | part of 'article_details_bloc.dart'; 2 | 3 | sealed class ArticleDetailsState {} 4 | 5 | class InitialArticleDetailsState implements ArticleDetailsState { 6 | const InitialArticleDetailsState(); 7 | } 8 | 9 | class ContentArticleDetailsState implements ArticleDetailsState { 10 | const ContentArticleDetailsState({required this.article}); 11 | 12 | final Article article; 13 | } 14 | 15 | class LoadingArticleDetailsState implements ArticleDetailsState { 16 | const LoadingArticleDetailsState(); 17 | } 18 | 19 | class ErrorArticleDetailsState implements ArticleDetailsState { 20 | const ErrorArticleDetailsState(); 21 | } 22 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/presentation/articles_list/bloc/articles_list_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_bloc/flutter_bloc.dart'; 2 | import 'package:space_flight_news/domain/api/api.dart'; 3 | import 'package:space_flight_news/domain/model/article.dart'; 4 | import 'package:space_flight_news/navigation/navigator.dart'; 5 | 6 | part 'articles_list_event.dart'; 7 | part 'articles_list_state.dart'; 8 | 9 | class ArticlesListBloc extends Bloc { 10 | ArticlesListBloc( 11 | this._api, 12 | this._navigator, 13 | this._launchId, 14 | ) : super(const InitialArticlesListState()) { 15 | on( 16 | (event, emit) => switch (event) { 17 | LoadArticlesListEvent() => _onLoad(event, emit), 18 | RetryArticlesListEvent() => _onRetry(event, emit), 19 | OpenDetailsArticlesListEvent() => _onOpenDetails(event, emit), 20 | }, 21 | ); 22 | 23 | add(const LoadArticlesListEvent()); 24 | } 25 | 26 | final SpaceFlightNewsApi _api; 27 | final SpaceFlightNewsNavigator _navigator; 28 | 29 | final String? _launchId; 30 | 31 | Future _onLoad( 32 | LoadArticlesListEvent event, 33 | Emitter emit, 34 | ) async { 35 | if (state is LoadingArticlesListState) { 36 | return; 37 | } 38 | 39 | emit(const LoadingArticlesListState()); 40 | 41 | try { 42 | final articles = _launchId != null 43 | ? await _api.getArticlesByLaunch(launchId: _launchId) 44 | : await _api.getArticles(); 45 | emit(ContentArticlesListState(articles: articles)); 46 | } on Exception { 47 | emit(const ErrorArticlesListState()); 48 | } 49 | } 50 | 51 | Future _onRetry( 52 | RetryArticlesListEvent event, 53 | Emitter emit, 54 | ) async { 55 | add(const LoadArticlesListEvent()); 56 | } 57 | 58 | Future _onOpenDetails( 59 | OpenDetailsArticlesListEvent event, 60 | Emitter emit, 61 | ) async { 62 | await _navigator.goToArticleDetails(event.articleId); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/presentation/articles_list/bloc/articles_list_event.dart: -------------------------------------------------------------------------------- 1 | part of 'articles_list_bloc.dart'; 2 | 3 | sealed class ArticlesListEvent {} 4 | 5 | class LoadArticlesListEvent implements ArticlesListEvent { 6 | const LoadArticlesListEvent(); 7 | } 8 | 9 | class RetryArticlesListEvent implements ArticlesListEvent { 10 | const RetryArticlesListEvent(); 11 | } 12 | 13 | class OpenDetailsArticlesListEvent implements ArticlesListEvent { 14 | const OpenDetailsArticlesListEvent(this.articleId); 15 | 16 | final String articleId; 17 | } 18 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/presentation/articles_list/bloc/articles_list_state.dart: -------------------------------------------------------------------------------- 1 | part of 'articles_list_bloc.dart'; 2 | 3 | sealed class ArticlesListState {} 4 | 5 | class InitialArticlesListState implements ArticlesListState { 6 | const InitialArticlesListState(); 7 | } 8 | 9 | class ContentArticlesListState implements ArticlesListState { 10 | const ContentArticlesListState({ 11 | this.articles = const
[], 12 | }); 13 | 14 | final List
articles; 15 | } 16 | 17 | class LoadingArticlesListState implements ArticlesListState { 18 | const LoadingArticlesListState(); 19 | } 20 | 21 | class ErrorArticlesListState implements ArticlesListState { 22 | const ErrorArticlesListState(); 23 | } 24 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/presentation/assets/assets.dart: -------------------------------------------------------------------------------- 1 | abstract class AssetsImages { 2 | static const linked = 'assets/images/linked.png'; 3 | static const rocket = 'assets/images/rocket.png'; 4 | } 5 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/presentation/widgets/page_content_error.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:space_flight_news/localization/build_context_extension.dart'; 3 | 4 | class PageContentError extends StatelessWidget { 5 | const PageContentError({ 6 | super.key, 7 | this.onRetry, 8 | }); 9 | 10 | final VoidCallback? onRetry; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Container( 15 | padding: const EdgeInsets.all(16.0), 16 | alignment: Alignment.center, 17 | child: Column( 18 | crossAxisAlignment: CrossAxisAlignment.center, 19 | mainAxisSize: MainAxisSize.min, 20 | children: [ 21 | Text( 22 | context.translations.error, 23 | textAlign: TextAlign.center, 24 | ), 25 | if (onRetry != null) 26 | Padding( 27 | padding: const EdgeInsets.only(top: 16.0), 28 | child: ElevatedButton( 29 | onPressed: onRetry, 30 | child: Text(context.translations.retry), 31 | ), 32 | ), 33 | ], 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/presentation/widgets/page_content_loading.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class PageContentLoading extends StatelessWidget { 4 | const PageContentLoading({super.key}); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return const Padding( 9 | padding: EdgeInsets.all(16.0), 10 | child: Center( 11 | child: CircularProgressIndicator(), 12 | ), 13 | ); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/util/dio_setup.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:space_flight_news/domain/api/data/data_interceptor.dart'; 3 | 4 | // For demo purposes only! Do not repeat this in real life! 5 | 6 | const _mockAPIData = false; 7 | // const _mockAPIData = true; 8 | 9 | extension DioX on Dio { 10 | Dio setUpForDemo() { 11 | if (_mockAPIData) { 12 | interceptors.add(SpaceFlightNewsDataInterceptor()); 13 | } 14 | return this; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/lib/util/launcher.dart: -------------------------------------------------------------------------------- 1 | import 'package:url_launcher/url_launcher.dart'; 2 | 3 | class Launcher { 4 | const Launcher(); 5 | 6 | Future launch(String link) async { 7 | try { 8 | final url = Uri.parse(link); 9 | await launchUrl(url); 10 | } catch (_) {} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 14 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_linux 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import url_launcher_macos 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - FlutterMacOS (1.0.0) 3 | - url_launcher_macos (0.0.1): 4 | - FlutterMacOS 5 | 6 | DEPENDENCIES: 7 | - FlutterMacOS (from `Flutter/ephemeral`) 8 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 9 | 10 | EXTERNAL SOURCES: 11 | FlutterMacOS: 12 | :path: Flutter/ephemeral 13 | url_launcher_macos: 14 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 15 | 16 | SPEC CHECKSUMS: 17 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 18 | url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 19 | 20 | PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 21 | 22 | COCOAPODS: 1.12.1 23 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = space_flight_news 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.spaceFlightNews 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | com.apple.security.network.client 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 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 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: space_flight_news 2 | description: Space Flight News 3 | publish_to: none 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: ^3.2.0 8 | flutter: ^3.16.0 9 | 10 | dependencies: 11 | dio: 5.4.0 12 | flutter: 13 | sdk: flutter 14 | flutter_bloc: 8.1.3 15 | flutter_localizations: 16 | sdk: flutter 17 | get_it: 7.6.7 18 | intl: 0.18.1 19 | url_launcher: 6.2.4 20 | 21 | dev_dependencies: 22 | flutter_lints: 3.0.1 23 | flutter_test: 24 | sdk: flutter 25 | 26 | flutter: 27 | uses-material-design: true 28 | 29 | assets: 30 | - assets/images/ 31 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/test/act/i_run_the_app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:space_flight_news/app.dart'; 3 | 4 | Future iRunTheApp(WidgetTester tester) async { 5 | await tester.pumpWidget(const SpaceFlightNewsApp()); 6 | await tester.pumpAndSettle(); 7 | } 8 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/test/act/i_tap_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | Future iTapText(WidgetTester tester, String text) async { 4 | await tester.tap(find.text(text)); 5 | await tester.pump(); 6 | } 7 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/test/act/i_wait.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | Future iWait(WidgetTester tester) async { 4 | await tester.pumpAndSettle(); 5 | } 6 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/test/arrange/api_is_mocked_to_fail.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:space_flight_news/di/di_container.dart'; 4 | import 'package:space_flight_news/domain/api/data/failure_interceptor.dart'; 5 | 6 | void apiIsMockedToFail(WidgetTester tester) { 7 | final interceptors = diContainer().interceptors; 8 | interceptors.clear(); 9 | interceptors.add(SpaceFlightNewsFailureInterceptor()); 10 | } 11 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/test/arrange/api_is_mocked_to_succeed.dart: -------------------------------------------------------------------------------- 1 | import 'package:dio/dio.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:space_flight_news/di/di_container.dart'; 4 | import 'package:space_flight_news/domain/api/data/data_interceptor.dart'; 5 | 6 | void apiIsMockedToSucceed(WidgetTester tester) { 7 | final interceptors = diContainer().interceptors; 8 | interceptors.clear(); 9 | interceptors.add(SpaceFlightNewsDataInterceptor()); 10 | } 11 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/test/arrange/di_is_initialized.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:space_flight_news/di/di_container.dart'; 3 | import 'package:space_flight_news/di/di_initializer.dart'; 4 | 5 | Future diIsInitialized(WidgetTester tester) async { 6 | await diContainer.reset(); 7 | initDI(diContainer, Environment.test); 8 | } -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/test/assert/i_see_multiple_texts.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | void iSeeMultipleTexts(WidgetTester tester, String text) { 4 | expect(find.text(text), findsWidgets); 5 | } 6 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/test/assert/i_see_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | void iSeeText(WidgetTester tester, String text) { 4 | expect(find.text(text), findsOneWidget); 5 | } 6 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/test/assert/i_see_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | void iSeeWidget(WidgetTester tester, Type type) { 4 | expect(find.byType(type), findsOneWidget); 5 | } 6 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/web/favicon.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/web/icons/Icon-192.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/web/icons/Icon-512.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | space_flight_news 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "space_flight_news", 3 | "short_name": "space_flight_news", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 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 | } 36 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | UrlLauncherWindowsRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 14 | } 15 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_windows 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"space_flight_news", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxanna/productive_code_gen/b391d8c4896bdb1cf99b86c90bccc4ef26e9626e/space_flight_news_without_code_gen/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length <= 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /space_flight_news_without_code_gen/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | --------------------------------------------------------------------------------