├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── documentation_update.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE │ ├── bug_fix.md │ ├── documentation_update.md │ └── new_feature.md └── workflows │ ├── check_issue.yaml │ ├── main.yml │ ├── new_issues_label.yml │ ├── new_pull_request_label.yml │ ├── new_pull_request_main_actions.yml │ └── publish_to_pub.yml ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── CONTRIBUTING.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 │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── drawable-v21 │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── values-night │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── 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 │ └── main.dart ├── pubspec.yaml └── web │ ├── favicon.png │ ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json ├── lib ├── render_metrics.dart └── src │ ├── data │ ├── comparison_diff.dart │ ├── coords_metrics.dart │ └── render_data.dart │ ├── manager │ ├── render_manager.dart │ └── render_parameters_manager.dart │ └── render │ └── render_metrics.dart ├── pubspec.yaml └── test ├── comparison_diff_test.dart ├── render_data_test.dart ├── render_metrics_test.dart ├── render_parameters_manager_test.dart └── test_utils.dart /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Something is wrong with Flutter Render Metrics. 4 | title: "[BUG] " 5 | labels: bug 6 | --- 7 | 8 | ## Expected behavior 9 | 10 | 11 | ## Actual behavior 12 | 13 | 14 | ## Video/Screenshot 15 | 16 | 17 | ## Steps to reproduce 18 | 24 | 25 | ## Details 26 | Flutter version: 27 | 28 | Dart version: 29 | 30 | Platform: 31 | 32 | ## Logs and stacktrace 33 | 36 | 37 | ## Any possible solutions 38 | 42 | 43 | ## What did you try to solve 44 | 48 | 49 | ## Checklist for self-check 50 | - [ ] Added expected and actual behavior. 51 | - [ ] Added video or screenshot of bug. 52 | - [ ] Added isolated way to reproduce the bug. 53 | - [ ] Specified Flutter, Dart version and platforms. 54 | - [ ] Attached error code and logs. 55 | - [ ] All unspecified fields in the Issue description deleted. 56 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation_update.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation update 3 | about: Fixing a problem or improve in an existing docs page. 4 | labels: documentation 5 | assignees: MbIXjkee 6 | --- 7 | 8 | 12 | 13 | ## Describe what scenario you think is uncovered by the existing examples / articles 14 | 15 | A clear and concise description of the problem that you want explained. 16 | 17 | ## Describe why existing examples / articles do not cover this case 18 | 19 | Explain which examples / articles you have seen before making this request, and 20 | why they did not help you with your problem. 21 | 22 | ## Additional context 23 | 24 | Add any other context or screenshots about the documentation request here. 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: I'd like Flutter Render Metrics to do something new. 4 | labels: enhancement 5 | assignees: MbIXjkee 6 | --- 7 | 8 | 13 | 14 | ## What is the new or updated feature that you are suggesting? 15 | 16 | A clear and concise description of what you want to happen. 17 | 18 | ## Why should this feature be included? 19 | 20 | Is your feature request related to a problem? Please describe a clear and concise description of what the problem is. If you investigated any alternative solutions please describe. 21 | 22 | ## Additional context 23 | 24 | Please provide any other context or screenshots about the feature request here. 25 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Related tasks 2 | 5 | 6 | 7 | ## Dependence on other Pull Requests (optional) 8 | 11 | 12 | ## Background (optional) 13 | 16 | 17 | ## Changes 18 | 21 | 22 | ## Troubles (optional) 23 | 26 | 27 | ## Note (optional) 28 | 31 | 32 | ## Checklist for self-check 33 | - [ ] Commits and PRs have been filed according to [the rules on the project](https://github.com/surfstudio/surf-flutter-app-template#workflow-in-a-repository). 34 | - [ ] The author is marked as an assigne and assigned mandatory reviewers. 35 | - [ ] Required labels marked 36 | - [ ] Specified related tasks and/or related PRs. 37 | - [ ] Specified Changes. 38 | - [ ] Attached videos/screenshots demonstrating the fix/feature. 39 | - [ ] All unspecified fields in the PR description deleted. 40 | - [ ] New code covered by tests. 41 | 42 | ## Checklist for reviewers 43 | - [ ] CI passed successfully _(with a green check mark)_. 44 | - [ ] PR is atomic, by volume no more than 400 (+-) corrected lines (not including codogen). 45 | 46 | Design: 47 | - [ ] System design corresponds to the agreements on structure and architecture on the project. 48 | - [ ] The code is decomposed into necessary and sufficient components. 49 | 50 | Functionality: 51 | - [ ] The code solves the problem. 52 | - [ ] Any changes to the user interface are reasonable and look good. 53 | 54 | Complexity: 55 | - [ ] The code is clear, easy to read, functions are small, no more than 50 lines. 56 | - [ ] The logic is not overcomplicated, there is no overengineering (no code sections that may be needed in the future, but no one knows about it). 57 | 58 | Tests: 59 | - [ ] Updated or added tests for mandatory components. 60 | - [ ] The tests are correct, helpful, and well designed/developed. 61 | 62 | Naming: 63 | - [ ] The naming of variables, methods, classes and other components is understandable. 64 | 65 | Comments: 66 | - [ ] The comments are understandable and helpful. 67 | 68 | Documentation: 69 | - [ ] All labels are correct 70 | - [ ] Technical documentation updated (after approval, updates last reviewer). 71 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/bug_fix.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug fix 3 | about: Fixing a problem with Flutter Render Metrics. 4 | assignees: MbIXjkee 5 | --- 6 | 7 | 12 | 13 | ## Checklist 14 | 15 | - [ ] Have you added an explanation of what your changes do and why you'd like us to include them? 16 | - [ ] Is there an existing issue for this PR? 17 | - _link issue here_ 18 | - [ ] Have the files been linted and formatted? 19 | - [ ] Have the docs been updated to match the changes in the PR? 20 | - [ ] Have the tests been updated to match the changes in the PR? 21 | - [ ] Have you run the tests locally to confirm they pass? 22 | 23 | ## Changes 24 | 25 | ### What is the current behavior, and the steps to reproduce the issue? 26 | 27 | ### What is the expected behavior? 28 | 29 | ### How does this PR fix the problem? 30 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/documentation_update.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation update 3 | about: Fixing a problem or improve in an existing docs page. 4 | labels: documentation 5 | assignees: MbIXjkee 6 | --- 7 | 8 | 13 | 14 | ## Checklist 15 | 16 | - [ ] Is there an existing issue for this PR? 17 | - _link issue here_ 18 | - [ ] Have the files been linted and formatted? 19 | 20 | ## Changes 21 | 22 | ### What docs page needs to be fixed? 23 | 24 | - **Section**: 25 | - **Page**: 26 | 27 | ## What is the problem? 28 | 29 | ## What changes does this PR make to fix the problem? 30 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/new_feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: New feature 3 | labels: enhancement 4 | assignees: MbIXjkee 5 | --- 6 | 7 | 12 | 13 | ## Checklist 14 | 15 | - [ ] Have you added an explanation of what your changes do and why you'd like us to include them? 16 | - [ ] Is there an existing issue for this PR? 17 | - _link issue here_ 18 | - [ ] Have the files been linted and formatted? 19 | - [ ] Have the docs been updated to match the changes in the PR? 20 | - [ ] Have the tests been updated to match the changes in the PR? 21 | - [ ] Have you run the tests locally to confirm they pass? 22 | 23 | ## New Features 24 | 25 | ### What new capabilities does this PR add? 26 | 27 | ### What docs changes are needed to explain this? 28 | -------------------------------------------------------------------------------- /.github/workflows/check_issue.yaml: -------------------------------------------------------------------------------- 1 | name: "Checking issue for correctness of described" 2 | 3 | on: 4 | issues: 5 | types: 6 | - reopened 7 | - opened 8 | 9 | jobs: 10 | check-issue: 11 | uses: surfstudio/flutter-ci-workflows/.github/workflows/check_issues.yaml@main 12 | with: 13 | REPO_PATH: 'https://github.com/surfstudio/flutter-render-metrics/issues/new/choose' 14 | ISSUE_TITLE: ${{ github.event.issue.title }} 15 | ISSUE_BODY: ${{ github.event.issue.body }} 16 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: "Main" 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | push: 8 | branches: 9 | - main 10 | tags-ignore: 11 | - '**' 12 | 13 | jobs: 14 | analysis: 15 | uses: surfstudio/flutter-ci-workflows/.github/workflows/analysis.yml@main 16 | 17 | testing: 18 | needs: analysis 19 | uses: surfstudio/flutter-ci-workflows/.github/workflows/testing.yml@main 20 | secrets: 21 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 22 | 23 | build_android_example: 24 | needs: analysis 25 | uses: surfstudio/flutter-ci-workflows/.github/workflows/build_android_example.yml@main 26 | 27 | build_ios_example: 28 | needs: analysis 29 | uses: surfstudio/flutter-ci-workflows/.github/workflows/build_ios_example.yml@main 30 | -------------------------------------------------------------------------------- /.github/workflows/new_issues_label.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | 6 | name: Label issues 7 | on: 8 | issues: 9 | types: 10 | - reopened 11 | - opened 12 | jobs: 13 | label_issues: 14 | uses: surfstudio/flutter-ci-workflows/.github/workflows/new_issues_label.yml@main 15 | secrets: 16 | SECRET_ISSUES: ${{ secrets.SECRET_ISSUES }} 17 | -------------------------------------------------------------------------------- /.github/workflows/new_pull_request_label.yml: -------------------------------------------------------------------------------- 1 | # This workflow is triggered when a WIP label is added to an open pull request. 2 | # When deleting the WIP label, the new_pull_request label is added. 3 | # When adding a WIP label, the new_pull_request label is removed if there is one. 4 | 5 | name: Pull-request label tracking 6 | on: 7 | pull_request_target: 8 | types: 9 | - labeled 10 | - unlabeled 11 | 12 | jobs: 13 | label_pull_request: 14 | if: ${{ github.event.label.name == 'WIP' }} 15 | uses: surfstudio/flutter-ci-workflows/.github/workflows/new_pull_request_label.yml@main 16 | secrets: 17 | SECRET_ISSUES: ${{ secrets.SECRET_ISSUES }} 18 | -------------------------------------------------------------------------------- /.github/workflows/new_pull_request_main_actions.yml: -------------------------------------------------------------------------------- 1 | # This workflow is triggered when a pull request opened, edited, reopened, 2 | # converted_to_draft and ready_for_review. 3 | # 4 | # There is no WIP in the title, there is no WIP label and the pull request is not a draft the 5 | # new pull request label is added. 6 | # If either of these is true then remove the label new pull request if there is one. 7 | 8 | name: Pull-request tracking 9 | on: 10 | pull_request_target: 11 | types: 12 | - opened 13 | - edited 14 | - reopened 15 | - converted_to_draft 16 | - ready_for_review 17 | 18 | jobs: 19 | pull_request: 20 | uses: surfstudio/flutter-ci-workflows/.github/workflows/new_pull_request_label.yml@main 21 | secrets: 22 | SECRET_ISSUES: ${{ secrets.SECRET_ISSUES }} -------------------------------------------------------------------------------- /.github/workflows/publish_to_pub.yml: -------------------------------------------------------------------------------- 1 | name: "Publishing" 2 | 3 | on: 4 | push: 5 | tags: 6 | - v* 7 | 8 | jobs: 9 | analysis: 10 | uses: surfstudio/flutter-ci-workflows/.github/workflows/analysis.yml@main 11 | 12 | testing: 13 | needs: analysis 14 | uses: surfstudio/flutter-ci-workflows/.github/workflows/testing.yml@main 15 | secrets: 16 | CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} 17 | 18 | package-publishing: 19 | needs: [ analysis, testing ] 20 | uses: surfstudio/flutter-ci-workflows/.github/workflows/publish_to_pub.yml@main 21 | with: 22 | PANA_TOTAL: '100' 23 | secrets: 24 | PUB_CREDENTIAL_JSON: ${{ secrets.PUB_CREDENTIAL_JSON }} 25 | PUB_OAUTH_ACCESS_TOKEN: ${{ secrets.PUB_OAUTH_ACCESS_TOKEN }} 26 | PUB_OAUTH_REFRESH_TOKEN: ${{ secrets.PUB_OAUTH_REFRESH_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .classpath 21 | .project 22 | .settings/ 23 | .vscode/ 24 | 25 | # Flutter/Dart/Pub related 26 | **/doc/api/ 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | build/ 34 | 35 | # Android related 36 | **/android/**/gradle-wrapper.jar 37 | **/android/.gradle 38 | **/android/captures/ 39 | **/android/gradlew 40 | **/android/gradlew.bat 41 | **/android/local.properties 42 | **/android/**/GeneratedPluginRegistrant.java 43 | 44 | # iOS/XCode related 45 | **/ios/**/*.mode1v3 46 | **/ios/**/*.mode2v3 47 | **/ios/**/*.moved-aside 48 | **/ios/**/*.pbxuser 49 | **/ios/**/*.perspectivev3 50 | **/ios/**/*sync/ 51 | **/ios/**/.sconsign.dblite 52 | **/ios/**/.tags* 53 | **/ios/**/.vagrant/ 54 | **/ios/**/DerivedData/ 55 | **/ios/**/Icon? 56 | **/ios/**/Pods/ 57 | **/ios/**/.symlinks/ 58 | **/ios/**/profile 59 | **/ios/**/xcuserdata 60 | **/ios/.generated/ 61 | **/ios/Flutter/App.framework 62 | **/ios/Flutter/Flutter.framework 63 | **/ios/Flutter/Generated.xcconfig 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/Flutter/app.flx 66 | **/ios/Flutter/app.zip 67 | **/ios/Flutter/flutter_assets/ 68 | **/ios/ServiceDefinitions.json 69 | **/ios/Runner/GeneratedPluginRegistrant.* 70 | 71 | # Coverage 72 | coverage/ 73 | 74 | # Exceptions to above rules. 75 | !**/ios/**/default.mode1v3 76 | !**/ios/**/default.mode2v3 77 | !**/ios/**/default.pbxuser 78 | !**/ios/**/default.perspectivev3 79 | -------------------------------------------------------------------------------- /.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: 27321ebbad34b0a3fafe99fac037102196d655ff 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 2.0.4 4 | 5 | * Correct logo position in readme. 6 | 7 | ## 2.0.3 8 | 9 | * Rebranding. 10 | 11 | ## 2.0.2 12 | 13 | * Internal improvements. 14 | 15 | ## 2.0.1 16 | 17 | * Stable release. 18 | 19 | ## 2.0.1-dev.1 20 | 21 | * Apply new lint rules. 22 | 23 | ## 2.0.0 24 | 25 | * Migrate this package to null safety. 26 | 27 | ## 1.0.1-dev.4 28 | 29 | * Fix lint hints. 30 | 31 | ## 1.0.0 32 | 33 | * Add `RenderData` class with widget metrics; 34 | * Add `ComparisonDiff` class with the difference between two `RenderData`; 35 | * Add `CoordsMetrics` class with x and y coordinates; 36 | * Add class `RenderManager`; 37 | * Add class `RenderParametersManager`; 38 | * Add class `RenderMetricsObject`; 39 | * Add class `RenderMetricsBox`. 40 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing rules 2 | 3 | Thank you for your help! Before you start, let's take a look at some agreements. 4 | 5 | ## Pull request rules 6 | 7 | Make sure that your code: 8 | 9 | 1. Does not contain analyzer errors. 10 | 2. Follows a [official style](https://dart.dev/guides/language/effective-dart/style). 11 | 3. Follows the official [style of formatting](https://flutter.dev/docs/development/tools/formatting). 12 | 4. Contains no errors. 13 | 5. New functionality is covered by tests. New functionality passes old tests. 14 | 6. Create example that demonstrate new functionality if it is possible. 15 | 16 | ## Accepting the changes 17 | 18 | After your pull request passes the review code, the project maintainers will merge the changes 19 | into the branch to which the pull request was sent. 20 | 21 | ## Issues 22 | 23 | Feel free to report any issues and bugs. 24 | 25 | 1. To report about the problem, create an issue on GitHub. 26 | 2. In the issue add the description of the problem. 27 | 3. Do not forget to mention your development environment, Flutter version, libraries required for 28 | illustration of the problem. 29 | 4. It is necessary to attach the code part that causes an issue or to make a small demo project 30 | that shows the issue. 31 | 5. Attach stack trace so it helps us to deal with the issue. 32 | 6. If the issue is related to graphics, screen recording is required. 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "{}" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2019 SurfStudio LLC 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Render Metrics 2 | 3 | 4 | 5 | 6 | Made by [Surf 🏄‍♂️🏄‍♂️🏄‍♂️](https://surf.dev/) 7 | 8 | [![Build Status](https://shields.io/github/actions/workflow/status/surfstudio/flutter-render-metrics/main.yml?logo=github&logoColor=white)](https://github.com/surfstudio/flutter-render-metrics) 9 | [![Coverage Status](https://img.shields.io/codecov/c/github/surfstudio/flutter-render-metrics?=render_metrics&logo=codecov&logoColor=white)](https://app.codecov.io/gh/surfstudio/flutter-render-metrics) 10 | [![Pub Version](https://img.shields.io/pub/v/render_metrics?logo=dart&logoColor=white)](https://pub.dev/packages/render_metrics) 11 | [![Pub Likes](https://badgen.net/pub/likes/render_metrics)](https://pub.dev/packages/render_metrics) 12 | [![Pub popularity](https://badgen.net/pub/popularity/render_metrics)](https://pub.dev/packages/render_metrics/score) 13 | ![Flutter Platform](https://badgen.net/pub/flutter-platform/render_metrics) 14 | 15 | ## Overview 16 | 17 | This package helps retrieve the current positioning coordinates of any widget in a widgets tree in your Flutter application. 18 | 19 | ## Currently supported features 20 | 21 | - Retrieve the full set of positioning coordinates of the desired widget at any time; 22 | - Calculate the difference in positioning between two widgets and use it the way you need. 23 | 24 | ## Example 25 | 26 | ### Getting widget's coordinates 27 | 28 | Instantiate `RenderParametersManager` object. You can set a special type for the widget's unique identifier or leave it `dynamic`. 29 | 30 | ```dart 31 | final renderManager = RenderParametersManager(); 32 | ``` 33 | 34 | Wrap the desired widget in a `RenderMetricsObject`. The `id` parameter is the widget’s unique identifier. 35 | 36 | ```dart 37 | RenderMetricsObject( 38 | id: "uniqueWidgetId", 39 | manager: renderManager, 40 | child: Container( 41 | ... 42 | ), 43 | ), 44 | ``` 45 | 46 | Get a bundle with the positioning coordinates of the wrapped widget. 47 | 48 | ```dart 49 | RenderData data = renderManager.getRenderData("uniqueWidgetId"); 50 | ``` 51 | 52 | ### Calculating the difference in positioning between two widgets 53 | 54 | Wrap the widgets you want to compare in `RenderMetricsObject`s. Specify two different `id`s for each of them. Please note, that the `manager` parameter of both widgets should contain the link to the same `RenderParametersManager` instance. 55 | 56 | ```dart 57 | RenderMetricsObject( 58 | id: "rowWidgetId", 59 | manager: renderManager, 60 | child: Row( 61 | ... 62 | ), 63 | ), 64 | RenderMetricsObject( 65 | id: "columnWidgetId", 66 | manager: renderManager, 67 | child: Column( 68 | ... 69 | ), 70 | ), 71 | ``` 72 | 73 | Specify two unique widget identifiers when using the `getDiffById()` function and extract a bundle with the relative difference in positioning coordinates between the widgets. 74 | 75 | ```dart 76 | ComparisonDiff diff = 77 | renderManager.getDiffById("rowWidgetId", "columnWidgetId"); 78 | ``` 79 | 80 | ## What metrics can I get? 81 | 82 | ### RenderData 83 | 84 | `RenderData` instance contains a complete set of properties that characterize any widget in a two-dimensional space. 85 | 86 | All metrics positioning coordinates are global, meaning they are relative to the entire screen coordinate space. 87 | 88 | ![RenderData](https://i.ibb.co/CzCWkSB/render-data-1.png) 89 | 90 | `RenderData` also provides you an ability to get all widget keypoint XY-coordinates by calling one of special getters. 91 | 92 | ![RenderData](https://i.ibb.co/DQzt33H/render-data-2.png) 93 | 94 | ### ComparisonDiff 95 | 96 | You can get the comparison relative results for each widget keypoint from the `ComparisonDiff` instance. 97 | 98 | An additional set of special getters can help you calculate the difference between two adjacent sides of two different widgets (e.g. right to left, top to bottom, etc.). 99 | 100 | ![RenderData](https://i.ibb.co/SNMPztt/render-diff.png) 101 | 102 | ## Installation 103 | 104 | Add `render_metrics` to your `pubspec.yaml` file: 105 | 106 | ```yaml 107 | dependencies: 108 | render_metrics: $currentVersion$ 109 | ``` 110 | 111 |

