├── .github └── workflows │ └── .github-actions.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_option.yaml ├── assets ├── fancy_checkmark.json └── gong.mp3 ├── devtools_options.yaml ├── example ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── example │ │ │ │ │ └── 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 │ ├── example_json.json │ ├── step_01_android.png │ ├── step_01_ios.png │ ├── step_02_android.png │ ├── step_02_ios.png │ ├── step_03_android.png │ ├── step_03_ios.png │ ├── step_04_android.png │ ├── step_04_ios.png │ ├── step_05_android.png │ ├── step_05_ios.png │ ├── survey-kit-demo.gif │ ├── survey-kit-features.png │ └── surveykit_logo.png ├── devtools_options.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 │ └── main.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 │ └── widget_test.dart ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── 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 ├── i18n ├── de.json └── en.json ├── lib ├── src │ ├── answer_format │ │ ├── agreement_answer_format.dart │ │ ├── agreement_answer_format.g.dart │ │ ├── answer_format.dart │ │ ├── boolean_answer_format.dart │ │ ├── boolean_answer_format.g.dart │ │ ├── date_answer_format.dart │ │ ├── date_answer_format.g.dart │ │ ├── double_answer_format.dart │ │ ├── double_answer_format.g.dart │ │ ├── integer_answer_format.dart │ │ ├── integer_answer_format.g.dart │ │ ├── multi_double.dart │ │ ├── multi_double.g.dart │ │ ├── multiple_choice_answer_format.dart │ │ ├── multiple_choice_answer_format.g.dart │ │ ├── multiple_choice_auto_complete_answer_format.dart │ │ ├── multiple_choice_auto_complete_answer_format.g.dart │ │ ├── multiple_double_answer_format.dart │ │ ├── multiple_double_answer_format.g.dart │ │ ├── scale_answer_format.dart │ │ ├── scale_answer_format.g.dart │ │ ├── single_choice_answer_format.dart │ │ ├── single_choice_answer_format.g.dart │ │ ├── text_answer_format.dart │ │ ├── text_answer_format.g.dart │ │ ├── text_choice.dart │ │ ├── text_choice.g.dart │ │ ├── time_answer_formart.dart │ │ └── time_answer_formart.g.dart │ ├── configuration │ │ └── app_bar_configuration.dart │ ├── controller │ │ └── survey_controller.dart │ ├── navigator │ │ ├── navigable_task_navigator.dart │ │ ├── ordered_task_navigator.dart │ │ ├── rules │ │ │ ├── conditional_navigation_rule.dart │ │ │ ├── direct_navigation_rule.dart │ │ │ ├── direct_navigation_rule.g.dart │ │ │ ├── navigation_rule.dart │ │ │ └── rule_not_defined_exception.dart │ │ └── task_navigator.dart │ ├── presenter │ │ ├── survey_event.dart │ │ ├── survey_presenter.dart │ │ └── survey_state.dart │ ├── result │ │ ├── question │ │ │ ├── agreement_question_result.dart │ │ │ ├── agreement_question_result.g.dart │ │ │ ├── boolean_question_result.dart │ │ │ ├── boolean_question_result.g.dart │ │ │ ├── date_question_result.dart │ │ │ ├── date_question_result.g.dart │ │ │ ├── double_question_result.dart │ │ │ ├── double_question_result.g.dart │ │ │ ├── integer_question_result.dart │ │ │ ├── integer_question_result.g.dart │ │ │ ├── multiple_choice_question_result.dart │ │ │ ├── multiple_choice_question_result.g.dart │ │ │ ├── multiple_double_question_result.dart │ │ │ ├── multiple_double_question_result.g.dart │ │ │ ├── scale_question_result.dart │ │ │ ├── scale_question_result.g.dart │ │ │ ├── single_choice_question_result.dart │ │ │ ├── single_choice_question_result.g.dart │ │ │ ├── text_question_result.dart │ │ │ ├── text_question_result.g.dart │ │ │ ├── time_question_result.dart │ │ │ └── time_question_result.g.dart │ │ ├── question_result.dart │ │ ├── result.dart │ │ ├── step │ │ │ ├── completion_step_result.dart │ │ │ ├── completion_step_result.g.dart │ │ │ ├── instruction_step_result.dart │ │ │ ├── instruction_step_result.g.dart │ │ │ ├── video_step_result.dart │ │ │ └── video_step_result.g.dart │ │ ├── step_result.dart │ │ ├── step_result.g.dart │ │ └── survey │ │ │ ├── survey_result.dart │ │ │ └── survey_result.g.dart │ ├── steps │ │ ├── identifier │ │ │ ├── identifier.dart │ │ │ ├── identifier.g.dart │ │ │ ├── step_identifier.dart │ │ │ └── step_identifier.g.dart │ │ ├── predefined_steps │ │ │ ├── answer_format_not_defined_exception.dart │ │ │ ├── completion_step.dart │ │ │ ├── completion_step.g.dart │ │ │ ├── instruction_step.dart │ │ │ ├── instruction_step.g.dart │ │ │ ├── question_step.dart │ │ │ └── question_step.g.dart │ │ ├── step.dart │ │ └── step_not_defined_exception.dart │ ├── survey_kit.dart │ ├── task │ │ ├── identifier │ │ │ ├── task_identifier.dart │ │ │ └── task_identifier.g.dart │ │ ├── navigable_task.dart │ │ ├── ordered_task.dart │ │ ├── ordered_task.g.dart │ │ ├── task.dart │ │ └── task_not_defined_exception.dart │ ├── views │ │ ├── agreement_answer_view.dart │ │ ├── boolean_answer_view.dart │ │ ├── completion_view.dart │ │ ├── date_answer_view.dart │ │ ├── decoration │ │ │ └── input_decoration.dart │ │ ├── double_answer_view.dart │ │ ├── instruction_view.dart │ │ ├── integer_answer_view.dart │ │ ├── multiple_auto_complete_answer_view.dart │ │ ├── multiple_choice_answer_view.dart │ │ ├── multiple_double_answer_view.dart │ │ ├── scale_answer_view.dart │ │ ├── single_choice_answer_view.dart │ │ ├── text_answer_view.dart │ │ ├── time_answer_view.dart │ │ └── widget │ │ │ ├── selection_list_tile.dart │ │ │ ├── step_view.dart │ │ │ ├── survey_app_bar.dart │ │ │ └── time_picker_widget.dart │ └── widget │ │ ├── survey_progress.dart │ │ └── survey_progress_configuration.dart └── survey_kit.dart ├── packages └── survey_kit_image_answer │ ├── .gitignore │ ├── .metadata │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── lib │ ├── src │ │ ├── answer_format │ │ │ ├── answer_format.dart │ │ │ ├── image_answer_format.dart │ │ │ └── image_answer_format.g.dart │ │ ├── result │ │ │ ├── image_question_result.dart │ │ │ └── image_question_result.g.dart │ │ └── view │ │ │ └── image_answer_view.dart │ └── survey_kit_image_answer.dart │ ├── pubspec.lock │ ├── pubspec.yaml │ └── test │ └── image_question_result_test.dart ├── pubspec.lock ├── pubspec.yaml └── test ├── navigator ├── navigable_task_navigator_test.dart └── ordered_task_navigator_test.dart ├── src ├── result │ ├── question │ │ ├── boolean_question_result_test.dart │ │ ├── date_question_result_test.dart │ │ ├── double_question_result_test.dart │ │ ├── integer_question_result_test.dart │ │ ├── multiple_choice_question_result_test.dart │ │ ├── multiple_double_question_result_test.dart │ │ ├── scale_question_result_test.dart │ │ ├── single_choice_result_test.dart │ │ ├── text_question_result_test.dart │ │ └── time_question_result_test.dart │ └── step │ │ ├── completion_step_result_test.dart │ │ ├── instruction_step_result_test.dart │ │ └── video_step_result_test.dart └── survey │ └── survey_result_test.dart ├── steps ├── identifier │ └── identifier_test.dart └── step_test.dart ├── surveykit_flutter_test.dart ├── task ├── navigable_task_test.dart └── ordered_task_test.dart └── views └── date_answer_view_test.dart /.github/workflows/.github-actions.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | # Trigger the workflow on push or pull request 3 | on: 4 | push: 5 | pull_request: 6 | jobs: 7 | test: 8 | defaults: 9 | run: 10 | working-directory: ./ 11 | runs-on: ubuntu-latest 12 | steps: 13 | # The branch or tag ref that triggered the workflow will be checked out. 14 | - uses: actions/checkout@v1 15 | # Setup a flutter environment. 16 | - uses: subosito/flutter-action@v1 17 | with: 18 | channel: "stable" 19 | - run: flutter pub get 20 | - run: flutter analyze 21 | - run: flutter test -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | .fvm/ 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 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Web related 36 | lib/generated_plugin_registrant.dart 37 | 38 | # Symbolication related 39 | app.*.symbols 40 | 41 | # Obfuscation related 42 | app.*.map.json 43 | 44 | # Android Studio will place build artifacts here 45 | /android/app/debug 46 | /android/app/profile 47 | /android/app/release 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 QuickBird Studios 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. -------------------------------------------------------------------------------- /assets/gong.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/assets/gong.mp3 -------------------------------------------------------------------------------- /devtools_options.yaml: -------------------------------------------------------------------------------- 1 | description: This file stores settings for Dart & Flutter DevTools. 2 | documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states 3 | extensions: 4 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/.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: "db7ef5bf9f59442b0e200a90587e8fa5e0c6336a" 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: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 17 | base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 18 | - platform: android 19 | create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 20 | base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 21 | - platform: ios 22 | create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 23 | base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 24 | - platform: linux 25 | create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 26 | base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 27 | - platform: macos 28 | create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 29 | base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 30 | - platform: web 31 | create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 32 | base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 33 | - platform: windows 34 | create_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 35 | base_revision: db7ef5bf9f59442b0e200a90587e8fa5e0c6336a 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 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # surveykit_example 2 | 3 | Demonstrates how to use the surveykit plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.9.25' 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 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/assets/step_01_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/step_01_android.png -------------------------------------------------------------------------------- /example/assets/step_01_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/step_01_ios.png -------------------------------------------------------------------------------- /example/assets/step_02_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/step_02_android.png -------------------------------------------------------------------------------- /example/assets/step_02_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/step_02_ios.png -------------------------------------------------------------------------------- /example/assets/step_03_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/step_03_android.png -------------------------------------------------------------------------------- /example/assets/step_03_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/step_03_ios.png -------------------------------------------------------------------------------- /example/assets/step_04_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/step_04_android.png -------------------------------------------------------------------------------- /example/assets/step_04_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/step_04_ios.png -------------------------------------------------------------------------------- /example/assets/step_05_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/step_05_android.png -------------------------------------------------------------------------------- /example/assets/step_05_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/step_05_ios.png -------------------------------------------------------------------------------- /example/assets/survey-kit-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/survey-kit-demo.gif -------------------------------------------------------------------------------- /example/assets/survey-kit-features.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/survey-kit-features.png -------------------------------------------------------------------------------- /example/assets/surveykit_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/assets/surveykit_logo.png -------------------------------------------------------------------------------- /example/devtools_options.yaml: -------------------------------------------------------------------------------- 1 | extensions: 2 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - camera_avfoundation (0.0.1): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | - image_picker_ios (0.0.1): 6 | - Flutter 7 | - integration_test (0.0.1): 8 | - Flutter 9 | - url_launcher_ios (0.0.1): 10 | - Flutter 11 | - video_player_avfoundation (0.0.1): 12 | - Flutter 13 | - FlutterMacOS 14 | 15 | DEPENDENCIES: 16 | - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) 17 | - Flutter (from `Flutter`) 18 | - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) 19 | - integration_test (from `.symlinks/plugins/integration_test/ios`) 20 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) 21 | - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`) 22 | 23 | EXTERNAL SOURCES: 24 | camera_avfoundation: 25 | :path: ".symlinks/plugins/camera_avfoundation/ios" 26 | Flutter: 27 | :path: Flutter 28 | image_picker_ios: 29 | :path: ".symlinks/plugins/image_picker_ios/ios" 30 | integration_test: 31 | :path: ".symlinks/plugins/integration_test/ios" 32 | url_launcher_ios: 33 | :path: ".symlinks/plugins/url_launcher_ios/ios" 34 | video_player_avfoundation: 35 | :path: ".symlinks/plugins/video_player_avfoundation/darwin" 36 | 37 | SPEC CHECKSUMS: 38 | camera_avfoundation: dd002b0330f4981e1bbcb46ae9b62829237459a4 39 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 40 | image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 41 | integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573 42 | url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe 43 | video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 44 | 45 | PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 46 | 47 | COCOAPODS: 1.16.2 48 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/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. -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 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 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example/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 | #include 11 | 12 | void fl_register_plugins(FlPluginRegistry* registry) { 13 | g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); 15 | file_selector_plugin_register_with_registrar(file_selector_linux_registrar); 16 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 17 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 18 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 19 | } 20 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | file_selector_linux 7 | url_launcher_linux 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import file_selector_macos 9 | import url_launcher_macos 10 | import video_player_avfoundation 11 | 12 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 13 | FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) 14 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 15 | FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) 16 | } 17 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - file_selector_macos (0.0.1): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | - url_launcher_macos (0.0.1): 6 | - FlutterMacOS 7 | - video_player_avfoundation (0.0.1): 8 | - Flutter 9 | - FlutterMacOS 10 | 11 | DEPENDENCIES: 12 | - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) 13 | - FlutterMacOS (from `Flutter/ephemeral`) 14 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 15 | - video_player_avfoundation (from `Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin`) 16 | 17 | EXTERNAL SOURCES: 18 | file_selector_macos: 19 | :path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos 20 | FlutterMacOS: 21 | :path: Flutter/ephemeral 22 | url_launcher_macos: 23 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 24 | video_player_avfoundation: 25 | :path: Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin 26 | 27 | SPEC CHECKSUMS: 28 | file_selector_macos: cc3858c981fe6889f364731200d6232dac1d812d 29 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 30 | url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404 31 | video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3 32 | 33 | PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367 34 | 35 | COCOAPODS: 1.16.2 36 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/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 = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | 12 | 13 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter_test/flutter_test.dart'; 9 | 10 | void main() { 11 | test('Empty', () {}); 12 | } 13 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | #include 11 | 12 | void RegisterPlugins(flutter::PluginRegistry* registry) { 13 | FileSelectorWindowsRegisterWithRegistrar( 14 | registry->GetRegistrarForPlugin("FileSelectorWindows")); 15 | UrlLauncherWindowsRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 17 | } 18 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | file_selector_windows 7 | url_launcher_windows 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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"example", 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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuickBirdEng/survey_kit/bdc3a94a18588409594b37407e3fa4d8546764ed/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /i18n/de.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Flutter Template App", 3 | "error": "Es ist ein Fehler aufgetreten" 4 | } -------------------------------------------------------------------------------- /i18n/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "Flutter template app", 3 | "error": "An error occured" 4 | } -------------------------------------------------------------------------------- /lib/src/answer_format/agreement_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 3 | import 'package:survey_kit/src/answer_format/boolean_answer_format.dart'; 4 | 5 | part 'agreement_answer_format.g.dart'; 6 | 7 | @JsonSerializable() 8 | class AgreementAnswerFormat implements AnswerFormat { 9 | final BooleanResult result; 10 | final BooleanResult? defaultValue; 11 | final String? markdownDescription; 12 | final String? markdownAgreementText; 13 | 14 | const AgreementAnswerFormat({ 15 | this.result = BooleanResult.NEGATIVE, 16 | this.defaultValue, 17 | this.markdownDescription, 18 | this.markdownAgreementText, 19 | }) : super(); 20 | 21 | factory AgreementAnswerFormat.fromJson(Map json) => 22 | _$AgreementAnswerFormatFromJson(json); 23 | Map toJson() => _$AgreementAnswerFormatToJson(this); 24 | } 25 | -------------------------------------------------------------------------------- /lib/src/answer_format/agreement_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'agreement_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | AgreementAnswerFormat _$AgreementAnswerFormatFromJson( 10 | Map json) => 11 | AgreementAnswerFormat( 12 | result: $enumDecodeNullable(_$BooleanResultEnumMap, json['result']) ?? 13 | BooleanResult.NEGATIVE, 14 | defaultValue: 15 | $enumDecodeNullable(_$BooleanResultEnumMap, json['defaultValue']), 16 | markdownDescription: json['markdownDescription'] as String?, 17 | markdownAgreementText: json['markdownAgreementText'] as String?, 18 | ); 19 | 20 | Map _$AgreementAnswerFormatToJson( 21 | AgreementAnswerFormat instance) => 22 | { 23 | 'result': _$BooleanResultEnumMap[instance.result]!, 24 | 'defaultValue': _$BooleanResultEnumMap[instance.defaultValue], 25 | 'markdownDescription': instance.markdownDescription, 26 | 'markdownAgreementText': instance.markdownAgreementText, 27 | }; 28 | 29 | const _$BooleanResultEnumMap = { 30 | BooleanResult.NONE: 'NONE', 31 | BooleanResult.POSITIVE: 'POSITIVE', 32 | BooleanResult.NEGATIVE: 'NEGATIVE', 33 | }; 34 | -------------------------------------------------------------------------------- /lib/src/answer_format/boolean_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 3 | 4 | part 'boolean_answer_format.g.dart'; 5 | 6 | @JsonSerializable() 7 | class BooleanAnswerFormat implements AnswerFormat { 8 | final String positiveAnswer; 9 | final String negativeAnswer; 10 | final BooleanResult result; 11 | final BooleanResult? defaultValue; 12 | 13 | const BooleanAnswerFormat({ 14 | required this.positiveAnswer, 15 | required this.negativeAnswer, 16 | this.result = BooleanResult.NONE, 17 | this.defaultValue, 18 | }) : super(); 19 | 20 | factory BooleanAnswerFormat.fromJson(Map json) => 21 | _$BooleanAnswerFormatFromJson(json); 22 | Map toJson() => _$BooleanAnswerFormatToJson(this); 23 | } 24 | 25 | enum BooleanResult { NONE, POSITIVE, NEGATIVE } 26 | -------------------------------------------------------------------------------- /lib/src/answer_format/boolean_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'boolean_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | BooleanAnswerFormat _$BooleanAnswerFormatFromJson(Map json) => 10 | BooleanAnswerFormat( 11 | positiveAnswer: json['positiveAnswer'] as String, 12 | negativeAnswer: json['negativeAnswer'] as String, 13 | result: $enumDecodeNullable(_$BooleanResultEnumMap, json['result']) ?? 14 | BooleanResult.NONE, 15 | defaultValue: 16 | $enumDecodeNullable(_$BooleanResultEnumMap, json['defaultValue']), 17 | ); 18 | 19 | Map _$BooleanAnswerFormatToJson( 20 | BooleanAnswerFormat instance) => 21 | { 22 | 'positiveAnswer': instance.positiveAnswer, 23 | 'negativeAnswer': instance.negativeAnswer, 24 | 'result': _$BooleanResultEnumMap[instance.result]!, 25 | 'defaultValue': _$BooleanResultEnumMap[instance.defaultValue], 26 | }; 27 | 28 | const _$BooleanResultEnumMap = { 29 | BooleanResult.NONE: 'NONE', 30 | BooleanResult.POSITIVE: 'POSITIVE', 31 | BooleanResult.NEGATIVE: 'NEGATIVE', 32 | }; 33 | -------------------------------------------------------------------------------- /lib/src/answer_format/date_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 3 | 4 | part 'date_answer_format.g.dart'; 5 | 6 | @JsonSerializable() 7 | class DateAnswerFormat implements AnswerFormat { 8 | /// Default date which will be preselected on datepicker opening 9 | final DateTime? defaultDate; 10 | 11 | /// Lowest date which can be selected via the datepicker 12 | final DateTime? minDate; 13 | 14 | /// Highest date which can be selected via the datepicker 15 | final DateTime? maxDate; 16 | 17 | DateAnswerFormat({ 18 | this.defaultDate, 19 | this.minDate, 20 | this.maxDate, 21 | }) : assert(minDate == null || maxDate == null || minDate.isBefore(maxDate)), 22 | assert(defaultDate == null || 23 | minDate == null || 24 | defaultDate.isAtSameMomentAs(minDate) || 25 | defaultDate.isAfter(minDate)), 26 | assert(defaultDate == null || 27 | maxDate == null || 28 | defaultDate.isAtSameMomentAs(maxDate) || 29 | defaultDate.isBefore(maxDate)), 30 | super(); 31 | 32 | factory DateAnswerFormat.fromJson(Map json) => 33 | _$DateAnswerFormatFromJson(json); 34 | Map toJson() => _$DateAnswerFormatToJson(this); 35 | } 36 | -------------------------------------------------------------------------------- /lib/src/answer_format/date_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'date_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | DateAnswerFormat _$DateAnswerFormatFromJson(Map json) => 10 | DateAnswerFormat( 11 | defaultDate: json['defaultDate'] == null 12 | ? null 13 | : DateTime.parse(json['defaultDate'] as String), 14 | minDate: json['minDate'] == null 15 | ? null 16 | : DateTime.parse(json['minDate'] as String), 17 | maxDate: json['maxDate'] == null 18 | ? null 19 | : DateTime.parse(json['maxDate'] as String), 20 | ); 21 | 22 | Map _$DateAnswerFormatToJson(DateAnswerFormat instance) => 23 | { 24 | 'defaultDate': instance.defaultDate?.toIso8601String(), 25 | 'minDate': instance.minDate?.toIso8601String(), 26 | 'maxDate': instance.maxDate?.toIso8601String(), 27 | }; 28 | -------------------------------------------------------------------------------- /lib/src/answer_format/double_answer_format.dart: -------------------------------------------------------------------------------- 1 | // by Antonio Bruno, Giacomo Ignesti and Massimo Martinelli 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 5 | 6 | part 'double_answer_format.g.dart'; 7 | 8 | @JsonSerializable() 9 | class DoubleAnswerFormat implements AnswerFormat { 10 | final double? defaultValue; 11 | final String hint; 12 | 13 | const DoubleAnswerFormat({ 14 | this.defaultValue, 15 | this.hint = '', 16 | }) : super(); 17 | 18 | factory DoubleAnswerFormat.fromJson(Map json) => 19 | _$DoubleAnswerFormatFromJson(json); 20 | Map toJson() => _$DoubleAnswerFormatToJson(this); 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/answer_format/double_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'double_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | DoubleAnswerFormat _$DoubleAnswerFormatFromJson(Map json) => 10 | DoubleAnswerFormat( 11 | defaultValue: (json['defaultValue'] as num?)?.toDouble(), 12 | hint: json['hint'] as String? ?? '', 13 | ); 14 | 15 | Map _$DoubleAnswerFormatToJson(DoubleAnswerFormat instance) => 16 | { 17 | 'defaultValue': instance.defaultValue, 18 | 'hint': instance.hint, 19 | }; 20 | -------------------------------------------------------------------------------- /lib/src/answer_format/integer_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 3 | 4 | part 'integer_answer_format.g.dart'; 5 | 6 | @JsonSerializable() 7 | class IntegerAnswerFormat implements AnswerFormat { 8 | final int? defaultValue; 9 | final String hint; 10 | 11 | const IntegerAnswerFormat({ 12 | this.defaultValue, 13 | this.hint = '', 14 | }) : super(); 15 | 16 | factory IntegerAnswerFormat.fromJson(Map json) => 17 | _$IntegerAnswerFormatFromJson(json); 18 | Map toJson() => _$IntegerAnswerFormatToJson(this); 19 | } 20 | -------------------------------------------------------------------------------- /lib/src/answer_format/integer_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'integer_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | IntegerAnswerFormat _$IntegerAnswerFormatFromJson(Map json) => 10 | IntegerAnswerFormat( 11 | defaultValue: (json['defaultValue'] as num?)?.toInt(), 12 | hint: json['hint'] as String? ?? '', 13 | ); 14 | 15 | Map _$IntegerAnswerFormatToJson( 16 | IntegerAnswerFormat instance) => 17 | { 18 | 'defaultValue': instance.defaultValue, 19 | 'hint': instance.hint, 20 | }; 21 | -------------------------------------------------------------------------------- /lib/src/answer_format/multi_double.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | part 'multi_double.g.dart'; 4 | 5 | @JsonSerializable() 6 | class MultiDouble { 7 | final String text; 8 | final double value; 9 | 10 | MultiDouble({ 11 | required this.text, 12 | required this.value, 13 | }) : super(); 14 | 15 | factory MultiDouble.fromJson(Map json) => 16 | _$MultiDoubleFromJson(json); 17 | Map toJson() => _$MultiDoubleToJson(this); 18 | 19 | bool operator ==(o) => o is MultiDouble && text == o.text && value == o.value; 20 | int get hashCode => text.hashCode ^ value.hashCode; 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/answer_format/multi_double.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'multi_double.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MultiDouble _$MultiDoubleFromJson(Map json) => MultiDouble( 10 | text: json['text'] as String, 11 | value: (json['value'] as num).toDouble(), 12 | ); 13 | 14 | Map _$MultiDoubleToJson(MultiDouble instance) => 15 | { 16 | 'text': instance.text, 17 | 'value': instance.value, 18 | }; 19 | -------------------------------------------------------------------------------- /lib/src/answer_format/multiple_choice_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 3 | import 'package:survey_kit/src/answer_format/text_choice.dart'; 4 | 5 | part 'multiple_choice_answer_format.g.dart'; 6 | 7 | @JsonSerializable() 8 | class MultipleChoiceAnswerFormat implements AnswerFormat { 9 | final List textChoices; 10 | @JsonKey(defaultValue: const []) 11 | final List defaultSelection; 12 | @JsonKey(defaultValue: false) 13 | final bool otherField; 14 | @JsonKey(defaultValue: 100) 15 | final int maxAnswers; 16 | 17 | const MultipleChoiceAnswerFormat({ 18 | required this.textChoices, 19 | this.defaultSelection = const [], 20 | this.otherField = false, 21 | this.maxAnswers = 100 22 | }) : super(); 23 | 24 | factory MultipleChoiceAnswerFormat.fromJson(Map json) => 25 | _$MultipleChoiceAnswerFormatFromJson(json); 26 | Map toJson() => _$MultipleChoiceAnswerFormatToJson(this); 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/answer_format/multiple_choice_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'multiple_choice_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MultipleChoiceAnswerFormat _$MultipleChoiceAnswerFormatFromJson( 10 | Map json) => 11 | MultipleChoiceAnswerFormat( 12 | textChoices: (json['textChoices'] as List) 13 | .map((e) => TextChoice.fromJson(e as Map)) 14 | .toList(), 15 | defaultSelection: (json['defaultSelection'] as List?) 16 | ?.map((e) => TextChoice.fromJson(e as Map)) 17 | .toList() ?? 18 | [], 19 | otherField: json['otherField'] as bool? ?? false, 20 | maxAnswers: (json['maxAnswers'] as num?)?.toInt() ?? 100, 21 | ); 22 | 23 | Map _$MultipleChoiceAnswerFormatToJson( 24 | MultipleChoiceAnswerFormat instance) => 25 | { 26 | 'textChoices': instance.textChoices, 27 | 'defaultSelection': instance.defaultSelection, 28 | 'otherField': instance.otherField, 29 | 'maxAnswers': instance.maxAnswers, 30 | }; 31 | -------------------------------------------------------------------------------- /lib/src/answer_format/multiple_choice_auto_complete_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 3 | import 'package:survey_kit/src/answer_format/text_choice.dart'; 4 | 5 | part 'multiple_choice_auto_complete_answer_format.g.dart'; 6 | 7 | @JsonSerializable() 8 | class MultipleChoiceAutoCompleteAnswerFormat implements AnswerFormat { 9 | final List textChoices; 10 | @JsonKey(defaultValue: const []) 11 | final List defaultSelection; 12 | @JsonKey(defaultValue: const []) 13 | final List suggestions; 14 | @JsonKey(defaultValue: false) 15 | final bool otherField; 16 | 17 | const MultipleChoiceAutoCompleteAnswerFormat({ 18 | required this.textChoices, 19 | this.defaultSelection = const [], 20 | this.suggestions = const [], 21 | this.otherField = false, 22 | }) : super(); 23 | 24 | factory MultipleChoiceAutoCompleteAnswerFormat.fromJson( 25 | Map json) => 26 | _$MultipleChoiceAutoCompleteAnswerFormatFromJson(json); 27 | Map toJson() => 28 | _$MultipleChoiceAutoCompleteAnswerFormatToJson(this); 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/answer_format/multiple_choice_auto_complete_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'multiple_choice_auto_complete_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MultipleChoiceAutoCompleteAnswerFormat 10 | _$MultipleChoiceAutoCompleteAnswerFormatFromJson( 11 | Map json) => 12 | MultipleChoiceAutoCompleteAnswerFormat( 13 | textChoices: (json['textChoices'] as List) 14 | .map((e) => TextChoice.fromJson(e as Map)) 15 | .toList(), 16 | defaultSelection: (json['defaultSelection'] as List?) 17 | ?.map((e) => TextChoice.fromJson(e as Map)) 18 | .toList() ?? 19 | [], 20 | suggestions: (json['suggestions'] as List?) 21 | ?.map((e) => TextChoice.fromJson(e as Map)) 22 | .toList() ?? 23 | [], 24 | otherField: json['otherField'] as bool? ?? false, 25 | ); 26 | 27 | Map _$MultipleChoiceAutoCompleteAnswerFormatToJson( 28 | MultipleChoiceAutoCompleteAnswerFormat instance) => 29 | { 30 | 'textChoices': instance.textChoices, 31 | 'defaultSelection': instance.defaultSelection, 32 | 'suggestions': instance.suggestions, 33 | 'otherField': instance.otherField, 34 | }; 35 | -------------------------------------------------------------------------------- /lib/src/answer_format/multiple_double_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 3 | import 'package:survey_kit/src/answer_format/multi_double.dart'; 4 | 5 | part 'multiple_double_answer_format.g.dart'; 6 | 7 | @JsonSerializable() 8 | class MultipleDoubleAnswerFormat implements AnswerFormat { 9 | final List? defaultValues; 10 | @JsonKey(defaultValue: const []) 11 | final List hints; 12 | 13 | const MultipleDoubleAnswerFormat({ 14 | this.defaultValues, 15 | required this.hints, 16 | }) : super(); 17 | 18 | factory MultipleDoubleAnswerFormat.fromJson(Map json) => 19 | _$MultipleDoubleAnswerFormatFromJson(json); 20 | Map toJson() => _$MultipleDoubleAnswerFormatToJson(this); 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/answer_format/multiple_double_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'multiple_double_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MultipleDoubleAnswerFormat _$MultipleDoubleAnswerFormatFromJson( 10 | Map json) => 11 | MultipleDoubleAnswerFormat( 12 | defaultValues: (json['defaultValues'] as List?) 13 | ?.map((e) => MultiDouble.fromJson(e as Map)) 14 | .toList(), 15 | hints: 16 | (json['hints'] as List?)?.map((e) => e as String).toList() ?? 17 | [], 18 | ); 19 | 20 | Map _$MultipleDoubleAnswerFormatToJson( 21 | MultipleDoubleAnswerFormat instance) => 22 | { 23 | 'defaultValues': instance.defaultValues, 24 | 'hints': instance.hints, 25 | }; 26 | -------------------------------------------------------------------------------- /lib/src/answer_format/scale_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 3 | 4 | part 'scale_answer_format.g.dart'; 5 | 6 | @JsonSerializable() 7 | class ScaleAnswerFormat implements AnswerFormat { 8 | final double maximumValue; 9 | final double minimumValue; 10 | final double defaultValue; 11 | final double step; 12 | final String maximumValueDescription; 13 | final String minimumValueDescription; 14 | final bool showValue; 15 | 16 | const ScaleAnswerFormat({ 17 | required this.maximumValue, 18 | required this.minimumValue, 19 | required this.defaultValue, 20 | required this.step, 21 | this.maximumValueDescription = '', 22 | this.minimumValueDescription = '', 23 | this.showValue = true, 24 | }) : super(); 25 | 26 | factory ScaleAnswerFormat.fromJson(Map json) => 27 | _$ScaleAnswerFormatFromJson(json); 28 | Map toJson() => _$ScaleAnswerFormatToJson(this); 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/answer_format/scale_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'scale_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ScaleAnswerFormat _$ScaleAnswerFormatFromJson(Map json) => 10 | ScaleAnswerFormat( 11 | maximumValue: (json['maximumValue'] as num).toDouble(), 12 | minimumValue: (json['minimumValue'] as num).toDouble(), 13 | defaultValue: (json['defaultValue'] as num).toDouble(), 14 | step: (json['step'] as num).toDouble(), 15 | maximumValueDescription: json['maximumValueDescription'] as String? ?? '', 16 | minimumValueDescription: json['minimumValueDescription'] as String? ?? '', 17 | showValue: json['showValue'] as bool? ?? true, 18 | ); 19 | 20 | Map _$ScaleAnswerFormatToJson(ScaleAnswerFormat instance) => 21 | { 22 | 'maximumValue': instance.maximumValue, 23 | 'minimumValue': instance.minimumValue, 24 | 'defaultValue': instance.defaultValue, 25 | 'step': instance.step, 26 | 'maximumValueDescription': instance.maximumValueDescription, 27 | 'minimumValueDescription': instance.minimumValueDescription, 28 | 'showValue': instance.showValue, 29 | }; 30 | -------------------------------------------------------------------------------- /lib/src/answer_format/single_choice_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 3 | import 'package:survey_kit/src/answer_format/text_choice.dart'; 4 | 5 | part 'single_choice_answer_format.g.dart'; 6 | 7 | @JsonSerializable() 8 | class SingleChoiceAnswerFormat implements AnswerFormat { 9 | final List textChoices; 10 | final TextChoice? defaultSelection; 11 | 12 | const SingleChoiceAnswerFormat({ 13 | required this.textChoices, 14 | this.defaultSelection, 15 | }) : super(); 16 | 17 | factory SingleChoiceAnswerFormat.fromJson(Map json) => 18 | _$SingleChoiceAnswerFormatFromJson(json); 19 | Map toJson() => _$SingleChoiceAnswerFormatToJson(this); 20 | } 21 | -------------------------------------------------------------------------------- /lib/src/answer_format/single_choice_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'single_choice_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SingleChoiceAnswerFormat _$SingleChoiceAnswerFormatFromJson( 10 | Map json) => 11 | SingleChoiceAnswerFormat( 12 | textChoices: (json['textChoices'] as List) 13 | .map((e) => TextChoice.fromJson(e as Map)) 14 | .toList(), 15 | defaultSelection: json['defaultSelection'] == null 16 | ? null 17 | : TextChoice.fromJson( 18 | json['defaultSelection'] as Map), 19 | ); 20 | 21 | Map _$SingleChoiceAnswerFormatToJson( 22 | SingleChoiceAnswerFormat instance) => 23 | { 24 | 'textChoices': instance.textChoices, 25 | 'defaultSelection': instance.defaultSelection, 26 | }; 27 | -------------------------------------------------------------------------------- /lib/src/answer_format/text_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 3 | 4 | part 'text_answer_format.g.dart'; 5 | 6 | @JsonSerializable() 7 | class TextAnswerFormat implements AnswerFormat { 8 | final int? maxLines; 9 | final String? defaultValue; 10 | @JsonKey(defaultValue: '') 11 | final String hint; 12 | 13 | /// Regular expression by which the text gets validated 14 | /// default: '^(?!\s*$).+' that checks if the entered text is empty 15 | /// to allow any type of an answer including an empty one; 16 | /// set it explicitly to null. 17 | /// 18 | @JsonKey(defaultValue: '^(?!\s*\$).+') 19 | final String? validationRegEx; 20 | 21 | const TextAnswerFormat({ 22 | this.maxLines, 23 | this.hint = '', 24 | this.defaultValue, 25 | this.validationRegEx = '^(?!\s*\$).+', 26 | }) : super(); 27 | 28 | factory TextAnswerFormat.fromJson(Map json) => 29 | _$TextAnswerFormatFromJson(json); 30 | Map toJson() => _$TextAnswerFormatToJson(this); 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/answer_format/text_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'text_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | TextAnswerFormat _$TextAnswerFormatFromJson(Map json) => 10 | TextAnswerFormat( 11 | maxLines: (json['maxLines'] as num?)?.toInt(), 12 | hint: json['hint'] as String? ?? '', 13 | defaultValue: json['defaultValue'] as String?, 14 | validationRegEx: json['validationRegEx'] as String? ?? r'^(?!s*$).+', 15 | ); 16 | 17 | Map _$TextAnswerFormatToJson(TextAnswerFormat instance) => 18 | { 19 | 'maxLines': instance.maxLines, 20 | 'defaultValue': instance.defaultValue, 21 | 'hint': instance.hint, 22 | 'validationRegEx': instance.validationRegEx, 23 | }; 24 | -------------------------------------------------------------------------------- /lib/src/answer_format/text_choice.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | part 'text_choice.g.dart'; 4 | 5 | @JsonSerializable() 6 | class TextChoice { 7 | final String text; 8 | final String value; 9 | 10 | const TextChoice({ 11 | required this.text, 12 | required this.value, 13 | }) : super(); 14 | 15 | factory TextChoice.fromJson(Map json) => 16 | _$TextChoiceFromJson(json); 17 | Map toJson() => _$TextChoiceToJson(this); 18 | 19 | bool operator ==(o) => o is TextChoice && text == o.text && value == o.value; 20 | int get hashCode => text.hashCode ^ value.hashCode; 21 | } 22 | -------------------------------------------------------------------------------- /lib/src/answer_format/text_choice.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'text_choice.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | TextChoice _$TextChoiceFromJson(Map json) => TextChoice( 10 | text: json['text'] as String, 11 | value: json['value'] as String, 12 | ); 13 | 14 | Map _$TextChoiceToJson(TextChoice instance) => 15 | { 16 | 'text': instance.text, 17 | 'value': instance.value, 18 | }; 19 | -------------------------------------------------------------------------------- /lib/src/answer_format/time_answer_formart.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | import 'package:survey_kit/src/answer_format/answer_format.dart'; 4 | 5 | part 'time_answer_formart.g.dart'; 6 | 7 | @JsonSerializable() 8 | class TimeAnswerFormat implements AnswerFormat { 9 | @_TimeOfDayJsonConverter() 10 | final TimeOfDay? defaultValue; 11 | 12 | const TimeAnswerFormat({ 13 | this.defaultValue, 14 | }) : super(); 15 | 16 | factory TimeAnswerFormat.fromJson(Map json) => 17 | _$TimeAnswerFormatFromJson(json); 18 | Map toJson() => _$TimeAnswerFormatToJson(this); 19 | } 20 | 21 | class _TimeOfDayJsonConverter 22 | implements JsonConverter> { 23 | const _TimeOfDayJsonConverter(); 24 | 25 | @override 26 | TimeOfDay? fromJson(Map json) { 27 | if (json['hour'] == null || json['minute'] == null) { 28 | return null; 29 | } 30 | return TimeOfDay( 31 | hour: json['hour'] as int, 32 | minute: json['minute'] as int, 33 | ); 34 | } 35 | 36 | @override 37 | Map toJson(TimeOfDay? timeOfDay) => { 38 | 'hour': timeOfDay?.hour, 39 | 'minute': timeOfDay?.minute, 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /lib/src/answer_format/time_answer_formart.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'time_answer_formart.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | TimeAnswerFormat _$TimeAnswerFormatFromJson(Map json) => 10 | TimeAnswerFormat( 11 | defaultValue: _$JsonConverterFromJson, TimeOfDay?>( 12 | json['defaultValue'], const _TimeOfDayJsonConverter().fromJson), 13 | ); 14 | 15 | Map _$TimeAnswerFormatToJson(TimeAnswerFormat instance) => 16 | { 17 | 'defaultValue': 18 | const _TimeOfDayJsonConverter().toJson(instance.defaultValue), 19 | }; 20 | 21 | Value? _$JsonConverterFromJson( 22 | Object? json, 23 | Value? Function(Json json) fromJson, 24 | ) => 25 | json == null ? null : fromJson(json as Json); 26 | -------------------------------------------------------------------------------- /lib/src/configuration/app_bar_configuration.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class AppBarConfiguration { 4 | final Widget? leading; 5 | final bool? canBack; 6 | final bool? showProgress; 7 | final Widget? trailing; 8 | final bool? showCancelButton; 9 | 10 | const AppBarConfiguration({ 11 | required this.canBack, 12 | required this.showProgress, 13 | this.showCancelButton = true, 14 | this.leading, 15 | this.trailing, 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/navigator/ordered_task_navigator.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/navigator/task_navigator.dart'; 2 | import 'package:survey_kit/src/result/question_result.dart'; 3 | import 'package:survey_kit/src/steps/step.dart'; 4 | import 'package:survey_kit/src/task/task.dart'; 5 | 6 | class OrderedTaskNavigator extends TaskNavigator { 7 | OrderedTaskNavigator(Task task) : super(task); 8 | 9 | @override 10 | Step? nextStep({required Step step, QuestionResult? questionResult}) { 11 | record(step); 12 | return nextInList(step); 13 | } 14 | 15 | @override 16 | Step? previousInList(Step step) { 17 | final currentIndex = task.steps 18 | .indexWhere((element) => element.stepIdentifier == step.stepIdentifier); 19 | return (currentIndex - 1 < 0) ? null : task.steps[currentIndex - 1]; 20 | } 21 | 22 | @override 23 | Step? firstStep() { 24 | final previousStep = peekHistory(); 25 | return previousStep == null 26 | ? task.initalStep ?? task.steps.first 27 | : nextInList(previousStep); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/navigator/rules/conditional_navigation_rule.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/navigator/rules/navigation_rule.dart'; 2 | import 'package:survey_kit/src/steps/identifier/step_identifier.dart'; 3 | 4 | class ConditionalNavigationRule implements NavigationRule { 5 | final StepIdentifier? Function(String?) resultToStepIdentifierMapper; 6 | 7 | ConditionalNavigationRule({required this.resultToStepIdentifierMapper}); 8 | 9 | factory ConditionalNavigationRule.fromJson(Map json) { 10 | final inputValues = json['values'] as Map; 11 | return ConditionalNavigationRule( 12 | resultToStepIdentifierMapper: (input) { 13 | for (final MapEntry entry in inputValues.entries) { 14 | if (entry.key == input) { 15 | return StepIdentifier(id: entry.value); 16 | } 17 | } 18 | return null; 19 | }, 20 | ); 21 | } 22 | 23 | Map toJson() => {'values': {}}; 24 | } 25 | -------------------------------------------------------------------------------- /lib/src/navigator/rules/direct_navigation_rule.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/navigator/rules/navigation_rule.dart'; 3 | import 'package:survey_kit/src/steps/identifier/step_identifier.dart'; 4 | 5 | part 'direct_navigation_rule.g.dart'; 6 | 7 | @JsonSerializable() 8 | class DirectNavigationRule implements NavigationRule { 9 | final StepIdentifier destinationStepIdentifier; 10 | 11 | DirectNavigationRule(this.destinationStepIdentifier); 12 | 13 | factory DirectNavigationRule.fromJson(Map json) => 14 | _$DirectNavigationRuleFromJson(json); 15 | Map toJson() => _$DirectNavigationRuleToJson(this); 16 | } 17 | -------------------------------------------------------------------------------- /lib/src/navigator/rules/direct_navigation_rule.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'direct_navigation_rule.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | DirectNavigationRule _$DirectNavigationRuleFromJson( 10 | Map json) => 11 | DirectNavigationRule( 12 | StepIdentifier.fromJson( 13 | json['destinationStepIdentifier'] as Map), 14 | ); 15 | 16 | Map _$DirectNavigationRuleToJson( 17 | DirectNavigationRule instance) => 18 | { 19 | 'destinationStepIdentifier': instance.destinationStepIdentifier, 20 | }; 21 | -------------------------------------------------------------------------------- /lib/src/navigator/rules/navigation_rule.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/navigator/rules/conditional_navigation_rule.dart'; 2 | import 'package:survey_kit/src/navigator/rules/direct_navigation_rule.dart'; 3 | import 'package:survey_kit/src/navigator/rules/rule_not_defined_exception.dart'; 4 | 5 | abstract class NavigationRule { 6 | const NavigationRule(); 7 | 8 | factory NavigationRule.fromJson(Map json) { 9 | final type = json['type']; 10 | if (type == 'conditional') { 11 | return ConditionalNavigationRule.fromJson(json); 12 | } else if (type == 'direct') { 13 | return DirectNavigationRule.fromJson(json); 14 | } 15 | throw RuleNotDefinedException(); 16 | } 17 | Map toJson(); 18 | } 19 | -------------------------------------------------------------------------------- /lib/src/navigator/rules/rule_not_defined_exception.dart: -------------------------------------------------------------------------------- 1 | class RuleNotDefinedException implements Exception { 2 | const RuleNotDefinedException() : super(); 3 | } 4 | -------------------------------------------------------------------------------- /lib/src/navigator/task_navigator.dart: -------------------------------------------------------------------------------- 1 | import 'dart:collection'; 2 | 3 | import 'package:survey_kit/src/result/question_result.dart'; 4 | import 'package:survey_kit/src/steps/predefined_steps/completion_step.dart'; 5 | import 'package:survey_kit/src/steps/step.dart'; 6 | import 'package:survey_kit/src/task/task.dart'; 7 | 8 | abstract class TaskNavigator { 9 | final Task task; 10 | final ListQueue history = ListQueue(); 11 | 12 | TaskNavigator(this.task); 13 | 14 | Step? firstStep(); 15 | Step? nextStep({required Step step, QuestionResult? questionResult}); 16 | Step? previousInList(Step step); 17 | 18 | Step? nextInList(Step? step) { 19 | final currentIndex = task.steps.indexWhere( 20 | (element) => element.stepIdentifier == step?.stepIdentifier); 21 | // end survey if already completed via CompletionStep 22 | if (step is CompletionStep) { 23 | return null; 24 | } 25 | return (currentIndex + 1 > task.steps.length - 1) 26 | ? null 27 | : task.steps[currentIndex + 1]; 28 | } 29 | 30 | Step? peekHistory() { 31 | if (history.isEmpty) { 32 | return null; 33 | } 34 | return history.last; 35 | } 36 | 37 | bool hasPreviousStep() { 38 | final step = peekHistory(); 39 | return step != null; 40 | } 41 | 42 | void record(Step step) { 43 | history.add(step); 44 | } 45 | 46 | // Discard count of multiple completion steps and count only one if present 47 | int get countSteps => 48 | task.steps.where((step) => !(step is CompletionStep)).length + 49 | (task.steps.where((step) => step is CompletionStep).isEmpty ? 0 : 1); 50 | 51 | int currentStepIndex(Step step) { 52 | return task.steps.indexOf(step); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/src/presenter/survey_event.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/result/question_result.dart'; 2 | 3 | abstract class SurveyEvent { 4 | const SurveyEvent(); 5 | } 6 | 7 | class StartSurvey extends SurveyEvent {} 8 | 9 | class NextStep extends SurveyEvent { 10 | final QuestionResult questionResult; 11 | 12 | NextStep(this.questionResult); 13 | } 14 | 15 | class StepBack extends SurveyEvent { 16 | final QuestionResult? questionResult; 17 | 18 | StepBack(this.questionResult); 19 | } 20 | 21 | class CloseSurvey extends SurveyEvent { 22 | final QuestionResult? questionResult; 23 | 24 | CloseSurvey(this.questionResult); 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/presenter/survey_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/configuration/app_bar_configuration.dart'; 2 | import 'package:survey_kit/src/result/question_result.dart'; 3 | import 'package:survey_kit/src/result/survey/survey_result.dart'; 4 | import 'package:survey_kit/src/steps/step.dart'; 5 | 6 | abstract class SurveyState { 7 | const SurveyState(); 8 | } 9 | 10 | class LoadingSurveyState extends SurveyState {} 11 | 12 | class PresentingSurveyState extends SurveyState { 13 | final AppBarConfiguration appBarConfiguration; 14 | final List steps; 15 | final Set questionResults; 16 | final Step currentStep; 17 | final QuestionResult? result; 18 | final int currentStepIndex; 19 | final int stepCount; 20 | final bool isPreviousStep; 21 | 22 | PresentingSurveyState({ 23 | required this.stepCount, 24 | required this.appBarConfiguration, 25 | required this.currentStep, 26 | required this.steps, 27 | required this.questionResults, 28 | this.result, 29 | this.currentStepIndex = 0, 30 | this.isPreviousStep = false, 31 | }); 32 | } 33 | 34 | class SurveyResultState extends SurveyState { 35 | final SurveyResult result; 36 | final Step? currentStep; 37 | final QuestionResult? stepResult; 38 | 39 | SurveyResultState({ 40 | required this.result, 41 | this.stepResult, 42 | required this.currentStep, 43 | }); 44 | } 45 | -------------------------------------------------------------------------------- /lib/src/result/question/agreement_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/answer_format/boolean_answer_format.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | import 'package:survey_kit/src/result/question_result.dart'; 4 | 5 | import 'package:json_annotation/json_annotation.dart'; 6 | 7 | part 'agreement_question_result.g.dart'; 8 | 9 | @JsonSerializable(explicitToJson: true) 10 | class AgreementQuestionResult extends QuestionResult { 11 | AgreementQuestionResult({ 12 | required Identifier id, 13 | required DateTime startDate, 14 | required DateTime endDate, 15 | required String valueIdentifier, 16 | required BooleanResult? result, 17 | }) : super( 18 | id: id, 19 | startDate: startDate, 20 | endDate: endDate, 21 | valueIdentifier: valueIdentifier, 22 | result: result, 23 | ); 24 | 25 | factory AgreementQuestionResult.fromJson(Map json) => 26 | _$AgreementQuestionResultFromJson(json); 27 | 28 | Map toJson() => _$AgreementQuestionResultToJson(this); 29 | 30 | @override 31 | List get props => [id, startDate, endDate, valueIdentifier, result]; 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/result/question/agreement_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'agreement_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | AgreementQuestionResult _$AgreementQuestionResultFromJson( 10 | Map json) => 11 | AgreementQuestionResult( 12 | id: Identifier.fromJson(json['id'] as Map), 13 | startDate: DateTime.parse(json['startDate'] as String), 14 | endDate: DateTime.parse(json['endDate'] as String), 15 | valueIdentifier: json['valueIdentifier'] as String, 16 | result: $enumDecodeNullable(_$BooleanResultEnumMap, json['result']), 17 | ); 18 | 19 | Map _$AgreementQuestionResultToJson( 20 | AgreementQuestionResult instance) => 21 | { 22 | 'id': instance.id?.toJson(), 23 | 'startDate': instance.startDate.toIso8601String(), 24 | 'endDate': instance.endDate.toIso8601String(), 25 | 'result': _$BooleanResultEnumMap[instance.result], 26 | 'valueIdentifier': instance.valueIdentifier, 27 | }; 28 | 29 | const _$BooleanResultEnumMap = { 30 | BooleanResult.NONE: 'NONE', 31 | BooleanResult.POSITIVE: 'POSITIVE', 32 | BooleanResult.NEGATIVE: 'NEGATIVE', 33 | }; 34 | -------------------------------------------------------------------------------- /lib/src/result/question/boolean_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/answer_format/boolean_answer_format.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | import 'package:survey_kit/src/result/question_result.dart'; 4 | 5 | import 'package:json_annotation/json_annotation.dart'; 6 | 7 | part 'boolean_question_result.g.dart'; 8 | 9 | @JsonSerializable(explicitToJson: true) 10 | class BooleanQuestionResult extends QuestionResult { 11 | BooleanQuestionResult({ 12 | required Identifier id, 13 | required DateTime startDate, 14 | required DateTime endDate, 15 | required String valueIdentifier, 16 | required BooleanResult? result, 17 | }) : super( 18 | id: id, 19 | startDate: startDate, 20 | endDate: endDate, 21 | valueIdentifier: valueIdentifier, 22 | result: result, 23 | ); 24 | 25 | factory BooleanQuestionResult.fromJson(Map json) => _$BooleanQuestionResultFromJson(json); 26 | 27 | Map toJson() => _$BooleanQuestionResultToJson(this); 28 | 29 | @override 30 | List get props => [id, startDate, endDate, valueIdentifier, result]; 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/result/question/boolean_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'boolean_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | BooleanQuestionResult _$BooleanQuestionResultFromJson( 10 | Map json) => 11 | BooleanQuestionResult( 12 | id: Identifier.fromJson(json['id'] as Map), 13 | startDate: DateTime.parse(json['startDate'] as String), 14 | endDate: DateTime.parse(json['endDate'] as String), 15 | valueIdentifier: json['valueIdentifier'] as String, 16 | result: $enumDecodeNullable(_$BooleanResultEnumMap, json['result']), 17 | ); 18 | 19 | Map _$BooleanQuestionResultToJson( 20 | BooleanQuestionResult instance) => 21 | { 22 | 'id': instance.id?.toJson(), 23 | 'startDate': instance.startDate.toIso8601String(), 24 | 'endDate': instance.endDate.toIso8601String(), 25 | 'result': _$BooleanResultEnumMap[instance.result], 26 | 'valueIdentifier': instance.valueIdentifier, 27 | }; 28 | 29 | const _$BooleanResultEnumMap = { 30 | BooleanResult.NONE: 'NONE', 31 | BooleanResult.POSITIVE: 'POSITIVE', 32 | BooleanResult.NEGATIVE: 'NEGATIVE', 33 | }; 34 | -------------------------------------------------------------------------------- /lib/src/result/question/date_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/result/question_result.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'date_question_result.g.dart'; 7 | 8 | @JsonSerializable(explicitToJson: true) 9 | class DateQuestionResult extends QuestionResult { 10 | DateQuestionResult({ 11 | required Identifier id, 12 | required DateTime startDate, 13 | required DateTime endDate, 14 | required String valueIdentifier, 15 | required DateTime? result, 16 | }) : super( 17 | id: id, 18 | startDate: startDate, 19 | endDate: endDate, 20 | valueIdentifier: valueIdentifier, 21 | result: result, 22 | ); 23 | 24 | factory DateQuestionResult.fromJson(Map json) => _$DateQuestionResultFromJson(json); 25 | 26 | Map toJson() => _$DateQuestionResultToJson(this); 27 | 28 | @override 29 | List get props => [id, startDate, endDate, valueIdentifier, result]; 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/result/question/date_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'date_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | DateQuestionResult _$DateQuestionResultFromJson(Map json) => 10 | DateQuestionResult( 11 | id: Identifier.fromJson(json['id'] as Map), 12 | startDate: DateTime.parse(json['startDate'] as String), 13 | endDate: DateTime.parse(json['endDate'] as String), 14 | valueIdentifier: json['valueIdentifier'] as String, 15 | result: json['result'] == null 16 | ? null 17 | : DateTime.parse(json['result'] as String), 18 | ); 19 | 20 | Map _$DateQuestionResultToJson(DateQuestionResult instance) => 21 | { 22 | 'id': instance.id?.toJson(), 23 | 'startDate': instance.startDate.toIso8601String(), 24 | 'endDate': instance.endDate.toIso8601String(), 25 | 'result': instance.result?.toIso8601String(), 26 | 'valueIdentifier': instance.valueIdentifier, 27 | }; 28 | -------------------------------------------------------------------------------- /lib/src/result/question/double_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 2 | import 'package:survey_kit/src/result/question_result.dart'; 3 | 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'double_question_result.g.dart'; 7 | 8 | @JsonSerializable(explicitToJson: true) 9 | class DoubleQuestionResult extends QuestionResult { 10 | DoubleQuestionResult({ 11 | required Identifier id, 12 | required DateTime startDate, 13 | required DateTime endDate, 14 | required String valueIdentifier, 15 | required double? result, 16 | }) : super( 17 | id: id, 18 | startDate: startDate, 19 | endDate: endDate, 20 | valueIdentifier: valueIdentifier, 21 | result: result, 22 | ); 23 | 24 | factory DoubleQuestionResult.fromJson(Map json) => _$DoubleQuestionResultFromJson(json); 25 | 26 | Map toJson() => _$DoubleQuestionResultToJson(this); 27 | 28 | @override 29 | List get props => [id, startDate, endDate, valueIdentifier, result]; 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/result/question/double_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'double_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | DoubleQuestionResult _$DoubleQuestionResultFromJson( 10 | Map json) => 11 | DoubleQuestionResult( 12 | id: Identifier.fromJson(json['id'] as Map), 13 | startDate: DateTime.parse(json['startDate'] as String), 14 | endDate: DateTime.parse(json['endDate'] as String), 15 | valueIdentifier: json['valueIdentifier'] as String, 16 | result: (json['result'] as num?)?.toDouble(), 17 | ); 18 | 19 | Map _$DoubleQuestionResultToJson( 20 | DoubleQuestionResult instance) => 21 | { 22 | 'id': instance.id?.toJson(), 23 | 'startDate': instance.startDate.toIso8601String(), 24 | 'endDate': instance.endDate.toIso8601String(), 25 | 'result': instance.result, 26 | 'valueIdentifier': instance.valueIdentifier, 27 | }; 28 | -------------------------------------------------------------------------------- /lib/src/result/question/integer_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 2 | import 'package:survey_kit/src/result/question_result.dart'; 3 | 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'integer_question_result.g.dart'; 7 | 8 | @JsonSerializable(explicitToJson: true) 9 | class IntegerQuestionResult extends QuestionResult { 10 | IntegerQuestionResult({ 11 | required Identifier id, 12 | required DateTime startDate, 13 | required DateTime endDate, 14 | required String valueIdentifier, 15 | required int? result, 16 | }) : super( 17 | id: id, 18 | startDate: startDate, 19 | endDate: endDate, 20 | valueIdentifier: valueIdentifier, 21 | result: result, 22 | ); 23 | 24 | factory IntegerQuestionResult.fromJson(Map json) => _$IntegerQuestionResultFromJson(json); 25 | 26 | Map toJson() => _$IntegerQuestionResultToJson(this); 27 | 28 | @override 29 | List get props => [id, startDate, endDate, valueIdentifier, result]; 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/result/question/integer_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'integer_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | IntegerQuestionResult _$IntegerQuestionResultFromJson( 10 | Map json) => 11 | IntegerQuestionResult( 12 | id: Identifier.fromJson(json['id'] as Map), 13 | startDate: DateTime.parse(json['startDate'] as String), 14 | endDate: DateTime.parse(json['endDate'] as String), 15 | valueIdentifier: json['valueIdentifier'] as String, 16 | result: (json['result'] as num?)?.toInt(), 17 | ); 18 | 19 | Map _$IntegerQuestionResultToJson( 20 | IntegerQuestionResult instance) => 21 | { 22 | 'id': instance.id?.toJson(), 23 | 'startDate': instance.startDate.toIso8601String(), 24 | 'endDate': instance.endDate.toIso8601String(), 25 | 'result': instance.result, 26 | 'valueIdentifier': instance.valueIdentifier, 27 | }; 28 | -------------------------------------------------------------------------------- /lib/src/result/question/multiple_choice_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/answer_format/text_choice.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | import 'package:survey_kit/src/result/question_result.dart'; 4 | 5 | import 'package:json_annotation/json_annotation.dart'; 6 | 7 | part 'multiple_choice_question_result.g.dart'; 8 | 9 | @JsonSerializable(explicitToJson: true) 10 | class MultipleChoiceQuestionResult extends QuestionResult?> { 11 | MultipleChoiceQuestionResult({ 12 | required Identifier id, 13 | required DateTime startDate, 14 | required DateTime endDate, 15 | required String valueIdentifier, 16 | required List? result, 17 | }) : super( 18 | id: id, 19 | startDate: startDate, 20 | endDate: endDate, 21 | valueIdentifier: valueIdentifier, 22 | result: result, 23 | ); 24 | 25 | factory MultipleChoiceQuestionResult.fromJson(Map json) => 26 | _$MultipleChoiceQuestionResultFromJson(json); 27 | 28 | Map toJson() => _$MultipleChoiceQuestionResultToJson(this); 29 | 30 | @override 31 | List get props => [id, startDate, endDate, valueIdentifier, result]; 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/result/question/multiple_choice_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'multiple_choice_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MultipleChoiceQuestionResult _$MultipleChoiceQuestionResultFromJson( 10 | Map json) => 11 | MultipleChoiceQuestionResult( 12 | id: Identifier.fromJson(json['id'] as Map), 13 | startDate: DateTime.parse(json['startDate'] as String), 14 | endDate: DateTime.parse(json['endDate'] as String), 15 | valueIdentifier: json['valueIdentifier'] as String, 16 | result: (json['result'] as List?) 17 | ?.map((e) => TextChoice.fromJson(e as Map)) 18 | .toList(), 19 | ); 20 | 21 | Map _$MultipleChoiceQuestionResultToJson( 22 | MultipleChoiceQuestionResult instance) => 23 | { 24 | 'id': instance.id?.toJson(), 25 | 'startDate': instance.startDate.toIso8601String(), 26 | 'endDate': instance.endDate.toIso8601String(), 27 | 'result': instance.result?.map((e) => e.toJson()).toList(), 28 | 'valueIdentifier': instance.valueIdentifier, 29 | }; 30 | -------------------------------------------------------------------------------- /lib/src/result/question/multiple_double_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/answer_format/multi_double.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | import 'package:survey_kit/src/result/question_result.dart'; 4 | 5 | import 'package:json_annotation/json_annotation.dart'; 6 | 7 | part 'multiple_double_question_result.g.dart'; 8 | 9 | @JsonSerializable(explicitToJson: true) 10 | class MultipleDoubleQuestionResult extends QuestionResult?> { 11 | MultipleDoubleQuestionResult({ 12 | required Identifier id, 13 | required DateTime startDate, 14 | required DateTime endDate, 15 | required String valueIdentifier, 16 | required List? result, 17 | }) : super( 18 | id: id, 19 | startDate: startDate, 20 | endDate: endDate, 21 | valueIdentifier: valueIdentifier, 22 | result: result, 23 | ); 24 | 25 | factory MultipleDoubleQuestionResult.fromJson(Map json) => _$MultipleDoubleQuestionResultFromJson(json); 26 | 27 | Map toJson() => _$MultipleDoubleQuestionResultToJson(this); 28 | 29 | @override 30 | List get props => [id, startDate, endDate, valueIdentifier, result]; 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/result/question/multiple_double_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'multiple_double_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | MultipleDoubleQuestionResult _$MultipleDoubleQuestionResultFromJson( 10 | Map json) => 11 | MultipleDoubleQuestionResult( 12 | id: Identifier.fromJson(json['id'] as Map), 13 | startDate: DateTime.parse(json['startDate'] as String), 14 | endDate: DateTime.parse(json['endDate'] as String), 15 | valueIdentifier: json['valueIdentifier'] as String, 16 | result: (json['result'] as List?) 17 | ?.map((e) => MultiDouble.fromJson(e as Map)) 18 | .toList(), 19 | ); 20 | 21 | Map _$MultipleDoubleQuestionResultToJson( 22 | MultipleDoubleQuestionResult instance) => 23 | { 24 | 'id': instance.id?.toJson(), 25 | 'startDate': instance.startDate.toIso8601String(), 26 | 'endDate': instance.endDate.toIso8601String(), 27 | 'result': instance.result?.map((e) => e.toJson()).toList(), 28 | 'valueIdentifier': instance.valueIdentifier, 29 | }; 30 | -------------------------------------------------------------------------------- /lib/src/result/question/scale_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 2 | import 'package:survey_kit/src/result/question_result.dart'; 3 | 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'scale_question_result.g.dart'; 7 | 8 | @JsonSerializable(explicitToJson: true) 9 | class ScaleQuestionResult extends QuestionResult { 10 | ScaleQuestionResult({ 11 | required Identifier id, 12 | required DateTime startDate, 13 | required DateTime endDate, 14 | required String valueIdentifier, 15 | required double? result, 16 | }) : super( 17 | id: id, 18 | startDate: startDate, 19 | endDate: endDate, 20 | valueIdentifier: valueIdentifier, 21 | result: result, 22 | ); 23 | 24 | factory ScaleQuestionResult.fromJson(Map json) => _$ScaleQuestionResultFromJson(json); 25 | 26 | Map toJson() => _$ScaleQuestionResultToJson(this); 27 | 28 | @override 29 | List get props => [id, startDate, endDate, valueIdentifier, result]; 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/result/question/scale_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'scale_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ScaleQuestionResult _$ScaleQuestionResultFromJson(Map json) => 10 | ScaleQuestionResult( 11 | id: Identifier.fromJson(json['id'] as Map), 12 | startDate: DateTime.parse(json['startDate'] as String), 13 | endDate: DateTime.parse(json['endDate'] as String), 14 | valueIdentifier: json['valueIdentifier'] as String, 15 | result: (json['result'] as num?)?.toDouble(), 16 | ); 17 | 18 | Map _$ScaleQuestionResultToJson( 19 | ScaleQuestionResult instance) => 20 | { 21 | 'id': instance.id?.toJson(), 22 | 'startDate': instance.startDate.toIso8601String(), 23 | 'endDate': instance.endDate.toIso8601String(), 24 | 'result': instance.result, 25 | 'valueIdentifier': instance.valueIdentifier, 26 | }; 27 | -------------------------------------------------------------------------------- /lib/src/result/question/single_choice_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/answer_format/text_choice.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | import 'package:survey_kit/src/result/question_result.dart'; 4 | 5 | import 'package:json_annotation/json_annotation.dart'; 6 | 7 | part 'single_choice_question_result.g.dart'; 8 | 9 | @JsonSerializable(explicitToJson: true) 10 | class SingleChoiceQuestionResult extends QuestionResult { 11 | SingleChoiceQuestionResult({ 12 | required Identifier id, 13 | required DateTime startDate, 14 | required DateTime endDate, 15 | required String valueIdentifier, 16 | required TextChoice? result, 17 | }) : super( 18 | id: id, 19 | startDate: startDate, 20 | endDate: endDate, 21 | valueIdentifier: valueIdentifier, 22 | result: result, 23 | ); 24 | 25 | factory SingleChoiceQuestionResult.fromJson(Map json) => _$SingleChoiceQuestionResultFromJson(json); 26 | 27 | Map toJson() => _$SingleChoiceQuestionResultToJson(this); 28 | 29 | @override 30 | List get props => [id, startDate, endDate, valueIdentifier, result]; 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/result/question/single_choice_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'single_choice_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SingleChoiceQuestionResult _$SingleChoiceQuestionResultFromJson( 10 | Map json) => 11 | SingleChoiceQuestionResult( 12 | id: Identifier.fromJson(json['id'] as Map), 13 | startDate: DateTime.parse(json['startDate'] as String), 14 | endDate: DateTime.parse(json['endDate'] as String), 15 | valueIdentifier: json['valueIdentifier'] as String, 16 | result: json['result'] == null 17 | ? null 18 | : TextChoice.fromJson(json['result'] as Map), 19 | ); 20 | 21 | Map _$SingleChoiceQuestionResultToJson( 22 | SingleChoiceQuestionResult instance) => 23 | { 24 | 'id': instance.id?.toJson(), 25 | 'startDate': instance.startDate.toIso8601String(), 26 | 'endDate': instance.endDate.toIso8601String(), 27 | 'result': instance.result?.toJson(), 28 | 'valueIdentifier': instance.valueIdentifier, 29 | }; 30 | -------------------------------------------------------------------------------- /lib/src/result/question/text_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 2 | import 'package:survey_kit/src/result/question_result.dart'; 3 | 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'text_question_result.g.dart'; 7 | 8 | @JsonSerializable(explicitToJson: true) 9 | class TextQuestionResult extends QuestionResult { 10 | TextQuestionResult({ 11 | required Identifier id, 12 | required DateTime startDate, 13 | required DateTime endDate, 14 | required String valueIdentifier, 15 | required String? result, 16 | }) : super( 17 | id: id, 18 | startDate: startDate, 19 | endDate: endDate, 20 | valueIdentifier: valueIdentifier, 21 | result: result, 22 | ); 23 | 24 | factory TextQuestionResult.fromJson(Map json) => _$TextQuestionResultFromJson(json); 25 | 26 | Map toJson() => _$TextQuestionResultToJson(this); 27 | 28 | @override 29 | List get props => [id, startDate, endDate, valueIdentifier, result]; 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/result/question/text_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'text_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | TextQuestionResult _$TextQuestionResultFromJson(Map json) => 10 | TextQuestionResult( 11 | id: Identifier.fromJson(json['id'] as Map), 12 | startDate: DateTime.parse(json['startDate'] as String), 13 | endDate: DateTime.parse(json['endDate'] as String), 14 | valueIdentifier: json['valueIdentifier'] as String, 15 | result: json['result'] as String?, 16 | ); 17 | 18 | Map _$TextQuestionResultToJson(TextQuestionResult instance) => 19 | { 20 | 'id': instance.id?.toJson(), 21 | 'startDate': instance.startDate.toIso8601String(), 22 | 'endDate': instance.endDate.toIso8601String(), 23 | 'result': instance.result, 24 | 'valueIdentifier': instance.valueIdentifier, 25 | }; 26 | -------------------------------------------------------------------------------- /lib/src/result/question/time_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'time_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | TimeQuestionResult _$TimeQuestionResultFromJson(Map json) => 10 | TimeQuestionResult( 11 | id: Identifier.fromJson(json['id'] as Map), 12 | startDate: DateTime.parse(json['startDate'] as String), 13 | endDate: DateTime.parse(json['endDate'] as String), 14 | valueIdentifier: json['valueIdentifier'] as String, 15 | result: const TimeOfDayConverter().fromJson(json['result'] as String?), 16 | ); 17 | 18 | Map _$TimeQuestionResultToJson(TimeQuestionResult instance) => 19 | { 20 | 'id': instance.id?.toJson(), 21 | 'startDate': instance.startDate.toIso8601String(), 22 | 'endDate': instance.endDate.toIso8601String(), 23 | 'result': const TimeOfDayConverter().toJson(instance.result), 24 | 'valueIdentifier': instance.valueIdentifier, 25 | }; 26 | -------------------------------------------------------------------------------- /lib/src/result/question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/result/result.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | 4 | abstract class QuestionResult extends Result { 5 | final T? result; 6 | final String? valueIdentifier; 7 | QuestionResult({ 8 | required Identifier? id, 9 | required DateTime startDate, 10 | required DateTime endDate, 11 | required this.valueIdentifier, 12 | required this.result, 13 | }) : super(id: id, startDate: startDate, endDate: endDate); 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/result/result.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | 4 | abstract class Result extends Equatable { 5 | final Identifier? id; 6 | final DateTime startDate; 7 | final DateTime endDate; 8 | 9 | Result({ 10 | required this.id, 11 | required this.startDate, 12 | required this.endDate, 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/result/step/completion_step_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 2 | import 'package:survey_kit/src/result/question_result.dart'; 3 | 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'completion_step_result.g.dart'; 7 | 8 | @JsonSerializable(explicitToJson: true) 9 | class CompletionStepResult extends QuestionResult { 10 | CompletionStepResult( 11 | Identifier id, 12 | DateTime startDate, 13 | DateTime endDate, 14 | ) : super( 15 | id: id, 16 | startDate: startDate, 17 | endDate: endDate, 18 | valueIdentifier: 'completion', 19 | result: null, 20 | ); 21 | factory CompletionStepResult.fromJson(Map json) => 22 | _$CompletionStepResultFromJson(json); 23 | 24 | Map toJson() => _$CompletionStepResultToJson(this); 25 | 26 | @override 27 | List get props => [id, startDate, endDate, valueIdentifier]; 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/result/step/completion_step_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'completion_step_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | CompletionStepResult _$CompletionStepResultFromJson( 10 | Map json) => 11 | CompletionStepResult( 12 | Identifier.fromJson(json['id'] as Map), 13 | DateTime.parse(json['startDate'] as String), 14 | DateTime.parse(json['endDate'] as String), 15 | ); 16 | 17 | Map _$CompletionStepResultToJson( 18 | CompletionStepResult instance) => 19 | { 20 | 'id': instance.id?.toJson(), 21 | 'startDate': instance.startDate.toIso8601String(), 22 | 'endDate': instance.endDate.toIso8601String(), 23 | }; 24 | -------------------------------------------------------------------------------- /lib/src/result/step/instruction_step_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/result/question_result.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'instruction_step_result.g.dart'; 7 | 8 | @JsonSerializable(explicitToJson: true) 9 | class InstructionStepResult extends QuestionResult { 10 | InstructionStepResult( 11 | Identifier id, 12 | DateTime startDate, 13 | DateTime endDate, 14 | ) : super( 15 | id: id, 16 | startDate: startDate, 17 | endDate: endDate, 18 | valueIdentifier: 'instruction', 19 | result: null, 20 | ); 21 | factory InstructionStepResult.fromJson(Map json) => 22 | _$InstructionStepResultFromJson(json); 23 | 24 | Map toJson() => _$InstructionStepResultToJson(this); 25 | 26 | @override 27 | List get props => [id, startDate, endDate, valueIdentifier]; 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/result/step/instruction_step_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'instruction_step_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | InstructionStepResult _$InstructionStepResultFromJson( 10 | Map json) => 11 | InstructionStepResult( 12 | Identifier.fromJson(json['id'] as Map), 13 | DateTime.parse(json['startDate'] as String), 14 | DateTime.parse(json['endDate'] as String), 15 | ); 16 | 17 | Map _$InstructionStepResultToJson( 18 | InstructionStepResult instance) => 19 | { 20 | 'id': instance.id?.toJson(), 21 | 'startDate': instance.startDate.toIso8601String(), 22 | 'endDate': instance.endDate.toIso8601String(), 23 | }; 24 | -------------------------------------------------------------------------------- /lib/src/result/step/video_step_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/result/question_result.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | 4 | import 'package:json_annotation/json_annotation.dart'; 5 | 6 | part 'video_step_result.g.dart'; 7 | 8 | @JsonSerializable(explicitToJson: true) 9 | class VideoStepResult extends QuestionResult { 10 | VideoStepResult({ 11 | required Identifier id, 12 | required DateTime startDate, 13 | required DateTime endDate, 14 | required VideoResult result, 15 | }) : super( 16 | id: id, 17 | startDate: startDate, 18 | endDate: endDate, 19 | valueIdentifier: id.id, 20 | result: result, 21 | ); 22 | factory VideoStepResult.fromJson(Map json) => 23 | _$VideoStepResultFromJson(json); 24 | 25 | Map toJson() => _$VideoStepResultToJson(this); 26 | 27 | @override 28 | List get props => [id, startDate, endDate, valueIdentifier]; 29 | } 30 | 31 | @JsonSerializable(explicitToJson: true) 32 | class VideoResult { 33 | final Duration leftVideoAt; 34 | final DateTime stayedInVideo; 35 | 36 | factory VideoResult.fromJson(Map json) => 37 | _$VideoResultFromJson(json); 38 | 39 | Map toJson() => _$VideoResultToJson(this); 40 | 41 | 42 | const VideoResult({ 43 | required this.leftVideoAt, 44 | required this.stayedInVideo, 45 | }); 46 | } 47 | -------------------------------------------------------------------------------- /lib/src/result/step/video_step_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'video_step_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | VideoStepResult _$VideoStepResultFromJson(Map json) => 10 | VideoStepResult( 11 | id: Identifier.fromJson(json['id'] as Map), 12 | startDate: DateTime.parse(json['startDate'] as String), 13 | endDate: DateTime.parse(json['endDate'] as String), 14 | result: VideoResult.fromJson(json['result'] as Map), 15 | ); 16 | 17 | Map _$VideoStepResultToJson(VideoStepResult instance) => 18 | { 19 | 'id': instance.id?.toJson(), 20 | 'startDate': instance.startDate.toIso8601String(), 21 | 'endDate': instance.endDate.toIso8601String(), 22 | 'result': instance.result?.toJson(), 23 | }; 24 | 25 | VideoResult _$VideoResultFromJson(Map json) => VideoResult( 26 | leftVideoAt: Duration(microseconds: (json['leftVideoAt'] as num).toInt()), 27 | stayedInVideo: DateTime.parse(json['stayedInVideo'] as String), 28 | ); 29 | 30 | Map _$VideoResultToJson(VideoResult instance) => 31 | { 32 | 'leftVideoAt': instance.leftVideoAt.inMicroseconds, 33 | 'stayedInVideo': instance.stayedInVideo.toIso8601String(), 34 | }; 35 | -------------------------------------------------------------------------------- /lib/src/result/step_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'step_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | StepResult _$StepResultFromJson(Map json) => StepResult( 10 | id: json['id'] == null 11 | ? null 12 | : Identifier.fromJson(json['id'] as Map), 13 | startDate: DateTime.parse(json['startDate'] as String), 14 | endDate: DateTime.parse(json['endDate'] as String), 15 | results: const _Converter().fromJson(json['results'] as Object), 16 | ); 17 | 18 | Map _$StepResultToJson(StepResult instance) => 19 | { 20 | 'id': instance.id?.toJson(), 21 | 'startDate': instance.startDate.toIso8601String(), 22 | 'endDate': instance.endDate.toIso8601String(), 23 | 'results': const _Converter().toJson(instance.results), 24 | }; 25 | -------------------------------------------------------------------------------- /lib/src/result/survey/survey_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/src/result/result.dart'; 2 | import 'package:survey_kit/src/result/step_result.dart'; 3 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 4 | 5 | import 'package:json_annotation/json_annotation.dart'; 6 | 7 | part 'survey_result.g.dart'; 8 | 9 | @JsonSerializable(explicitToJson: true) 10 | class SurveyResult extends Result { 11 | final FinishReason finishReason; 12 | final List results; 13 | 14 | SurveyResult({ 15 | required Identifier? id, 16 | required DateTime startDate, 17 | required DateTime endDate, 18 | required this.finishReason, 19 | required this.results, 20 | }) : super(id: id, startDate: startDate, endDate: endDate); 21 | 22 | factory SurveyResult.fromJson(Map json) => _$SurveyResultFromJson(json); 23 | 24 | Map toJson() => _$SurveyResultToJson(this); 25 | 26 | @override 27 | List get props => [id, startDate, endDate, finishReason]; 28 | } 29 | 30 | enum FinishReason { SAVED, DISCARDED, COMPLETED, FAILED } 31 | -------------------------------------------------------------------------------- /lib/src/result/survey/survey_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'survey_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | SurveyResult _$SurveyResultFromJson(Map json) => SurveyResult( 10 | id: json['id'] == null 11 | ? null 12 | : Identifier.fromJson(json['id'] as Map), 13 | startDate: DateTime.parse(json['startDate'] as String), 14 | endDate: DateTime.parse(json['endDate'] as String), 15 | finishReason: $enumDecode(_$FinishReasonEnumMap, json['finishReason']), 16 | results: (json['results'] as List) 17 | .map((e) => StepResult.fromJson(e as Map)) 18 | .toList(), 19 | ); 20 | 21 | Map _$SurveyResultToJson(SurveyResult instance) => 22 | { 23 | 'id': instance.id?.toJson(), 24 | 'startDate': instance.startDate.toIso8601String(), 25 | 'endDate': instance.endDate.toIso8601String(), 26 | 'finishReason': _$FinishReasonEnumMap[instance.finishReason]!, 27 | 'results': instance.results.map((e) => e.toJson()).toList(), 28 | }; 29 | 30 | const _$FinishReasonEnumMap = { 31 | FinishReason.SAVED: 'SAVED', 32 | FinishReason.DISCARDED: 'DISCARDED', 33 | FinishReason.COMPLETED: 'COMPLETED', 34 | FinishReason.FAILED: 'FAILED', 35 | }; 36 | -------------------------------------------------------------------------------- /lib/src/steps/identifier/identifier.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:uuid/uuid.dart'; 3 | 4 | part 'identifier.g.dart'; 5 | 6 | @JsonSerializable() 7 | class Identifier { 8 | final String id; 9 | 10 | Identifier({String? id}) : id = id ?? Uuid().v4(); 11 | 12 | factory Identifier.fromJson(Map json) => 13 | _$IdentifierFromJson(json); 14 | Map toJson() => _$IdentifierToJson(this); 15 | 16 | bool operator ==(o) => o is Identifier && o.id == id; 17 | int get hashCode => id.hashCode; 18 | } 19 | -------------------------------------------------------------------------------- /lib/src/steps/identifier/identifier.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'identifier.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Identifier _$IdentifierFromJson(Map json) => Identifier( 10 | id: json['id'] as String?, 11 | ); 12 | 13 | Map _$IdentifierToJson(Identifier instance) => 14 | { 15 | 'id': instance.id, 16 | }; 17 | -------------------------------------------------------------------------------- /lib/src/steps/identifier/step_identifier.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | 4 | part 'step_identifier.g.dart'; 5 | 6 | @JsonSerializable() 7 | class StepIdentifier extends Identifier { 8 | StepIdentifier({String? id}) : super(id: id); 9 | 10 | factory StepIdentifier.fromJson(Map json) => 11 | _$StepIdentifierFromJson(json); 12 | Map toJson() => _$StepIdentifierToJson(this); 13 | 14 | bool operator ==(o) => o is StepIdentifier && id == o.id; 15 | int get hashCode => id.hashCode; 16 | } 17 | -------------------------------------------------------------------------------- /lib/src/steps/identifier/step_identifier.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'step_identifier.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | StepIdentifier _$StepIdentifierFromJson(Map json) => 10 | StepIdentifier( 11 | id: json['id'] as String?, 12 | ); 13 | 14 | Map _$StepIdentifierToJson(StepIdentifier instance) => 15 | { 16 | 'id': instance.id, 17 | }; 18 | -------------------------------------------------------------------------------- /lib/src/steps/predefined_steps/answer_format_not_defined_exception.dart: -------------------------------------------------------------------------------- 1 | class AnswerFormatNotDefinedException implements Exception { 2 | const AnswerFormatNotDefinedException() : super(); 3 | } 4 | -------------------------------------------------------------------------------- /lib/src/steps/predefined_steps/completion_step.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | import 'package:survey_kit/src/result/question_result.dart'; 4 | import 'package:survey_kit/src/steps/step.dart'; 5 | import 'package:survey_kit/src/steps/identifier/step_identifier.dart'; 6 | import 'package:survey_kit/src/views/completion_view.dart'; 7 | 8 | part 'completion_step.g.dart'; 9 | 10 | @JsonSerializable() 11 | class CompletionStep extends Step { 12 | final String title; 13 | final String text; 14 | final String assetPath; 15 | 16 | CompletionStep({ 17 | bool isOptional = false, 18 | required StepIdentifier stepIdentifier, 19 | String buttonText = 'End Survey', 20 | bool showAppBar = true, 21 | required this.title, 22 | required this.text, 23 | this.assetPath = "" 24 | }) : super( 25 | stepIdentifier: stepIdentifier, 26 | isOptional: isOptional, 27 | buttonText: buttonText, 28 | showAppBar: showAppBar, 29 | ); 30 | 31 | @override 32 | Widget createView({required QuestionResult? questionResult}) { 33 | return CompletionView(completionStep: this, assetPath: assetPath); 34 | } 35 | 36 | factory CompletionStep.fromJson(Map json) => 37 | _$CompletionStepFromJson(json); 38 | Map toJson() => _$CompletionStepToJson(this); 39 | 40 | bool operator ==(o) => 41 | super == (o) && o is CompletionStep && o.title == title && o.text == text; 42 | int get hashCode => super.hashCode ^ title.hashCode ^ text.hashCode; 43 | } 44 | -------------------------------------------------------------------------------- /lib/src/steps/predefined_steps/completion_step.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'completion_step.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | CompletionStep _$CompletionStepFromJson(Map json) => 10 | CompletionStep( 11 | isOptional: json['isOptional'] as bool? ?? false, 12 | stepIdentifier: StepIdentifier.fromJson( 13 | json['stepIdentifier'] as Map), 14 | buttonText: json['buttonText'] as String? ?? 'Next', 15 | showAppBar: json['showAppBar'] as bool? ?? true, 16 | title: json['title'] as String, 17 | text: json['text'] as String, 18 | assetPath: json['assetPath'] as String? ?? "", 19 | ); 20 | 21 | Map _$CompletionStepToJson(CompletionStep instance) => 22 | { 23 | 'stepIdentifier': instance.stepIdentifier, 24 | 'isOptional': instance.isOptional, 25 | 'buttonText': instance.buttonText, 26 | 'showAppBar': instance.showAppBar, 27 | 'title': instance.title, 28 | 'text': instance.text, 29 | 'assetPath': instance.assetPath, 30 | }; 31 | -------------------------------------------------------------------------------- /lib/src/steps/predefined_steps/instruction_step.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | import 'package:survey_kit/src/result/question_result.dart'; 4 | import 'package:survey_kit/src/steps/step.dart'; 5 | import 'package:survey_kit/src/steps/identifier/step_identifier.dart'; 6 | import 'package:survey_kit/src/views/instruction_view.dart'; 7 | 8 | part 'instruction_step.g.dart'; 9 | 10 | @JsonSerializable(explicitToJson: true) 11 | class InstructionStep extends Step { 12 | final String title; 13 | final String text; 14 | 15 | InstructionStep({ 16 | required this.title, 17 | required this.text, 18 | bool isOptional = false, 19 | String buttonText = 'Next', 20 | StepIdentifier? stepIdentifier, 21 | bool? canGoBack, 22 | bool? showProgress, 23 | bool showAppBar = true, 24 | }) : super( 25 | stepIdentifier: stepIdentifier, 26 | isOptional: isOptional, 27 | buttonText: buttonText, 28 | canGoBack: canGoBack ?? false, 29 | showProgress: showProgress ?? false, 30 | showAppBar: showAppBar, 31 | ); 32 | 33 | @override 34 | Widget createView({required QuestionResult? questionResult}) { 35 | return InstructionView( 36 | instructionStep: this, 37 | ); 38 | } 39 | 40 | factory InstructionStep.fromJson(Map json) => 41 | _$InstructionStepFromJson(json); 42 | Map toJson() => _$InstructionStepToJson(this); 43 | 44 | bool operator ==(o) => 45 | super == (o) && 46 | o is InstructionStep && 47 | o.title == title && 48 | o.text == text; 49 | int get hashCode => super.hashCode ^ title.hashCode ^ text.hashCode; 50 | } 51 | -------------------------------------------------------------------------------- /lib/src/steps/predefined_steps/instruction_step.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'instruction_step.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | InstructionStep _$InstructionStepFromJson(Map json) => 10 | InstructionStep( 11 | title: json['title'] as String, 12 | text: json['text'] as String, 13 | isOptional: json['isOptional'] as bool? ?? false, 14 | buttonText: json['buttonText'] as String? ?? 'Next', 15 | stepIdentifier: json['stepIdentifier'] == null 16 | ? null 17 | : StepIdentifier.fromJson( 18 | json['stepIdentifier'] as Map), 19 | canGoBack: json['canGoBack'] as bool?, 20 | showProgress: json['showProgress'] as bool?, 21 | showAppBar: json['showAppBar'] as bool? ?? true, 22 | ); 23 | 24 | Map _$InstructionStepToJson(InstructionStep instance) => 25 | { 26 | 'stepIdentifier': instance.stepIdentifier.toJson(), 27 | 'isOptional': instance.isOptional, 28 | 'buttonText': instance.buttonText, 29 | 'canGoBack': instance.canGoBack, 30 | 'showProgress': instance.showProgress, 31 | 'showAppBar': instance.showAppBar, 32 | 'title': instance.title, 33 | 'text': instance.text, 34 | }; 35 | -------------------------------------------------------------------------------- /lib/src/steps/predefined_steps/question_step.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'question_step.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | QuestionStep _$QuestionStepFromJson(Map json) => QuestionStep( 10 | isOptional: json['isOptional'] as bool? ?? false, 11 | buttonText: json['buttonText'] as String? ?? 'Next', 12 | stepIdentifier: json['stepIdentifier'] == null 13 | ? null 14 | : StepIdentifier.fromJson( 15 | json['stepIdentifier'] as Map), 16 | showAppBar: json['showAppBar'] as bool? ?? true, 17 | title: json['title'] as String? ?? '', 18 | text: json['text'] as String? ?? '', 19 | answerFormat: 20 | AnswerFormat.fromJson(json['answerFormat'] as Map), 21 | ); 22 | 23 | Map _$QuestionStepToJson(QuestionStep instance) => 24 | { 25 | 'stepIdentifier': instance.stepIdentifier, 26 | 'isOptional': instance.isOptional, 27 | 'buttonText': instance.buttonText, 28 | 'showAppBar': instance.showAppBar, 29 | 'title': instance.title, 30 | 'text': instance.text, 31 | 'answerFormat': instance.answerFormat, 32 | }; 33 | -------------------------------------------------------------------------------- /lib/src/steps/step.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:json_annotation/json_annotation.dart'; 3 | import 'package:survey_kit/src/result/question_result.dart'; 4 | import 'package:survey_kit/src/steps/identifier/step_identifier.dart'; 5 | import 'package:survey_kit/src/steps/predefined_steps/completion_step.dart'; 6 | import 'package:survey_kit/src/steps/predefined_steps/instruction_step.dart'; 7 | import 'package:survey_kit/src/steps/predefined_steps/question_step.dart'; 8 | import 'package:survey_kit/src/steps/step_not_defined_exception.dart'; 9 | 10 | abstract class Step { 11 | final StepIdentifier stepIdentifier; 12 | @JsonKey(defaultValue: false) 13 | final bool isOptional; 14 | @JsonKey(defaultValue: 'Next') 15 | final String? buttonText; 16 | final bool canGoBack; 17 | final bool showProgress; 18 | final bool showAppBar; 19 | 20 | Step({ 21 | StepIdentifier? stepIdentifier, 22 | this.isOptional = false, 23 | this.buttonText = 'Next', 24 | this.canGoBack = true, 25 | this.showProgress = true, 26 | this.showAppBar = true, 27 | }) : stepIdentifier = stepIdentifier ?? StepIdentifier(); 28 | 29 | Widget createView({required QuestionResult? questionResult}); 30 | 31 | factory Step.fromJson(Map json) { 32 | final type = json['type']; 33 | if (type == 'intro') { 34 | return InstructionStep.fromJson(json); 35 | } else if (type == 'question') { 36 | return QuestionStep.fromJson(json); 37 | } else if (type == 'completion') { 38 | return CompletionStep.fromJson(json); 39 | } 40 | throw StepNotDefinedException(); 41 | } 42 | 43 | Map toJson(); 44 | 45 | bool operator ==(o) => 46 | o is Step && 47 | o.stepIdentifier == stepIdentifier && 48 | o.isOptional == isOptional && 49 | o.buttonText == buttonText; 50 | int get hashCode => 51 | stepIdentifier.hashCode ^ isOptional.hashCode ^ buttonText.hashCode; 52 | } 53 | -------------------------------------------------------------------------------- /lib/src/steps/step_not_defined_exception.dart: -------------------------------------------------------------------------------- 1 | class StepNotDefinedException implements Exception { 2 | const StepNotDefinedException() : super(); 3 | } 4 | -------------------------------------------------------------------------------- /lib/src/task/identifier/task_identifier.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/steps/identifier/identifier.dart'; 3 | 4 | part 'task_identifier.g.dart'; 5 | 6 | /// Used to uniquly identify a [Task] 7 | @JsonSerializable() 8 | class TaskIdentifier extends Identifier { 9 | TaskIdentifier({String? id}) : super(id: id); 10 | 11 | factory TaskIdentifier.fromJson(Map json) => 12 | _$TaskIdentifierFromJson(json); 13 | Map toJson() => _$TaskIdentifierToJson(this); 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/task/identifier/task_identifier.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'task_identifier.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | TaskIdentifier _$TaskIdentifierFromJson(Map json) => 10 | TaskIdentifier( 11 | id: json['id'] as String?, 12 | ); 13 | 14 | Map _$TaskIdentifierToJson(TaskIdentifier instance) => 15 | { 16 | 'id': instance.id, 17 | }; 18 | -------------------------------------------------------------------------------- /lib/src/task/ordered_task.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/steps/step.dart'; 3 | import 'package:survey_kit/src/task/task.dart'; 4 | import 'package:survey_kit/src/task/identifier/task_identifier.dart'; 5 | 6 | part 'ordered_task.g.dart'; 7 | 8 | /// Defines a [Task] which handles its steps in the order of the [steps] list. 9 | @JsonSerializable(createFactory: false) 10 | class OrderedTask extends Task { 11 | OrderedTask({ 12 | required TaskIdentifier id, 13 | required List steps, 14 | Step? initialStep, 15 | }) : super( 16 | id: id, 17 | steps: steps, 18 | initalStep: initialStep, 19 | ); 20 | 21 | factory OrderedTask.fromJson(Map json) => OrderedTask( 22 | id: TaskIdentifier.fromJson(json), 23 | steps: json['steps'] != null 24 | ? (json['steps'] as List>) 25 | .map((step) => Step.fromJson(step)) 26 | .toList() 27 | : [], 28 | ); 29 | 30 | Map toJson() => _$OrderedTaskToJson(this); 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/task/ordered_task.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'ordered_task.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Map _$OrderedTaskToJson(OrderedTask instance) => 10 | { 11 | 'id': instance.id, 12 | 'steps': instance.steps, 13 | 'initalStep': instance.initalStep, 14 | 'hashCode': instance.hashCode, 15 | }; 16 | -------------------------------------------------------------------------------- /lib/src/task/task.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/src/steps/step.dart'; 3 | import 'package:survey_kit/src/task/identifier/task_identifier.dart'; 4 | import 'package:survey_kit/src/task/navigable_task.dart'; 5 | import 'package:survey_kit/src/task/ordered_task.dart'; 6 | import 'package:survey_kit/src/task/task_not_defined_exception.dart'; 7 | 8 | /// Abstract definition of survey task 9 | /// 10 | /// If you want to create a custom task: 11 | /// * Inherit from Task 12 | /// * If you want to use JSON override [fromJson] and add your type 13 | abstract class Task { 14 | late final TaskIdentifier id; 15 | @JsonKey(defaultValue: []) 16 | final List steps; 17 | final Step? initalStep; 18 | 19 | Task({ 20 | TaskIdentifier? id, 21 | this.steps = const [], 22 | this.initalStep, 23 | }) { 24 | if (id == null) { 25 | id = TaskIdentifier(); 26 | return; 27 | } 28 | this.id = id; 29 | } 30 | 31 | /// Creates a task from a Map. The task needs to have a type definition of 32 | /// either 'ordered' - [OrderedTask] or 'navigable' - [NavigableTask]. 33 | /// If not it will throw a [TaskNotDefinedException]. 34 | factory Task.fromJson(Map json) { 35 | final type = json['type']; 36 | if (type == 'ordered') { 37 | return OrderedTask.fromJson(json); 38 | } else if (type == 'navigable') { 39 | return NavigableTask.fromJson(json); 40 | } 41 | throw TaskNotDefinedException(); 42 | } 43 | 44 | Map toJson(); 45 | 46 | bool operator ==(o) => o is Task && o.id == id; 47 | int get hashCode => id.hashCode ^ steps.hashCode; 48 | } 49 | -------------------------------------------------------------------------------- /lib/src/task/task_not_defined_exception.dart: -------------------------------------------------------------------------------- 1 | /// Defines an exception if not valid task definition is found 2 | class TaskNotDefinedException implements Exception { 3 | const TaskNotDefinedException() : super(); 4 | } 5 | -------------------------------------------------------------------------------- /lib/src/views/completion_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:lottie/lottie.dart'; 3 | import 'package:survey_kit/src/result/step/completion_step_result.dart'; 4 | import 'package:survey_kit/src/steps/predefined_steps/completion_step.dart'; 5 | import 'package:survey_kit/src/views/widget/step_view.dart'; 6 | 7 | class CompletionView extends StatelessWidget { 8 | final CompletionStep completionStep; 9 | final DateTime _startDate = DateTime.now(); 10 | final String assetPath; 11 | 12 | CompletionView({required this.completionStep, this.assetPath = ""}); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return StepView( 17 | step: completionStep, 18 | resultFunction: () => CompletionStepResult( 19 | completionStep.stepIdentifier, 20 | _startDate, 21 | DateTime.now(), 22 | ), 23 | title: Text(completionStep.title, 24 | style: Theme.of(context).textTheme.displayMedium, 25 | textAlign: TextAlign.center), 26 | child: Padding( 27 | padding: const EdgeInsets.symmetric(horizontal: 64.0), 28 | child: Column( 29 | children: [ 30 | Text( 31 | completionStep.text, 32 | style: Theme.of(context).textTheme.bodyMedium, 33 | textAlign: TextAlign.center, 34 | ), 35 | Padding( 36 | padding: const EdgeInsets.symmetric(vertical: 32.0), 37 | child: Container( 38 | width: 150.0, 39 | height: 150.0, 40 | child: assetPath.isNotEmpty 41 | ? Lottie.asset( 42 | assetPath, 43 | repeat: false, 44 | ) 45 | : Lottie.asset( 46 | 'assets/fancy_checkmark.json', 47 | package: 'survey_kit', 48 | repeat: false, 49 | ), 50 | ), 51 | ) 52 | ], 53 | ), 54 | ), 55 | ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib/src/views/decoration/input_decoration.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | InputDecoration textFieldInputDecoration({String hint = ''}) => InputDecoration( 4 | contentPadding: const EdgeInsets.only( 5 | left: 10, 6 | bottom: 10, 7 | top: 10, 8 | right: 10, 9 | ), 10 | focusedBorder: OutlineInputBorder( 11 | borderRadius: BorderRadius.all( 12 | Radius.zero, 13 | ), 14 | borderSide: BorderSide( 15 | color: Colors.black.withOpacity(0.2), 16 | ), 17 | ), 18 | enabledBorder: OutlineInputBorder( 19 | borderRadius: BorderRadius.all( 20 | Radius.zero, 21 | ), 22 | borderSide: BorderSide( 23 | color: Colors.black.withOpacity(0.2), 24 | ), 25 | ), 26 | hintText: hint, 27 | ); 28 | -------------------------------------------------------------------------------- /lib/src/views/instruction_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:survey_kit/src/result/step/instruction_step_result.dart'; 3 | import 'package:survey_kit/src/steps/predefined_steps/instruction_step.dart'; 4 | import 'package:survey_kit/src/views/widget/step_view.dart'; 5 | 6 | class InstructionView extends StatelessWidget { 7 | final InstructionStep instructionStep; 8 | final DateTime _startDate = DateTime.now(); 9 | 10 | InstructionView({required this.instructionStep}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return StepView( 15 | step: instructionStep, 16 | title: Text( 17 | instructionStep.title, 18 | style: Theme.of(context).textTheme.displayMedium, 19 | textAlign: TextAlign.center, 20 | ), 21 | resultFunction: () => InstructionStepResult( 22 | instructionStep.stepIdentifier, 23 | _startDate, 24 | DateTime.now(), 25 | ), 26 | child: Padding( 27 | padding: const EdgeInsets.symmetric(horizontal: 14.0), 28 | child: Text( 29 | instructionStep.text, 30 | style: Theme.of(context).textTheme.bodyMedium, 31 | textAlign: TextAlign.center, 32 | ), 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/src/views/widget/selection_list_tile.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SelectionListTile extends StatelessWidget { 4 | final String text; 5 | final Function onTap; 6 | final bool isSelected; 7 | 8 | const SelectionListTile({ 9 | Key? key, 10 | required this.text, 11 | required this.onTap, 12 | this.isSelected = false, 13 | }) : super(key: key); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Column( 18 | children: [ 19 | Padding( 20 | padding: const EdgeInsets.symmetric(horizontal: 14.0), 21 | child: ListTile( 22 | title: Text( 23 | text, 24 | style: Theme.of(context).textTheme.headlineSmall?.copyWith( 25 | color: isSelected 26 | ? Theme.of(context).primaryColor 27 | : Theme.of(context).textTheme.headlineSmall?.color, 28 | ), 29 | ), 30 | trailing: isSelected 31 | ? Icon( 32 | Icons.check, 33 | size: 32, 34 | color: isSelected 35 | ? Theme.of(context).primaryColor 36 | : Colors.black, 37 | ) 38 | : Container( 39 | width: 32, 40 | height: 32, 41 | ), 42 | onTap: () => onTap.call(), 43 | ), 44 | ), 45 | Divider( 46 | color: Colors.grey, 47 | ), 48 | ], 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/src/views/widget/survey_app_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:survey_kit/src/configuration/app_bar_configuration.dart'; 3 | import 'package:survey_kit/src/controller/survey_controller.dart'; 4 | import 'package:survey_kit/src/widget/survey_progress.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | class SurveyAppBar extends StatelessWidget { 8 | final AppBarConfiguration appBarConfiguration; 9 | final SurveyController? controller; 10 | 11 | const SurveyAppBar({ 12 | required this.appBarConfiguration, 13 | this.controller, 14 | }); 15 | 16 | @override 17 | AppBar build(BuildContext context) { 18 | final _showProgress = 19 | appBarConfiguration.showProgress ?? context.read(); 20 | final _canGoBack = appBarConfiguration.canBack ?? true; 21 | 22 | final surveyController = controller ?? context.read(); 23 | return AppBar( 24 | elevation: 0, 25 | leading: _canGoBack 26 | ? appBarConfiguration.leading ?? 27 | BackButton( 28 | onPressed: () { 29 | surveyController.stepBack( 30 | context: context, 31 | ); 32 | }, 33 | ) 34 | : Container(), 35 | title: _showProgress ? SurveyProgress() : SizedBox.shrink(), 36 | actions: [ 37 | if (appBarConfiguration.showCancelButton ?? true) 38 | TextButton( 39 | child: appBarConfiguration.trailing ?? 40 | Text( 41 | context.read?>()?['cancel'] ?? 'Cancel', 42 | style: TextStyle( 43 | color: Theme.of(context).primaryColor, 44 | ), 45 | ), 46 | onPressed: () => surveyController.closeSurvey(context), 47 | ), 48 | ], 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/src/widget/survey_progress_configuration.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SurveyProgressConfiguration { 4 | /// Color of the progressbar 5 | final Color progressbarColor; 6 | 7 | /// Color of the value of the progressbar 8 | final Color? valueProgressbarColor; 9 | 10 | /// Color of the background of the progressbar 11 | final Color? backgroundColor; 12 | 13 | /// Min height of the progressbar 14 | final double height; 15 | 16 | /// Padding of the progressbar and text 17 | final EdgeInsets padding; 18 | 19 | /// If a Label should be shown above the progressbar (You also need to add 20 | /// the label ) 21 | final bool showLabel; 22 | 23 | /// Label widget which should be shown above the appbar (Also need to 24 | /// activate via the 'showLabel flag {from currentProgress, to 25 | /// finishOfProgress}) 26 | final Function(String from, String to)? label; 27 | 28 | /// The corner radius of the progress bar - If not defines 29 | /// BorderRadius.circular(14.0) 30 | final BorderRadius? borderRadius; 31 | 32 | SurveyProgressConfiguration({ 33 | this.progressbarColor = Colors.white, 34 | this.height = 6.0, 35 | this.padding = const EdgeInsets.symmetric(horizontal: 24.0), 36 | this.showLabel = false, 37 | this.borderRadius, 38 | this.label, 39 | this.backgroundColor, 40 | this.valueProgressbarColor, 41 | }); 42 | } 43 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/.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 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | build/ 30 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/.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: "2663184aa79047d0a33a14a3b607954f8fdd8730" 8 | channel: "stable" 9 | 10 | project_type: plugin 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730 17 | base_revision: 2663184aa79047d0a33a14a3b607954f8fdd8730 18 | 19 | # User provided section 20 | 21 | # List of Local paths (relative to this file) that should be 22 | # ignored by the migrate tool. 23 | # 24 | # Files that are not part of the templates will be ignored by default. 25 | unmanaged_files: 26 | - 'lib/main.dart' 27 | - 'ios/Runner.xcodeproj/project.pbxproj' 28 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1 Work in progress 2 | INFO: Inital release of the image_answer step for survey_kit 3 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/LICENSE: -------------------------------------------------------------------------------- 1 | TODO: Add your license here. 2 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/README.md: -------------------------------------------------------------------------------- 1 | # survey_kit_image_answer 2 | 3 | Adds an Image-Answer question type to the Survey Kit package. -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/lib/src/answer_format/answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:survey_kit/survey_kit.dart'; 2 | 3 | abstract class ImageAnswerFormat extends AnswerFormat { 4 | factory ImageAnswerFormat.fromJson(Map json) { 5 | switch (json['type'] as String) { 6 | case 'file': 7 | return ImageAnswerFormat.fromJson(json); 8 | default: 9 | throw AnswerFormatNotDefinedException(); 10 | } 11 | } 12 | @override 13 | Map toJson(); 14 | } 15 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/lib/src/answer_format/image_answer_format.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | part 'image_answer_format.g.dart'; 5 | 6 | @JsonSerializable() 7 | class ImageAnswerFormat implements AnswerFormat { 8 | final String? defaultValue; 9 | final String buttonText; 10 | final bool useGallery; 11 | final String? hintImage; 12 | final String? hintTitle; 13 | 14 | const ImageAnswerFormat({ 15 | this.defaultValue, 16 | this.buttonText = 'Image: ', 17 | this.useGallery = true, 18 | this.hintImage, 19 | this.hintTitle, 20 | }) : super(); 21 | 22 | factory ImageAnswerFormat.fromJson(Map json) => 23 | _$ImageAnswerFormatFromJson(json); 24 | 25 | @override 26 | Map toJson() => _$ImageAnswerFormatToJson(this); 27 | } 28 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/lib/src/answer_format/image_answer_format.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'image_answer_format.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ImageAnswerFormat _$ImageAnswerFormatFromJson(Map json) => 10 | ImageAnswerFormat( 11 | defaultValue: json['defaultValue'] as String?, 12 | buttonText: json['buttonText'] as String? ?? 'Image: ', 13 | useGallery: json['useGallery'] as bool? ?? true, 14 | hintImage: json['hintImage'] as String?, 15 | hintTitle: json['hintTitle'] as String?, 16 | ); 17 | 18 | Map _$ImageAnswerFormatToJson(ImageAnswerFormat instance) => 19 | { 20 | 'defaultValue': instance.defaultValue, 21 | 'buttonText': instance.buttonText, 22 | 'useGallery': instance.useGallery, 23 | 'hintImage': instance.hintImage, 24 | 'hintTitle': instance.hintTitle, 25 | }; 26 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/lib/src/result/image_question_result.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | part 'image_question_result.g.dart'; 5 | 6 | @JsonSerializable(explicitToJson: true) 7 | class ImageQuestionResult extends QuestionResult { 8 | ImageQuestionResult({ 9 | required Identifier super.id, 10 | required super.startDate, 11 | required super.endDate, 12 | required String super.valueIdentifier, 13 | required super.result, 14 | }); 15 | 16 | factory ImageQuestionResult.fromJson(Map json) => 17 | _$ImageQuestionResultFromJson(json); 18 | 19 | Map toJson() => _$ImageQuestionResultToJson(this); 20 | 21 | @override 22 | List get props => [id, startDate, endDate, valueIdentifier, result]; 23 | } 24 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/lib/src/result/image_question_result.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'image_question_result.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | ImageQuestionResult _$ImageQuestionResultFromJson(Map json) => 10 | ImageQuestionResult( 11 | id: Identifier.fromJson(json['id'] as Map), 12 | startDate: DateTime.parse(json['startDate'] as String), 13 | endDate: DateTime.parse(json['endDate'] as String), 14 | valueIdentifier: json['valueIdentifier'] as String, 15 | result: json['result'] as String?, 16 | ); 17 | 18 | Map _$ImageQuestionResultToJson( 19 | ImageQuestionResult instance) => 20 | { 21 | 'id': instance.id?.toJson(), 22 | 'startDate': instance.startDate.toIso8601String(), 23 | 'endDate': instance.endDate.toIso8601String(), 24 | 'result': instance.result, 25 | 'valueIdentifier': instance.valueIdentifier, 26 | }; 27 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/lib/survey_kit_image_answer.dart: -------------------------------------------------------------------------------- 1 | library survey_kit_image_answer; 2 | 3 | //export 'src/answer_format/answer_format.dart'; 4 | export 'src/answer_format/image_answer_format.dart'; 5 | export 'src/result/image_question_result.dart'; 6 | export 'src/view/image_answer_view.dart'; 7 | -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: survey_kit_image_answer 2 | description: Image Answer View for survey_kit 3 | version: 0.0.1 4 | homepage: https://quickbirdstudios.com 5 | repository: https://github.com/quickbirdstudios/survey_kit 6 | issue_tracker: https://github.com/quickbirdstudios/survey_kit/issues 7 | 8 | environment: 9 | sdk: ">=2.18.0 <4.0.0" 10 | flutter: ">=1.20.0" 11 | 12 | dependencies: 13 | camera: ^0.11.0+1 14 | flutter: 15 | sdk: flutter 16 | image_picker: ^1.0.4 17 | json_annotation: ^4.0.1 18 | survey_kit: ^0.2.1 19 | 20 | dev_dependencies: 21 | build_runner: ^2.4.6 22 | flutter_test: 23 | sdk: flutter 24 | flutter_lints: ^5.0.0 25 | json_serializable: ^6.1.3 26 | integration_test: 27 | sdk: flutter 28 | 29 | 30 | flutter: 31 | uses-material-design: true -------------------------------------------------------------------------------- /packages/survey_kit_image_answer/test/image_question_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = ImageQuestionResult( 6 | id: Identifier(id: 'example1'), 7 | startDate: DateTime(2023, 7, 4, 10, 41), 8 | endDate: DateTime(2023, 7, 4, 10, 51), 9 | valueIdentifier: 'imageInput1', 10 | result: 'url for the image', 11 | ); 12 | 13 | group('serialisarion', () { 14 | test('should work with valid example', () async { 15 | final encodedResult = tResult.toJson(); 16 | final decodedResult = ImageQuestionResult.fromJson(encodedResult); 17 | expect(tResult, decodedResult); 18 | }); 19 | }); 20 | } 21 | -------------------------------------------------------------------------------- /test/navigator/navigable_task_navigator_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/src/answer_format/boolean_answer_format.dart'; 3 | import 'package:survey_kit/src/navigator/navigable_task_navigator.dart'; 4 | import 'package:survey_kit/src/steps/identifier/step_identifier.dart'; 5 | import 'package:survey_kit/src/steps/predefined_steps/completion_step.dart'; 6 | import 'package:survey_kit/src/steps/predefined_steps/question_step.dart'; 7 | import 'package:survey_kit/src/task/navigable_task.dart'; 8 | import 'package:survey_kit/src/task/task.dart'; 9 | 10 | void main() { 11 | test('''Navigable task navigator completes 12 | after first occurence of completion step''', () { 13 | final Task task = NavigableTask( 14 | steps: [ 15 | QuestionStep( 16 | answerFormat: BooleanAnswerFormat( 17 | positiveAnswer: 'Yes', negativeAnswer: 'No')), 18 | CompletionStep( 19 | stepIdentifier: StepIdentifier(id: '111'), title: '', text: ''), 20 | CompletionStep( 21 | stepIdentifier: StepIdentifier(id: '222'), title: '', text: ''), 22 | ], 23 | ); 24 | final NavigableTaskNavigator navigator = NavigableTaskNavigator(task); 25 | final step0 = navigator.firstStep(); 26 | expect(step0, isNotNull); 27 | expect(step0, isA()); 28 | 29 | final completionStep0 = navigator.nextStep(step: step0!); 30 | expect(completionStep0, isNotNull); 31 | expect(completionStep0, isA()); 32 | 33 | final completionStep1 = navigator.nextStep(step: completionStep0!); 34 | expect(completionStep1, isNull); 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /test/navigator/ordered_task_navigator_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/src/answer_format/boolean_answer_format.dart'; 3 | import 'package:survey_kit/src/navigator/ordered_task_navigator.dart'; 4 | import 'package:survey_kit/src/steps/identifier/step_identifier.dart'; 5 | import 'package:survey_kit/src/steps/predefined_steps/completion_step.dart'; 6 | import 'package:survey_kit/src/steps/predefined_steps/question_step.dart'; 7 | import 'package:survey_kit/src/task/identifier/task_identifier.dart'; 8 | import 'package:survey_kit/src/task/ordered_task.dart'; 9 | import 'package:survey_kit/src/task/task.dart'; 10 | 11 | void main() { 12 | test('''Ordered task navigator completes 13 | after first occurence of completion step''', () { 14 | final Task task = OrderedTask( 15 | id: TaskIdentifier(id: '100'), 16 | steps: [ 17 | QuestionStep( 18 | answerFormat: BooleanAnswerFormat( 19 | positiveAnswer: 'Yes', negativeAnswer: 'No')), 20 | CompletionStep( 21 | stepIdentifier: StepIdentifier(id: '111'), title: '', text: ''), 22 | CompletionStep( 23 | stepIdentifier: StepIdentifier(id: '222'), title: '', text: ''), 24 | ], 25 | ); 26 | final OrderedTaskNavigator navigator = OrderedTaskNavigator(task); 27 | final step0 = navigator.firstStep(); 28 | expect(step0, isNotNull); 29 | expect(step0, isA()); 30 | 31 | final completionStep0 = navigator.nextStep(step: step0!); 32 | expect(completionStep0, isNotNull); 33 | expect(completionStep0, isA()); 34 | 35 | final completionStep1 = navigator.nextStep(step: completionStep0!); 36 | expect(completionStep1, isNull); 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /test/src/result/question/boolean_question_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = BooleanQuestionResult( 6 | id: Identifier(id: 'example1'), 7 | startDate: DateTime(2022, 8, 12, 16, 4), 8 | endDate: DateTime(2022, 8, 12, 16, 14), 9 | valueIdentifier: 'bool1', 10 | result: BooleanResult.NEGATIVE, 11 | ); 12 | 13 | group('serialisation', () { 14 | test( 15 | 'should work with valid example', 16 | () async { 17 | final encodedResult = tResult.toJson(); 18 | final decodedResult = BooleanQuestionResult.fromJson(encodedResult); 19 | expect(tResult, decodedResult); 20 | }, 21 | ); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /test/src/result/question/date_question_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = DateQuestionResult( 6 | id: Identifier(id: 'example1'), 7 | startDate: DateTime(2022, 8, 12, 16, 4), 8 | endDate: DateTime(2022, 8, 12, 16, 14), 9 | valueIdentifier: 'date1', 10 | result: DateTime.now(), 11 | ); 12 | 13 | group('serialisation', () { 14 | test( 15 | 'should work with valid example', 16 | () async { 17 | final encodedResult = tResult.toJson(); 18 | final decodedResult = DateQuestionResult.fromJson(encodedResult); 19 | expect(tResult, decodedResult); 20 | }, 21 | ); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /test/src/result/question/double_question_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = DoubleQuestionResult( 6 | id: Identifier(id: 'example1'), 7 | startDate: DateTime(2022, 8, 12, 16, 4), 8 | endDate: DateTime(2022, 8, 12, 16, 14), 9 | valueIdentifier: 'double1', 10 | result: 123.45, 11 | ); 12 | 13 | group('serialisation', () { 14 | test( 15 | 'should work with valid example', 16 | () async { 17 | final encodedResult = tResult.toJson(); 18 | final decodedResult = DoubleQuestionResult.fromJson(encodedResult); 19 | expect(tResult, decodedResult); 20 | }, 21 | ); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /test/src/result/question/integer_question_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = IntegerQuestionResult( 6 | id: Identifier(id: 'example1'), 7 | startDate: DateTime(2022, 8, 12, 16, 4), 8 | endDate: DateTime(2022, 8, 12, 16, 14), 9 | valueIdentifier: 'int1', 10 | result: 123, 11 | ); 12 | 13 | group('serialisation', () { 14 | test( 15 | 'should work with valid example', 16 | () async { 17 | final encodedResult = tResult.toJson(); 18 | final decodedResult = IntegerQuestionResult.fromJson(encodedResult); 19 | expect(tResult, decodedResult); 20 | }, 21 | ); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /test/src/result/question/multiple_choice_question_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = MultipleChoiceQuestionResult( 6 | id: Identifier(id: 'example1'), 7 | startDate: DateTime(2022, 8, 12, 16, 4), 8 | endDate: DateTime(2022, 8, 12, 16, 14), 9 | valueIdentifier: 'multiChoice1', 10 | result: [ 11 | TextChoice(text: 'doubleVal1', value: '123.45'), 12 | TextChoice(text: 'doubleVal2', value: '234.56'), 13 | ], 14 | ); 15 | 16 | group('serialisation', () { 17 | test( 18 | 'should work with valid example', 19 | () async { 20 | final encodedResult = tResult.toJson(); 21 | final decodedResult = 22 | MultipleChoiceQuestionResult.fromJson(encodedResult); 23 | expect(tResult, decodedResult); 24 | }, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /test/src/result/question/multiple_double_question_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = MultipleDoubleQuestionResult( 6 | id: Identifier(id: 'example1'), 7 | startDate: DateTime(2022, 8, 12, 16, 4), 8 | endDate: DateTime(2022, 8, 12, 16, 14), 9 | valueIdentifier: 'multiDouble1', 10 | result: [ 11 | MultiDouble(text: 'doubleVal1', value: 123.45), 12 | MultiDouble(text: 'doubleVal2', value: 234.56), 13 | ], 14 | ); 15 | 16 | group('serialisation', () { 17 | test( 18 | 'should work with valid example', 19 | () async { 20 | final encodedResult = tResult.toJson(); 21 | final decodedResult = 22 | MultipleDoubleQuestionResult.fromJson(encodedResult); 23 | expect(tResult, decodedResult); 24 | }, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /test/src/result/question/scale_question_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = ScaleQuestionResult( 6 | id: Identifier(id: 'example1'), 7 | startDate: DateTime(2022, 8, 12, 16, 4), 8 | endDate: DateTime(2022, 8, 12, 16, 14), 9 | valueIdentifier: 'scaleInput1', 10 | result: -123.45, 11 | ); 12 | 13 | group('serialisation', () { 14 | test( 15 | 'should work with valid example', 16 | () async { 17 | final encodedResult = tResult.toJson(); 18 | final decodedResult = ScaleQuestionResult.fromJson(encodedResult); 19 | expect(tResult, decodedResult); 20 | }, 21 | ); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /test/src/result/question/single_choice_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = SingleChoiceQuestionResult( 6 | id: Identifier(id: 'example1'), 7 | startDate: DateTime(2022, 8, 12, 16, 4), 8 | endDate: DateTime(2022, 8, 12, 16, 14), 9 | valueIdentifier: 'singleChoiceValue1', 10 | result: TextChoice(text: 'choice1', value: 'option2'), 11 | ); 12 | 13 | group('serialisation', () { 14 | test( 15 | 'should work with valid example', 16 | () async { 17 | final encodedResult = tResult.toJson(); 18 | final decodedResult = SingleChoiceQuestionResult.fromJson(encodedResult); 19 | expect(tResult, decodedResult); 20 | }, 21 | ); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /test/src/result/question/text_question_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = TextQuestionResult( 6 | id: Identifier(id: 'example1'), 7 | startDate: DateTime(2022, 8, 12, 16, 4), 8 | endDate: DateTime(2022, 8, 12, 16, 14), 9 | valueIdentifier: 'textInput1', 10 | result: 'some witty input ', 11 | ); 12 | 13 | group('serialisation', () { 14 | test( 15 | 'should work with valid example', 16 | () async { 17 | final encodedResult = tResult.toJson(); 18 | final decodedResult = TextQuestionResult.fromJson(encodedResult); 19 | expect(tResult, decodedResult); 20 | }, 21 | ); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /test/src/result/question/time_question_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:survey_kit/survey_kit.dart'; 4 | 5 | void main() { 6 | final tResult = TimeQuestionResult( 7 | id: Identifier(id: 'example1'), 8 | startDate: DateTime(2022, 8, 12, 16, 4), 9 | endDate: DateTime(2022, 8, 12, 16, 14), 10 | valueIdentifier: 'timeInput1', 11 | result: TimeOfDay(hour: 14, minute: 59), 12 | ); 13 | 14 | group('serialisation', () { 15 | test( 16 | 'should work with valid example', 17 | () async { 18 | final encodedResult = tResult.toJson(); 19 | final decodedResult = TimeQuestionResult.fromJson(encodedResult); 20 | expect(tResult, decodedResult); 21 | }, 22 | ); 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /test/src/result/step/completion_step_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = CompletionStepResult( 6 | Identifier(id: 'example1'), 7 | DateTime(2022, 8, 12, 16, 4), 8 | DateTime(2022, 8, 12, 16, 14), 9 | ); 10 | 11 | group('serialisation', () { 12 | test( 13 | 'should work with valid example', 14 | () async { 15 | final encodedResult = tResult.toJson(); 16 | final decodedResult = CompletionStepResult.fromJson(encodedResult); 17 | expect(tResult, decodedResult); 18 | }, 19 | ); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /test/src/result/step/instruction_step_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final tResult = InstructionStepResult( 6 | Identifier(id: 'example1'), 7 | DateTime(2022, 8, 12, 16, 4), 8 | DateTime(2022, 8, 12, 16, 14), 9 | ); 10 | 11 | group('serialisation', () { 12 | test( 13 | 'should work with valid example', 14 | () async { 15 | final encodedResult = tResult.toJson(); 16 | final decodedResult = InstructionStepResult.fromJson(encodedResult); 17 | expect(tResult, decodedResult); 18 | }, 19 | ); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /test/src/result/step/video_step_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/src/result/step/video_step_result.dart'; 3 | import 'package:survey_kit/survey_kit.dart'; 4 | 5 | void main() { 6 | final tResult = VideoStepResult( 7 | id: Identifier(id: 'example1'), 8 | startDate: DateTime(2022, 8, 12, 16, 4), 9 | endDate: DateTime(2022, 8, 12, 16, 14), 10 | result: VideoResult( 11 | stayedInVideo: DateTime(2022, 8, 12, 16, 12, 30), 12 | leftVideoAt: Duration(minutes: 1, seconds: 13, milliseconds: 123), 13 | ), 14 | ); 15 | 16 | group('serialisation', () { 17 | test( 18 | 'should work with valid example', 19 | () async { 20 | final encodedResult = tResult.toJson(); 21 | final decodedResult = VideoStepResult.fromJson(encodedResult); 22 | expect(tResult, decodedResult); 23 | }, 24 | ); 25 | }); 26 | } 27 | -------------------------------------------------------------------------------- /test/src/survey/survey_result_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:survey_kit/survey_kit.dart'; 3 | 4 | void main() { 5 | final List tQuestionResults = ([ 6 | InstructionStepResult( 7 | Identifier(id: 'example1_intro'), 8 | DateTime(2022, 8, 12, 16, 4), 9 | DateTime(2022, 8, 12, 16, 5), 10 | ), 11 | BooleanQuestionResult( 12 | id: Identifier(id: 'example1_boolean'), 13 | startDate: DateTime(2022, 8, 12, 16, 5), 14 | endDate: DateTime(2022, 8, 12, 16, 10), 15 | valueIdentifier: 'bool1', 16 | result: BooleanResult.NEGATIVE, 17 | ), 18 | CompletionStepResult( 19 | Identifier(id: 'example1_completion'), 20 | DateTime(2022, 8, 12, 16, 10), 21 | DateTime(2022, 8, 12, 16, 14), 22 | ), 23 | ]); 24 | final tSurveyResult = SurveyResult( 25 | id: Identifier(id: 'example1'), 26 | startDate: DateTime(2022, 8, 12, 16, 4), 27 | endDate: DateTime(2022, 8, 12, 16, 14), 28 | finishReason: FinishReason.COMPLETED, 29 | results: [ 30 | StepResult( 31 | id: Identifier(id: 'example1_stepResult'), 32 | startDate: DateTime(2022, 8, 12, 16, 5), 33 | endDate: DateTime(2022, 8, 12, 16, 10), 34 | results: tQuestionResults, 35 | ), 36 | ], 37 | ); 38 | 39 | group('serialisation', () { 40 | test( 41 | 'should work with valid example', 42 | () async { 43 | final encodedResult = tSurveyResult.toJson(); 44 | final decodedResult = SurveyResult.fromJson(encodedResult); 45 | expect(tSurveyResult, decodedResult); 46 | }, 47 | ); 48 | }); 49 | } 50 | -------------------------------------------------------------------------------- /test/steps/identifier/identifier_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter_test/flutter_test.dart'; 4 | import 'package:survey_kit/survey_kit.dart'; 5 | 6 | void main() { 7 | test('identifier created by json is the same as created by code', () { 8 | final jsonStr = ''' 9 | { 10 | "id":"123" 11 | } 12 | '''; 13 | final jsonIdentifier = Identifier.fromJson(json.decode(jsonStr)); 14 | final identifier = Identifier(id: '123'); 15 | 16 | expect(identifier, jsonIdentifier); 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /test/steps/step_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter_test/flutter_test.dart'; 4 | import 'package:survey_kit/src/steps/identifier/step_identifier.dart'; 5 | import 'package:survey_kit/src/steps/predefined_steps/instruction_step.dart'; 6 | import 'package:survey_kit/src/steps/step.dart'; 7 | 8 | void main() { 9 | test('instruction step is the same created by json and code', () { 10 | final jsonStr = ''' 11 | { 12 | "stepIdentifier": { 13 | "id": "1" 14 | }, 15 | "type": "intro", 16 | "title": "Welcome to the\\nQuickBird Studios\\nHealth Survey", 17 | "text": "Get ready for a bunch of super random questions!", 18 | "buttonText": "Let's go!" 19 | } 20 | '''; 21 | final jsonStep = Step.fromJson(json.decode(jsonStr)); 22 | final step = InstructionStep( 23 | stepIdentifier: StepIdentifier(id: "1"), 24 | title: 'Welcome to the\nQuickBird Studios\nHealth Survey', 25 | text: 'Get ready for a bunch of super random questions!', 26 | buttonText: 'Let\'s go!', 27 | ); 28 | 29 | expect(step, jsonStep); 30 | }); 31 | 32 | test('throw step not defined exception of type is unvalid', () { 33 | final jsonStr = ''' 34 | { 35 | "stepIdentifier": { 36 | "id": "1" 37 | }, 38 | "type": "undefined", 39 | "title": "Welcome to the\\nQuickBird Studios\\nHealth Survey", 40 | "text": "Get ready for a bunch of super random questions!", 41 | "buttonText": "Let's go!" 42 | } 43 | '''; 44 | expect(() => Step.fromJson(json.decode(jsonStr)), throwsException); 45 | }); 46 | } 47 | -------------------------------------------------------------------------------- /test/task/navigable_task_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter_test/flutter_test.dart'; 4 | import 'package:survey_kit/survey_kit.dart'; 5 | 6 | void main() { 7 | test('navigable task created by json is the same as created via code', () { 8 | final jsonStr = ''' 9 | { 10 | "id": "123", 11 | "type": "navigable", 12 | "rules": [ 13 | { 14 | "type": "conditional", 15 | "triggerStepIdentifier": { 16 | "id": "123" 17 | }, 18 | "values": { 19 | "Yes": "321", 20 | "No": "456" 21 | } 22 | } 23 | ] 24 | } 25 | '''; 26 | final NavigableTask navigableTask = NavigableTask( 27 | id: TaskIdentifier(id: '123'), 28 | steps: [], 29 | ); 30 | navigableTask.addNavigationRule( 31 | forTriggerStepIdentifier: StepIdentifier(id: '123'), 32 | navigationRule: ConditionalNavigationRule( 33 | resultToStepIdentifierMapper: (input) { 34 | switch (input) { 35 | case "Yes": 36 | return StepIdentifier(id: '321'); 37 | case "No": 38 | return StepIdentifier(id: '456'); 39 | default: 40 | return null; 41 | } 42 | }, 43 | ), 44 | ); 45 | 46 | final navigableJsonTask = NavigableTask.fromJson(json.decode(jsonStr)); 47 | 48 | expect(navigableJsonTask, navigableTask); 49 | }); 50 | } 51 | -------------------------------------------------------------------------------- /test/task/ordered_task_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter_test/flutter_test.dart'; 4 | import 'package:survey_kit/survey_kit.dart'; 5 | 6 | void main() { 7 | test('ordered task created by json is the same as created via code', () { 8 | final jsonStr = ''' 9 | { 10 | "id": "123", 11 | "type": "ordered" 12 | } 13 | '''; 14 | final Task orderedTask = 15 | OrderedTask(id: TaskIdentifier(id: '123'), steps: []); 16 | 17 | final orderedJsonTask = OrderedTask.fromJson(json.decode(jsonStr)); 18 | 19 | expect(orderedTask, orderedJsonTask); 20 | }); 21 | } 22 | --------------------------------------------------------------------------------