├── .github
└── workflows
│ └── unit.yml
├── .gitignore
├── .metadata
├── .vscode
└── launch.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── analysis_options.yaml
├── example
├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── br
│ │ │ │ │ └── com
│ │ │ │ │ └── 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
├── example.md
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── .last_build_id
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── 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
├── lib
│ ├── counter
│ │ ├── counter_cube.dart
│ │ ├── counter_screen.dart
│ │ └── counter_screen_animation.dart
│ ├── counter_simple_cube
│ │ ├── counter_simple_cube.dart
│ │ └── counter_simple_cube_screen.dart
│ ├── counter_singleton
│ │ ├── counter_singleton_cube.dart
│ │ ├── counter_singleton_widget.dart
│ │ └── screen_counter_singleton.dart
│ ├── feedback_manager
│ │ ├── feedback_manager_cube.dart
│ │ └── feedback_manager_screen.dart
│ ├── main.dart
│ ├── pokemon
│ │ ├── pokemon_cube.dart
│ │ ├── pokemon_screen.dart
│ │ ├── repository
│ │ │ ├── model
│ │ │ │ └── pokemon.dart
│ │ │ └── pokemon_repository.dart
│ │ └── widgets
│ │ │ └── pokemon_item_widget.dart
│ ├── text_form_field
│ │ ├── text_form_field_cube.dart
│ │ └── text_form_field_screen.dart
│ └── todo
│ │ ├── todo_cube.dart
│ │ ├── todo_list.dart
│ │ └── todo_register.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
│ │ └── ephemeral
│ │ │ ├── Flutter-Generated.xcconfig
│ │ │ └── flutter_export_environment.sh
│ ├── 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
├── pubspec.lock
├── pubspec.yaml
├── test
│ ├── unit
│ │ ├── counter_test.dart
│ │ └── pokemon_test.dart
│ ├── util
│ │ └── robot.dart
│ └── widget
│ │ └── counter
│ │ ├── counter_widget_robot.dart
│ │ ├── counter_widget_test.dart
│ │ ├── failures
│ │ ├── counterScreen_isolatedDiff.png
│ │ ├── counterScreen_maskedDiff.png
│ │ ├── counterScreen_masterImage.png
│ │ └── counterScreen_testImage.png
│ │ └── golden_files
│ │ └── counterScreen.png
├── 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
├── lib
├── cubes.dart
└── src
│ ├── actions
│ ├── cube_action.dart
│ └── navigation_cube_action.dart
│ ├── cube.dart
│ ├── feedback_manager
│ ├── bottom_sheet_feedback_mixin.dart
│ ├── dialog_feedback_mixin.dart
│ ├── feedback_manager.dart
│ └── snackbar_feedback_mixin.dart
│ ├── injector
│ ├── get_it_injector.dart
│ └── injector.dart
│ ├── observable
│ ├── observable_list.dart
│ └── observable_value.dart
│ ├── util
│ ├── cube_navigation_mixin.dart
│ ├── cube_provider.dart
│ ├── debouncer.dart
│ ├── extensions
│ │ ├── bool_extensions.dart
│ │ ├── build_context_extensions.dart
│ │ ├── ext.dart
│ │ └── observable_value_extensions.dart
│ ├── functions.dart
│ └── state_mixin.dart
│ └── widgets
│ ├── animated_list_cube.dart
│ ├── cube_consumer.dart
│ ├── cube_widget.dart
│ ├── observer.dart
│ └── text_form_field.dart
├── media
├── example-folders.png
└── icon.png
├── pubspec.lock
├── pubspec.yaml
└── test
├── injector
└── get_it_injector_test.dart
├── observable
├── observable_list_test.dart
└── observable_value_test.dart
└── widgets
├── cube_builder
├── cube_builder_robot.dart
└── cube_builder_test.dart
├── cube_widget
├── cube_widget_robot.dart
└── cube_widget_test.dart
└── observer
├── observer_robot.dart
└── observer_test.dart
/.github/workflows/unit.yml:
--------------------------------------------------------------------------------
1 | name: unit-tests
2 | on:
3 | push:
4 | branches:
5 | - master
6 | pull_request:
7 | jobs:
8 | test:
9 | runs-on: ${{ matrix.os }}
10 | strategy:
11 | matrix:
12 | os: [ubuntu-18.04]
13 | steps:
14 | # Set up Flutter and add it to the path.
15 | - name: Clone Flutter repository with stable channel
16 | uses: actions/checkout@v2
17 | with:
18 | repository: 'flutter/flutter'
19 | ref: 'stable'
20 | path: 'flutter'
21 | fetch-depth: 0
22 | - name: Add Flutter to the PATH for Unix
23 | run: echo "$GITHUB_WORKSPACE/flutter/bin" >> $GITHUB_PATH
24 | - name: Run Flutter doctor
25 | run: flutter doctor -v
26 |
27 | # Clone the Gallery repository under `code`, to avoid conflicts with `flutter`.
28 | - uses: actions/checkout@v2
29 | with:
30 | path: 'code'
31 |
32 | # Run the tests for the repository.
33 | - run: flutter pub get
34 | working-directory: code
35 | - run: flutter analyze
36 | working-directory: code
37 | - run: flutter format --set-exit-if-changed --dry-run .
38 | working-directory: code
39 | - run: flutter test
40 | working-directory: code
41 |
--------------------------------------------------------------------------------
/.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 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | build/
32 |
33 | # Android related
34 | **/android/**/gradle-wrapper.jar
35 | **/android/.gradle
36 | **/android/captures/
37 | **/android/gradlew
38 | **/android/gradlew.bat
39 | **/android/local.properties
40 | **/android/**/GeneratedPluginRegistrant.java
41 |
42 | # iOS/XCode related
43 | **/ios/**/*.mode1v3
44 | **/ios/**/*.mode2v3
45 | **/ios/**/*.moved-aside
46 | **/ios/**/*.pbxuser
47 | **/ios/**/*.perspectivev3
48 | **/ios/**/*sync/
49 | **/ios/**/.sconsign.dblite
50 | **/ios/**/.tags*
51 | **/ios/**/.vagrant/
52 | **/ios/**/DerivedData/
53 | **/ios/**/Icon?
54 | **/ios/**/Pods/
55 | **/ios/**/.symlinks/
56 | **/ios/**/profile
57 | **/ios/**/xcuserdata
58 | **/ios/.generated/
59 | **/ios/Flutter/App.framework
60 | **/ios/Flutter/Flutter.framework
61 | **/ios/Flutter/Flutter.podspec
62 | **/ios/Flutter/Generated.xcconfig
63 | **/ios/Flutter/app.flx
64 | **/ios/Flutter/app.zip
65 | **/ios/Flutter/flutter_assets/
66 | **/ios/Flutter/flutter_export_environment.sh
67 | **/ios/ServiceDefinitions.json
68 | **/ios/Runner/GeneratedPluginRegistrant.*
69 |
70 | # Exceptions to above rules.
71 | !**/ios/**/default.mode1v3
72 | !**/ios/**/default.mode2v3
73 | !**/ios/**/default.pbxuser
74 | !**/ios/**/default.perspectivev3
75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
76 |
--------------------------------------------------------------------------------
/.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: 8af6b2f038c1172e61d418869363a28dffec3cb4
8 | channel: stable
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "cube",
9 | "request": "launch",
10 | "type": "dart"
11 | },
12 | {
13 | "name": "cube (profile mode)",
14 | "request": "launch",
15 | "type": "dart",
16 | "flutterMode": "profile"
17 | },
18 | {
19 | "name": "cube (release mode)",
20 | "request": "launch",
21 | "type": "dart",
22 | "flutterMode": "release"
23 | },
24 | {
25 | "name": "example",
26 | "cwd": "example",
27 | "request": "launch",
28 | "type": "dart"
29 | },
30 | {
31 | "name": "example (profile mode)",
32 | "cwd": "example",
33 | "request": "launch",
34 | "type": "dart",
35 | "flutterMode": "profile"
36 | },
37 | {
38 | "name": "example (release mode)",
39 | "cwd": "example",
40 | "request": "launch",
41 | "type": "dart",
42 | "flutterMode": "release"
43 | }
44 | ]
45 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Rafaelbarbosatec
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.
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | analyzer:
2 | plugins:
3 | - dart_code_metrics
4 |
5 | dart_code_metrics:
6 | anti-patterns:
7 | - long-method
8 | - long-parameter-list
9 | metrics:
10 | cyclomatic-complexity: 20
11 | lines-of-executable-code: 50
12 | maximum-nesting-level: 5
13 | number-of-parameters: 5
14 | source-lines-of-code: 50
15 | metrics-exclude:
16 | - tests/**
17 | rules:
18 | - newline-before-return
19 | - no-boolean-literal-compare
20 | - no-empty-block
21 | - prefer-trailing-comma
22 | - prefer-conditional-expressions
23 | - no-equal-then-else
--------------------------------------------------------------------------------
/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 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | /build/
32 |
33 | # Web related
34 | lib/generated_plugin_registrant.dart
35 |
36 | # Symbolication related
37 | app.*.symbols
38 |
39 | # Obfuscation related
40 | app.*.map.json
41 |
42 | # Exceptions to above rules.
43 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
44 |
--------------------------------------------------------------------------------
/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.
5 |
6 | version:
7 | revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
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: fb57da5f945d02ef4f98dfd9409a72b7cce74268
17 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
18 | - platform: android
19 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
20 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
21 | - platform: ios
22 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
23 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
24 | - platform: linux
25 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
26 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
27 | - platform: macos
28 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
29 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
30 | - platform: web
31 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
32 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
33 | - platform: windows
34 | create_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
35 | base_revision: fb57da5f945d02ef4f98dfd9409a72b7cce74268
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 | # examplecube
2 |
3 | Example
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/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | #include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/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/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion flutter.compileSdkVersion
30 | ndkVersion flutter.ndkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "br.com.example"
48 | // You can update the following values to match your application needs.
49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50 | minSdkVersion flutter.minSdkVersion
51 | targetSdkVersion flutter.targetSdkVersion
52 | versionCode flutterVersionCode.toInteger()
53 | versionName flutterVersionName
54 | }
55 |
56 | buildTypes {
57 | release {
58 | // TODO: Add your own signing config for the release build.
59 | // Signing with the debug keys for now, so `flutter run --release` works.
60 | signingConfig signingConfigs.debug
61 | }
62 | }
63 | }
64 |
65 | flutter {
66 | source '../..'
67 | }
68 |
69 | dependencies {
70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
71 | }
72 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/br/com/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package br.com.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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
--------------------------------------------------------------------------------
/example/ios/Flutter/.last_build_id:
--------------------------------------------------------------------------------
1 | d3de83d5ad881213c5a73fe73b1dece2
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
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 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/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.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/LaunchScreen.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 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/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 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | examplecube
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 | NSAppTransportSecurity
45 |
46 | NSAllowsArbitraryLoads
47 |
48 |
49 | CADisableMinimumFrameDurationOnPhone
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/lib/counter/counter_cube.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 | import 'package:flutter/src/widgets/framework.dart';
3 |
4 | class MsgAction extends CubeAction {
5 | final String? text;
6 |
7 | MsgAction({this.text});
8 |
9 | @override
10 | String toString() {
11 | return 'MsgAction{text: $text}';
12 | }
13 |
14 | @override
15 | void onExecute(BuildContext context) {
16 | print(this);
17 | }
18 | }
19 |
20 | class CounterCube extends Cube {
21 | final bool withDebounce;
22 | final count = 0.obs;
23 |
24 | CounterCube({this.withDebounce = true});
25 |
26 | @override
27 | Future onReady(Object? arguments) {
28 | // do anythings when view is ready
29 | return super.onReady(arguments);
30 | }
31 |
32 | void increment() {
33 | count.modify((value) => value + 1);
34 | if (count.value == 5) {
35 | sendAction(MsgAction(text: "count five")); // to send action to view
36 | }
37 |
38 | if (count.value == 50) {
39 | sendAction(
40 | MsgAction(text: "You are clicking too much o.O"),
41 | ); // to send action to view
42 | }
43 |
44 | if (withDebounce) {
45 | runDebounce(
46 | 'increment',
47 | () => print(count.value),
48 | duration: Duration(seconds: 1),
49 | );
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/example/lib/counter/counter_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 | import 'package:examplecube/counter/counter_cube.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | class CounterScreen extends StatelessWidget {
6 | @visibleForTesting
7 | static const KEY_FLOATING_BUTTON = Key('CounterScreen.KEY_FLOATING_BUTTON');
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return CubeConsumer(
12 | builder: (BuildContext context, CounterCube cube) {
13 | return Scaffold(
14 | appBar: AppBar(
15 | title: Text('counter'),
16 | ),
17 | body: Center(
18 | child: Column(
19 | mainAxisAlignment: MainAxisAlignment.center,
20 | children: [
21 | Text('You have pushed the button this many times:'),
22 | cube.count.build(
23 | (value) => Text(value.toString()),
24 | ),
25 | ],
26 | ),
27 | ),
28 | floatingActionButton: FloatingActionButton(
29 | key: KEY_FLOATING_BUTTON,
30 | onPressed: cube.increment,
31 | tooltip: 'Increment',
32 | child: Icon(Icons.add),
33 | ), // This trailing comma makes auto-formatting nicer for build methods.
34 | );
35 | },
36 | );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/example/lib/counter/counter_screen_animation.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 | import 'package:examplecube/counter/counter_cube.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | class CounterScreenWithAnimation extends StatefulWidget {
6 | @override
7 | _CounterScreenWithAnimationState createState() =>
8 | _CounterScreenWithAnimationState();
9 | }
10 |
11 | class _CounterScreenWithAnimationState extends State
12 | with
13 | CubeStateMixin,
14 | TickerProviderStateMixin {
15 | late AnimationController _controller;
16 | late CurvedAnimation _curveAnimation;
17 |
18 | @override
19 | void initState() {
20 | _controller = AnimationController(
21 | vsync: this,
22 | duration: Duration(seconds: 1),
23 | );
24 | _curveAnimation = CurvedAnimation(
25 | parent: _controller,
26 | curve: Curves.bounceOut,
27 | );
28 | super.initState();
29 | _controller.forward();
30 | }
31 |
32 | @override
33 | void dispose() {
34 | _controller.dispose();
35 | super.dispose();
36 | }
37 |
38 | @override
39 | Widget build(BuildContext context) {
40 | return Scaffold(
41 | appBar: AppBar(
42 | title: Text('Cube with animation'),
43 | ),
44 | body: ScaleTransition(
45 | scale: _curveAnimation,
46 | child: Center(
47 | child: Column(
48 | mainAxisAlignment: MainAxisAlignment.center,
49 | children: [
50 | Text('description_counter'),
51 | cube.count.build((value) {
52 | return Text(value.toString());
53 | }),
54 | ],
55 | ),
56 | ),
57 | ),
58 | floatingActionButton: FloatingActionButton(
59 | onPressed: cube.increment,
60 | tooltip: 'Increment',
61 | child: Icon(Icons.add),
62 | ), // This trailing comma makes auto-formatting nicer for build methods.
63 | );
64 | }
65 |
66 | @override
67 | void onAction(CubeAction action) {
68 | print('onAction: $action');
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/example/lib/counter_simple_cube/counter_simple_cube.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 |
3 | class CounterSimpleCube extends SimpleCube {
4 | final count = 0.obs;
5 |
6 | void increment() {
7 | count.modify((value) => value + 1);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/lib/counter_simple_cube/counter_simple_cube_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 | import 'package:examplecube/counter_simple_cube/counter_simple_cube.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | class CounterSimpleCubeScreen extends StatefulWidget {
6 | const CounterSimpleCubeScreen({Key? key}) : super(key: key);
7 |
8 | @override
9 | _CounterSimpleCubeScreenState createState() =>
10 | _CounterSimpleCubeScreenState();
11 | }
12 |
13 | class _CounterSimpleCubeScreenState extends State {
14 | late CounterSimpleCube cube;
15 |
16 | @override
17 | void initState() {
18 | cube = inject();
19 | super.initState();
20 | }
21 |
22 | @override
23 | void dispose() {
24 | cube.dispose();
25 | super.dispose();
26 | }
27 |
28 | @override
29 | Widget build(BuildContext context) {
30 | return Scaffold(
31 | appBar: AppBar(
32 | title: Text('counter'),
33 | ),
34 | body: Center(
35 | child: Column(
36 | mainAxisAlignment: MainAxisAlignment.center,
37 | children: [
38 | Text('description_counter'),
39 | cube.count.build(
40 | (value) => Text(value.toString()),
41 | ),
42 | ],
43 | ),
44 | ),
45 | floatingActionButton: FloatingActionButton(
46 | onPressed: cube.increment,
47 | tooltip: 'Increment',
48 | child: Icon(Icons.add),
49 | ), // This trailing comma makes auto-formatting nicer for build methods.
50 | );
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/example/lib/counter_singleton/counter_singleton_cube.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 |
3 | class CounterSingletonCube extends Cube {
4 | final count = 0.obs;
5 |
6 | void increment() => count.modify((value) => value + 1);
7 | }
8 |
--------------------------------------------------------------------------------
/example/lib/counter_singleton/counter_singleton_widget.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:cubes/cubes.dart';
4 | import 'package:examplecube/counter_singleton/counter_singleton_cube.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | class CounterSingletonWidget extends CubeWidget {
8 | @override
9 | Widget buildView(BuildContext context, CounterSingletonCube cube) {
10 | return Scaffold(
11 | body: Center(
12 | child: Column(
13 | mainAxisAlignment: MainAxisAlignment.center,
14 | children: [
15 | Text('You have pushed the button this many times:'),
16 | SizedBox(
17 | height: 20,
18 | ),
19 | cube.count.build((value) {
20 | return Text(value.toString());
21 | }),
22 | ],
23 | ),
24 | ),
25 | floatingActionButton: FloatingActionButton(
26 | heroTag: Random().nextInt(1000),
27 | onPressed: cube.increment,
28 | tooltip: 'Increment',
29 | child: Icon(Icons.add),
30 | ), // This trailing comma makes auto-formatting nicer for build methods.
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/example/lib/counter_singleton/screen_counter_singleton.dart:
--------------------------------------------------------------------------------
1 | import 'package:examplecube/counter_singleton/counter_singleton_widget.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | class ScreenCounterSingleton extends StatelessWidget {
5 | @override
6 | Widget build(BuildContext context) {
7 | return Scaffold(
8 | appBar: AppBar(
9 | title: Text('singleton'),
10 | ),
11 | body: Column(
12 | children: [
13 | Expanded(
14 | child: Row(
15 | children: [
16 | Expanded(child: CounterSingletonWidget()),
17 | Expanded(child: CounterSingletonWidget()),
18 | ],
19 | ),
20 | ),
21 | Expanded(
22 | child: Row(
23 | children: [
24 | Expanded(child: CounterSingletonWidget()),
25 | Expanded(child: CounterSingletonWidget()),
26 | ],
27 | ),
28 | ),
29 | ],
30 | ),
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/example/lib/feedback_manager/feedback_manager_cube.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 |
3 | class FeedbackManagerCube extends Cube {
4 | final dialogControl = CFeedBackControl().obs;
5 | final bottomSheetControl = CFeedBackControl().obs;
6 | final snackBarControl = CFeedBackControl().obs;
7 |
8 | void showDialogPer3Seconds() async {
9 | if (dialogControl.value.show) return;
10 | dialogControl.show(data: 'Dialog Example\n\nawait 3 seconds');
11 | await Future.delayed(Duration(seconds: 3));
12 | dialogControl.hide();
13 | }
14 |
15 | void showBottomSheetPer3Seconds() async {
16 | if (bottomSheetControl.value.show) return;
17 | bottomSheetControl.show(data: 'BottomSheet Example\n\nawait 3 seconds');
18 | await Future.delayed(Duration(seconds: 3));
19 | bottomSheetControl.hide();
20 | }
21 |
22 | void showSnackBar() {
23 | snackBarControl.show(data: 'SnackBar Example');
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/example/lib/feedback_manager/feedback_manager_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 | import 'package:examplecube/feedback_manager/feedback_manager_cube.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | class FeedbackManagerScreen extends CubeWidget {
6 | @override
7 | Widget buildView(BuildContext context, FeedbackManagerCube cube) {
8 | return Scaffold(
9 | appBar: AppBar(
10 | title: Text('FeedBackManager'),
11 | ),
12 | body: CFeedBackManager(
13 | dialogControllers: [
14 | CDialogController(
15 | observable: cube.dialogControl,
16 | dismissible: false,
17 | builder: (data, context) => Center(
18 | child: Card(
19 | child: Padding(
20 | padding: const EdgeInsets.all(20.0),
21 | child: Text(data),
22 | ),
23 | ),
24 | ),
25 | ),
26 | ],
27 | bottomSheetControllers: [
28 | CBottomSheetController(
29 | dismissible: false,
30 | observable: cube.bottomSheetControl,
31 | builder: (data, context) => Container(
32 | height: 200,
33 | child: Center(
34 | child: Text(data),
35 | ),
36 | ),
37 | ),
38 | ],
39 | snackBarControllers: [
40 | CSnackBarController(
41 | observable: cube.snackBarControl,
42 | builder: (data, context) => SnackBar(content: Text(data)),
43 | ),
44 | ],
45 | child: _buildContent(cube),
46 | ),
47 | );
48 | }
49 |
50 | Widget _buildContent(FeedbackManagerCube cube) {
51 | return Center(
52 | child: Column(
53 | mainAxisSize: MainAxisSize.min,
54 | children: [
55 | ElevatedButton(
56 | child: Text('Show dialog per 3 seconds'),
57 | onPressed: cube.showDialogPer3Seconds,
58 | ),
59 | SizedBox(
60 | height: 20,
61 | ),
62 | ElevatedButton(
63 | child: Text('Show bottomSheet per 3 seconds'),
64 | onPressed: cube.showBottomSheetPer3Seconds,
65 | ),
66 | SizedBox(
67 | height: 20,
68 | ),
69 | ElevatedButton(
70 | child: Text('Show snackBar'),
71 | onPressed: cube.showSnackBar,
72 | ),
73 | ],
74 | ),
75 | );
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/example/lib/pokemon/pokemon_cube.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:cubes/cubes.dart';
4 | import 'package:examplecube/pokemon/repository/model/pokemon.dart';
5 | import 'package:examplecube/pokemon/repository/pokemon_repository.dart';
6 |
7 | class PokemonCube extends Cube {
8 | static const LIMIT_PAGE = 20;
9 | final PokemonRepository repository;
10 |
11 | PokemonCube(this.repository);
12 |
13 | final list = [].obs;
14 | final progress = false.obs;
15 | final snackBarController = CFeedBackControl().obs;
16 |
17 | @override
18 | Future onReady(Object? arguments) {
19 | fetchPokemonList();
20 | return super.onReady(arguments);
21 | }
22 |
23 | void fetchPokemonList({bool isMore = false}) {
24 | if (progress.value) return;
25 | int page = 0;
26 | if (isMore) {
27 | page = (list.length ~/ LIMIT_PAGE) + 1;
28 | }
29 | progress.value = true;
30 | repository.getPokemonList(page: page, limit: LIMIT_PAGE)?.then((value) {
31 | if (isMore) {
32 | list.addAll(value);
33 | } else {
34 | list.value = value;
35 | }
36 | }).catchError((error) {
37 | snackBarController.show(data: error.toString());
38 | }).whenComplete(() => progress.value = false);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/example/lib/pokemon/pokemon_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 | import 'package:examplecube/pokemon/pokemon_cube.dart';
3 | import 'package:examplecube/pokemon/repository/model/pokemon.dart';
4 | import 'package:examplecube/pokemon/widgets/pokemon_item_widget.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | class PokemonScreen extends CubeWidget {
8 | @override
9 | Widget buildView(BuildContext context, PokemonCube cube) {
10 | return Scaffold(
11 | appBar: AppBar(
12 | title: Text('Pokemons with CubeWidget'),
13 | ),
14 | body: CFeedBackManager(
15 | snackBarControllers: [
16 | CSnackBarController(
17 | observable: cube.snackBarController,
18 | builder: (value, context) => SnackBar(content: Text(value)),
19 | ),
20 | ],
21 | child: Stack(
22 | children: [
23 | cube.list.build>(
24 | (data) {
25 | return ListView.builder(
26 | itemCount: data.length,
27 | itemBuilder: (context, index) {
28 | if (index >= data.length - 3) {
29 | cube.fetchPokemonList(isMore: true);
30 | }
31 |
32 | return PokemonItemWidget(
33 | item: data[index],
34 | );
35 | },
36 | );
37 | },
38 | ),
39 | cube.progress.build(
40 | (value) => value.conditional(
41 | match: Center(child: CircularProgressIndicator()),
42 | ),
43 | animate: true,
44 | ),
45 | ],
46 | ),
47 | ),
48 | );
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/example/lib/pokemon/repository/model/pokemon.dart:
--------------------------------------------------------------------------------
1 | class Pokemon {
2 | List? abilities;
3 | String? detailPageURL;
4 | double? weight;
5 | List? weakness;
6 | String? number;
7 | int? height;
8 | String? collectiblesSlug;
9 | String? featured;
10 | String? slug;
11 | String? description;
12 | String? name;
13 | String? thumbnailAltText;
14 | String? thumbnailImage;
15 | int? id;
16 | List? type;
17 |
18 | Pokemon({
19 | this.abilities,
20 | this.detailPageURL,
21 | this.weight,
22 | this.weakness,
23 | this.number,
24 | this.height,
25 | this.collectiblesSlug,
26 | this.featured,
27 | this.slug,
28 | this.description,
29 | this.name,
30 | this.thumbnailAltText,
31 | this.thumbnailImage,
32 | this.id,
33 | this.type,
34 | });
35 |
36 | Pokemon.fromJson(Map json) {
37 | abilities = json['abilities'].cast();
38 | detailPageURL = json['detailPageURL'];
39 | weight = json['weight'].toDouble();
40 | weakness = json['weakness'].cast();
41 | number = json['number'];
42 | height = json['height'];
43 | collectiblesSlug = json['collectibles_slug'];
44 | featured = json['featured'];
45 | slug = json['slug'];
46 | description = json['description'];
47 | name = json['name'];
48 | thumbnailAltText = json['thumbnailAltText'];
49 | thumbnailImage = json['thumbnailImage'];
50 | id = json['id'];
51 | type = json['type'].cast();
52 | }
53 |
54 | Map toJson() {
55 | final Map data = Map();
56 | data['abilities'] = this.abilities;
57 | data['detailPageURL'] = this.detailPageURL;
58 | data['weight'] = this.weight;
59 | data['weakness'] = this.weakness;
60 | data['number'] = this.number;
61 | data['height'] = this.height;
62 | data['collectibles_slug'] = this.collectiblesSlug;
63 | data['featured'] = this.featured;
64 | data['slug'] = this.slug;
65 | data['description'] = this.description;
66 | data['name'] = this.name;
67 | data['thumbnailAltText'] = this.thumbnailAltText;
68 | data['thumbnailImage'] = this.thumbnailImage;
69 | data['id'] = this.id;
70 | data['type'] = this.type;
71 |
72 | return data;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/example/lib/pokemon/repository/pokemon_repository.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:examplecube/pokemon/repository/model/pokemon.dart';
4 | import 'package:flutter/foundation.dart';
5 | import 'package:http/http.dart' as http;
6 |
7 | class PokemonRepository {
8 | Future>? getPokemonList({int page = 0, int limit = 20}) {
9 | String paramLimit = '';
10 | paramLimit = '&limit=$limit';
11 | String CORS = '';
12 | if (kIsWeb) {
13 | CORS = 'https://cors-anywhere.herokuapp.com/';
14 | }
15 |
16 | return http
17 | .get(
18 | Uri.parse(
19 | '${CORS}http://104.131.18.84/pokemon?page=$page$paramLimit',
20 | ),
21 | )
22 | .then(
23 | (response) {
24 | return jsonDecode(response.body)['data']
25 | .map((item) => Pokemon.fromJson(item))
26 | .toList();
27 | },
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/example/lib/pokemon/widgets/pokemon_item_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:examplecube/pokemon/repository/model/pokemon.dart';
2 | import 'package:flutter/foundation.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | class PokemonItemWidget extends StatefulWidget {
6 | final Pokemon? item;
7 |
8 | final Function(Pokemon?)? onClick;
9 |
10 | const PokemonItemWidget({Key? key, this.item, this.onClick})
11 | : super(key: key);
12 | @override
13 | _PokemonItemWidgetState createState() => _PokemonItemWidgetState();
14 | }
15 |
16 | class _PokemonItemWidgetState extends State
17 | with TickerProviderStateMixin {
18 | late AnimationController _controller;
19 | late Animation _animationSlide;
20 |
21 | @override
22 | void initState() {
23 | _controller =
24 | AnimationController(vsync: this, duration: Duration(seconds: 1));
25 | _animationSlide =
26 | Tween(begin: Offset(2.0, 0.0), end: Offset(0.0, 0.0)).animate(
27 | CurvedAnimation(
28 | parent: _controller,
29 | curve: Curves.decelerate,
30 | ),
31 | );
32 | _controller.forward(from: 0.0);
33 | super.initState();
34 | }
35 |
36 | @override
37 | Widget build(BuildContext context) {
38 | return SlideTransition(
39 | position: _animationSlide,
40 | child: Container(
41 | margin: const EdgeInsets.all(5.0),
42 | child: Card(
43 | child: _getListTile(),
44 | ),
45 | ),
46 | );
47 | }
48 |
49 | ListTile _getListTile() {
50 | return ListTile(
51 | contentPadding: const EdgeInsets.all(10),
52 | leading: _getLeadingWidget(widget.item!.thumbnailImage!),
53 | title: _getTittleWidget(widget.item!.name!),
54 | subtitle: Text(
55 | widget.item!.description!,
56 | maxLines: 3,
57 | ),
58 | onTap: () {
59 | if (widget.onClick != null) {
60 | widget.onClick!(widget.item);
61 | }
62 | },
63 | );
64 | }
65 |
66 | Widget _getLeadingWidget(String url) {
67 | return Container(
68 | width: 50,
69 | height: 50,
70 | child: Image.network(_getUrl(url)),
71 | );
72 | }
73 |
74 | Widget _getTittleWidget(String name) {
75 | return Padding(
76 | padding: const EdgeInsets.only(bottom: 10),
77 | child: Text(
78 | name,
79 | style: TextStyle(fontWeight: FontWeight.bold),
80 | ),
81 | );
82 | }
83 |
84 | @override
85 | void dispose() {
86 | _controller.dispose();
87 | super.dispose();
88 | }
89 |
90 | String _getUrl(String url) {
91 | String CORS = '';
92 | if (kIsWeb) {
93 | CORS = 'https://cors-anywhere.herokuapp.com/';
94 | }
95 |
96 | return '$CORS$url';
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/example/lib/text_form_field/text_form_field_cube.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 |
3 | class TextFormFieldCube extends Cube {
4 | final textFieldControl = CTextFormFieldControl.empty().obs;
5 |
6 | void cleanText() {
7 | textFieldControl.text = '';
8 | }
9 |
10 | void changeText() {
11 | textFieldControl.text = 'Change Text';
12 | }
13 |
14 | void setError() {
15 | textFieldControl.error = 'error example';
16 | }
17 |
18 | void enable() {
19 | textFieldControl.enable = true;
20 | }
21 |
22 | void disable() {
23 | textFieldControl.enable = false;
24 | }
25 |
26 | void changeObscureText() {
27 | textFieldControl.enableObscureText = !textFieldControl.enableObscureText;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/example/lib/text_form_field/text_form_field_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 | import 'package:examplecube/text_form_field/text_form_field_cube.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | class TextFormFieldScreen extends CubeWidget {
6 | @override
7 | Widget buildView(BuildContext context, TextFormFieldCube cube) {
8 | return Scaffold(
9 | appBar: AppBar(
10 | title: Text('CTexFormField'),
11 | ),
12 | body: Center(
13 | child: Padding(
14 | padding: const EdgeInsets.all(20.0),
15 | child: Column(
16 | mainAxisSize: MainAxisSize.min,
17 | children: [
18 | CTextFormField(
19 | observable: cube.textFieldControl,
20 | decoration: InputDecoration(hintText: 'Digite algo'),
21 | obscureTextButtonConfiguration: CObscureTextButtonConfiguration(
22 | show: true,
23 | align: CObscureTextAlign.right,
24 | iconHide: Icon(Icons.visibility_off_outlined),
25 | iconShow: Icon(Icons.visibility_outlined),
26 | ),
27 | ),
28 | SizedBox(
29 | height: 100,
30 | ),
31 | _buildButtons(cube),
32 | ],
33 | ),
34 | ),
35 | ),
36 | );
37 | }
38 |
39 | Widget _buildButtons(TextFormFieldCube cube) {
40 | return Wrap(
41 | children: [
42 | ElevatedButton(
43 | child: Text('Clean text'),
44 | onPressed: cube.cleanText,
45 | ),
46 | SizedBox(width: 10),
47 | ElevatedButton(
48 | child: Text('Change text'),
49 | onPressed: cube.changeText,
50 | ),
51 | SizedBox(width: 10),
52 | ElevatedButton(
53 | child: Text('Set error'),
54 | onPressed: cube.setError,
55 | ),
56 | SizedBox(width: 10),
57 | ElevatedButton(child: Text('enable'), onPressed: cube.enable),
58 | SizedBox(width: 10),
59 | ElevatedButton(
60 | child: Text('disable'),
61 | onPressed: cube.disable,
62 | ),
63 | SizedBox(width: 10),
64 | ElevatedButton(
65 | child: Text('change obscureText'),
66 | onPressed: cube.changeObscureText,
67 | ),
68 | ],
69 | );
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/example/lib/todo/todo_cube.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 |
3 | class TodoCube extends Cube with CubeNavigation {
4 | final todoList = ['first TODO', 'second TODO'].obs;
5 |
6 | void addTodo(String todo) => todoList.add(todo);
7 |
8 | void delete(String todo) => todoList.remove(todo);
9 | }
10 |
--------------------------------------------------------------------------------
/example/lib/todo/todo_list.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 | import 'package:examplecube/todo/todo_cube.dart';
3 | import 'package:examplecube/todo/todo_register.dart';
4 | import 'package:flutter/material.dart';
5 |
6 | class TodoList extends CubeWidget {
7 | @override
8 | Widget buildView(BuildContext context, TodoCube cube) {
9 | return Scaffold(
10 | appBar: AppBar(
11 | title: Text('Todo List'),
12 | ),
13 | body: CAnimatedList(
14 | observable: cube.todoList,
15 | itemBuilder: (context, item, animation, type) {
16 | // ignore: prefer-conditional-expressions
17 | if (type == TypeAnimationListEnum.add) {
18 | return ScaleTransition(
19 | scale: animation,
20 | child: _buildItem(item, cube),
21 | );
22 | } else {
23 | return SizeTransition(
24 | sizeFactor: animation,
25 | child: _buildItem(item, cube),
26 | );
27 | }
28 | },
29 | ),
30 | floatingActionButton: FloatingActionButton(
31 | onPressed: () => _navToRegister(context),
32 | tooltip: 'Increment',
33 | child: Icon(Icons.add),
34 | ), //
35 | );
36 | }
37 |
38 | Widget _buildItem(String text, TodoCube cube) {
39 | return Card(
40 | margin: const EdgeInsets.symmetric(
41 | horizontal: 10,
42 | vertical: 5,
43 | ),
44 | child: Container(
45 | padding: const EdgeInsets.all(15),
46 | child: Row(
47 | children: [
48 | Expanded(child: Text(text)),
49 | IconButton(
50 | icon: Icon(
51 | Icons.delete,
52 | color: Colors.red,
53 | ),
54 | onPressed: () {
55 | cube.delete(text);
56 | },
57 | ),
58 | ],
59 | ),
60 | ),
61 | );
62 | }
63 |
64 | void _navToRegister(BuildContext context) {
65 | Navigator.push(
66 | context,
67 | MaterialPageRoute(builder: (context) => TodoRegister()),
68 | );
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/example/lib/todo/todo_register.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 | import 'package:examplecube/todo/todo_cube.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | class TodoRegister extends CubeWidget {
6 | final formKey = GlobalKey();
7 | final textEditingController = TextEditingController();
8 |
9 | @override
10 | Widget buildView(BuildContext context, TodoCube cube) {
11 | return Scaffold(
12 | appBar: AppBar(
13 | title: Text('Todo register'),
14 | ),
15 | body: Form(
16 | key: formKey,
17 | child: Card(
18 | margin: const EdgeInsets.all(10),
19 | child: Padding(
20 | padding: const EdgeInsets.all(20.0),
21 | child: Column(
22 | mainAxisSize: MainAxisSize.min,
23 | children: [
24 | TextFormField(
25 | controller: textEditingController,
26 | decoration: InputDecoration(hintText: 'todo'),
27 | validator: (value) {
28 | if (value!.isEmpty) {
29 | return 'Required field';
30 | }
31 |
32 | return null;
33 | },
34 | ),
35 | SizedBox(
36 | height: 20,
37 | ),
38 | SizedBox(
39 | width: double.maxFinite,
40 | child: ElevatedButton(
41 | style: ButtonStyle(
42 | backgroundColor:
43 | MaterialStateProperty.all(context.theme.primaryColor),
44 | ),
45 | child: Text('Save'),
46 | onPressed: () {
47 | if (formKey.currentState!.validate()) {
48 | cube.addTodo(textEditingController.text);
49 | context.pop(textEditingController.text);
50 | }
51 | },
52 | ),
53 | ),
54 | ],
55 | ),
56 | ),
57 | ),
58 | ),
59 | );
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/example/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.10)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 |
12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
13 | # which isn't available in 3.10.
14 | function(list_prepend LIST_NAME PREFIX)
15 | set(NEW_LIST "")
16 | foreach(element ${${LIST_NAME}})
17 | list(APPEND NEW_LIST "${PREFIX}${element}")
18 | endforeach(element)
19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
20 | endfunction()
21 |
22 | # === Flutter Library ===
23 | # System-level dependencies.
24 | find_package(PkgConfig REQUIRED)
25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
28 |
29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
30 |
31 | # Published to parent scope for install step.
32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
36 |
37 | list(APPEND FLUTTER_LIBRARY_HEADERS
38 | "fl_basic_message_channel.h"
39 | "fl_binary_codec.h"
40 | "fl_binary_messenger.h"
41 | "fl_dart_project.h"
42 | "fl_engine.h"
43 | "fl_json_message_codec.h"
44 | "fl_json_method_codec.h"
45 | "fl_message_codec.h"
46 | "fl_method_call.h"
47 | "fl_method_channel.h"
48 | "fl_method_codec.h"
49 | "fl_method_response.h"
50 | "fl_plugin_registrar.h"
51 | "fl_plugin_registry.h"
52 | "fl_standard_message_codec.h"
53 | "fl_standard_method_codec.h"
54 | "fl_string_codec.h"
55 | "fl_value.h"
56 | "fl_view.h"
57 | "flutter_linux.h"
58 | )
59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
60 | add_library(flutter INTERFACE)
61 | target_include_directories(flutter INTERFACE
62 | "${EPHEMERAL_DIR}"
63 | )
64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
65 | target_link_libraries(flutter INTERFACE
66 | PkgConfig::GTK
67 | PkgConfig::GLIB
68 | PkgConfig::GIO
69 | )
70 | add_dependencies(flutter flutter_assemble)
71 |
72 | # === Flutter tool backend ===
73 | # _phony_ is a non-existent file to force this command to run every time,
74 | # since currently there's no way to get a full input/output list from the
75 | # flutter tool.
76 | add_custom_command(
77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
79 | COMMAND ${CMAKE_COMMAND} -E env
80 | ${FLUTTER_TOOL_ENVIRONMENT}
81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
83 | VERBATIM
84 | )
85 | add_custom_target(flutter_assemble DEPENDS
86 | "${FLUTTER_LIBRARY}"
87 | ${FLUTTER_LIBRARY_HEADERS}
88 | )
89 |
--------------------------------------------------------------------------------
/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 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/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 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/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.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | #include
4 | #ifdef GDK_WINDOWING_X11
5 | #include
6 | #endif
7 |
8 | #include "flutter/generated_plugin_registrant.h"
9 |
10 | struct _MyApplication {
11 | GtkApplication parent_instance;
12 | char** dart_entrypoint_arguments;
13 | };
14 |
15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
16 |
17 | // Implements GApplication::activate.
18 | static void my_application_activate(GApplication* application) {
19 | MyApplication* self = MY_APPLICATION(application);
20 | GtkWindow* window =
21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
22 |
23 | // Use a header bar when running in GNOME as this is the common style used
24 | // by applications and is the setup most users will be using (e.g. Ubuntu
25 | // desktop).
26 | // If running on X and not using GNOME then just use a traditional title bar
27 | // in case the window manager does more exotic layout, e.g. tiling.
28 | // If running on Wayland assume the header bar will work (may need changing
29 | // if future cases occur).
30 | gboolean use_header_bar = TRUE;
31 | #ifdef GDK_WINDOWING_X11
32 | GdkScreen* screen = gtk_window_get_screen(window);
33 | if (GDK_IS_X11_SCREEN(screen)) {
34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
36 | use_header_bar = FALSE;
37 | }
38 | }
39 | #endif
40 | if (use_header_bar) {
41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
42 | gtk_widget_show(GTK_WIDGET(header_bar));
43 | gtk_header_bar_set_title(header_bar, "example");
44 | gtk_header_bar_set_show_close_button(header_bar, TRUE);
45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
46 | } else {
47 | gtk_window_set_title(window, "example");
48 | }
49 |
50 | gtk_window_set_default_size(window, 1280, 720);
51 | gtk_widget_show(GTK_WIDGET(window));
52 |
53 | g_autoptr(FlDartProject) project = fl_dart_project_new();
54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
55 |
56 | FlView* view = fl_view_new(project);
57 | gtk_widget_show(GTK_WIDGET(view));
58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
59 |
60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view));
61 |
62 | gtk_widget_grab_focus(GTK_WIDGET(view));
63 | }
64 |
65 | // Implements GApplication::local_command_line.
66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
67 | MyApplication* self = MY_APPLICATION(application);
68 | // Strip out the first argument as it is the binary name.
69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
70 |
71 | g_autoptr(GError) error = nullptr;
72 | if (!g_application_register(application, nullptr, &error)) {
73 | g_warning("Failed to register: %s", error->message);
74 | *exit_status = 1;
75 | return TRUE;
76 | }
77 |
78 | g_application_activate(application);
79 | *exit_status = 0;
80 |
81 | return TRUE;
82 | }
83 |
84 | // Implements GObject::dispose.
85 | static void my_application_dispose(GObject* object) {
86 | MyApplication* self = MY_APPLICATION(object);
87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
89 | }
90 |
91 | static void my_application_class_init(MyApplicationClass* klass) {
92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate;
93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
95 | }
96 |
97 | static void my_application_init(MyApplication* self) {}
98 |
99 | MyApplication* my_application_new() {
100 | return MY_APPLICATION(g_object_new(my_application_get_type(),
101 | "application-id", APPLICATION_ID,
102 | "flags", G_APPLICATION_NON_UNIQUE,
103 | nullptr));
104 | }
105 |
--------------------------------------------------------------------------------
/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 | **/xcuserdata/
7 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 |
9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10 | }
11 |
--------------------------------------------------------------------------------
/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig:
--------------------------------------------------------------------------------
1 | // This is a generated file; do not edit or check into version control.
2 | FLUTTER_ROOT=/Users/rafaelbarbosa/flutter
3 | FLUTTER_APPLICATION_PATH=/Users/rafaelbarbosa/Documents/MyProjects/cube/example
4 | COCOAPODS_PARALLEL_CODE_SIGN=true
5 | FLUTTER_TARGET=/Users/rafaelbarbosa/Documents/MyProjects/cube/example/lib/main.dart
6 | FLUTTER_BUILD_DIR=build
7 | FLUTTER_BUILD_NAME=1.0.0
8 | FLUTTER_BUILD_NUMBER=1
9 | DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==
10 | DART_OBFUSCATION=false
11 | TRACK_WIDGET_CREATION=true
12 | TREE_SHAKE_ICONS=false
13 | PACKAGE_CONFIG=/Users/rafaelbarbosa/Documents/MyProjects/cube/example/.dart_tool/package_config.json
14 |
--------------------------------------------------------------------------------
/example/macos/Flutter/ephemeral/flutter_export_environment.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This is a generated file; do not edit or check into version control.
3 | export "FLUTTER_ROOT=/Users/rafaelbarbosa/flutter"
4 | export "FLUTTER_APPLICATION_PATH=/Users/rafaelbarbosa/Documents/MyProjects/cube/example"
5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true"
6 | export "FLUTTER_TARGET=/Users/rafaelbarbosa/Documents/MyProjects/cube/example/lib/main.dart"
7 | export "FLUTTER_BUILD_DIR=build"
8 | export "FLUTTER_BUILD_NAME=1.0.0"
9 | export "FLUTTER_BUILD_NUMBER=1"
10 | export "DART_DEFINES=Zmx1dHRlci5pbnNwZWN0b3Iuc3RydWN0dXJlZEVycm9ycz10cnVl,RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
11 | export "DART_OBFUSCATION=false"
12 | export "TRACK_WIDGET_CREATION=true"
13 | export "TREE_SHAKE_ICONS=false"
14 | export "PACKAGE_CONFIG=/Users/rafaelbarbosa/Documents/MyProjects/cube/example/.dart_tool/package_config.json"
15 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
64 |
65 |
71 |
73 |
79 |
80 |
81 |
82 |
84 |
85 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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 | @NSApplicationMain
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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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 = br.com.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2021 br.com. 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 | com.apple.security.network.client
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/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 | NSAppTransportSecurity
32 |
33 | NSAllowsArbitraryLoads
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
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/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: examplecube
2 | description: Example
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 1.0.0+1
19 |
20 | environment:
21 | sdk: '>=2.12.0 <3.0.0'
22 |
23 | dependencies:
24 | flutter:
25 | sdk: flutter
26 |
27 | cubes:
28 | path: ../
29 | http: ^0.13.0
30 | mockito: ^5.0.1
31 |
32 | dev_dependencies:
33 | flutter_test:
34 | sdk: flutter
35 |
36 | # For information on the generic Dart part of this file, see the
37 | # following page: https://dart.dev/tools/pub/pubspec
38 |
39 | # The following section is specific to Flutter.
40 | flutter:
41 |
42 | # The following line ensures that the Material Icons font is
43 | # included with your application, so that you can use the icons in
44 | # the material Icons class.
45 | uses-material-design: true
46 |
47 | # To add assets to your application, add an assets section, like this:
48 | # assets:
49 | # - lang/
50 |
51 | # An image asset can refer to one or more resolution-specific "variants", see
52 | # https://flutter.dev/assets-and-images/#resolution-aware.
53 |
54 | # For details regarding adding assets from package dependencies, see
55 | # https://flutter.dev/assets-and-images/#from-packages
56 |
57 | # To add custom fonts to your application, add a fonts section here,
58 | # in this "flutter" section. Each entry in this list should have a
59 | # "family" key with the font family name, and a "fonts" key with a
60 | # list giving the asset and other descriptors for the font. For
61 | # example:
62 | # fonts:
63 | # - family: Schyler
64 | # fonts:
65 | # - asset: fonts/Schyler-Regular.ttf
66 | # - asset: fonts/Schyler-Italic.ttf
67 | # style: italic
68 | # - family: Trajan Pro
69 | # fonts:
70 | # - asset: fonts/TrajanPro.ttf
71 | # - asset: fonts/TrajanPro_Bold.ttf
72 | # weight: 700
73 | #
74 | # For details regarding fonts from package dependencies,
75 | # see https://flutter.dev/custom-fonts/#from-packages
76 |
--------------------------------------------------------------------------------
/example/test/unit/counter_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget tests.
2 | //
3 | // To perform an interaction with a widget in your tests, 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:examplecube/counter/counter_cube.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | void main() {
12 | late CounterCube cube;
13 | setUp(() {
14 | cube = CounterCube();
15 | });
16 |
17 | tearDown(() {
18 | cube.dispose();
19 | });
20 | test('initial value', () {
21 | expect(cube.count.value, 0);
22 | });
23 |
24 | test('increment value', () {
25 | cube.increment();
26 | expect(cube.count.value, 1);
27 | });
28 |
29 | test('increment value 3 times', () {
30 | cube.increment();
31 | cube.increment();
32 | cube.increment();
33 | expect(cube.count.value, 3);
34 | });
35 | }
36 |
--------------------------------------------------------------------------------
/example/test/unit/pokemon_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:examplecube/pokemon/pokemon_cube.dart';
2 | import 'package:examplecube/pokemon/repository/model/pokemon.dart';
3 | import 'package:examplecube/pokemon/repository/pokemon_repository.dart';
4 | import 'package:flutter_test/flutter_test.dart';
5 | import 'package:mockito/mockito.dart';
6 |
7 | class MockPokemonRepository extends Mock implements PokemonRepository {}
8 |
9 | void main() {
10 | late MockPokemonRepository repository;
11 | late PokemonCube cube;
12 | setUp(() {
13 | repository = MockPokemonRepository();
14 | cube = PokemonCube(repository);
15 | });
16 |
17 | tearDown(() {
18 | cube.dispose();
19 | });
20 |
21 | test('initial value', () {
22 | expect(cube.list.value, []);
23 | expect(cube.progress.value, false);
24 | });
25 |
26 | test('load pokémons', () async {
27 | final List mockList = [
28 | Pokemon(),
29 | Pokemon(),
30 | Pokemon(),
31 | Pokemon(),
32 | Pokemon(),
33 | ];
34 |
35 | when(
36 | repository.getPokemonList(),
37 | ).thenAnswer((_) => Future.value(mockList));
38 |
39 | await cube.onReady(null);
40 |
41 | expect(cube.list.value, isA>());
42 | expect(cube.list.value, mockList);
43 | expect(cube.progress.value, false);
44 | });
45 | }
46 |
--------------------------------------------------------------------------------
/example/test/util/robot.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_test/flutter_test.dart';
3 |
4 | ///
5 | /// Created by
6 | ///
7 | /// ─▄▀─▄▀
8 | /// ──▀──▀
9 | /// █▀▀▀▀▀█▄
10 | /// █░░░░░█─█
11 | /// ▀▄▄▄▄▄▀▀
12 | ///
13 | /// Rafaelbarbosatec
14 | /// on 03/09/21
15 |
16 | class CubeRobotMaterialAppParams {
17 | final ThemeData? themeData;
18 | final ThemeData? darkTheme;
19 | final ThemeMode? themeMode;
20 | final Locale? locale;
21 | final Iterable>? localizationsDelegates;
22 | final Iterable? supportedLocales;
23 |
24 | CubeRobotMaterialAppParams({
25 | this.themeData,
26 | this.themeMode,
27 | this.darkTheme,
28 | this.localizationsDelegates,
29 | this.supportedLocales,
30 | this.locale,
31 | });
32 | }
33 |
34 | abstract class Robot {
35 | static const SIZE_DEVICE_DEFAULT = Size(1440, 2560);
36 | final WidgetTester tester;
37 |
38 | Robot(this.tester);
39 |
40 | Future widgetSetup(
41 | Widget widget, {
42 | Duration? awaitAnimation,
43 | Size? sizeScreen,
44 | CubeRobotMaterialAppParams? materialAppParams,
45 | }) async {
46 | tester.binding.window.physicalSizeTestValue =
47 | sizeScreen ?? SIZE_DEVICE_DEFAULT;
48 | await tester.pumpWidget(
49 | MaterialApp(
50 | home: widget,
51 | theme: materialAppParams?.themeData,
52 | localizationsDelegates: materialAppParams?.localizationsDelegates,
53 | supportedLocales:
54 | materialAppParams?.supportedLocales ?? [Locale('en', 'US')],
55 | darkTheme: materialAppParams?.darkTheme,
56 | themeMode: materialAppParams?.themeMode,
57 | locale: materialAppParams?.locale,
58 | debugShowCheckedModeBanner: false,
59 | ),
60 | );
61 |
62 | await awaitForAnimations(duration: awaitAnimation);
63 | }
64 |
65 | Future awaitForAnimations({Duration? duration}) async {
66 | try {
67 | await tester.pumpAndSettle(duration ?? Duration(milliseconds: 300));
68 | } catch (e) {
69 | await tester.pump(duration);
70 | }
71 | }
72 |
73 | Future takeSnapshot(String filename) {
74 | return expectLater(
75 | find.byType(MaterialApp),
76 | matchesGoldenFile('./golden_files/$filename.png'),
77 | );
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/example/test/widget/counter/counter_widget_robot.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/cubes.dart';
2 | import 'package:examplecube/counter/counter_cube.dart';
3 | import 'package:examplecube/counter/counter_screen.dart';
4 | import 'package:flutter_test/flutter_test.dart';
5 |
6 | import '../../util/robot.dart';
7 |
8 | class CounterWidgetRobot extends Robot {
9 | CounterWidgetRobot(WidgetTester tester) : super(tester);
10 |
11 | Future setup() async {
12 | _setupInjections();
13 |
14 | await widgetSetup(
15 | CounterScreen(),
16 | );
17 | }
18 |
19 | void _setupInjections() {
20 | Cubes.resetInjector();
21 | Cubes.registerFactory((i) => CounterCube(withDebounce: false));
22 | }
23 |
24 | Finder get buttonIncrement {
25 | return find.byKey(CounterScreen.KEY_FLOATING_BUTTON);
26 | }
27 |
28 | void assetText() {
29 | final finder = find.text('You have pushed the button this many times:');
30 | expect(finder, findsOneWidget);
31 | }
32 |
33 | void assetValue0() {
34 | final finder = find.text('0');
35 | expect(finder, findsOneWidget);
36 | }
37 |
38 | void assetValue3() {
39 | final finder = find.text('3');
40 | expect(finder, findsOneWidget);
41 | }
42 |
43 | Future clickIncrement() async {
44 | await tester.tap(buttonIncrement);
45 | await awaitForAnimations();
46 | }
47 |
48 | Future assetSnapshotScreen() {
49 | return takeSnapshot('counterScreen');
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/example/test/widget/counter/counter_widget_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_test/flutter_test.dart';
2 |
3 | import 'counter_widget_robot.dart';
4 |
5 | void main() {
6 | testWidgets('Should load Screen', (WidgetTester tester) async {
7 | final robot = CounterWidgetRobot(tester);
8 | await robot.setup();
9 | await robot.assetSnapshotScreen();
10 | });
11 |
12 | testWidgets('Should increment counter when click in button',
13 | (WidgetTester tester) async {
14 | final robot = CounterWidgetRobot(tester);
15 | await robot.setup();
16 | robot.assetText();
17 | robot.assetValue0();
18 | await robot.clickIncrement();
19 | await robot.clickIncrement();
20 | await robot.clickIncrement();
21 | robot.assetValue3();
22 | });
23 | }
24 |
--------------------------------------------------------------------------------
/example/test/widget/counter/failures/counterScreen_isolatedDiff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/test/widget/counter/failures/counterScreen_isolatedDiff.png
--------------------------------------------------------------------------------
/example/test/widget/counter/failures/counterScreen_maskedDiff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/test/widget/counter/failures/counterScreen_maskedDiff.png
--------------------------------------------------------------------------------
/example/test/widget/counter/failures/counterScreen_masterImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/test/widget/counter/failures/counterScreen_masterImage.png
--------------------------------------------------------------------------------
/example/test/widget/counter/failures/counterScreen_testImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/test/widget/counter/failures/counterScreen_testImage.png
--------------------------------------------------------------------------------
/example/test/widget/counter/golden_files/counterScreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/test/widget/counter/golden_files/counterScreen.png
--------------------------------------------------------------------------------
/example/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/web/favicon.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/example/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/example/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | example
30 |
31 |
32 |
33 |
36 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/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 | }
24 |
--------------------------------------------------------------------------------
/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/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # Project-level configuration.
2 | cmake_minimum_required(VERSION 3.14)
3 | project(example LANGUAGES CXX)
4 |
5 | # The name of the executable created for the application. Change this to change
6 | # the on-disk name of your application.
7 | set(BINARY_NAME "example")
8 |
9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent
10 | # versions of CMake.
11 | cmake_policy(SET CMP0063 NEW)
12 |
13 | # Define build configuration option.
14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
15 | if(IS_MULTICONFIG)
16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
17 | CACHE STRING "" FORCE)
18 | else()
19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
20 | set(CMAKE_BUILD_TYPE "Debug" CACHE
21 | STRING "Flutter build mode" FORCE)
22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
23 | "Debug" "Profile" "Release")
24 | endif()
25 | endif()
26 | # Define settings for the Profile build mode.
27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
31 |
32 | # Use Unicode for all projects.
33 | add_definitions(-DUNICODE -D_UNICODE)
34 |
35 | # Compilation settings that should be applied to most targets.
36 | #
37 | # Be cautious about adding new options here, as plugins use this function by
38 | # default. In most cases, you should add new options to specific targets instead
39 | # of modifying this function.
40 | function(APPLY_STANDARD_SETTINGS TARGET)
41 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
43 | target_compile_options(${TARGET} PRIVATE /EHsc)
44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
46 | endfunction()
47 |
48 | # Flutter library and tool build rules.
49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
50 | add_subdirectory(${FLUTTER_MANAGED_DIR})
51 |
52 | # Application build; see runner/CMakeLists.txt.
53 | add_subdirectory("runner")
54 |
55 | # Generated plugin build rules, which manage building the plugins and adding
56 | # them to the application.
57 | include(flutter/generated_plugins.cmake)
58 |
59 |
60 | # === Installation ===
61 | # Support files are copied into place next to the executable, so that it can
62 | # run in place. This is done instead of making a separate bundle (as on Linux)
63 | # so that building and running from within Visual Studio will work.
64 | set(BUILD_BUNDLE_DIR "$")
65 | # Make the "install" step default, as it's required to run.
66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
69 | endif()
70 |
71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
73 |
74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
75 | COMPONENT Runtime)
76 |
77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
78 | COMPONENT Runtime)
79 |
80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
81 | COMPONENT Runtime)
82 |
83 | if(PLUGIN_BUNDLED_LIBRARIES)
84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
86 | COMPONENT Runtime)
87 | endif()
88 |
89 | # Fully re-copy the assets directory on each build to avoid having stale files
90 | # from a previous install.
91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
92 | install(CODE "
93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
94 | " COMPONENT Runtime)
95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
97 |
98 | # Install the AOT library on non-Debug builds only.
99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
100 | CONFIGURATIONS Profile;Release
101 | COMPONENT Runtime)
102 |
--------------------------------------------------------------------------------
/example/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # This file controls Flutter-level build steps. It should not be edited.
2 | cmake_minimum_required(VERSION 3.14)
3 |
4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
5 |
6 | # Configuration provided via flutter tool.
7 | include(${EPHEMERAL_DIR}/generated_config.cmake)
8 |
9 | # TODO: Move the rest of this into files in ephemeral. See
10 | # https://github.com/flutter/flutter/issues/57146.
11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
12 |
13 | # === Flutter Library ===
14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
15 |
16 | # Published to parent scope for install step.
17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
21 |
22 | list(APPEND FLUTTER_LIBRARY_HEADERS
23 | "flutter_export.h"
24 | "flutter_windows.h"
25 | "flutter_messenger.h"
26 | "flutter_plugin_registrar.h"
27 | "flutter_texture_registrar.h"
28 | )
29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
30 | add_library(flutter INTERFACE)
31 | target_include_directories(flutter INTERFACE
32 | "${EPHEMERAL_DIR}"
33 | )
34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
35 | add_dependencies(flutter flutter_assemble)
36 |
37 | # === Wrapper ===
38 | list(APPEND CPP_WRAPPER_SOURCES_CORE
39 | "core_implementations.cc"
40 | "standard_codec.cc"
41 | )
42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
44 | "plugin_registrar.cc"
45 | )
46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
47 | list(APPEND CPP_WRAPPER_SOURCES_APP
48 | "flutter_engine.cc"
49 | "flutter_view_controller.cc"
50 | )
51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
52 |
53 | # Wrapper sources needed for a plugin.
54 | add_library(flutter_wrapper_plugin STATIC
55 | ${CPP_WRAPPER_SOURCES_CORE}
56 | ${CPP_WRAPPER_SOURCES_PLUGIN}
57 | )
58 | apply_standard_settings(flutter_wrapper_plugin)
59 | set_target_properties(flutter_wrapper_plugin PROPERTIES
60 | POSITION_INDEPENDENT_CODE ON)
61 | set_target_properties(flutter_wrapper_plugin PROPERTIES
62 | CXX_VISIBILITY_PRESET hidden)
63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
64 | target_include_directories(flutter_wrapper_plugin PUBLIC
65 | "${WRAPPER_ROOT}/include"
66 | )
67 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
68 |
69 | # Wrapper sources needed for the runner.
70 | add_library(flutter_wrapper_app STATIC
71 | ${CPP_WRAPPER_SOURCES_CORE}
72 | ${CPP_WRAPPER_SOURCES_APP}
73 | )
74 | apply_standard_settings(flutter_wrapper_app)
75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
76 | target_include_directories(flutter_wrapper_app PUBLIC
77 | "${WRAPPER_ROOT}/include"
78 | )
79 | add_dependencies(flutter_wrapper_app flutter_assemble)
80 |
81 | # === Flutter tool backend ===
82 | # _phony_ is a non-existent file to force this command to run every time,
83 | # since currently there's no way to get a full input/output list from the
84 | # flutter tool.
85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
87 | add_custom_command(
88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
90 | ${CPP_WRAPPER_SOURCES_APP}
91 | ${PHONY_OUTPUT}
92 | COMMAND ${CMAKE_COMMAND} -E env
93 | ${FLUTTER_TOOL_ENVIRONMENT}
94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
95 | windows-x64 $
96 | VERBATIM
97 | )
98 | add_custom_target(flutter_assemble DEPENDS
99 | "${FLUTTER_LIBRARY}"
100 | ${FLUTTER_LIBRARY_HEADERS}
101 | ${CPP_WRAPPER_SOURCES_CORE}
102 | ${CPP_WRAPPER_SOURCES_PLUGIN}
103 | ${CPP_WRAPPER_SOURCES_APP}
104 | )
105 |
--------------------------------------------------------------------------------
/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 |
10 | void RegisterPlugins(flutter::PluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/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 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/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 | # Disable Windows macros that collide with C++ standard library functions.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
25 |
26 | # Add dependency libraries and include directories. Add any application-specific
27 | # dependencies here.
28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
30 |
31 | # Run the Flutter tool portions of the build. This must not be removed.
32 | add_dependencies(${BINARY_NAME} flutter_assemble)
33 |
--------------------------------------------------------------------------------
/example/windows/runner/Runner.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #pragma code_page(65001)
4 | #include "resource.h"
5 |
6 | #define APSTUDIO_READONLY_SYMBOLS
7 | /////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Generated from the TEXTINCLUDE 2 resource.
10 | //
11 | #include "winres.h"
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 | #undef APSTUDIO_READONLY_SYMBOLS
15 |
16 | /////////////////////////////////////////////////////////////////////////////
17 | // English (United States) resources
18 |
19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_APP_ICON ICON "resources\\app_icon.ico"
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | #ifdef FLUTTER_BUILD_NUMBER
64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0
67 | #endif
68 |
69 | #ifdef FLUTTER_BUILD_NAME
70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME
71 | #else
72 | #define VERSION_AS_STRING "1.0.0"
73 | #endif
74 |
75 | VS_VERSION_INFO VERSIONINFO
76 | FILEVERSION VERSION_AS_NUMBER
77 | PRODUCTVERSION VERSION_AS_NUMBER
78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
79 | #ifdef _DEBUG
80 | FILEFLAGS VS_FF_DEBUG
81 | #else
82 | FILEFLAGS 0x0L
83 | #endif
84 | FILEOS VOS__WINDOWS32
85 | FILETYPE VFT_APP
86 | FILESUBTYPE 0x0L
87 | BEGIN
88 | BLOCK "StringFileInfo"
89 | BEGIN
90 | BLOCK "040904e4"
91 | BEGIN
92 | VALUE "CompanyName", "br.com" "\0"
93 | VALUE "FileDescription", "example" "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "example" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2022 br.com. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "example.exe" "\0"
98 | VALUE "ProductName", "example" "\0"
99 | VALUE "ProductVersion", VERSION_AS_STRING "\0"
100 | END
101 | END
102 | BLOCK "VarFileInfo"
103 | BEGIN
104 | VALUE "Translation", 0x409, 1252
105 | END
106 | END
107 |
108 | #endif // English (United States) resources
109 | /////////////////////////////////////////////////////////////////////////////
110 |
111 |
112 |
113 | #ifndef APSTUDIO_INVOKED
114 | /////////////////////////////////////////////////////////////////////////////
115 | //
116 | // Generated from the TEXTINCLUDE 3 resource.
117 | //
118 |
119 |
120 | /////////////////////////////////////////////////////////////////////////////
121 | #endif // not APSTUDIO_INVOKED
122 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 | return true;
30 | }
31 |
32 | void FlutterWindow::OnDestroy() {
33 | if (flutter_controller_) {
34 | flutter_controller_ = nullptr;
35 | }
36 |
37 | Win32Window::OnDestroy();
38 | }
39 |
40 | LRESULT
41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
42 | WPARAM const wparam,
43 | LPARAM const lparam) noexcept {
44 | // Give Flutter, including plugins, an opportunity to handle window messages.
45 | if (flutter_controller_) {
46 | std::optional result =
47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
48 | lparam);
49 | if (result) {
50 | return *result;
51 | }
52 | }
53 |
54 | switch (message) {
55 | case WM_FONTCHANGE:
56 | flutter_controller_->engine()->ReloadSystemFonts();
57 | break;
58 | }
59 |
60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
61 | }
62 |
--------------------------------------------------------------------------------
/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.CreateAndShow(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/RafaelBarbosatec/cube/15022fb1356a96da0213eda62f4140cfaca0b4bc/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 | std::string utf8_string;
52 | if (target_length == 0 || target_length > utf8_string.max_size()) {
53 | return utf8_string;
54 | }
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/windows/runner/win32_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_WIN32_WINDOW_H_
2 | #define RUNNER_WIN32_WINDOW_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be
11 | // inherited from by classes that wish to specialize with custom
12 | // rendering and input handling
13 | class Win32Window {
14 | public:
15 | struct Point {
16 | unsigned int x;
17 | unsigned int y;
18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {}
19 | };
20 |
21 | struct Size {
22 | unsigned int width;
23 | unsigned int height;
24 | Size(unsigned int width, unsigned int height)
25 | : width(width), height(height) {}
26 | };
27 |
28 | Win32Window();
29 | virtual ~Win32Window();
30 |
31 | // Creates and shows a win32 window with |title| and position and size using
32 | // |origin| and |size|. New windows are created on the default monitor. Window
33 | // sizes are specified to the OS in physical pixels, hence to ensure a
34 | // consistent size to will treat the width height passed in to this function
35 | // as logical pixels and scale to appropriate for the default monitor. Returns
36 | // true if the window was created successfully.
37 | bool CreateAndShow(const std::wstring& title,
38 | const Point& origin,
39 | const Size& size);
40 |
41 | // Release OS resources associated with window.
42 | void Destroy();
43 |
44 | // Inserts |content| into the window tree.
45 | void SetChildContent(HWND content);
46 |
47 | // Returns the backing Window handle to enable clients to set icon and other
48 | // window properties. Returns nullptr if the window has been destroyed.
49 | HWND GetHandle();
50 |
51 | // If true, closing this window will quit the application.
52 | void SetQuitOnClose(bool quit_on_close);
53 |
54 | // Return a RECT representing the bounds of the current client area.
55 | RECT GetClientArea();
56 |
57 | protected:
58 | // Processes and route salient window messages for mouse handling,
59 | // size change and DPI. Delegates handling of these to member overloads that
60 | // inheriting classes can handle.
61 | virtual LRESULT MessageHandler(HWND window,
62 | UINT const message,
63 | WPARAM const wparam,
64 | LPARAM const lparam) noexcept;
65 |
66 | // Called when CreateAndShow is called, allowing subclass window-related
67 | // setup. Subclasses should return false if setup fails.
68 | virtual bool OnCreate();
69 |
70 | // Called when Destroy is called.
71 | virtual void OnDestroy();
72 |
73 | private:
74 | friend class WindowClassRegistrar;
75 |
76 | // OS callback called by message pump. Handles the WM_NCCREATE message which
77 | // is passed when the non-client area is being created and enables automatic
78 | // non-client DPI scaling so that the non-client area automatically
79 | // responsponds to changes in DPI. All other messages are handled by
80 | // MessageHandler.
81 | static LRESULT CALLBACK WndProc(HWND const window,
82 | UINT const message,
83 | WPARAM const wparam,
84 | LPARAM const lparam) noexcept;
85 |
86 | // Retrieves a class instance pointer for |window|
87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept;
88 |
89 | bool quit_on_close_ = false;
90 |
91 | // window handle for top level window.
92 | HWND window_handle_ = nullptr;
93 |
94 | // window handle for hosted content.
95 | HWND child_content_ = nullptr;
96 | };
97 |
98 | #endif // RUNNER_WIN32_WINDOW_H_
99 |
--------------------------------------------------------------------------------
/lib/cubes.dart:
--------------------------------------------------------------------------------
1 | library cube;
2 |
3 | import 'package:flutter/widgets.dart';
4 |
5 | import 'src/cube.dart';
6 | import 'src/injector/get_it_injector.dart';
7 | import 'src/injector/injector.dart';
8 | import 'src/util/cube_provider.dart';
9 |
10 | export 'package:cubes/src/actions/cube_action.dart';
11 | export 'package:cubes/src/cube.dart';
12 | export 'package:cubes/src/feedback_manager/feedback_manager.dart';
13 | export 'package:cubes/src/injector/injector.dart';
14 | export 'package:cubes/src/observable/observable_list.dart';
15 | export 'package:cubes/src/observable/observable_value.dart';
16 | export 'package:cubes/src/util/cube_navigation_mixin.dart';
17 | export 'package:cubes/src/util/cube_provider.dart';
18 | export 'package:cubes/src/util/extensions/ext.dart';
19 | export 'package:cubes/src/util/functions.dart';
20 | export 'package:cubes/src/util/state_mixin.dart';
21 | export 'package:cubes/src/widgets/animated_list_cube.dart';
22 | export 'package:cubes/src/widgets/cube_consumer.dart';
23 | export 'package:cubes/src/widgets/cube_widget.dart';
24 | export 'package:cubes/src/widgets/text_form_field.dart';
25 |
26 | /// Core of the package where you will have useful functions and settings
27 | class Cubes {
28 | /// instance of the Cubes
29 | static final Cubes _instance = Cubes._internal();
30 | CInjector _injector = GetItInjector();
31 |
32 | Cubes._internal();
33 |
34 | /// Factory to get instance of the Cubes
35 | factory Cubes() {
36 | return _instance;
37 | }
38 |
39 | /// Use to get dependency registered
40 | static T get({String? dependencyName}) {
41 | return _instance._injector.get(dependencyName: dependencyName);
42 | }
43 |
44 | /// Use to get dependency registered by async
45 | static Future getAsync({String? dependencyName}) {
46 | return _instance._injector.getAsync(dependencyName: dependencyName);
47 | }
48 |
49 | /// Method used to register dependency by lazy
50 | static void registerLazySingleton(
51 | CDependencyInjectorBuilder builder, {
52 | String? dependencyName,
53 | }) {
54 | _instance._injector.registerLazySingleton(
55 | builder,
56 | dependencyName: dependencyName,
57 | );
58 | }
59 |
60 | /// Method used to register dependency by factory
61 | static void registerFactory(
62 | CDependencyInjectorBuilder builder, {
63 | String? dependencyName,
64 | }) {
65 | _instance._injector.registerFactory(
66 | builder,
67 | dependencyName: dependencyName,
68 | );
69 | }
70 |
71 | /// Method used to register singleton dependency
72 | static void registerSingleton(
73 | T value, {
74 | String? dependencyName,
75 | }) {
76 | _instance._injector.registerSingleton(
77 | value,
78 | dependencyName: dependencyName,
79 | );
80 | }
81 |
82 | static void registerSingletonAsync(
83 | CDependencyInjectorAsyncBuilder builder, {
84 | String? dependencyName,
85 | }) {
86 | _instance._injector.registerSingletonAsync(
87 | builder,
88 | dependencyName: dependencyName,
89 | );
90 | }
91 |
92 | static void registerFactoryAsync(
93 | CDependencyInjectorAsyncBuilder builder, {
94 | String? dependencyName,
95 | }) {
96 | _instance._injector.registerFactoryAsync(
97 | builder,
98 | dependencyName: dependencyName,
99 | );
100 | }
101 |
102 | /// Use to reset injector
103 | static void resetInjector() => _instance._injector.reset();
104 |
105 | /// Use to get injector
106 | CInjector get injector => _instance._injector;
107 |
108 | /// Use to register your on Injector
109 | set injector(CInjector injector) => _instance._injector = injector;
110 |
111 | /// Use to get Cube registered in de Widget tree.
112 | static C? of(BuildContext context) {
113 | return context.dependOnInheritedWidgetOfExactType>()?.cube;
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/lib/src/actions/cube_action.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/widgets.dart';
2 |
3 | ///
4 | /// Created by
5 | ///
6 | /// ─▄▀─▄▀
7 | /// ──▀──▀
8 | /// █▀▀▀▀▀█▄
9 | /// █░░░░░█─█
10 | /// ▀▄▄▄▄▄▀▀
11 | ///
12 | /// Rafaelbarbosatec
13 | /// on 14/02/22
14 | /// Base to Actions
15 |
16 | abstract class CubeAction {
17 | /// When the action is sent he will are executed per this method
18 | // ignore: no-empty-block
19 | void onExecute(BuildContext context) {}
20 | }
21 |
--------------------------------------------------------------------------------
/lib/src/actions/navigation_cube_action.dart:
--------------------------------------------------------------------------------
1 | import 'package:cubes/src/actions/cube_action.dart';
2 | import 'package:cubes/src/util/extensions/ext.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | ///
6 | /// Created by
7 | ///
8 | /// ─▄▀─▄▀
9 | /// ──▀──▀
10 | /// █▀▀▀▀▀█▄
11 | /// █░░░░░█─█
12 | /// ▀▄▄▄▄▄▀▀
13 | ///
14 | /// Rafaelbarbosatec
15 | /// on 14/02/22
16 |
17 | enum NavigationType {
18 | pushNamed,
19 | pushNamedAndRemoveUntil,
20 | pushReplacementNamed,
21 | pop,
22 | }
23 |
24 | class NavigationCubeAction extends CubeAction {
25 | final String? routeName;
26 | final Object? arguments;
27 | final RouteSettings? settings;
28 | final bool fullscreenDialog;
29 | final RoutePredicate? predicate;
30 | final NavigationType type;
31 | final Object? result;
32 | final ValueChanged