At this moment, the current version of render_metrics is render_metrics version.

112 | 113 | ## Changelog 114 | 115 | All notable changes to this project will be documented in [this file](./CHANGELOG.md). 116 | 117 | ## Issues 118 | 119 | To report your issues, submit them directly in the [Issues](https://github.com/surfstudio/flutter-render-metrics/issues) section. 120 | 121 | ## Contribute 122 | 123 | If you would like to contribute to the package (e.g. by improving the documentation, fixing a bug or adding a cool new feature), please read our [contribution guide](./CONTRIBUTING.md) first and send us your pull request. 124 | 125 | Your PRs are always welcome. 126 | 127 | ## How to reach us 128 | 129 | Please feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian. 130 | 131 | [![Telegram](https://img.shields.io/badge/chat-on%20Telegram-blue.svg)](https://t.me/SurfGear) 132 | 133 | ## License 134 | 135 | [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0) 136 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:surf_lint_rules/analysis_options.yaml 2 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .classpath 21 | .project 22 | .settings/ 23 | .vscode/ 24 | 25 | # Flutter/Dart/Pub related 26 | **/doc/api/ 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | build/ 34 | 35 | # Android related 36 | **/android/**/gradle-wrapper.jar 37 | **/android/.gradle 38 | **/android/captures/ 39 | **/android/gradlew 40 | **/android/gradlew.bat 41 | **/android/local.properties 42 | **/android/**/GeneratedPluginRegistrant.java 43 | 44 | # iOS/XCode related 45 | **/ios/**/*.mode1v3 46 | **/ios/**/*.mode2v3 47 | **/ios/**/*.moved-aside 48 | **/ios/**/*.pbxuser 49 | **/ios/**/*.perspectivev3 50 | **/ios/**/*sync/ 51 | **/ios/**/.sconsign.dblite 52 | **/ios/**/.tags* 53 | **/ios/**/.vagrant/ 54 | **/ios/**/DerivedData/ 55 | **/ios/**/Icon? 56 | **/ios/**/Pods/ 57 | **/ios/**/.symlinks/ 58 | **/ios/**/profile 59 | **/ios/**/xcuserdata 60 | **/ios/.generated/ 61 | **/ios/Flutter/App.framework 62 | **/ios/Flutter/Flutter.framework 63 | **/ios/Flutter/Generated.xcconfig 64 | **/ios/Flutter/flutter_export_environment.sh 65 | **/ios/Flutter/app.flx 66 | **/ios/Flutter/app.zip 67 | **/ios/Flutter/flutter_assets/ 68 | **/ios/ServiceDefinitions.json 69 | **/ios/Runner/GeneratedPluginRegistrant.* 70 | 71 | # Coverage 72 | coverage/ 73 | 74 | # Exceptions to above rules. 75 | !**/ios/**/default.mode1v3 76 | !**/ios/**/default.mode2v3 77 | !**/ios/**/default.pbxuser 78 | !**/ios/**/default.perspectivev3 79 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: cf4400006550b70f28e4b4af815151d1e74846c6 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 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 | 31 | compileOptions { 32 | sourceCompatibility JavaVersion.VERSION_1_8 33 | targetCompatibility JavaVersion.VERSION_1_8 34 | } 35 | 36 | kotlinOptions { 37 | jvmTarget = '1.8' 38 | } 39 | 40 | sourceSets { 41 | main.java.srcDirs += 'src/main/kotlin' 42 | } 43 | 44 | defaultConfig { 45 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 46 | applicationId "com.example.example" 47 | minSdkVersion flutter.minSdkVersion 48 | targetSdkVersion flutter.targetSdkVersion 49 | versionCode flutterVersionCode.toInteger() 50 | versionName flutterVersionName 51 | } 52 | 53 | buildTypes { 54 | release { 55 | // TODO: Add your own signing config for the release build. 56 | // Signing with the debug keys for now, so `flutter run --release` works. 57 | signingConfig signingConfigs.debug 58 | } 59 | } 60 | } 61 | 62 | flutter { 63 | source '../..' 64 | } 65 | 66 | dependencies { 67 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 68 | } 69 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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:4.1.0' 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-6.7-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 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 9.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.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXCopyFilesBuildPhase section */ 19 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 20 | isa = PBXCopyFilesBuildPhase; 21 | buildActionMask = 2147483647; 22 | dstPath = ""; 23 | dstSubfolderSpec = 10; 24 | files = ( 25 | ); 26 | name = "Embed Frameworks"; 27 | runOnlyForDeploymentPostprocessing = 0; 28 | }; 29 | /* End PBXCopyFilesBuildPhase section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 33 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 34 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 35 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 36 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 38 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 39 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 40 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | ); 53 | runOnlyForDeploymentPostprocessing = 0; 54 | }; 55 | /* End PBXFrameworksBuildPhase section */ 56 | 57 | /* Begin PBXGroup section */ 58 | 9740EEB11CF90186004384FC /* Flutter */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 62 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 63 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 64 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 65 | ); 66 | name = Flutter; 67 | sourceTree = ""; 68 | }; 69 | 97C146E51CF9000F007C117D = { 70 | isa = PBXGroup; 71 | children = ( 72 | 9740EEB11CF90186004384FC /* Flutter */, 73 | 97C146F01CF9000F007C117D /* Runner */, 74 | 97C146EF1CF9000F007C117D /* Products */, 75 | ); 76 | sourceTree = ""; 77 | }; 78 | 97C146EF1CF9000F007C117D /* Products */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | 97C146EE1CF9000F007C117D /* Runner.app */, 82 | ); 83 | name = Products; 84 | sourceTree = ""; 85 | }; 86 | 97C146F01CF9000F007C117D /* Runner */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 90 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 91 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 92 | 97C147021CF9000F007C117D /* Info.plist */, 93 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 94 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 95 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 96 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 97 | ); 98 | path = Runner; 99 | sourceTree = ""; 100 | }; 101 | /* End PBXGroup section */ 102 | 103 | /* Begin PBXNativeTarget section */ 104 | 97C146ED1CF9000F007C117D /* Runner */ = { 105 | isa = PBXNativeTarget; 106 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 107 | buildPhases = ( 108 | 9740EEB61CF901F6004384FC /* Run Script */, 109 | 97C146EA1CF9000F007C117D /* Sources */, 110 | 97C146EB1CF9000F007C117D /* Frameworks */, 111 | 97C146EC1CF9000F007C117D /* Resources */, 112 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 113 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 114 | ); 115 | buildRules = ( 116 | ); 117 | dependencies = ( 118 | ); 119 | name = Runner; 120 | productName = Runner; 121 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 122 | productType = "com.apple.product-type.application"; 123 | }; 124 | /* End PBXNativeTarget section */ 125 | 126 | /* Begin PBXProject section */ 127 | 97C146E61CF9000F007C117D /* Project object */ = { 128 | isa = PBXProject; 129 | attributes = { 130 | LastUpgradeCheck = 1300; 131 | ORGANIZATIONNAME = ""; 132 | TargetAttributes = { 133 | 97C146ED1CF9000F007C117D = { 134 | CreatedOnToolsVersion = 7.3.1; 135 | LastSwiftMigration = 1100; 136 | }; 137 | }; 138 | }; 139 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 140 | compatibilityVersion = "Xcode 9.3"; 141 | developmentRegion = en; 142 | hasScannedForEncodings = 0; 143 | knownRegions = ( 144 | en, 145 | Base, 146 | ); 147 | mainGroup = 97C146E51CF9000F007C117D; 148 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 149 | projectDirPath = ""; 150 | projectRoot = ""; 151 | targets = ( 152 | 97C146ED1CF9000F007C117D /* Runner */, 153 | ); 154 | }; 155 | /* End PBXProject section */ 156 | 157 | /* Begin PBXResourcesBuildPhase section */ 158 | 97C146EC1CF9000F007C117D /* Resources */ = { 159 | isa = PBXResourcesBuildPhase; 160 | buildActionMask = 2147483647; 161 | files = ( 162 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 163 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 164 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 165 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 166 | ); 167 | runOnlyForDeploymentPostprocessing = 0; 168 | }; 169 | /* End PBXResourcesBuildPhase section */ 170 | 171 | /* Begin PBXShellScriptBuildPhase section */ 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 173 | isa = PBXShellScriptBuildPhase; 174 | buildActionMask = 2147483647; 175 | files = ( 176 | ); 177 | inputPaths = ( 178 | ); 179 | name = "Thin Binary"; 180 | outputPaths = ( 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | shellPath = /bin/sh; 184 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 185 | }; 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { 187 | isa = PBXShellScriptBuildPhase; 188 | buildActionMask = 2147483647; 189 | files = ( 190 | ); 191 | inputPaths = ( 192 | ); 193 | name = "Run Script"; 194 | outputPaths = ( 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 199 | }; 200 | /* End PBXShellScriptBuildPhase section */ 201 | 202 | /* Begin PBXSourcesBuildPhase section */ 203 | 97C146EA1CF9000F007C117D /* Sources */ = { 204 | isa = PBXSourcesBuildPhase; 205 | buildActionMask = 2147483647; 206 | files = ( 207 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 208 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 209 | ); 210 | runOnlyForDeploymentPostprocessing = 0; 211 | }; 212 | /* End PBXSourcesBuildPhase section */ 213 | 214 | /* Begin PBXVariantGroup section */ 215 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 216 | isa = PBXVariantGroup; 217 | children = ( 218 | 97C146FB1CF9000F007C117D /* Base */, 219 | ); 220 | name = Main.storyboard; 221 | sourceTree = ""; 222 | }; 223 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 224 | isa = PBXVariantGroup; 225 | children = ( 226 | 97C147001CF9000F007C117D /* Base */, 227 | ); 228 | name = LaunchScreen.storyboard; 229 | sourceTree = ""; 230 | }; 231 | /* End PBXVariantGroup section */ 232 | 233 | /* Begin XCBuildConfiguration section */ 234 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 244 | CLANG_WARN_BOOL_CONVERSION = YES; 245 | CLANG_WARN_COMMA = YES; 246 | CLANG_WARN_CONSTANT_CONVERSION = YES; 247 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 248 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 249 | CLANG_WARN_EMPTY_BODY = YES; 250 | CLANG_WARN_ENUM_CONVERSION = YES; 251 | CLANG_WARN_INFINITE_RECURSION = YES; 252 | CLANG_WARN_INT_CONVERSION = YES; 253 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 254 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 255 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 258 | CLANG_WARN_STRICT_PROTOTYPES = YES; 259 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu99; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | SDKROOT = iphoneos; 278 | SUPPORTED_PLATFORMS = iphoneos; 279 | TARGETED_DEVICE_FAMILY = "1,2"; 280 | VALIDATE_PRODUCT = YES; 281 | }; 282 | name = Profile; 283 | }; 284 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 285 | isa = XCBuildConfiguration; 286 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CLANG_ENABLE_MODULES = YES; 290 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 291 | DEVELOPMENT_TEAM = T4N4PW44VX; 292 | ENABLE_BITCODE = NO; 293 | INFOPLIST_FILE = Runner/Info.plist; 294 | LD_RUNPATH_SEARCH_PATHS = ( 295 | "$(inherited)", 296 | "@executable_path/Frameworks", 297 | ); 298 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 301 | SWIFT_VERSION = 5.0; 302 | VERSIONING_SYSTEM = "apple-generic"; 303 | }; 304 | name = Profile; 305 | }; 306 | 97C147031CF9000F007C117D /* Debug */ = { 307 | isa = XCBuildConfiguration; 308 | buildSettings = { 309 | ALWAYS_SEARCH_USER_PATHS = NO; 310 | CLANG_ANALYZER_NONNULL = YES; 311 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 312 | CLANG_CXX_LIBRARY = "libc++"; 313 | CLANG_ENABLE_MODULES = YES; 314 | CLANG_ENABLE_OBJC_ARC = YES; 315 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 316 | CLANG_WARN_BOOL_CONVERSION = YES; 317 | CLANG_WARN_COMMA = YES; 318 | CLANG_WARN_CONSTANT_CONVERSION = YES; 319 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 320 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 321 | CLANG_WARN_EMPTY_BODY = YES; 322 | CLANG_WARN_ENUM_CONVERSION = YES; 323 | CLANG_WARN_INFINITE_RECURSION = YES; 324 | CLANG_WARN_INT_CONVERSION = YES; 325 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 326 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 327 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 328 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 329 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 330 | CLANG_WARN_STRICT_PROTOTYPES = YES; 331 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 332 | CLANG_WARN_UNREACHABLE_CODE = YES; 333 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 334 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 335 | COPY_PHASE_STRIP = NO; 336 | DEBUG_INFORMATION_FORMAT = dwarf; 337 | ENABLE_STRICT_OBJC_MSGSEND = YES; 338 | ENABLE_TESTABILITY = YES; 339 | GCC_C_LANGUAGE_STANDARD = gnu99; 340 | GCC_DYNAMIC_NO_PIC = NO; 341 | GCC_NO_COMMON_BLOCKS = YES; 342 | GCC_OPTIMIZATION_LEVEL = 0; 343 | GCC_PREPROCESSOR_DEFINITIONS = ( 344 | "DEBUG=1", 345 | "$(inherited)", 346 | ); 347 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 348 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 349 | GCC_WARN_UNDECLARED_SELECTOR = YES; 350 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 351 | GCC_WARN_UNUSED_FUNCTION = YES; 352 | GCC_WARN_UNUSED_VARIABLE = YES; 353 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 354 | MTL_ENABLE_DEBUG_INFO = YES; 355 | ONLY_ACTIVE_ARCH = YES; 356 | SDKROOT = iphoneos; 357 | TARGETED_DEVICE_FAMILY = "1,2"; 358 | }; 359 | name = Debug; 360 | }; 361 | 97C147041CF9000F007C117D /* Release */ = { 362 | isa = XCBuildConfiguration; 363 | buildSettings = { 364 | ALWAYS_SEARCH_USER_PATHS = NO; 365 | CLANG_ANALYZER_NONNULL = YES; 366 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 367 | CLANG_CXX_LIBRARY = "libc++"; 368 | CLANG_ENABLE_MODULES = YES; 369 | CLANG_ENABLE_OBJC_ARC = YES; 370 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 371 | CLANG_WARN_BOOL_CONVERSION = YES; 372 | CLANG_WARN_COMMA = YES; 373 | CLANG_WARN_CONSTANT_CONVERSION = YES; 374 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 376 | CLANG_WARN_EMPTY_BODY = YES; 377 | CLANG_WARN_ENUM_CONVERSION = YES; 378 | CLANG_WARN_INFINITE_RECURSION = YES; 379 | CLANG_WARN_INT_CONVERSION = YES; 380 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 381 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 382 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 383 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 384 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 385 | CLANG_WARN_STRICT_PROTOTYPES = YES; 386 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 387 | CLANG_WARN_UNREACHABLE_CODE = YES; 388 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 389 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 390 | COPY_PHASE_STRIP = NO; 391 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 392 | ENABLE_NS_ASSERTIONS = NO; 393 | ENABLE_STRICT_OBJC_MSGSEND = YES; 394 | GCC_C_LANGUAGE_STANDARD = gnu99; 395 | GCC_NO_COMMON_BLOCKS = YES; 396 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 397 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 398 | GCC_WARN_UNDECLARED_SELECTOR = YES; 399 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 400 | GCC_WARN_UNUSED_FUNCTION = YES; 401 | GCC_WARN_UNUSED_VARIABLE = YES; 402 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 403 | MTL_ENABLE_DEBUG_INFO = NO; 404 | SDKROOT = iphoneos; 405 | SUPPORTED_PLATFORMS = iphoneos; 406 | SWIFT_COMPILATION_MODE = wholemodule; 407 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 408 | TARGETED_DEVICE_FAMILY = "1,2"; 409 | VALIDATE_PRODUCT = YES; 410 | }; 411 | name = Release; 412 | }; 413 | 97C147061CF9000F007C117D /* Debug */ = { 414 | isa = XCBuildConfiguration; 415 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 416 | buildSettings = { 417 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 418 | CLANG_ENABLE_MODULES = YES; 419 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 420 | DEVELOPMENT_TEAM = T4N4PW44VX; 421 | ENABLE_BITCODE = NO; 422 | INFOPLIST_FILE = Runner/Info.plist; 423 | LD_RUNPATH_SEARCH_PATHS = ( 424 | "$(inherited)", 425 | "@executable_path/Frameworks", 426 | ); 427 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 428 | PRODUCT_NAME = "$(TARGET_NAME)"; 429 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 430 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 431 | SWIFT_VERSION = 5.0; 432 | VERSIONING_SYSTEM = "apple-generic"; 433 | }; 434 | name = Debug; 435 | }; 436 | 97C147071CF9000F007C117D /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 439 | buildSettings = { 440 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 441 | CLANG_ENABLE_MODULES = YES; 442 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 443 | DEVELOPMENT_TEAM = T4N4PW44VX; 444 | ENABLE_BITCODE = NO; 445 | INFOPLIST_FILE = Runner/Info.plist; 446 | LD_RUNPATH_SEARCH_PATHS = ( 447 | "$(inherited)", 448 | "@executable_path/Frameworks", 449 | ); 450 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 451 | PRODUCT_NAME = "$(TARGET_NAME)"; 452 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 453 | SWIFT_VERSION = 5.0; 454 | VERSIONING_SYSTEM = "apple-generic"; 455 | }; 456 | name = Release; 457 | }; 458 | /* End XCBuildConfiguration section */ 459 | 460 | /* Begin XCConfigurationList section */ 461 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 462 | isa = XCConfigurationList; 463 | buildConfigurations = ( 464 | 97C147031CF9000F007C117D /* Debug */, 465 | 97C147041CF9000F007C117D /* Release */, 466 | 249021D3217E4FDB00AE95B9 /* Profile */, 467 | ); 468 | defaultConfigurationIsVisible = 0; 469 | defaultConfigurationName = Release; 470 | }; 471 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 472 | isa = XCConfigurationList; 473 | buildConfigurations = ( 474 | 97C147061CF9000F007C117D /* Debug */, 475 | 97C147071CF9000F007C117D /* Release */, 476 | 249021D4217E4FDB00AE95B9 /* Profile */, 477 | ); 478 | defaultConfigurationIsVisible = 0; 479 | defaultConfigurationName = Release; 480 | }; 481 | /* End XCConfigurationList section */ 482 | }; 483 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 484 | } 485 | -------------------------------------------------------------------------------- /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 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/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 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:flutter/material.dart'; 16 | import 'package:render_metrics/render_metrics.dart'; 17 | 18 | void main() => runApp(const MyApp()); 19 | 20 | class MyApp extends StatelessWidget { 21 | const MyApp({Key? key}) : super(key: key); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return MaterialApp( 26 | title: 'Render Metrics Example', 27 | theme: ThemeData( 28 | primarySwatch: Colors.blue, 29 | ), 30 | home: const MyHomePage(title: 'Auto reload Home Page'), 31 | ); 32 | } 33 | } 34 | 35 | class MyHomePage extends StatefulWidget { 36 | final String title; 37 | 38 | const MyHomePage({ 39 | required this.title, 40 | Key? key, 41 | }) : super(key: key); 42 | 43 | @override 44 | _MyHomePageState createState() => _MyHomePageState(); 45 | } 46 | 47 | class _MyHomePageState extends State { 48 | final renderManager = RenderParametersManager(); 49 | 50 | final String _text0Id = 'text0Id'; 51 | final String _text1Id = 'text1Id'; 52 | final String _containerPositionedId = 'containerPositionedId'; 53 | final String _textBlockId = 'textBlockId'; 54 | 55 | final _scrollController = ScrollController(); 56 | 57 | bool _isOpacity = false; 58 | 59 | String _text0 = ''; 60 | 61 | @override 62 | void initState() { 63 | super.initState(); 64 | _scrollController.addListener(_scrollListener); 65 | WidgetsBinding.instance.addPostFrameCallback((_) { 66 | setState(() {}); 67 | }); 68 | } 69 | 70 | @override 71 | void dispose() { 72 | _scrollController.dispose(); 73 | super.dispose(); 74 | } 75 | 76 | @override 77 | Widget build(BuildContext context) { 78 | return Scaffold( 79 | appBar: AppBar( 80 | title: Text(widget.title), 81 | ), 82 | body: Stack( 83 | children: [ 84 | ListView( 85 | controller: _scrollController, 86 | children: [ 87 | const SizedBox(height: 500), 88 | RenderMetricsObject( 89 | id: _textBlockId, 90 | manager: renderManager, 91 | onMount: (id, box) { 92 | // Method called when creating a RenderObject 93 | // id - passed id (In this case, the string from _textBlockId) 94 | // box - renderMetricsBox instance from which data is taken 95 | }, 96 | onUnMount: (box) { 97 | // Method called when RenderObject is removed from the tree 98 | // box - renderMetricsBox instance from which data is taken 99 | }, 100 | child: Column( 101 | crossAxisAlignment: CrossAxisAlignment.stretch, 102 | children: [ 103 | RenderMetricsObject( 104 | id: _text1Id, 105 | manager: renderManager, 106 | child: _TextContainer( 107 | text: 108 | 'Diff metrics between the current and the blue square:' 109 | '\n\n' 110 | // ignore: lines_longer_than_80_chars 111 | '${renderManager.getDiffById(_text1Id, _containerPositionedId) ?? ''}', 112 | ), 113 | ), 114 | const SizedBox(height: 20), 115 | RenderMetricsObject( 116 | id: _text0Id, 117 | manager: renderManager, 118 | child: _TextContainer( 119 | text: 'Metrics:\n\n$_text0', 120 | ), 121 | ), 122 | const SizedBox(height: 1500), 123 | ], 124 | ), 125 | ), 126 | ], 127 | ), 128 | Positioned( 129 | top: 50, 130 | left: 10, 131 | child: _Box( 132 | renderManager: renderManager, 133 | containerPositionedId: _containerPositionedId, 134 | isOpacity: _isOpacity, 135 | ), 136 | ), 137 | ], 138 | ), 139 | ); 140 | } 141 | 142 | void _scrollListener() { 143 | setState(() { 144 | _text0 = _getRenderDataText(_text0Id, renderManager); 145 | }); 146 | 147 | final diff = renderManager.getDiffById( 148 | _containerPositionedId, 149 | _textBlockId, 150 | ); 151 | 152 | if (diff != null) { 153 | _changeBlockUi((diff.diffBottomToTop) > 0); 154 | } 155 | } 156 | 157 | void _changeBlockUi(bool isChange) { 158 | if (_isOpacity == isChange) return; 159 | setState(() { 160 | _isOpacity = isChange; 161 | }); 162 | } 163 | } 164 | 165 | class _TextContainer extends StatelessWidget { 166 | final String text; 167 | 168 | const _TextContainer({ 169 | required this.text, 170 | Key? key, 171 | }) : super(key: key); 172 | 173 | @override 174 | Widget build(BuildContext context) { 175 | return Container( 176 | color: Colors.black.withOpacity(.2), 177 | child: Padding( 178 | padding: const EdgeInsets.all(10), 179 | child: Text( 180 | text, 181 | ), 182 | ), 183 | ); 184 | } 185 | } 186 | 187 | class _Box extends StatelessWidget { 188 | final RenderParametersManager renderManager; 189 | final String containerPositionedId; 190 | final bool isOpacity; 191 | 192 | const _Box({ 193 | required this.renderManager, 194 | required this.containerPositionedId, 195 | required this.isOpacity, 196 | Key? key, 197 | }) : super(key: key); 198 | 199 | @override 200 | Widget build(BuildContext context) { 201 | return RenderMetricsObject( 202 | id: containerPositionedId, 203 | manager: renderManager, 204 | child: AnimatedOpacity( 205 | duration: const Duration(milliseconds: 250), 206 | opacity: isOpacity ? .5 : 1, 207 | child: Container( 208 | width: 300, 209 | height: 210, 210 | color: Colors.blue, 211 | child: Padding( 212 | padding: const EdgeInsets.all(10), 213 | child: Text( 214 | 'Blue Container() widget metrics:' 215 | '\n\n' 216 | '${_getRenderDataText(containerPositionedId, renderManager)}', 217 | style: const TextStyle(color: Colors.white), 218 | ), 219 | ), 220 | ), 221 | ), 222 | ); 223 | } 224 | } 225 | 226 | String _getRenderDataText( 227 | T id, 228 | RenderParametersManager renderManager, 229 | ) { 230 | final data = renderManager.getRenderData(id); 231 | if (data == null) return ''; 232 | return data.toString(); 233 | } 234 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter module. 3 | version: 1.0.0+1 4 | publish_to: none 5 | 6 | environment: 7 | sdk: ">=2.12.0 <3.0.0" 8 | flutter: ">=3.0.0 <4.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | render_metrics: 15 | path: ../ 16 | 17 | dev_dependencies: 18 | surf_lint_rules: ^1.0.0 19 | 20 | flutter: 21 | uses-material-design: true 22 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/surfstudio/flutter-render-metrics/4d5a5258e135d9cea0d441081f1146b4cd517acd/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 36 | 39 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /lib/render_metrics.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | library render_metrics; 16 | 17 | export 'package:render_metrics/src/data/comparison_diff.dart'; 18 | export 'package:render_metrics/src/data/render_data.dart'; 19 | export 'package:render_metrics/src/manager/render_manager.dart'; 20 | export 'package:render_metrics/src/manager/render_parameters_manager.dart'; 21 | export 'package:render_metrics/src/render/render_metrics.dart'; 22 | -------------------------------------------------------------------------------- /lib/src/data/comparison_diff.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:render_metrics/src/data/coords_metrics.dart'; 16 | 17 | /// An object with data on the difference of render metrics between two objects 18 | /// `RenderData` 19 | /// 20 | /// [yTop] - difference of the upper Y position relative to the screen. 21 | /// [yBottom] - difference of the lower Y position relative to the screen. 22 | /// [yCenter] - difference of the central Y position relative to the screen. 23 | /// [xLeft] - difference left X position relative to the screen. 24 | /// [xRight] - difference of the right X position relative to the screen. 25 | /// [xCenter] - difference of the central X position relative to the screen. 26 | /// [diffTopToBottom] - difference between the upper border of first object and the lower 27 | /// border of second object. 28 | /// [diffBottomToTop] - difference between the lower border of first object and the upper 29 | /// border of second object. 30 | /// [diffLeftToRight] - difference between the left border of first object and the right 31 | /// border of second object. 32 | /// [diffRightToLeft] - difference between the right border of first object and the left 33 | /// border of second object. 34 | /// [width] - difference in width of elements. 35 | /// [height] - difference in element heights. 36 | /// [topLeft] - upper left coordinate. 37 | /// [topRight] - upper right coordinate. 38 | /// [bottomLeft] - lower left coordinate. 39 | /// [bottomRight] - lower right coordinate. 40 | /// [center] - central coordinate. 41 | /// [topCenter] - upper center coordinate. 42 | /// [bottomCenter] - lower central coordinate. 43 | /// [centerLeft] - center left coordinate. 44 | /// [centerRight] - center right coordinate. 45 | class ComparisonDiff { 46 | const ComparisonDiff({ 47 | required this.yTop, 48 | required this.yBottom, 49 | required this.yCenter, 50 | required this.xLeft, 51 | required this.xRight, 52 | required this.xCenter, 53 | required this.diffTopToBottom, 54 | required this.diffBottomToTop, 55 | required this.diffLeftToRight, 56 | required this.diffRightToLeft, 57 | required this.width, 58 | required this.height, 59 | }); 60 | final double yTop; 61 | final double yBottom; 62 | final double yCenter; 63 | final double xLeft; 64 | final double xRight; 65 | final double xCenter; 66 | final double diffTopToBottom; 67 | final double diffBottomToTop; 68 | final double diffLeftToRight; 69 | final double diffRightToLeft; 70 | final double width; 71 | final double height; 72 | 73 | CoordinatesMetrics get topLeft => CoordinatesMetrics(y: yTop, x: xLeft); 74 | 75 | CoordinatesMetrics get topRight => CoordinatesMetrics(y: yTop, x: xRight); 76 | 77 | CoordinatesMetrics get bottomLeft => CoordinatesMetrics(y: yBottom, x: xLeft); 78 | 79 | CoordinatesMetrics get bottomRight => 80 | CoordinatesMetrics(y: yBottom, x: xRight); 81 | 82 | CoordinatesMetrics get center => CoordinatesMetrics(y: yCenter, x: xCenter); 83 | 84 | CoordinatesMetrics get topCenter => CoordinatesMetrics(y: yTop, x: xCenter); 85 | 86 | CoordinatesMetrics get bottomCenter => 87 | CoordinatesMetrics(y: yBottom, x: xCenter); 88 | 89 | CoordinatesMetrics get centerLeft => CoordinatesMetrics(y: yCenter, x: xLeft); 90 | 91 | CoordinatesMetrics get centerRight => 92 | CoordinatesMetrics(y: yCenter, x: xRight); 93 | 94 | @override 95 | String toString() { 96 | return 'ComparisonDiff(\n' 97 | ' yTop = $yTop;\n' 98 | ' yBottom = $yBottom;\n' 99 | ' yCenter = $yCenter;\n' 100 | ' xLeft = $xLeft;\n' 101 | ' xRight = $xRight;\n' 102 | ' xCenter = $xCenter;\n' 103 | ' diffTopToBottom = $diffTopToBottom;\n' 104 | ' diffBottomToTop = $diffBottomToTop;\n' 105 | ' diffLeftToRight = $diffLeftToRight;\n' 106 | ' diffRightToLeft = $diffRightToLeft;\n' 107 | ' width = $width;\n' 108 | ' height = $height;\n' 109 | ')'; 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /lib/src/data/coords_metrics.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// Defines a point representing a location in (x,y) coordinate space. 16 | class CoordinatesMetrics { 17 | const CoordinatesMetrics({ 18 | required this.x, 19 | required this.y, 20 | }); 21 | final double x; 22 | final double y; 23 | } 24 | -------------------------------------------------------------------------------- /lib/src/data/render_data.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:render_metrics/src/data/comparison_diff.dart'; 16 | import 'package:render_metrics/src/data/coords_metrics.dart'; 17 | 18 | /// Widget metric data class. 19 | /// [yTop] - top Y position relative to the screen. 20 | /// [yBottom] - lower Y position relative to the screen. 21 | /// [yCenter] - center Y position relative to the screen. 22 | /// [xLeft] - left X position relative to the screen. 23 | /// [xRight] - right X position relative to the screen. 24 | /// [xCenter] - center X position relative to the screen. 25 | /// [width] - element width. 26 | /// [height] - element height. 27 | /// [topLeft] - upper left coordinate. 28 | /// [topRight] - upper right coordinate. 29 | /// [bottomLeft] - lower left coordinate. 30 | /// [bottomRight] - lower right coordinate. 31 | /// [center] - central coordinate. 32 | /// [topCenter] - upper center coordinate. 33 | /// [bottomCenter] - lower central coordinate. 34 | /// [centerLeft] - center left coordinate. 35 | /// [centerRight] - center right coordinate. 36 | class RenderData { 37 | const RenderData({ 38 | required this.yTop, 39 | required this.yBottom, 40 | required this.yCenter, 41 | required this.xLeft, 42 | required this.xRight, 43 | required this.xCenter, 44 | required this.width, 45 | required this.height, 46 | }); 47 | final double yTop; 48 | final double yBottom; 49 | final double yCenter; 50 | final double xLeft; 51 | final double xRight; 52 | final double xCenter; 53 | final double width; 54 | final double height; 55 | 56 | CoordinatesMetrics get topLeft => CoordinatesMetrics(y: yTop, x: xLeft); 57 | 58 | CoordinatesMetrics get topRight => CoordinatesMetrics(y: yTop, x: xRight); 59 | 60 | CoordinatesMetrics get bottomLeft => CoordinatesMetrics(y: yBottom, x: xLeft); 61 | 62 | CoordinatesMetrics get bottomRight => 63 | CoordinatesMetrics(y: yBottom, x: xRight); 64 | 65 | CoordinatesMetrics get center => CoordinatesMetrics(y: yCenter, x: xCenter); 66 | 67 | CoordinatesMetrics get topCenter => CoordinatesMetrics(y: yTop, x: xCenter); 68 | 69 | CoordinatesMetrics get bottomCenter => 70 | CoordinatesMetrics(y: yBottom, x: xCenter); 71 | 72 | CoordinatesMetrics get centerLeft => CoordinatesMetrics(y: yCenter, x: xLeft); 73 | 74 | CoordinatesMetrics get centerRight => 75 | CoordinatesMetrics(y: yCenter, x: xRight); 76 | 77 | @override 78 | String toString() { 79 | return 'RenderData(\n' 80 | ' yTop = $yTop;\n' 81 | ' yBottom = $yBottom;\n' 82 | ' yCenter = $yCenter;\n' 83 | ' xLeft = $xLeft;\n' 84 | ' xRight = $xRight;\n' 85 | ' xCenter = $xCenter;\n' 86 | ' width = $width;\n' 87 | ' height = $height;\n' 88 | ')'; 89 | } 90 | 91 | /// Returns the difference between 92 | /// the external and the current instance ofRenderData, 93 | /// as an instance of the ComparisonDiff class. 94 | ComparisonDiff operator -(RenderData other) => ComparisonDiff( 95 | yTop: yTop - other.yTop, 96 | yBottom: yBottom - other.yBottom, 97 | yCenter: yCenter - other.yCenter, 98 | xLeft: xLeft - other.xLeft, 99 | xRight: xRight - other.xRight, 100 | xCenter: xCenter - other.xCenter, 101 | diffTopToBottom: yTop - other.yBottom, 102 | diffBottomToTop: yBottom - other.yTop, 103 | diffLeftToRight: xLeft - other.xRight, 104 | diffRightToLeft: xRight - other.xLeft, 105 | width: width - other.width, 106 | height: height - other.height, 107 | ); 108 | } 109 | -------------------------------------------------------------------------------- /lib/src/manager/render_manager.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:flutter/rendering.dart'; 16 | 17 | /// Base class for rendering interaction managers. 18 | abstract class RenderManager { 19 | /// Handling the RenderObject Add Call. 20 | void addRenderObject(T id, RenderObject object); 21 | 22 | /// Handling the RenderObject Update Call. 23 | void updateRenderObject(T id, RenderObject object); 24 | 25 | /// Handling the RenderObject Delete Call. 26 | void removeRenderObject(T id); 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/manager/render_parameters_manager.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:flutter/cupertino.dart'; 16 | import 'package:render_metrics/src/data/comparison_diff.dart'; 17 | import 'package:render_metrics/src/data/render_data.dart'; 18 | import 'package:render_metrics/src/manager/render_manager.dart'; 19 | import 'package:render_metrics/src/render/render_metrics.dart'; 20 | 21 | /// Manager class extending [RenderManager]. 22 | /// Contains a collection of mounted [RenderMetricsBox] 23 | /// and provides methods for working with it. 24 | class RenderParametersManager extends RenderManager { 25 | @visibleForTesting 26 | final renderObjects = {}; 27 | 28 | /// Add an instance of [RenderObject] by [id]. 29 | @override 30 | void addRenderObject(T id, RenderObject renderObject) { 31 | renderObjects[id] = renderObject as RenderMetricsBox; 32 | } 33 | 34 | /// Update an instance of [RenderObject] by [id]. 35 | @override 36 | void updateRenderObject(T id, RenderObject renderObject) { 37 | renderObjects[id] = renderObject as RenderMetricsBox; 38 | } 39 | 40 | /// Delete an instance of [RenderObject] by [id]. 41 | @override 42 | void removeRenderObject(T id) { 43 | renderObjects.remove(id); 44 | } 45 | 46 | /// Collection with mounted [RenderMetricsBox]. 47 | RenderMetricsBox? operator [](T id) { 48 | return renderObjects[id]; 49 | } 50 | 51 | /// Get an instance of [RenderObject] by [id]. 52 | RenderMetricsBox? getRenderObject(T id) { 53 | return renderObjects[id]; 54 | } 55 | 56 | /// Get instance of [RenderData] from [RenderObject] by [id]. 57 | RenderData? getRenderData(T id) { 58 | return getRenderObject(id)?.data; 59 | } 60 | 61 | /// Get the difference between two instances [RenderObject] 62 | /// by [firstId] and [secondId]. 63 | ComparisonDiff? getDiffById(T firstId, T secondId) { 64 | final first = getRenderData(firstId); 65 | final second = getRenderData(secondId); 66 | return getDiffByInstance(first, second); 67 | } 68 | 69 | /// Get the difference between 70 | /// two instances [RenderObject] by Instance. 71 | ComparisonDiff? getDiffByInstance(RenderData? first, RenderData? second) { 72 | if (first == null || second == null) return null; 73 | return first - second; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /lib/src/render/render_metrics.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:flutter/rendering.dart'; 16 | import 'package:flutter/widgets.dart'; 17 | import 'package:render_metrics/src/data/render_data.dart'; 18 | import 'package:render_metrics/src/manager/render_manager.dart'; 19 | 20 | /// Mount / create instance callback [RenderMetricsObject]. 21 | typedef MountCallback = void Function(T id, RenderMetricsBox box); 22 | 23 | /// Unmounted / uninstall instance callback [RenderMetricsObject]. 24 | typedef UnMountCallback = void Function(T id); 25 | 26 | /// [RenderObjectWidget] for getting widget metrics. 27 | /// [id] - widget id. 28 | /// [manager] - an instance of the RenderManager for getting and processing 29 | /// metrics. 30 | /// [onMount] - mount / create instance callback [RenderMetricsObject]. 31 | /// [onUpdate] - called in the [updateRenderObject] method, 32 | /// update [RenderMetricsObject]. 33 | /// [onUnMount] - unmounted / uninstall instance callback [RenderMetricsObject]. 34 | /// 35 | /// When mounting a RenderMetricsObject, the createRenderObject method fires. 36 | /// It calls onMount(if passed) 37 | /// and the manager method addRenderObject(if passed too). 38 | /// When deleted from the tree, didUnmountRenderObject is triggered. 39 | /// It calls onUnMount(if passed) and the removeRenderObject method. 40 | class RenderMetricsObject extends SingleChildRenderObjectWidget { 41 | const RenderMetricsObject({ 42 | required this.id, 43 | required this.manager, 44 | this.onMount, 45 | this.onUpdate, 46 | this.onUnMount, 47 | Key? key, 48 | Widget? child, 49 | }) : super(key: key, child: child); 50 | final T id; 51 | final RenderManager manager; 52 | final MountCallback? onMount; 53 | final MountCallback? onUpdate; 54 | final UnMountCallback? onUnMount; 55 | 56 | @override 57 | RenderMetricsBox createRenderObject(BuildContext context) { 58 | final r = RenderMetricsBox(); 59 | onMount?.call(id, r); 60 | manager.addRenderObject(id, r); 61 | return r; 62 | } 63 | 64 | @override 65 | void updateRenderObject( 66 | BuildContext context, 67 | covariant RenderObject renderObject, 68 | ) { 69 | if (renderObject is RenderMetricsBox) { 70 | onUpdate?.call(id, renderObject); 71 | manager.updateRenderObject(id, renderObject); 72 | } 73 | } 74 | 75 | @override 76 | void didUnmountRenderObject(covariant RenderObject renderObject) { 77 | manager.removeRenderObject(id); 78 | onUnMount?.call(id); 79 | } 80 | } 81 | 82 | /// [RenderBox] for getting widget metrics 83 | /// extends [RenderProxyBox] which extends [RenderObject]. 84 | /// [data] - getter for receiving data in the instance [RenderData]. 85 | class RenderMetricsBox extends RenderProxyBox { 86 | RenderMetricsBox({ 87 | RenderBox? child, 88 | }) : super(child); 89 | RenderData get data { 90 | final size = this.size; 91 | final width = size.width; 92 | final height = size.height; 93 | final globalOffset = localToGlobal(Offset(width, height)); 94 | final dy = globalOffset.dy; 95 | final dx = globalOffset.dx; 96 | 97 | return RenderData( 98 | yTop: dy - height, 99 | yBottom: dy, 100 | yCenter: dy - height / 2, 101 | xLeft: dx - width, 102 | xRight: dx, 103 | xCenter: dx - width / 2, 104 | width: width, 105 | height: height, 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: render_metrics 2 | version: 2.0.4 3 | description: Library for getting widget metrics. Uses RenderObject to get the size and position of widgets relative to the screen window, as well as the difference between widgets. 4 | homepage: "https://github.com/surfstudio/flutter-render-metrics" 5 | issue_tracker: "https://github.com/surfstudio/flutter-render-metrics/issues" 6 | 7 | dependencies: 8 | flutter: 9 | sdk: flutter 10 | 11 | dev_dependencies: 12 | flutter_test: 13 | sdk: flutter 14 | mocktail: ^0.2.0 15 | surf_lint_rules: ^1.0.0 16 | 17 | environment: 18 | sdk: ">=2.12.0 <3.0.0" 19 | 20 | flutter: 21 | uses-material-design: true 22 | -------------------------------------------------------------------------------- /test/comparison_diff_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:flutter_test/flutter_test.dart'; 16 | import 'package:render_metrics/render_metrics.dart'; 17 | import 'package:render_metrics/src/data/coords_metrics.dart'; 18 | 19 | void main() { 20 | const yTop = 250.72; 21 | const yBottom = 316.72; 22 | const yCenter = 283.72; 23 | const xLeft = -10.0; 24 | const xRight = 82.72; 25 | const xCenter = 36.36; 26 | const diffTopToBottom = 40.72; 27 | const diffBottomToTop = 526.72; 28 | const diffLeftToRight = -310.0; 29 | const diffRightToLeft = 382.72; 30 | const width = 92.72; 31 | const height = 66.0; 32 | 33 | const comparisonDiff = ComparisonDiff( 34 | yTop: yTop, 35 | yBottom: yBottom, 36 | yCenter: yCenter, 37 | xLeft: xLeft, 38 | xRight: xRight, 39 | xCenter: xCenter, 40 | diffTopToBottom: diffTopToBottom, 41 | diffBottomToTop: diffBottomToTop, 42 | diffLeftToRight: diffLeftToRight, 43 | diffRightToLeft: diffRightToLeft, 44 | width: width, 45 | height: height, 46 | ); 47 | 48 | test( 49 | 'topLeft getter should return CoordinatesMetrics with correct parameters', 50 | () { 51 | final topLeft = comparisonDiff.topLeft; 52 | 53 | expect(topLeft.runtimeType, CoordinatesMetrics); 54 | expect(topLeft.x, xLeft); 55 | expect(topLeft.y, yTop); 56 | }, 57 | ); 58 | 59 | test( 60 | 'topRight getter should return CoordinatesMetrics with correct parameters', 61 | () { 62 | final topRight = comparisonDiff.topRight; 63 | 64 | expect(topRight.runtimeType, CoordinatesMetrics); 65 | expect(topRight.x, xRight); 66 | expect(topRight.y, yTop); 67 | }, 68 | ); 69 | 70 | test( 71 | 'bottomLeft getter should return CoordinatesMetrics with correct parameters', 72 | () { 73 | final bottomLeft = comparisonDiff.bottomLeft; 74 | 75 | expect(bottomLeft.runtimeType, CoordinatesMetrics); 76 | expect(bottomLeft.x, xLeft); 77 | expect(bottomLeft.y, yBottom); 78 | }, 79 | ); 80 | 81 | test( 82 | 'bottomLeft getter should return CoordinatesMetrics with correct parameters', 83 | () { 84 | final bottomRight = comparisonDiff.bottomRight; 85 | 86 | expect(bottomRight.runtimeType, CoordinatesMetrics); 87 | expect(bottomRight.x, xRight); 88 | expect(bottomRight.y, yBottom); 89 | }, 90 | ); 91 | 92 | test( 93 | 'center getter should return CoordinatesMetrics with correct parameters', 94 | () { 95 | final center = comparisonDiff.center; 96 | 97 | expect(center.runtimeType, CoordinatesMetrics); 98 | expect(center.x, xCenter); 99 | expect(center.y, yCenter); 100 | }, 101 | ); 102 | 103 | test( 104 | 'topCenter getter should return CoordinatesMetrics with correct parameters', 105 | () { 106 | final topCenter = comparisonDiff.topCenter; 107 | 108 | expect(topCenter.runtimeType, CoordinatesMetrics); 109 | expect(topCenter.x, xCenter); 110 | expect(topCenter.y, yTop); 111 | }, 112 | ); 113 | 114 | test( 115 | 'bottomCenter getter should return CoordinatesMetrics with correct parameters', 116 | () { 117 | final bottomCenter = comparisonDiff.bottomCenter; 118 | 119 | expect(bottomCenter.runtimeType, CoordinatesMetrics); 120 | expect(bottomCenter.x, xCenter); 121 | expect(bottomCenter.y, yBottom); 122 | }, 123 | ); 124 | 125 | test( 126 | 'centerLeft getter should return CoordinatesMetrics with correct parameters', 127 | () { 128 | final centerLeft = comparisonDiff.centerLeft; 129 | 130 | expect(centerLeft.runtimeType, CoordinatesMetrics); 131 | expect(centerLeft.x, xLeft); 132 | expect(centerLeft.y, yCenter); 133 | }, 134 | ); 135 | 136 | test( 137 | 'centerRight getter should return CoordinatesMetrics with correct parameters', 138 | () { 139 | final centerRight = comparisonDiff.centerRight; 140 | 141 | expect(centerRight.runtimeType, CoordinatesMetrics); 142 | expect(centerRight.x, xRight); 143 | expect(centerRight.y, yCenter); 144 | }, 145 | ); 146 | 147 | test( 148 | 'toString method should return correctly string', 149 | () { 150 | const expectString = 'ComparisonDiff(\n' 151 | ' yTop = $yTop;\n' 152 | ' yBottom = $yBottom;\n' 153 | ' yCenter = $yCenter;\n' 154 | ' xLeft = $xLeft;\n' 155 | ' xRight = $xRight;\n' 156 | ' xCenter = $xCenter;\n' 157 | ' diffTopToBottom = $diffTopToBottom;\n' 158 | ' diffBottomToTop = $diffBottomToTop;\n' 159 | ' diffLeftToRight = $diffLeftToRight;\n' 160 | ' diffRightToLeft = $diffRightToLeft;\n' 161 | ' width = $width;\n' 162 | ' height = $height;\n' 163 | ')'; 164 | 165 | final string = comparisonDiff.toString(); 166 | 167 | expect(string, expectString); 168 | }, 169 | ); 170 | } 171 | -------------------------------------------------------------------------------- /test/render_data_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:flutter_test/flutter_test.dart'; 16 | import 'package:render_metrics/render_metrics.dart'; 17 | import 'package:render_metrics/src/data/coords_metrics.dart'; 18 | 19 | void main() { 20 | const yTop = 250.72; 21 | const yBottom = 316.72; 22 | const yCenter = 283.72; 23 | const xLeft = -10.0; 24 | const xRight = 82.72; 25 | const xCenter = 36.36; 26 | const width = 92.72; 27 | const height = 66.0; 28 | 29 | const yTopOther = 451.99; 30 | const yBottomOther = 663.99; 31 | const yCenterOther = 557.99; 32 | const xLeftOther = 0.0; 33 | const xRightOther = 392.72; 34 | const xCenterOther = 196.36; 35 | const widthOther = 392.72; 36 | const heightOther = 212.0; 37 | 38 | const renderData = RenderData( 39 | yTop: yTop, 40 | yBottom: yBottom, 41 | yCenter: yCenter, 42 | xLeft: xLeft, 43 | xRight: xRight, 44 | xCenter: xCenter, 45 | width: width, 46 | height: height, 47 | ); 48 | 49 | const renderDataOther = RenderData( 50 | yTop: yTopOther, 51 | yBottom: yBottomOther, 52 | yCenter: yCenterOther, 53 | xLeft: xLeftOther, 54 | xRight: xRightOther, 55 | xCenter: xCenterOther, 56 | width: widthOther, 57 | height: heightOther, 58 | ); 59 | 60 | test( 61 | 'topLeft getter should return CoordinatesMetrics with correct parameters', 62 | () { 63 | final topLeft = renderData.topLeft; 64 | 65 | expect(topLeft.runtimeType, CoordinatesMetrics); 66 | expect(topLeft.x, xLeft); 67 | expect(topLeft.y, yTop); 68 | }, 69 | ); 70 | 71 | test( 72 | 'topRight getter should return CoordinatesMetrics with correct parameters', 73 | () { 74 | final topRight = renderData.topRight; 75 | 76 | expect(topRight.runtimeType, CoordinatesMetrics); 77 | expect(topRight.x, xRight); 78 | expect(topRight.y, yTop); 79 | }, 80 | ); 81 | 82 | test( 83 | 'bottomLeft getter should return CoordinatesMetrics with correct parameters', 84 | () { 85 | final bottomLeft = renderData.bottomLeft; 86 | 87 | expect(bottomLeft.runtimeType, CoordinatesMetrics); 88 | expect(bottomLeft.x, xLeft); 89 | expect(bottomLeft.y, yBottom); 90 | }, 91 | ); 92 | 93 | test( 94 | 'bottomLeft getter should return CoordinatesMetrics with correct parameters', 95 | () { 96 | final bottomRight = renderData.bottomRight; 97 | 98 | expect(bottomRight.runtimeType, CoordinatesMetrics); 99 | expect(bottomRight.x, xRight); 100 | expect(bottomRight.y, yBottom); 101 | }, 102 | ); 103 | 104 | test( 105 | 'center getter should return CoordinatesMetrics with correct parameters', 106 | () { 107 | final center = renderData.center; 108 | 109 | expect(center.runtimeType, CoordinatesMetrics); 110 | expect(center.x, xCenter); 111 | expect(center.y, yCenter); 112 | }, 113 | ); 114 | 115 | test( 116 | 'topCenter getter should return CoordinatesMetrics with correct parameters', 117 | () { 118 | final topCenter = renderData.topCenter; 119 | 120 | expect(topCenter.runtimeType, CoordinatesMetrics); 121 | expect(topCenter.x, xCenter); 122 | expect(topCenter.y, yTop); 123 | }, 124 | ); 125 | 126 | test( 127 | 'bottomCenter getter should return CoordinatesMetrics with correct parameters', 128 | () { 129 | final bottomCenter = renderData.bottomCenter; 130 | 131 | expect(bottomCenter.runtimeType, CoordinatesMetrics); 132 | expect(bottomCenter.x, xCenter); 133 | expect(bottomCenter.y, yBottom); 134 | }, 135 | ); 136 | 137 | test( 138 | 'centerLeft getter should return CoordinatesMetrics with correct parameters', 139 | () { 140 | final centerLeft = renderData.centerLeft; 141 | 142 | expect(centerLeft.runtimeType, CoordinatesMetrics); 143 | expect(centerLeft.x, xLeft); 144 | expect(centerLeft.y, yCenter); 145 | }, 146 | ); 147 | 148 | test( 149 | 'centerRight getter should return CoordinatesMetrics with correct parameters', 150 | () { 151 | final centerRight = renderData.centerRight; 152 | 153 | expect(centerRight.runtimeType, CoordinatesMetrics); 154 | expect(centerRight.x, xRight); 155 | expect(centerRight.y, yCenter); 156 | }, 157 | ); 158 | 159 | test( 160 | 'toString method should return correctly string', 161 | () { 162 | const expectString = 'RenderData(\n' 163 | ' yTop = $yTop;\n' 164 | ' yBottom = $yBottom;\n' 165 | ' yCenter = $yCenter;\n' 166 | ' xLeft = $xLeft;\n' 167 | ' xRight = $xRight;\n' 168 | ' xCenter = $xCenter;\n' 169 | ' width = $width;\n' 170 | ' height = $height;\n' 171 | ')'; 172 | 173 | final string = renderData.toString(); 174 | 175 | expect(string, expectString); 176 | }, 177 | ); 178 | 179 | test( 180 | "Overridden '-' operator should work correctly", 181 | () { 182 | final difference = renderData - renderDataOther; 183 | 184 | expect(difference.yTop, yTop - yTopOther); 185 | expect(difference.yBottom, yBottom - yBottomOther); 186 | expect(difference.yCenter, yCenter - yCenterOther); 187 | expect(difference.xLeft, xLeft - xLeftOther); 188 | expect(difference.xRight, xRight - xRightOther); 189 | expect(difference.xCenter, xCenter - xCenterOther); 190 | expect(difference.diffTopToBottom, yTop - yBottomOther); 191 | expect(difference.diffBottomToTop, yBottom - yTopOther); 192 | expect(difference.diffLeftToRight, xLeft - xRightOther); 193 | expect(difference.diffRightToLeft, xRight - xLeftOther); 194 | expect(difference.width, width - widthOther); 195 | expect(difference.height, height - heightOther); 196 | }, 197 | ); 198 | } 199 | -------------------------------------------------------------------------------- /test/render_metrics_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:flutter/material.dart'; 16 | import 'package:flutter_test/flutter_test.dart'; 17 | import 'package:mocktail/mocktail.dart'; 18 | import 'package:render_metrics/render_metrics.dart'; 19 | 20 | import 'test_utils.dart'; 21 | 22 | void main() { 23 | setUpAll(() { 24 | registerFallbackValue(RenderMetricsBox()); 25 | }); 26 | 27 | const firstId = 'first'; 28 | const secondId = 'second'; 29 | 30 | group( 31 | 'RenderParametersManager', 32 | () { 33 | testWidgets( 34 | "Calling the renderManager's getRenderData method should return " 35 | 'the height and width of the box', 36 | (tester) async { 37 | const box = SizedBox(height: 400, width: 800); 38 | final renderManager = RenderParametersManager(); 39 | final object = RenderMetricsObject( 40 | id: firstId, 41 | manager: renderManager, 42 | child: box, 43 | ); 44 | 45 | await tester.pumpWidget(makeTestableWidget(object)); 46 | final renderData = renderManager.getRenderData(firstId); 47 | 48 | expect(renderData?.height, 400); 49 | expect(renderData?.width, 800); 50 | }, 51 | ); 52 | 53 | testWidgets( 54 | 'After drug the yTop of the RenderData value should become less ' 55 | 'than its initial value', 56 | (tester) async { 57 | final controller = ScrollController(); 58 | const box = SizedBox(height: 400, width: 800); 59 | final renderManager = RenderParametersManager(); 60 | final object = RenderMetricsObject( 61 | id: firstId, 62 | manager: renderManager, 63 | child: box, 64 | ); 65 | 66 | await tester.pumpWidget( 67 | makeTestableWidget( 68 | ListView( 69 | controller: controller, 70 | children: [ 71 | const SizedBox( 72 | height: 400, 73 | width: 800, 74 | ), 75 | object, 76 | const SizedBox( 77 | height: 400, 78 | width: 800, 79 | ), 80 | ], 81 | ), 82 | ), 83 | ); 84 | final renderData = renderManager.getRenderData(firstId); 85 | await tester.drag(find.byType(ListView), const Offset(0, -300)); 86 | await tester.pumpAndSettle(); 87 | final renderDataBeforeDrag = renderManager.getRenderData(firstId); 88 | 89 | expect(renderDataBeforeDrag!.yTop < renderData!.yTop, true); 90 | }, 91 | ); 92 | 93 | testWidgets( 94 | 'getDiffById method must perform correct calculations', 95 | (tester) async { 96 | const firstBox = SizedBox(height: 400, width: 800); 97 | const secondBox = SizedBox(height: 200, width: 400); 98 | 99 | final renderManager = RenderParametersManager(); 100 | 101 | final firstObject = RenderMetricsObject( 102 | id: firstId, 103 | manager: renderManager, 104 | child: firstBox, 105 | ); 106 | final secondObject = RenderMetricsObject( 107 | id: secondId, 108 | manager: renderManager, 109 | child: secondBox, 110 | ); 111 | 112 | await tester.pumpWidget( 113 | makeTestableWidget(Column(children: [firstObject, secondObject])), 114 | ); 115 | 116 | final diff = renderManager.getDiffById(firstId, secondId); 117 | 118 | expect(diff?.height, equals(200)); 119 | expect(diff?.width, equals(400)); 120 | 121 | final firstRenderData = renderManager.getRenderData(firstId); 122 | final secondRenderData = renderManager.getRenderData(secondId); 123 | 124 | final diffUsingOperator = firstRenderData! - secondRenderData!; 125 | 126 | expect(diffUsingOperator.height, equals(200)); 127 | expect(diffUsingOperator.width, equals(400)); 128 | 129 | expect(diffUsingOperator.height, diff?.height); 130 | expect(diffUsingOperator.width, diff?.width); 131 | }, 132 | ); 133 | 134 | test( 135 | 'Calling the updateRenderObject method should call the correct methods', 136 | () { 137 | const box = SizedBox(height: 400, width: 800); 138 | final renderManager = MockRenderParametersManager(); 139 | when(() => renderManager.updateRenderObject(any(), any())) 140 | .thenAnswer((invocation) => Future.value()); 141 | 142 | final context = FakeContext(); 143 | final renderObject = RenderMetricsBox(); 144 | 145 | final onUpdate = MockOnUpdateFunction(); 146 | when(() => onUpdate.call(any(), any())).thenAnswer( 147 | (invocation) => Future.value(), 148 | ); 149 | 150 | RenderMetricsObject( 151 | id: firstId, 152 | manager: renderManager, 153 | onUpdate: onUpdate, 154 | child: box, 155 | ).updateRenderObject(context, renderObject); 156 | 157 | verify(() => onUpdate(any(), any())).called(1); 158 | verify(() => renderManager.updateRenderObject(firstId, renderObject)) 159 | .called(1); 160 | }, 161 | ); 162 | }, 163 | ); 164 | } 165 | 166 | class FakeContext extends Fake implements BuildContext {} 167 | 168 | class MockOnUpdateFunction extends Mock { 169 | void call(T id, RenderMetricsBox box); 170 | } 171 | 172 | class MockRenderParametersManager extends Mock 173 | implements RenderParametersManager {} 174 | -------------------------------------------------------------------------------- /test/render_parameters_manager_test.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:flutter/material.dart'; 16 | import 'package:flutter/rendering.dart'; 17 | import 'package:flutter_test/flutter_test.dart'; 18 | import 'package:render_metrics/render_metrics.dart'; 19 | 20 | void main() { 21 | const id = 'Test id'; 22 | const secondId = 'Second id'; 23 | 24 | late RenderParametersManager renderParametersManager; 25 | final renderObject = RenderMetricsBox(); 26 | 27 | final secondRenderObject = RenderMetricsBox(); 28 | 29 | setUp( 30 | () { 31 | renderParametersManager = RenderParametersManager(); 32 | }, 33 | ); 34 | 35 | test( 36 | 'renderObjects getter call should return {}', 37 | () { 38 | final renderObjects = renderParametersManager.renderObjects; 39 | 40 | expect(renderObjects, {}); 41 | }, 42 | ); 43 | 44 | test( 45 | 'addRenderObject method should add an instance of [RenderObject] in ' 46 | 'renderObjects', 47 | () { 48 | renderParametersManager.addRenderObject(id, renderObject); 49 | 50 | final renderObjects = renderParametersManager.renderObjects; 51 | 52 | expect(renderObjects, {id: renderObject}); 53 | }, 54 | ); 55 | 56 | test( 57 | 'updateRenderObject method should update an instance of [RenderObject] ' 58 | 'by [id] in renderObjects', 59 | () { 60 | renderParametersManager.updateRenderObject(id, secondRenderObject); 61 | 62 | final rendersObjects = renderParametersManager.renderObjects; 63 | 64 | expect( 65 | rendersObjects, 66 | {id: secondRenderObject}, 67 | ); 68 | }, 69 | ); 70 | 71 | test( 72 | 'removeRenderObject method should delete an instance of [RenderObject] by ' 73 | '[id] in renderObjects', 74 | () { 75 | renderParametersManager 76 | ..addRenderObject(id, renderObject) 77 | ..addRenderObject(secondId, secondRenderObject); 78 | 79 | var rendersObjects = renderParametersManager.renderObjects; 80 | 81 | expect( 82 | rendersObjects, 83 | { 84 | id: renderObject, 85 | secondId: secondRenderObject, 86 | }, 87 | ); 88 | 89 | renderParametersManager.removeRenderObject(id); 90 | 91 | rendersObjects = renderParametersManager.renderObjects; 92 | 93 | expect( 94 | rendersObjects, 95 | {secondId: secondRenderObject}, 96 | ); 97 | 98 | renderParametersManager.removeRenderObject(secondId); 99 | 100 | rendersObjects = renderParametersManager.renderObjects; 101 | 102 | expect(rendersObjects, {}); 103 | }, 104 | ); 105 | 106 | test( 107 | '[] operator should return correctly render object', 108 | () { 109 | renderParametersManager.addRenderObject(id, renderObject); 110 | 111 | final RenderObject? object = renderParametersManager[id]; 112 | 113 | expect(object, renderObject); 114 | }, 115 | ); 116 | 117 | test( 118 | 'getRenderObject method should return renderObject from renderObjects', 119 | () { 120 | renderParametersManager.addRenderObject(id, renderObject); 121 | 122 | final object = renderParametersManager.getRenderObject(id); 123 | 124 | expect(object, renderObject); 125 | }, 126 | ); 127 | } 128 | -------------------------------------------------------------------------------- /test/test_utils.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019-present, SurfStudio LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | import 'package:flutter/material.dart'; 16 | 17 | // ignore: avoid-returning-widgets 18 | Widget makeTestableWidget(Widget widget) => 19 | MaterialApp(home: Scaffold(body: widget)); 20 | --------------------------------------------------------------------------------