├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── BUG-REPORT.yaml │ ├── FEATURE-REQUEST.yaml │ └── QUESTION.yaml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── flutter_easy_dialogs.yaml ├── .gitignore ├── .metadata ├── .vscode └── launch.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── dartdoc_options.yaml ├── doc ├── decorations.md ├── dialogs.md ├── faq.md ├── getting-started.md └── migration_guide_2_to_3.md ├── 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 │ ├── full_screen │ │ ├── routes.dart │ │ └── screens │ │ │ ├── full_screen_dialog_basic_usage_screen.dart │ │ │ ├── full_screen_dialog_customization_screen.dart │ │ │ └── screens.dart │ ├── main.dart │ ├── positioned │ │ ├── routes.dart │ │ └── screens │ │ │ ├── positioned_dialog_basic_usage.dart │ │ │ ├── positioned_dialog_customization_screen.dart │ │ │ └── positioned_dialog_flutter_animate.dart │ ├── screens │ │ └── home_screen.dart │ └── widget │ │ └── home_template.dart ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ ├── main.cc │ ├── my_application.cc │ └── my_application.h ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.lock ├── pubspec.yaml ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── index.html │ └── manifest.json └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── lib ├── flutter_easy_dialogs.dart └── src │ ├── core │ ├── android_back_button_interceptor_mixin.dart │ ├── core.dart │ ├── easy_dialog_animation.dart │ ├── easy_dialog_animation_configuration.dart │ ├── easy_dialog_decoration.dart │ ├── easy_dialog_dismiss.dart │ ├── easy_dialogs_controller.dart │ ├── easy_overlay.dart │ └── widget │ │ ├── free_positioned.dart │ │ └── overlay_provider.dart │ ├── flutter_easy_dialogs.dart │ ├── full_screen │ ├── dialog │ │ └── full_screen_dialog.dart │ ├── full_screen.dart │ ├── shell │ │ ├── full_screen_shell.dart │ │ └── modal_banner.dart │ └── widgets │ │ ├── easy_full_screen_blur.dart │ │ └── widget.dart │ ├── positioned │ ├── dialog │ │ └── positioned_dialog.dart │ ├── positioned.dart │ └── shell │ │ ├── banner.dart │ │ └── positioned_shell.dart │ └── util │ └── multiply_animation.dart ├── pubspec.yaml └── test ├── helper.dart ├── mock.dart └── src ├── core ├── easy_dialog_animation_configuration_test.dart ├── easy_dialog_animation_test.dart ├── easy_dialog_controller_test.dart ├── easy_dialog_dismiss_test.dart ├── easy_overlay_box_test.dart ├── easy_overlay_entry_test.dart └── widget │ └── free_positioned_test.dart ├── flutter_easy_dialogs_test.dart ├── full_screen └── dialog │ ├── full_screen_dialog_test.dart │ └── insert_test.dart ├── positioned └── dialog │ ├── insert_test.dart │ └── positioned_dialog_test.dart └── util └── multiply_animation_test.dart /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Every request must be reviewed and accepted by: 2 | 3 | * @feduke-nukem -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG-REPORT.yaml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: File a bug report 3 | title: "[Bug]: " 4 | labels: ["bug"] 5 | assignees: 6 | - feduke-nukem 7 | body: 8 | - type: markdown 9 | attributes: 10 | value: | 11 | Thanks for taking the time to fill out this bug report! 12 | - type: textarea 13 | id: what-happened 14 | attributes: 15 | label: What happened? 16 | description: Also tell us, what did you expect to happen? 17 | placeholder: Tell us what you see! 18 | value: "A bug happened!" 19 | validations: 20 | required: true 21 | - type: textarea 22 | id: logs 23 | attributes: 24 | label: Relevant log output 25 | description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. 26 | render: shell 27 | - type: checkboxes 28 | id: terms 29 | attributes: 30 | label: Code of Conduct 31 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/feduke-nukem/flutter_easy_dialogs/blob/main/CODE_OF_CONDUCT.md) 32 | options: 33 | - label: I agree to follow this project's Code of Conduct 34 | required: true 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE-REQUEST.yaml: -------------------------------------------------------------------------------- 1 | name: Feature Request 2 | description: File a feature request 3 | title: "[Feature]: " 4 | labels: ["feature request"] 5 | assignees: 6 | - feduke-nukem 7 | body: 8 | - type: markdown 9 | attributes: 10 | value: | 11 | Thanks for taking the time to fill out this feature request! 12 | - type: textarea 13 | id: your-idea 14 | attributes: 15 | label: What is your idea? 16 | description: Tell us about your idea. 17 | placeholder: Your idea 18 | value: "Your idea!" 19 | validations: 20 | required: true 21 | - type: checkboxes 22 | id: terms 23 | attributes: 24 | label: Code of Conduct 25 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/feduke-nukem/flutter_easy_dialogs/blob/main/CODE_OF_CONDUCT.md) 26 | options: 27 | - label: I agree to follow this project's Code of Conduct 28 | required: true 29 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/QUESTION.yaml: -------------------------------------------------------------------------------- 1 | name: Question 2 | description: File a question 3 | title: "[Question]: " 4 | labels: ["question"] 5 | assignees: 6 | - feduke-nukem 7 | body: 8 | - type: markdown 9 | attributes: 10 | value: | 11 | Thanks for taking the time to fill out this question! 12 | - type: textarea 13 | id: your-question 14 | attributes: 15 | label: What is your question? 16 | description: Ask a question. 17 | placeholder: Your question 18 | value: "Your question!" 19 | validations: 20 | required: true 21 | - type: checkboxes 22 | id: terms 23 | attributes: 24 | label: Code of Conduct 25 | description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/feduke-nukem/flutter_easy_dialogs/blob/main/CODE_OF_CONDUCT.md) 26 | options: 27 | - label: I agree to follow this project's Code of Conduct 28 | required: true 29 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | ## Status 10 | 11 | **READY/IN DEVELOPMENT/HOLD** 12 | 13 | ## Breaking Changes 14 | 15 | YES | NO 16 | 17 | ## Description 18 | 19 | 20 | 21 | ## Type of Change 22 | 23 | 24 | 25 | - [ ] ✨ New feature (non-breaking change which adds functionality) 26 | - [ ] 🛠️ Bug fix (non-breaking change which fixes an issue) 27 | - [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change) 28 | - [ ] 🧹 Code refactor 29 | - [ ] 📝 Documentation 30 | - [ ] 🗑️ Chore -------------------------------------------------------------------------------- /.github/workflows/flutter_easy_dialogs.yaml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | defaults: 8 | run: 9 | working-directory: ./ 10 | 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v3 15 | - uses: subosito/flutter-action@v2 16 | 17 | - name: Install Dependencies 18 | run: flutter packages get 19 | 20 | - name: Format 21 | run: dart format --set-exit-if-changed . 22 | 23 | - name: Analyze 24 | run: dart analyze --fatal-infos --fatal-warnings . 25 | 26 | - name: Run tests 27 | run: flutter test --no-pub --coverage --test-randomize-ordering-seed random 28 | 29 | - name: Check Code Coverage 30 | uses: VeryGoodOpenSource/very_good_coverage@v2 31 | with: 32 | min_coverage: 90 33 | path: ./coverage/lcov.info 34 | 35 | - name: Upload coverage reports to Codecov 36 | uses: codecov/codecov-action@v3 37 | with: 38 | token: ${{ secrets.CODECOV_TOKEN }} 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | .vscode/settings.json 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | coverage/ -------------------------------------------------------------------------------- /.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: f1875d570e39de09040c8f79aa13cc56baab8db1 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "example", 6 | "cwd": "example", 7 | "request": "launch", 8 | "type": "dart" 9 | }, 10 | { 11 | "name": "example (profile mode)", 12 | "cwd": "example", 13 | "request": "launch", 14 | "type": "dart", 15 | "flutterMode": "profile" 16 | }, 17 | { 18 | "name": "example (release mode)", 19 | "cwd": "example", 20 | "request": "launch", 21 | "type": "dart", 22 | "flutterMode": "release" 23 | }, 24 | { 25 | "name": "Golden", 26 | "request": "launch", 27 | "type": "dart", 28 | "codeLens": { 29 | "for": [ 30 | "run-test", 31 | "run-test-file" 32 | ] 33 | }, 34 | "args": [ 35 | "--update-goldens" 36 | ] 37 | } 38 | ] 39 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | bagotir@gmail.com. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to FlutterEasyDialogs 2 | 3 | 👍🎉 First off, thanks for taking the time to contribute! 🎉👍 4 | 5 | The following is a set of guidelines for contributing to FlutterEasyDialogs and its packages. 6 | These are mostly guidelines, not rules. Use your best judgment, 7 | and feel free to propose changes to this document in a pull request. 8 | 9 | ## Proposing a Change 10 | 11 | If you intend to change the public API, or make any non-trivial changes 12 | to the implementation, we recommend filing an issue. 13 | This lets us reach an agreement on your proposal before you put significant 14 | effort into it. 15 | 16 | If you’re only fixing a bug, it’s fine to submit a pull request right away 17 | but we still recommend to file an issue detailing what you’re fixing. 18 | This is helpful in case we don’t accept that specific fix but want to keep 19 | track of the issue. 20 | 21 | ## Creating a Pull Request 22 | 23 | Before creating a pull request please: 24 | 25 | 1. Fork the repository and create your branch from `main`. 26 | 2. Install all dependencies (`flutter packages get` or `pub get`). 27 | 3. Squash your commits and ensure you have a meaningful commit message. 28 | 4. If you’ve fixed a bug or added code that should be tested, add tests! 29 | Pull Requests without 100% test coverage will not be approved. 30 | 5. Ensure the test suite passes. 31 | 6. If you've changed the public API, make sure to update/add documentation. 32 | 7. Create the Pull Request. 33 | 8. Verify that all status checks are passing. 34 | 35 | While the prerequisites above must be satisfied prior to having your 36 | pull request reviewed, the reviewer(s) may ask you to complete additional 37 | design work, tests, or other changes before your pull request can be ultimately 38 | accepted. 39 | 40 | ## Contributing to Documentation 41 | 42 | If you would like to contribute to the documentation 43 | please follow the same process for "Creating a Pull Request" and double check 44 | that your changes look good by running the docs locally. 45 | 46 | ## License 47 | 48 | By contributing to this library, you agree that your contributions will be licensed 49 | under its [MIT license](LICENSE). 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Fedor Blagodyr 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | License: MIT 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 | #### What is `FlutterEasyDialogs` ? 37 | It is an open-source package for the Flutter framework that provides easy-to-use and customizable dialogs based on [Overlay](https://api.flutter.dev/flutter/widgets/Overlay-class.html) for use in your application without `BuildContext`. With this library, you can quickly create and display dialogs such as alerts, confirmation dialogs, info dialogs, and etc. 38 | The library is designed to be lightweight, efficient, and easy to use, making it ideal for developers who want to add dialog functionality to their apps without having to write complex code. 39 | 40 | ## Documentation 41 | 42 | - [Getting started](https://pub.dev/documentation/flutter_easy_dialogs/latest/topics/Getting%20started-topic.html) 43 | - [Dialogs](https://pub.dev/documentation/flutter_easy_dialogs/latest/topics/Dialogs-topic.html) 44 | - [Decorations](https://pub.dev/documentation/flutter_easy_dialogs/latest/topics/Decorations-topic.html) 45 | - [Migration guide from 2.x to 3.x](https://pub.dev/documentation/flutter_easy_dialogs/latest/topics/Migration%20guide%20from%202.x%20to%203.x-topic.html) 46 | - [FAQ](https://pub.dev/documentation/flutter_easy_dialogs/latest/topics/FAQ-topic.html) -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | analyzer: 2 | 3 | dart_code_metrics: 4 | metrics: 5 | cyclomatic-complexity: 20 6 | number-of-parameters: 4 7 | maximum-nesting-level: 3 8 | metrics-exclude: 9 | - test/** 10 | rules: 11 | - avoid-unnecessary-type-assertions 12 | - avoid-unrelated-type-assertions 13 | - avoid-nested-conditional-expressions 14 | - no-boolean-literal-compare 15 | - prefer-conditional-expressions 16 | - no-equal-then-else 17 | - prefer-moving-to-variable 18 | - prefer-match-file-name 19 | - avoid-double-slash-imports 20 | - member-ordering: 21 | order: 22 | - private-fields 23 | - public-fields 24 | - constructors 25 | - close-method 26 | - dispose-method 27 | widgets-order: 28 | - constructor 29 | - build-method 30 | - init-state-method 31 | - did-change-dependencies-method 32 | - did-update-widget-method 33 | - dispose-method 34 | - format-comment: 35 | only-doc-comments: true 36 | ignored-patterns: 37 | - "@nodoc" 38 | severity: error 39 | - double-literal-format: 40 | severity: error 41 | - binary-expression-operand-order: 42 | severity: error 43 | - avoid-unnecessary-conditionals: 44 | severity: error 45 | - avoid-missing-enum-constant-in-map: 46 | severity: error 47 | - avoid-redundant-async: 48 | severity: error 49 | - avoid-unnecessary-type-casts: 50 | severity: error 51 | - prefer-trailing-comma: 52 | severity: error 53 | - arguments-ordering: 54 | child-last: true 55 | severity: error 56 | - newline-before-return: 57 | severity: error 58 | - prefer-commenting-analyzer-ignores: 59 | severity: error 60 | - avoid-collection-methods-with-unrelated-types: 61 | strict: false 62 | severity: error 63 | - prefer-correct-type-name: 64 | excluded: [ 'exampleExclude' ] 65 | min-length: 3 66 | max-length: 40 67 | severity: error 68 | - prefer-first: 69 | severity: error 70 | - prefer-iterable-of: 71 | severity: error 72 | - prefer-last: 73 | severity: error 74 | - always-remove-listener: 75 | severity: error 76 | - avoid-returning-widgets: 77 | ignored-names: 78 | - testFunction 79 | ignored-annotations: 80 | - allowedAnnotation 81 | - avoid-unnecessary-setstate: 82 | severity: error 83 | - avoid-wrapping-in-padding: 84 | severity: error 85 | - check-for-equals-in-render-object-setters: 86 | severity: error 87 | - consistent-update-render-object: 88 | severity: error 89 | - prefer-correct-edge-insets-constructor: 90 | severity: error 91 | - prefer-extracting-callbacks: 92 | severity: error 93 | ignored-named-arguments: 94 | - onPressed 95 | allowed-line-count: 3 96 | - use-setstate-synchronously: 97 | severity: error 98 | 99 | 100 | 101 | rules-exclude: 102 | - test/** -------------------------------------------------------------------------------- /dartdoc_options.yaml: -------------------------------------------------------------------------------- 1 | dartdoc: 2 | categories: 3 | "Getting started": 4 | markdown: doc/getting-started.md 5 | name: Getting started 6 | "Dialogs": 7 | markdown: doc/dialogs.md 8 | name: Dialogs 9 | "Decorations": 10 | markdown: doc/decorations.md 11 | name: Decorations 12 | "Migration guide from 2.x to 3.x": 13 | markdown: doc/migration_guide_2_to_3.md 14 | name: Migration guide from 2.x to 3.x 15 | "FAQ": 16 | markdown: doc/faq.md 17 | name: FAQ 18 | categoryOrder: 19 | - "Getting started" 20 | - "Dialogs" 21 | - "Decorations" 22 | - "Migration guide from 2.x to 3.x" 23 | - "FAQ" 24 | showUndocumentedCategories: true 25 | ignore: 26 | - broken-link 27 | - missing-from-search-index -------------------------------------------------------------------------------- /doc/dialogs.md: -------------------------------------------------------------------------------- 1 | ## Dialogs 2 | 3 | #### Positioned dialogs 4 | This type of dialogs is used to show at a specific place on the screen using [EasyDialogPosition](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialogPosition.html). 5 | 6 | ```dart 7 | FlutterEasyDialogs.show( 8 | EasyDialog.positioned( 9 | position: EasyDialogPosition.top, 10 | content: Container( 11 | height: 150.0, 12 | color: Colors.amber[900], 13 | alignment: Alignment.center, 14 | child: Text('Dialog'), 15 | ), 16 | ), 17 | ); 18 | ``` 19 | Or: 20 | 21 | ```dart 22 | Container( 23 | height: 150.0, 24 | color: Colors.amber[900], 25 | alignment: Alignment.center, 26 | child: Text('Dialog'), 27 | ).positioned(position: EasyDialogPosition.top).show(); 28 | ``` 29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
41 | 42 | **Since version 3.2.0** you can make dialog draggable: 43 | ```dart 44 | final content = Container( 45 | height: 150.0, 46 | color: Colors.amber[900], 47 | alignment: Alignment.center, 48 | child: Text('Dialog'), 49 | ); 50 | 51 | content 52 | .positioned() 53 | .draggable() 54 | .show(); 55 | ``` 56 |
57 | 58 | 59 | 60 |
61 | 62 | 63 | #### FullScreen dialogs 64 | 65 | These dialogs are intended to cover all available space on the screen and be presented one at a time. There is a special [behavior](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/FullScreenDialog/onAndroidPop.html) available to detect the Android software back button and handle it: 66 | 67 | ```dart 68 | FlutterEasyDialogs.show( 69 | EasyDialog.fullScreen( 70 | content: Container( 71 | height: 150.0, 72 | color: Colors.amber[900], 73 | alignment: Alignment.center, 74 | child: Text('Dialog'), 75 | ), 76 | ), 77 | ); 78 | ``` 79 | 80 | Or: 81 | 82 | ```dart 83 | Container( 84 | height: 150.0, 85 | color: Colors.amber[900], 86 | alignment: Alignment.center, 87 | child: Text('Dialog'), 88 | ).fullScreen().show(); 89 | ``` 90 | 91 |
92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 |
102 | 103 | #### Basic parameters 104 | - [content](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialog/content.html) - [widget](https://api.flutter.dev/flutter/widgets/Widget-class.html) that is desired to be shown. 105 | - [animation configuration](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialogAnimationConfiguration-class.html) - responsible for configuring animation duration, start value, etc. It also provides an opportunity to create a configuration with an external [AnimationController](https://api.flutter.dev/flutter/animation/AnimationController-class.html) that will drive the dialog animation. 106 | - [auto hide duration](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialog/autoHideDuration.html): duration after which the dialog will be automatically hidden. If you pass `null` the dialog won't auto hide at all. 107 | - [decoration](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialogDecoration-class.html): a provided decoration that will be applied to the content. 108 | 109 | #### Context 110 | Each dialog has its own [context](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialogContext-class.html), which is a class that contains helpful methods and properties, such as the animation associated with the dialog: 111 | 112 | ```dart 113 | dialog.context.animation; 114 | dialog.context.hideDialog(); 115 | dialog.context.vsync; 116 | ``` 117 | -------------------------------------------------------------------------------- /doc/faq.md: -------------------------------------------------------------------------------- 1 | **Q:** What can I do if I already have some builders in my `MaterialApp`? 2 | 3 | **A:** `FlutterEasyDialogs.builder()` returns a function, so you may simply call it: 4 | 5 | ```dart 6 | MaterialApp.router( 7 | builder: (context, child) { 8 | final mediaQueryData = MediaQuery.of(context); 9 | final easyDialogsBuilder = FlutterEasyDialogs.builder(); 10 | return MediaQuery( 11 | data: mediaQueryData.copyWith(textScaleFactor: 1.0), 12 | child: easyDialogsBuilder(context, child), 13 | ); 14 | }, 15 | ); 16 | ``` 17 | 18 | **Q:** I didn't see an option like: 'autoHide'. How to make a dialog to stay until I hide it manually besides setting autoHideDuration: const Duration(days: 999)? 19 | 20 | **A:** Each dialog has a property named `autoHideDuration`, and if you pass `null`, it won't automatically hide the dialog. You can then hide the dialog manually later: 21 | 22 | ```dart 23 | Container( 24 | color: Colors.blueAccent, 25 | width: double.infinity, 26 | height: 200.0, 27 | child: const Text('Hello World'), 28 | ).positioned(autoHideDuration: null).show(); 29 | 30 | // or 31 | FlutterEasyDialogs.show( 32 | EasyDialog.positioned( 33 | autoHideDuration: null, 34 | content: Container( 35 | color: Colors.blueAccent, 36 | width: double.infinity, 37 | height: 200.0, 38 | child: const Text('Hello World'), 39 | ), 40 | ), 41 | ); 42 | ``` -------------------------------------------------------------------------------- /doc/getting-started.md: -------------------------------------------------------------------------------- 1 | ## Getting started 2 | ## Installation 3 | In the `pubspec.yaml` of your flutter project, add the following dependency: 4 | 5 | ```yaml 6 | dependencies: 7 | flutter_easy_dialogs: 8 | ``` 9 | 10 | In your library add the following import: 11 | 12 | ```dart 13 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 14 | ``` 15 | 16 | ## Setup and usage 17 | 18 | Wrap your MaterialApp with [FlutterEasyDialogs.builder()](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/FlutterEasyDialogs/builder-constant.html) and you are ready to go. 19 | 20 | ```dart 21 | class MyApp extends StatelessWidget { 22 | const MyApp({super.key}); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return MaterialApp( 27 | builder: FlutterEasyDialogs.builder(), 28 | ); 29 | } 30 | } 31 | ``` 32 | 33 | Now you are able to call show methods from [FlutterEasyDialogs](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/FlutterEasyDialogs-class.html) like so: 34 | ```dart 35 | FlutterEasyDialogs.show( 36 | EasyDialog.positioned( 37 | decoration: const EasyDialogAnimation.fade(), 38 | content: Container( 39 | height: 150.0, 40 | color: Colors.blue[900], 41 | alignment: Alignment.center, 42 | child: const Text( 43 | 'Dialog', 44 | style: TextStyle( 45 | color: Colors.white, 46 | fontSize: 30.0, 47 | ), 48 | ), 49 | ), 50 | ), 51 | ); 52 | ``` 53 | 54 | Or: 55 | 56 | ```dart 57 | Container( 58 | height: 150.0, 59 | color: Colors.blue[900], 60 | alignment: Alignment.center, 61 | child: const Text( 62 | 'Dialog', 63 | style: TextStyle( 64 | color: Colors.white, 65 | fontSize: 30.0, 66 | ), 67 | ), 68 | ).positioned().fade().show(); 69 | ``` 70 | 71 | ![ezgif-1-c274042f92](https://github.com/feduke-nukem/flutter_easy_dialogs/assets/72284940/2d632324-cb62-40b2-a757-bd9e96b8af4e) 72 | 73 | Or to hide with the help of specific dialog `id`: 74 | 75 | ```dart 76 | FlutterEasyDialogs.hide(id: EasyDialogPosition.top); 77 | ``` 78 | 79 | You can await and and finish dialog showing with some result: 80 | 81 | ```dart 82 | final result = await FlutterEasyDialogs.show( 83 | EasyDialog.positioned( 84 | content: Container( 85 | height: 150.0, 86 | color: Colors.amber[900], 87 | alignment: Alignment.center, 88 | child: const Text('Dialog'), 89 | ), 90 | position: EasyDialogPosition.bottom, 91 | ), 92 | ); 93 | 94 | await FlutterEasyDialogs.hide( 95 | id: EasyDialogPosition.bottom, 96 | result: 5, 97 | ); 98 | ``` 99 | 100 | Or: 101 | 102 | ```dart 103 | final result = await Container( 104 | height: 150.0, 105 | color: Colors.amber[900], 106 | alignment: Alignment.center, 107 | child: const Text('Dialog'), 108 | ).positioned(position: EasyDialogPosition.bottom).show(); 109 | 110 | await FlutterEasyDialogs.hide( 111 | id: EasyDialogPosition.bottom, 112 | result: 5, 113 | ); 114 | ``` 115 | 116 | If needed, there is an option to hide multiple dialogs at once. 117 | 118 | ```dart 119 | FlutterEasyDialogs.hideWhere( 120 | (dialog) => 121 | dialog.position == EasyDialogPosition.bottom || 122 | dialog.position == EasyDialogPosition.top, 123 | ); 124 | ``` 125 | 126 | #### Extension 127 | 128 | There is an [extension](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialogsX.html) that provides alternative ways to show and hide dialogs. 129 | 130 | ```dart 131 | final dialog = Container( 132 | height: 150.0, 133 | color: Colors.blue[900], 134 | alignment: Alignment.center, 135 | child: Text( 136 | 'bottom', 137 | style: const TextStyle( 138 | color: Colors.white, 139 | fontSize: 30.0, 140 | ), 141 | ), 142 | ) 143 | .positioned(position: EasyDialogPosition.bottom) 144 | .fade() 145 | .swipe(instantly: false) 146 | .animatedTap() 147 | .slideHorizontal() 148 | .slideVertical() 149 | .blurBackground(backgroundColor: Colors.red.withOpacity(0.5)); 150 | 151 | final result = await dialog.show(); 152 | await dialog.hide(result: 5); 153 | ``` 154 | 155 | ![ezgif-5-c6586e94c5](https://github.com/feduke-nukem/flutter_easy_dialogs/assets/72284940/5969da40-0d3f-4cb0-8aa3-e166bbe11b6d) 156 | 157 | -------------------------------------------------------------------------------- /doc/migration_guide_2_to_3.md: -------------------------------------------------------------------------------- 1 | ## Migration from 2.x to 3.x 2 | 3 | Each manager has been transformed into a dialog itself: 4 | 5 | * [PositionedDialogManager](https://pub.dev/packages/positioned_dialog_manager) -> [EasyDialog.positioned](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialog/EasyDialog.positioned.html) 6 | * [FullScreenDialogManager](https://pub.dev/packages/full_screen_dialog_manager) -> [EasyDialog.fullScreen](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialog/EasyDialog.fullScreen.html) 7 | 8 | There are no more "Show/Hide" parameters; the dialog contains all the required information internally. 9 | 10 | From: 11 | 12 | ```dart 13 | FlutterEasyDialogs.provider.showPositioned( 14 | PositionedShowParams( 15 | hideAfterDuration: Duration(milliseconds: 500) 16 | content: Container( 17 | height: 150.0, 18 | color: Colors.amber[900], 19 | alignment: Alignment.center, 20 | child: Text('Dialog'), 21 | ), 22 | position: EasyDialogPosition.top, 23 | ), 24 | ); 25 | ``` 26 | 27 | To: 28 | 29 | ```dart 30 | FlutterEasyDialogs.show( 31 | EasyDialog.positioned( 32 | autoHideDuration: Duration(milliseconds: 500), 33 | content: Container( 34 | height: 150.0, 35 | color: Colors.amber[900], 36 | alignment: Alignment.center, 37 | child: Text('Dialog'), 38 | ), 39 | position: EasyDialogPosition.top, 40 | ), 41 | ); 42 | ``` 43 | 44 | Or: 45 | 46 | ```dart 47 | Container( 48 | height: 150.0, 49 | color: Colors.amber[900], 50 | alignment: Alignment.center, 51 | child: Text('Dialog'), 52 | ) 53 | .positioned( 54 | position: EasyDialogPosition.top, 55 | autoHideDuration: Duration(milliseconds: 500), 56 | ) 57 | .show(); 58 | ``` 59 | 60 | To hide a dialog, you can now create an [identifier](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialogIdentifier-class.html) for a specific dialog type. 61 | 62 | From: 63 | 64 | ```dart 65 | FlutterEasyDialogs.provider.hidePositioned(EasyDialogPosition.top) 66 | ``` 67 | 68 | To: 69 | 70 | ```dart 71 | FlutterEasyDialogs.hide( 72 | PositionedDialog.identifier( 73 | position: EasyDialogPosition.top, 74 | ), 75 | ); 76 | ``` 77 | 78 | #### Decorators 79 | 80 | Decorators and all related objects have changed too: 81 | 82 | * Decorator -> [Decoration](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialogDecoration-class.html) 83 | * Animator -> [Animation](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialogAnimation-class.html) 84 | * Dismissible -> [Dismiss](https://pub.dev/documentation/flutter_easy_dialogs/latest/flutter_easy_dialogs/EasyDialogDismiss-class.html) 85 | 86 | They all have become more flexible and universal. 87 | 88 | Better watch this [topic](https://pub.dev/documentation/flutter_easy_dialogs/latest/topics/Decorations-topic.html) for better a understanding. 89 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Web related 36 | lib/generated_plugin_registrant.dart 37 | 38 | # Symbolication related 39 | app.*.symbols 40 | 41 | # Obfuscation related 42 | app.*.map.json 43 | 44 | # Android Studio will place build artifacts here 45 | /android/app/debug 46 | /android/app/profile 47 | /android/app/release 48 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: f1875d570e39de09040c8f79aa13cc56baab8db1 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 17 | base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 18 | - platform: android 19 | create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 20 | base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 21 | - platform: ios 22 | create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 23 | base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 24 | - platform: linux 25 | create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 26 | base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 27 | - platform: macos 28 | create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 29 | base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 30 | - platform: web 31 | create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 32 | base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 33 | - platform: windows 34 | create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 35 | base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | Flutter Easy Dialogs example -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | 4 | linter: 5 | rules: 6 | # - public_member_api_docs 7 | - annotate_overrides 8 | - avoid_empty_else 9 | - avoid_function_literals_in_foreach_calls 10 | - avoid_init_to_null 11 | - avoid_null_checks_in_equality_operators 12 | - avoid_relative_lib_imports 13 | # - avoid_renaming_method_parameters 14 | - avoid_redundant_argument_values 15 | - use_function_type_syntax_for_parameters 16 | - avoid_return_types_on_setters 17 | - avoid_types_as_parameter_names 18 | - avoid_unused_constructor_parameters 19 | - await_only_futures 20 | - camel_case_types 21 | - cancel_subscriptions 22 | - cascade_invocations 23 | - comment_references 24 | - constant_identifier_names 25 | - control_flow_in_finally 26 | - directives_ordering 27 | - empty_catches 28 | - empty_constructor_bodies 29 | - empty_statements 30 | - hash_and_equals 31 | - implementation_imports 32 | - library_names 33 | - library_prefixes 34 | - no_adjacent_strings_in_list 35 | - no_duplicate_case_values 36 | - non_constant_identifier_names 37 | - null_closures 38 | - omit_local_variable_types 39 | - only_throw_errors 40 | - overridden_fields 41 | - package_api_docs 42 | - package_names 43 | - package_prefixed_library_names 44 | - prefer_adjacent_string_concatenation 45 | - prefer_collection_literals 46 | - prefer_conditional_assignment 47 | - prefer_const_constructors 48 | - prefer_contains 49 | - prefer_final_fields 50 | - prefer_initializing_formals 51 | - prefer_interpolation_to_compose_strings 52 | - prefer_is_empty 53 | - prefer_is_not_empty 54 | - prefer_single_quotes 55 | - prefer_typing_uninitialized_variables 56 | - recursive_getters 57 | - require_trailing_commas 58 | - slash_for_doc_comments 59 | - test_types_in_equals 60 | - throw_in_finally 61 | - type_init_formals 62 | - unawaited_futures 63 | - unnecessary_brace_in_string_interps 64 | - unnecessary_const 65 | - unnecessary_getters_setters 66 | - unnecessary_lambdas 67 | - unnecessary_new 68 | - unnecessary_null_aware_assignments 69 | - unnecessary_statements 70 | - unnecessary_this 71 | - unrelated_type_equality_checks 72 | - use_rethrow_when_possible 73 | - valid_regexps 74 | - cast_nullable_to_non_nullable -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.example" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/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 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/lib/full_screen/routes.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/full_screen/screens/full_screen_dialog_customization_screen.dart'; 2 | import 'package:example/widget/home_template.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | import 'screens/screens.dart'; 6 | 7 | enum FullScreenDialogRoutes { 8 | basicUsage(name: 'basic usage'), 9 | home(name: 'full screen dialog manager home'), 10 | customization(name: 'customization'); 11 | 12 | final String name; 13 | 14 | const FullScreenDialogRoutes({ 15 | required this.name, 16 | }); 17 | 18 | Widget get screen { 19 | switch (this) { 20 | case FullScreenDialogRoutes.home: 21 | return HomeTemplate( 22 | title: 'Full Screen Dialog Manager', 23 | destinations: { 24 | for (var element in FullScreenDialogRoutes.values 25 | .where( 26 | (element) => element != FullScreenDialogRoutes.home, 27 | ) 28 | .toList()) 29 | (element).name: () => (element).route, 30 | }, 31 | ); 32 | case FullScreenDialogRoutes.basicUsage: 33 | return const FullScreenDialogManagerBasicUsageScreen(); 34 | 35 | case FullScreenDialogRoutes.customization: 36 | return const FullScreenDialogCustomizationScreen(); 37 | } 38 | } 39 | 40 | Route get route => _buildRoute(screen); 41 | 42 | Route _buildRoute(Widget child) => MaterialPageRoute(builder: (_) => child); 43 | } 44 | -------------------------------------------------------------------------------- /example/lib/full_screen/screens/screens.dart: -------------------------------------------------------------------------------- 1 | export 'full_screen_dialog_basic_usage_screen.dart'; 2 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/screens/home_screen.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 4 | 5 | void main() { 6 | runApp(const MyApp()); 7 | } 8 | 9 | class MyApp extends StatelessWidget { 10 | const MyApp({Key? key}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return MaterialApp( 15 | debugShowCheckedModeBanner: false, 16 | theme: ThemeData( 17 | colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), 18 | useMaterial3: true, 19 | ), 20 | title: 'Easy Dialogs demo', 21 | home: const HomeScreen(), 22 | builder: FlutterEasyDialogs.builder(), 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /example/lib/positioned/routes.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/widget/home_template.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'screens/positioned_dialog_basic_usage.dart'; 5 | import 'screens/positioned_dialog_customization_screen.dart'; 6 | import 'screens/positioned_dialog_flutter_animate.dart'; 7 | 8 | enum PositionedDialogRoutes { 9 | basicUsage(name: 'basic usage'), 10 | home(name: 'positioned dialog manager home'), 11 | flutterAnimmate(name: 'flutter animate'), 12 | customization(name: 'customization'); 13 | 14 | final String name; 15 | 16 | const PositionedDialogRoutes({required this.name}); 17 | 18 | Widget get screen { 19 | switch (this) { 20 | case PositionedDialogRoutes.home: 21 | return HomeTemplate( 22 | title: 'Positioned Dialog Manager', 23 | destinations: { 24 | for (var element in PositionedDialogRoutes.values 25 | .where( 26 | (element) => element != PositionedDialogRoutes.home, 27 | ) 28 | .toList()) 29 | (element).name: () => (element).route, 30 | }, 31 | ); 32 | case PositionedDialogRoutes.basicUsage: 33 | return const PositionedDialogManagerBasicUsageScreen(); 34 | 35 | case PositionedDialogRoutes.customization: 36 | return const PositionedDialogManagerCustomizationScreen(); 37 | 38 | case PositionedDialogRoutes.flutterAnimmate: 39 | return const PositionedDialogFlutterAnimate(); 40 | } 41 | } 42 | 43 | Route get route => _buildRoute(screen); 44 | 45 | Route _buildRoute(Widget child) => MaterialPageRoute(builder: (_) => child); 46 | } 47 | -------------------------------------------------------------------------------- /example/lib/positioned/screens/positioned_dialog_customization_screen.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: avoid_print 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 5 | 6 | class PositionedDialogManagerCustomizationScreen extends StatelessWidget { 7 | const PositionedDialogManagerCustomizationScreen({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Scaffold( 12 | appBar: AppBar( 13 | title: const Text('Positioned dialog customization'), 14 | ), 15 | body: Center( 16 | child: Column( 17 | mainAxisAlignment: MainAxisAlignment.center, 18 | children: [ 19 | ElevatedButton( 20 | onPressed: _show, 21 | child: const Text('show'), 22 | ), 23 | ], 24 | ), 25 | ), 26 | ); 27 | } 28 | 29 | void _show() => EasyDialog.positioned( 30 | animationConfiguration: const EasyDialogAnimationConfiguration.bounded( 31 | duration: Duration(milliseconds: 400), 32 | ), 33 | position: EasyDialogPosition.bottom, 34 | decoration: const _CustomPositionedShell() 35 | .chained(_CustomPositionedAnimation()) 36 | .chained( 37 | _CustomPositionedDismiss( 38 | onDismissed: () => 6, 39 | ), 40 | ), 41 | content: const SizedBox.square( 42 | dimension: 250, 43 | child: Center( 44 | child: Text( 45 | 'custom banner', 46 | ), 47 | ), 48 | ), 49 | ).show().then((value) => print('dismissed with $value')); 50 | } 51 | 52 | final class _CustomPositionedShell extends PositionedShell { 53 | const _CustomPositionedShell(); 54 | 55 | @override 56 | Widget call(PositionedDialog dialog) { 57 | return SizedBox( 58 | width: double.infinity, 59 | height: 200.0, 60 | child: ColoredBox( 61 | color: Colors.amber, 62 | child: dialog.content, 63 | ), 64 | ); 65 | } 66 | } 67 | 68 | final class _CustomPositionedAnimation 69 | extends EasyDialogDecoration { 70 | @override 71 | Widget call(EasyDialog dialog) { 72 | final animation = dialog.context.animation; 73 | 74 | final offset = Tween( 75 | begin: const Offset(0.0, 1.0), 76 | end: const Offset(0.0, 0.0), 77 | ).chain(CurveTween(curve: Curves.fastOutSlowIn)).animate(animation); 78 | return AnimatedBuilder( 79 | animation: animation, 80 | builder: (_, __) => Stack( 81 | children: [ 82 | Positioned.fill( 83 | child: ColoredBox( 84 | color: Colors.black.withValues( 85 | alpha: animation.value.clamp(0.0, 0.6), 86 | ), 87 | ), 88 | ), 89 | Align( 90 | alignment: Alignment.bottomCenter, 91 | child: SlideTransition(position: offset, child: dialog.content), 92 | ), 93 | ], 94 | ), 95 | ); 96 | } 97 | } 98 | 99 | final class _CustomPositionedDismiss 100 | extends EasyDialogDismiss { 101 | const _CustomPositionedDismiss({ 102 | required super.onDismissed, 103 | }); 104 | 105 | @override 106 | Widget call(PositionedDialog dialog) { 107 | return GestureDetector( 108 | onTap: () => super.handleDismiss(dialog), 109 | child: dialog.content, 110 | ); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /example/lib/positioned/screens/positioned_dialog_flutter_animate.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_animate/flutter_animate.dart'; 3 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 4 | 5 | class PositionedDialogFlutterAnimate extends StatefulWidget { 6 | const PositionedDialogFlutterAnimate({super.key}); 7 | 8 | @override 9 | State createState() => 10 | _PositionedDialogFlutterAnimateState(); 11 | } 12 | 13 | class _PositionedDialogFlutterAnimateState 14 | extends State 15 | with SingleTickerProviderStateMixin { 16 | late final _controller = AnimationController( 17 | vsync: this, 18 | duration: const Duration( 19 | milliseconds: 1500, 20 | ), 21 | ); 22 | @override 23 | Widget build(BuildContext context) { 24 | return Scaffold( 25 | appBar: AppBar( 26 | title: const Text('Positioned Dialog Flutter Animate'), 27 | ), 28 | body: Center( 29 | child: ElevatedButton( 30 | onPressed: () { 31 | FlutterEasyDialogs.show( 32 | EasyDialog.positioned( 33 | animationConfiguration: 34 | EasyDialogAnimationConfiguration.withController( 35 | _controller, 36 | willReverse: true, 37 | ), 38 | decoration: EasyDialogDecoration.builder( 39 | (context, dialog) => dialog.content 40 | .animate(controller: _controller) 41 | .scale(curve: Curves.fastOutSlowIn) 42 | .shake() 43 | .elevation() 44 | .slide() 45 | .fadeIn(), 46 | ), 47 | content: Container( 48 | color: Colors.white, 49 | width: double.infinity, 50 | height: 200.0, 51 | child: Column( 52 | mainAxisAlignment: MainAxisAlignment.center, 53 | mainAxisSize: MainAxisSize.min, 54 | children: [ 55 | const Text('Hello World'), 56 | ElevatedButton( 57 | onPressed: () => 58 | FlutterEasyDialogs.hide(id: EasyDialogPosition.top), 59 | child: const Text('Close'), 60 | ), 61 | ], 62 | ), 63 | ), 64 | ), 65 | ); 66 | }, 67 | child: const Text('Show Dialog'), 68 | ), 69 | ), 70 | ); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /example/lib/screens/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:example/full_screen/routes.dart'; 2 | import 'package:example/positioned/routes.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class HomeScreen extends StatelessWidget { 6 | const HomeScreen({super.key}); 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Scaffold( 11 | appBar: AppBar( 12 | title: const Text('Easy Dialogs Example'), 13 | ), 14 | body: Center( 15 | child: Column( 16 | mainAxisAlignment: MainAxisAlignment.center, 17 | children: [ 18 | ElevatedButton( 19 | onPressed: () => 20 | Navigator.of(context).push(PositionedDialogRoutes.home.route), 21 | child: const Text('Positioned dialogs example'), 22 | ), 23 | ElevatedButton( 24 | onPressed: () => 25 | Navigator.of(context).push(FullScreenDialogRoutes.home.route), 26 | child: const Text('Full screen dialogs example'), 27 | ), 28 | ], 29 | ), 30 | ), 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /example/lib/widget/home_template.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class HomeTemplate extends StatelessWidget { 4 | final Map destinations; 5 | final String title; 6 | 7 | const HomeTemplate({ 8 | required this.destinations, 9 | required this.title, 10 | super.key, 11 | }); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Scaffold( 16 | appBar: AppBar( 17 | title: Text(title), 18 | ), 19 | body: Center( 20 | child: SingleChildScrollView( 21 | child: Column( 22 | mainAxisAlignment: MainAxisAlignment.center, 23 | children: destinations.entries 24 | .map( 25 | (e) => ElevatedButton( 26 | onPressed: () => Navigator.of(context).push(e.value()), 27 | child: Text(e.key), 28 | ), 29 | ) 30 | .toList(), 31 | ), 32 | ), 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.example") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /example/linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "example"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | 4 | publish_to: "none" 5 | version: 1.0.0+1 6 | 7 | environment: 8 | sdk: ">=3.0.0 <4.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | flutter_easy_dialogs: 14 | path: ../ 15 | flutter_animate: ^4.2.0 16 | 17 | dev_dependencies: 18 | flutter_test: 19 | sdk: flutter 20 | flutter_lints: ^2.0.0 21 | 22 | flutter: 23 | uses-material-design: true 24 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(example LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Disable Windows macros that collide with C++ standard library functions. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 25 | 26 | # Add dependency libraries and include directories. Add any application-specific 27 | # dependencies here. 28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 30 | 31 | # Run the Flutter tool portions of the build. This must not be removed. 32 | add_dependencies(${BINARY_NAME} flutter_assemble) 33 | -------------------------------------------------------------------------------- /example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "example.exe" "\0" 98 | VALUE "ProductName", "example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/feduke-nukem/flutter_easy_dialogs/31df444c7e8f5032e19f9aec5996cbf602825016/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /lib/flutter_easy_dialogs.dart: -------------------------------------------------------------------------------- 1 | library flutter_easy_dialogs; 2 | 3 | export 'src/core/core.dart' 4 | hide 5 | EasyDialogsOverlayBox, 6 | AnimationConfigurationWithoutController, 7 | AnimationConfigurationWithController, 8 | AnimationConfigurationBounded, 9 | AnimationConfigurationUnbounded; 10 | export 'src/util/multiply_animation.dart'; 11 | export 'src/positioned/positioned.dart'; 12 | export 'src/full_screen/full_screen.dart'; 13 | export 'src/flutter_easy_dialogs.dart'; 14 | -------------------------------------------------------------------------------- /lib/src/core/android_back_button_interceptor_mixin.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 4 | 5 | /// For handling back button on Android. 6 | 7 | mixin AndroidBackButtonInterceptorMixin on EasyDialogLifecycle { 8 | @override 9 | void init() { 10 | super.init(); 11 | _AndroidBackButtonInterceptor.addCallback(onAndroidPop); 12 | } 13 | 14 | @override 15 | void onShow() { 16 | super.onShow(); 17 | 18 | _AndroidBackButtonInterceptor.blockBackButton(); 19 | } 20 | 21 | @override 22 | void onHidden() { 23 | super.onHidden(); 24 | 25 | _AndroidBackButtonInterceptor.unblockBackButton(); 26 | } 27 | 28 | @override 29 | void dispose() { 30 | _AndroidBackButtonInterceptor.removeCallback(onAndroidPop); 31 | super.dispose(); 32 | } 33 | 34 | /// Will be called when Android back button is pressed. 35 | @protected 36 | void onAndroidPop() {} 37 | } 38 | 39 | abstract interface class _AndroidBackButtonInterceptor 40 | implements WidgetsBinding { 41 | static bool _isBlocked = false; 42 | static bool _isMethodCallHandlerSet = false; 43 | 44 | static final _callBacks = []; 45 | 46 | static void addCallback(VoidCallback callback) { 47 | _callBacks.add(callback); 48 | } 49 | 50 | static void removeCallback(VoidCallback callback) { 51 | _callBacks.remove(callback); 52 | } 53 | 54 | /// Starts blocking Android back button events. 55 | static void blockBackButton() { 56 | if (!_isMethodCallHandlerSet) { 57 | SystemChannels.navigation 58 | .setMethodCallHandler(_handleNavigationInvocation); 59 | _isMethodCallHandlerSet = true; 60 | } 61 | _isBlocked = true; 62 | } 63 | 64 | static void unblockBackButton() { 65 | _isBlocked = false; 66 | } 67 | 68 | static Future _handleNavigationInvocation(MethodCall methodCall) { 69 | if (methodCall.method == 'popRoute') { 70 | _callBacks.forEach((callback) => callback()); 71 | 72 | return _isBlocked 73 | ? Future.value() 74 | : WidgetsBinding.instance.handlePopRoute(); 75 | } 76 | 77 | if (methodCall.method == 'pushRoute') { 78 | return WidgetsBinding.instance.handlePushRoute(methodCall.arguments); 79 | } 80 | 81 | return Future.value(); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lib/src/core/core.dart: -------------------------------------------------------------------------------- 1 | export 'easy_dialog_animation_configuration.dart'; 2 | export 'easy_dialogs_controller.dart'; 3 | export 'easy_overlay.dart'; 4 | -------------------------------------------------------------------------------- /lib/src/core/easy_dialog_animation_configuration.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/src/core/easy_dialogs_controller.dart'; 3 | 4 | /// {@category Dialogs} 5 | /// {@category Migration guide from 2.x to 3.x} 6 | /// {@template easy_dialog_animation_configuration} 7 | /// Configuration of [EasyDialogAnimation]. 8 | /// 9 | /// This is typically used to configure the [Animation] 10 | /// that is created by [EasyDialogsController] which implies to drive any 11 | /// kind of animations that can be applied to the dialog. 12 | /// {@endtemplate} 13 | sealed class EasyDialogAnimationConfiguration { 14 | /// @nodoc 15 | const EasyDialogAnimationConfiguration(); 16 | 17 | /// See [AnimationController]. 18 | const factory EasyDialogAnimationConfiguration.bounded({ 19 | double? startValue, 20 | Duration duration, 21 | Duration reverseDuration, 22 | double lowerBound, 23 | double upperBound, 24 | }) = AnimationConfigurationBounded; 25 | 26 | /// See [AnimationController.unbounded]. 27 | const factory EasyDialogAnimationConfiguration.unbounded({ 28 | double startValue, 29 | Duration duration, 30 | Duration reverseDuration, 31 | }) = AnimationConfigurationUnbounded; 32 | 33 | /// Create configuration using an [AnimationController]. 34 | /// 35 | /// * The [willDispose] is whether the controller should be disposed by 36 | /// [EasyDialogsController] when the dialog is dismissed. 37 | /// 38 | /// * The [willForward] is whether the controller should be started by 39 | /// [EasyDialogsController] when the dialog is intended to be shown. 40 | /// 41 | /// * The [willReverse] is whether the controller should be reversed by 42 | /// [EasyDialogsController] when the dialog is intended to be dismissed. 43 | const factory EasyDialogAnimationConfiguration.withController( 44 | AnimationController controller, { 45 | bool willForward, 46 | bool willReverse, 47 | bool willDispose, 48 | }) = AnimationConfigurationWithController; 49 | } 50 | 51 | final class AnimationConfigurationWithController 52 | extends EasyDialogAnimationConfiguration { 53 | final AnimationController controller; 54 | final bool willForward; 55 | final bool willReverse; 56 | final bool willDispose; 57 | 58 | const AnimationConfigurationWithController( 59 | this.controller, { 60 | this.willForward = false, 61 | this.willReverse = false, 62 | this.willDispose = false, 63 | }); 64 | } 65 | 66 | sealed class AnimationConfigurationWithoutController 67 | extends EasyDialogAnimationConfiguration { 68 | const AnimationConfigurationWithoutController(); 69 | 70 | AnimationController createController(TickerProvider vsync); 71 | } 72 | 73 | final class AnimationConfigurationBounded 74 | extends AnimationConfigurationWithoutController { 75 | final Duration duration; 76 | final Duration reverseDuration; 77 | final double startValue; 78 | final double lowerBound; 79 | final double upperBound; 80 | 81 | const AnimationConfigurationBounded({ 82 | double? startValue, 83 | Duration duration = const Duration(milliseconds: 350), 84 | Duration? reverseDuration, 85 | this.lowerBound = 0.0, 86 | this.upperBound = 1.0, 87 | }) : this.startValue = startValue ?? lowerBound, 88 | this.duration = duration, 89 | this.reverseDuration = reverseDuration ?? duration, 90 | assert(upperBound >= lowerBound); 91 | 92 | @override 93 | AnimationController createController(TickerProvider vsync) => 94 | AnimationController( 95 | value: startValue, 96 | duration: duration, 97 | reverseDuration: reverseDuration, 98 | lowerBound: lowerBound, 99 | upperBound: upperBound, 100 | vsync: vsync, 101 | ); 102 | } 103 | 104 | final class AnimationConfigurationUnbounded 105 | extends AnimationConfigurationWithoutController { 106 | final Duration duration; 107 | final Duration reverseDuration; 108 | final double startValue; 109 | 110 | const AnimationConfigurationUnbounded({ 111 | this.startValue = 0.0, 112 | Duration duration = const Duration(milliseconds: 350), 113 | Duration? reverseDuration, 114 | }) : this.duration = duration, 115 | this.reverseDuration = reverseDuration ?? duration; 116 | 117 | @override 118 | AnimationController createController(TickerProvider vsync) => 119 | AnimationController.unbounded( 120 | value: startValue, 121 | duration: duration, 122 | reverseDuration: reverseDuration, 123 | vsync: vsync, 124 | ); 125 | } 126 | -------------------------------------------------------------------------------- /lib/src/core/easy_overlay.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: prefer-match-file-name 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/scheduler.dart'; 5 | 6 | import 'core.dart'; 7 | 8 | /// {@category Overlay} 9 | /// {@category Custom} 10 | /// Controller for manipulating overlay with the dialogs. 11 | /// 12 | /// It defines the methods for inserting and removing dialogs 13 | /// from an [EasyDialogsOverlayBox]. 14 | /// 15 | /// It extends the [TickerProvider] interface, 16 | /// which is used for providing animation tickers. 17 | /// 18 | /// It is involved to be used for creating [AnimationController] 19 | /// by [EasyDialogsController]. 20 | abstract interface class IEasyOverlay implements TickerProvider { 21 | /// Insert dialog using provided [insertion]. 22 | void insertDialog(EasyOverlayBoxInsertion insertion); 23 | 24 | /// Remove dialog using provided [removal]. 25 | void removeDialog(EasyOverlayBoxRemoval removal); 26 | } 27 | 28 | /// {@category Overlay} 29 | /// {@category Custom} 30 | /// Box for storing dialog specific entries. 31 | final class EasyDialogsOverlayBox { 32 | @visibleForTesting 33 | final currentEntries = {}; 34 | 35 | T putIfAbsent(Object key, T Function() ifAbsent) => 36 | currentEntries.putIfAbsent(key, ifAbsent) as T; 37 | 38 | T? get(Object key) => currentEntries[key] as T?; 39 | 40 | void put(Object key, Object value) => currentEntries[key] = value; 41 | 42 | T? remove(Object key) => currentEntries.remove(key) as T?; 43 | } 44 | 45 | /// {@category Overlay} 46 | /// {@category Custom} 47 | /// Class for applying specific mutation within [EasyDialogsOverlayBox]. 48 | /// 49 | /// It is intended to be used as a base class for 50 | /// creating custom mutation operations. 51 | /// 52 | /// This class has two generic type parameters: 53 | /// 54 | /// [D] represents the type of [EasyDialog] that this mutation 55 | /// associates to with the [dialogType] getter. 56 | /// 57 | /// [R] represents the type of the return value for the [call] method, 58 | /// it should extends [EasyOverlayEntry] which can bu nullable. 59 | abstract interface class EasyOverlayBoxMutation { 61 | const EasyOverlayBoxMutation(); 62 | 63 | Type get dialogType => D; 64 | 65 | /// Apply mutation to provided [box]. 66 | /// 67 | /// The result is [R]. 68 | R call(EasyDialogsOverlayBox box); 69 | } 70 | 71 | /// {@category Overlay} 72 | /// {@category Custom} 73 | /// Insertion mutation. 74 | abstract base class EasyOverlayBoxInsertion 75 | extends EasyOverlayBoxMutation { 76 | final Widget dialog; 77 | 78 | /// @nodoc 79 | const EasyOverlayBoxInsertion({required this.dialog}); 80 | } 81 | 82 | /// {@category Overlay} 83 | /// {@category Custom} 84 | /// Removal mutation. 85 | abstract base class EasyOverlayBoxRemoval 86 | extends EasyOverlayBoxMutation { 87 | const EasyOverlayBoxRemoval(); 88 | } 89 | 90 | /// {@category Overlay} 91 | /// The EasyOverlayEntry class is an abstract class that 92 | /// extends [OverlayEntry]. 93 | /// 94 | /// It is designed to be used as a base class for creating 95 | /// custom overlay entries. 96 | /// 97 | /// The class overrides the [markNeedsBuild] 98 | /// method to ensure that the widget 99 | /// is only rebuilt during the [SchedulerPhase.persistentCallbacks] 100 | /// phase. 101 | /// 102 | /// If the method is called during any other phase, 103 | /// it schedules a [SchedulerBinding.addPostFrameCallback] 104 | /// to ensure that the widget is rebuilt during the 105 | /// [SchedulerPhase.persistentCallbacks] phase. 106 | abstract base class EasyOverlayEntry extends OverlayEntry { 107 | /// Creates an instance of [EasyOverlayEntry]. 108 | EasyOverlayEntry({required super.builder}); 109 | 110 | @override 111 | void markNeedsBuild() { 112 | if (SchedulerBinding.instance.schedulerPhase == 113 | SchedulerPhase.persistentCallbacks) { 114 | SchedulerBinding.instance.addPostFrameCallback((_) { 115 | super.markNeedsBuild(); 116 | }); 117 | 118 | return; 119 | } 120 | 121 | super.markNeedsBuild(); 122 | } 123 | } 124 | 125 | /// {@category Overlay} 126 | /// Simple overlay entry. 127 | base class EasyDialogsOverlayEntry extends EasyOverlayEntry { 128 | /// Creates an instance of [EasyDialogsOverlayEntry]. 129 | EasyDialogsOverlayEntry({required super.builder}); 130 | } 131 | -------------------------------------------------------------------------------- /lib/src/core/widget/free_positioned.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class FreePositioned extends StatefulWidget { 4 | final Widget child; 5 | 6 | const FreePositioned({required this.child}); 7 | 8 | @override 9 | State createState() => _FreePositionedState(); 10 | } 11 | 12 | class _FreePositionedState extends State { 13 | var _x = 0.0; 14 | var _y = 0.0; 15 | AlignmentGeometry? _alignment; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | final screenSize = MediaQuery.sizeOf(context); 20 | 21 | return Stack( 22 | children: [ 23 | Positioned( 24 | left: _x, 25 | top: _y, 26 | child: GestureDetector( 27 | child: ConstrainedBox( 28 | constraints: BoxConstraints( 29 | maxWidth: screenSize.width, 30 | maxHeight: screenSize.height, 31 | ), 32 | // Not the best approach to apply alignment but it works for now, 33 | // need to be reworked in the future 34 | child: _alignment == null 35 | ? widget.child 36 | : Align( 37 | alignment: _alignment!, 38 | child: widget.child, 39 | ), 40 | ), 41 | onPanUpdate: (details) => setState( 42 | () { 43 | _x += details.delta.dx; 44 | _y += details.delta.dy; 45 | }, 46 | ), 47 | ), 48 | ), 49 | ], 50 | ); 51 | } 52 | 53 | @override 54 | void didChangeDependencies() { 55 | super.didChangeDependencies(); 56 | 57 | _alignment = context.findAncestorWidgetOfExactType()?.alignment; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /lib/src/core/widget/overlay_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/scheduler.dart'; 3 | import 'package:flutter_easy_dialogs/src/core/core.dart'; 4 | 5 | class OverlayProvider extends StatefulWidget { 6 | static final stateKey = GlobalKey(); 7 | 8 | final Widget child; 9 | 10 | const OverlayProvider({ 11 | required this.child, 12 | super.key, 13 | }); 14 | 15 | @override 16 | State createState() => OverlayProviderState(); 17 | } 18 | 19 | class OverlayProviderState extends State 20 | implements IEasyOverlay { 21 | late final EasyDialogsController controller; 22 | final _overlayKey = GlobalKey(); 23 | @visibleForTesting 24 | final box = EasyDialogsOverlayBox(); 25 | 26 | @override 27 | Widget build(BuildContext context) { 28 | return Material( 29 | child: Overlay( 30 | key: _overlayKey, 31 | initialEntries: [ 32 | EasyDialogsOverlayEntry(builder: (context) => widget.child), 33 | ], 34 | ), 35 | ); 36 | } 37 | 38 | @override 39 | void initState() { 40 | super.initState(); 41 | controller = EasyDialogsController(this); 42 | } 43 | 44 | @override 45 | Ticker createTicker(TickerCallback onTick) => 46 | _overlayKey.currentState!.createTicker(onTick); 47 | 48 | @override 49 | void insertDialog(EasyOverlayBoxInsertion insertion) => 50 | _overlayKey.currentState!.insert(insertion(box)); 51 | 52 | @override 53 | void removeDialog(EasyOverlayBoxRemoval removal) => 54 | (removal(box))?.remove(); 55 | } 56 | -------------------------------------------------------------------------------- /lib/src/flutter_easy_dialogs.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/src/core/core.dart'; 3 | import 'package:flutter_easy_dialogs/src/core/widget/overlay_provider.dart'; 4 | 5 | /// {@category Dialogs} 6 | /// {@category Getting started} 7 | /// {@category Migration guide from 2.x to 3.x} 8 | /// {@category FAQ} 9 | /// Wrapper for providing an easy use of different custom dialogs. 10 | final class FlutterEasyDialogs extends StatelessWidget { 11 | /// Child widget. 12 | final Widget child; 13 | 14 | /// Creates an instance of [FlutterEasyDialogs]. 15 | const FlutterEasyDialogs({ 16 | required this.child, 17 | super.key, 18 | }); 19 | 20 | @visibleForTesting 21 | static EasyDialogsController get controller => 22 | OverlayProvider.stateKey.currentState!.controller; 23 | 24 | /// {@macro easy_dialogs_controller.show} 25 | static Future show(EasyDialog dialog) => 26 | controller.show(dialog); 27 | 28 | /// {@macro easy_dialogs_controller.hide} 29 | static Future hide({ 30 | required Object id, 31 | bool instantly = false, 32 | Object? result, 33 | }) { 34 | return controller.hide( 35 | id: id, 36 | instantly: instantly, 37 | result: result, 38 | ); 39 | } 40 | 41 | /// {@macro easy_dialogs_controller.get} 42 | static EasyDialog get(Object id) => controller.get(id); 43 | 44 | /// {@macro easy_dialogs_controller.hideWhere} 45 | static Future hideWhere( 46 | bool Function(T dialog) test, { 47 | bool instantly = false, 48 | }) { 49 | return controller.hideWhere(test, instantly: instantly); 50 | } 51 | 52 | /// {@macro easy_dialogs_controller.isShown} 53 | static bool isShown({required Object id}) => controller.isShown(id: id); 54 | 55 | /// For using in [MaterialApp.builder]. 56 | static const builder = _builder; 57 | 58 | static TransitionBuilder _builder() => (context, child) => 59 | FlutterEasyDialogs(child: child ?? const SizedBox.shrink()); 60 | 61 | @override 62 | Widget build(BuildContext context) => 63 | OverlayProvider(child: child, key: OverlayProvider.stateKey); 64 | } 65 | -------------------------------------------------------------------------------- /lib/src/full_screen/dialog/full_screen_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_easy_dialogs/src/core/core.dart'; 5 | import 'package:flutter_easy_dialogs/src/core/android_back_button_interceptor_mixin.dart'; 6 | 7 | typedef FullScreenWillPopCallback = FutureOr Function(); 8 | 9 | /// Dialog that is intended to cover the entire screen. 10 | final class FullScreenDialog extends EasyDialog 11 | with AndroidBackButtonInterceptorMixin { 12 | static const defaultId = '\$fullScreenDialog'; 13 | 14 | static const defaultAnimationConfiguration = 15 | EasyDialogAnimationConfiguration.bounded( 16 | duration: const Duration(milliseconds: 300), 17 | reverseDuration: const Duration(milliseconds: 300), 18 | ); 19 | 20 | /// Callback that is invoked when the user presses the back button on Android. 21 | final FullScreenWillPopCallback? androidWillPop; 22 | 23 | /// Creates an instance of [FullScreenDialog]. 24 | FullScreenDialog({ 25 | required super.content, 26 | super.id = defaultId, 27 | this.androidWillPop, 28 | super.animationConfiguration = defaultAnimationConfiguration, 29 | super.decoration, 30 | super.autoHideDuration, 31 | }); 32 | 33 | @override 34 | EasyOverlayBoxInsertion createInsert(Widget decorated) => 35 | FullScreenDialogInsert(dialog: decorated); 36 | 37 | @override 38 | EasyOverlayBoxRemoval createRemove() => const FullScreenDialogRemove(); 39 | 40 | @override 41 | Future onAndroidPop() async { 42 | if (androidWillPop == null) return; 43 | 44 | final canPop = await androidWillPop!(); 45 | 46 | if (!canPop) return; 47 | 48 | this.context.hideDialog( 49 | result: context 50 | .getDecorationOfExactType() 51 | ?.onDismissed 52 | ?.call(), 53 | ); 54 | } 55 | 56 | @override 57 | EasyDialog clone() { 58 | return FullScreenDialog( 59 | content: content, 60 | androidWillPop: androidWillPop, 61 | animationConfiguration: animationConfiguration, 62 | decoration: decoration, 63 | autoHideDuration: autoHideDuration, 64 | id: id, 65 | ); 66 | } 67 | } 68 | 69 | @visibleForTesting 70 | final class FullScreenDialogInsert 71 | extends EasyOverlayBoxInsertion { 72 | /// @nodoc 73 | const FullScreenDialogInsert({required super.dialog}); 74 | 75 | @override 76 | EasyOverlayEntry call(EasyDialogsOverlayBox box) { 77 | assert( 78 | box.get(super.dialogType) == null, 79 | 'only single one full screen $EasyDialogsOverlayEntry can be presented', 80 | ); 81 | 82 | final entry = EasyDialogsOverlayEntry( 83 | builder: (_) => dialog, 84 | ); 85 | 86 | box.put(super.dialogType, entry); 87 | 88 | return entry; 89 | } 90 | } 91 | 92 | @visibleForTesting 93 | final class FullScreenDialogRemove 94 | extends EasyOverlayBoxRemoval { 95 | /// Creates a new instance of the [FullScreenDialogRemove]. 96 | const FullScreenDialogRemove(); 97 | 98 | @override 99 | EasyOverlayEntry? call(EasyDialogsOverlayBox box) => 100 | box.remove(dialogType); 101 | } 102 | -------------------------------------------------------------------------------- /lib/src/full_screen/full_screen.dart: -------------------------------------------------------------------------------- 1 | export 'shell/full_screen_shell.dart'; 2 | export 'widgets/widget.dart'; 3 | export 'dialog/full_screen_dialog.dart' 4 | hide FullScreenDialogInsert, FullScreenDialogRemove; 5 | -------------------------------------------------------------------------------- /lib/src/full_screen/shell/full_screen_shell.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 3 | 4 | part 'modal_banner.dart'; 5 | 6 | /// The [EasyDialogDecoration] that is specific to the [FullScreenDialog]. 7 | abstract base class FullScreenShell 8 | extends EasyDialogDecoration { 9 | const FullScreenShell(); 10 | 11 | /// Applies some [Container] related content modifications. 12 | const factory FullScreenShell.modalBanner({ 13 | EdgeInsets padding, 14 | EdgeInsets margin, 15 | BoxDecoration? boxDecoration, 16 | }) = _ModalBanner; 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/full_screen/shell/modal_banner.dart: -------------------------------------------------------------------------------- 1 | part of 'full_screen_shell.dart'; 2 | 3 | final class _ModalBanner extends FullScreenShell { 4 | final EdgeInsets padding; 5 | 6 | final EdgeInsets margin; 7 | 8 | final BoxDecoration? boxDecoration; 9 | 10 | const _ModalBanner({ 11 | this.padding = const EdgeInsets.all(60.0), 12 | this.margin = const EdgeInsets.symmetric(horizontal: 15.0), 13 | this.boxDecoration, 14 | }); 15 | 16 | @override 17 | Widget call(FullScreenDialog dialog) { 18 | return Center( 19 | child: Container( 20 | padding: padding, 21 | decoration: boxDecoration, 22 | margin: margin, 23 | child: dialog.content, 24 | ), 25 | ); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/src/full_screen/widgets/easy_full_screen_blur.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | /// Full screen blur widget. 6 | class EasyFullScreenBlur extends StatelessWidget { 7 | /// Amount of blur applied to the background. 8 | final double blur; 9 | 10 | /// Amount of opacity applied to the background. 11 | final double opacity; 12 | 13 | /// Presented child below. 14 | final Widget child; 15 | 16 | /// Background color. 17 | final Color? backgroundColor; 18 | 19 | /// Creates an instance of [EasyFullScreenBlur]. 20 | const EasyFullScreenBlur({ 21 | required this.blur, 22 | required this.opacity, 23 | required this.child, 24 | this.backgroundColor, 25 | super.key, 26 | }); 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | final double sigmaX = blur, sigmaY = blur; 31 | 32 | return Stack( 33 | alignment: Alignment.center, 34 | children: [ 35 | Positioned.fill( 36 | child: Opacity( 37 | opacity: opacity, 38 | child: BackdropFilter( 39 | filter: ImageFilter.blur( 40 | sigmaX: sigmaX, 41 | sigmaY: sigmaY, 42 | ), 43 | child: backgroundColor != null 44 | ? ColoredBox(color: backgroundColor!) 45 | : null, 46 | ), 47 | ), 48 | ), 49 | child, 50 | ], 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/src/full_screen/widgets/widget.dart: -------------------------------------------------------------------------------- 1 | export 'easy_full_screen_blur.dart'; 2 | -------------------------------------------------------------------------------- /lib/src/positioned/dialog/positioned_dialog.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../../core/core.dart'; 4 | 5 | /// [EasyDialog] that is shown at a specific [EasyDialogPosition]. 6 | final class PositionedDialog extends EasyDialog { 7 | static const defaultPosition = EasyDialogPosition.top; 8 | static const defaultAnimationConfiguration = 9 | const EasyDialogAnimationConfiguration.bounded( 10 | duration: Duration(milliseconds: 500), 11 | reverseDuration: Duration(milliseconds: 500), 12 | ); 13 | static const defaultAutoHideDuration = Duration(seconds: 3); 14 | 15 | /// The position where the dialog will be shown. 16 | final EasyDialogPosition position; 17 | 18 | /// Creates an instance of [PositionedDialog]. 19 | PositionedDialog({ 20 | required super.content, 21 | this.position = defaultPosition, 22 | super.decoration, 23 | super.animationConfiguration = defaultAnimationConfiguration, 24 | super.autoHideDuration = defaultAutoHideDuration, 25 | Object? id, 26 | }) : super(id: id ?? position); 27 | 28 | @override 29 | EasyOverlayBoxInsertion createInsert(Widget decorated) { 30 | return PositionedDialogInsert( 31 | position: position, 32 | dialog: Align( 33 | alignment: position.alignment, 34 | child: decorated, 35 | ), 36 | ); 37 | } 38 | 39 | @override 40 | EasyOverlayBoxRemoval createRemove() => 41 | PositionedDialogRemove(position: position); 42 | 43 | @override 44 | EasyDialog clone() { 45 | return PositionedDialog( 46 | content: content, 47 | position: position, 48 | decoration: decoration, 49 | animationConfiguration: animationConfiguration, 50 | autoHideDuration: autoHideDuration, 51 | id: id, 52 | ); 53 | } 54 | } 55 | 56 | /// Enum that represents the position of the dialog. 57 | enum EasyDialogPosition { 58 | top(Alignment.topCenter), 59 | bottom(Alignment.bottomCenter), 60 | center(Alignment.center); 61 | 62 | final AlignmentGeometry alignment; 63 | 64 | const EasyDialogPosition(this.alignment); 65 | } 66 | 67 | @visibleForTesting 68 | final class PositionedDialogInsert 69 | extends EasyOverlayBoxInsertion { 70 | final EasyDialogPosition position; 71 | 72 | const PositionedDialogInsert({ 73 | required this.position, 74 | required super.dialog, 75 | }); 76 | 77 | @override 78 | EasyOverlayEntry call(EasyDialogsOverlayBox box) { 79 | final container = 80 | box.putIfAbsent>( 81 | dialogType, 82 | () => {}, 83 | ); 84 | assert( 85 | !container.containsKey(position), 86 | 'only single one $EasyDialogsOverlayEntry with the same $EasyDialogPosition can be presented at the same time', 87 | ); 88 | 89 | final entry = EasyDialogsOverlayEntry( 90 | builder: (_) => dialog, 91 | ); 92 | 93 | container[position] = entry; 94 | 95 | return entry; 96 | } 97 | } 98 | 99 | @visibleForTesting 100 | final class PositionedDialogRemove 101 | extends EasyOverlayBoxRemoval { 102 | final EasyDialogPosition position; 103 | 104 | const PositionedDialogRemove({ 105 | required this.position, 106 | }); 107 | 108 | @override 109 | EasyOverlayEntry? call(EasyDialogsOverlayBox box) { 110 | final container = 111 | box.get>(dialogType); 112 | 113 | assert(container != null, 'entries container is not initialized'); 114 | 115 | if (container!.entries.isEmpty) return null; 116 | 117 | return container.remove(position); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /lib/src/positioned/positioned.dart: -------------------------------------------------------------------------------- 1 | export 'shell/positioned_shell.dart'; 2 | export 'dialog/positioned_dialog.dart' 3 | hide PositionedDialogInsert, PositionedDialogRemove; 4 | -------------------------------------------------------------------------------- /lib/src/positioned/shell/banner.dart: -------------------------------------------------------------------------------- 1 | part of 'positioned_shell.dart'; 2 | 3 | /// Dialog banner. 4 | final class _Banner extends PositionedShell { 5 | /// Background color. 6 | /// 7 | /// Use [ThemeData.primaryColor] if null. 8 | final Color? backgroundColor; 9 | 10 | /// Padding. 11 | final EdgeInsets padding; 12 | 13 | /// Margin. 14 | final EdgeInsets margin; 15 | 16 | /// Border radius. 17 | final BorderRadius borderRadius; 18 | 19 | /// Creates an instance of [_Banner]. 20 | const _Banner({ 21 | this.backgroundColor, 22 | this.padding = const EdgeInsets.all(10.0), 23 | this.margin = EdgeInsets.zero, 24 | this.borderRadius = BorderRadius.zero, 25 | }); 26 | 27 | @override 28 | Widget call(PositionedDialog dialog) { 29 | return Builder( 30 | builder: (context) { 31 | return Padding( 32 | padding: margin, 33 | child: ClipRRect( 34 | borderRadius: borderRadius, 35 | child: ColoredBox( 36 | color: backgroundColor ?? Theme.of(context).primaryColor, 37 | child: SafeArea( 38 | top: dialog.position == EasyDialogPosition.top, 39 | bottom: dialog.position == EasyDialogPosition.bottom, 40 | child: Padding( 41 | padding: padding, 42 | child: SizedBox( 43 | width: double.infinity, 44 | child: dialog.content, 45 | ), 46 | ), 47 | ), 48 | ), 49 | ), 50 | ); 51 | }, 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/src/positioned/shell/positioned_shell.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 3 | 4 | part 'banner.dart'; 5 | 6 | /// An [EasyDialogDecoration] specific to the [PositionedDialog]. 7 | abstract base class PositionedShell 8 | extends EasyDialogDecoration { 9 | /// @nodoc 10 | const PositionedShell(); 11 | 12 | /// Provide some sort of shape to the dialog. 13 | const factory PositionedShell.banner({ 14 | Color? backgroundColor, 15 | EdgeInsets padding, 16 | EdgeInsets margin, 17 | BorderRadius borderRadius, 18 | }) = _Banner; 19 | } 20 | -------------------------------------------------------------------------------- /lib/src/util/multiply_animation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | /// [CompoundAnimation] for multiplying two provided animations. 4 | class MultiplyAnimation extends CompoundAnimation { 5 | /// Creates an instance of [MultiplyAnimation]. 6 | MultiplyAnimation({required super.first, required super.next}); 7 | 8 | @override 9 | double get value => first.value * next.value; 10 | } 11 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_easy_dialogs 2 | description: Easy and flexible package for showing dialogs inside your Flutter application without BuildContext. 3 | version: 4.0.3 4 | homepage: https://github.com/feduke-nukem/flutter_easy_dialogs 5 | repository: https://github.com/feduke-nukem/flutter_easy_dialogs/tree/main 6 | issue_tracker: https://github.com/feduke-nukem/flutter_easy_dialogs/issues 7 | 8 | environment: 9 | sdk: ">=3.0.0 <4.0.0" 10 | flutter: ">=1.17.0" 11 | 12 | dependencies: 13 | flutter: 14 | sdk: flutter 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | flutter_lints: ^4.0.0 20 | dart_code_metrics: ^5.6.0 21 | 22 | -------------------------------------------------------------------------------- /test/helper.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/src/core/core.dart'; 3 | import 'package:flutter_easy_dialogs/src/core/widget/overlay_provider.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | 6 | final _key = GlobalKey(); 7 | 8 | OverlayProviderState get easyOverlayState => _key.currentState!; 9 | 10 | const dialogKey = ValueKey('dialog'); 11 | const testCurve = Curves.linear; 12 | 13 | Widget app({Widget? child}) => MaterialApp( 14 | builder: (context, child) => OverlayProvider( 15 | child: child ?? const SizedBox(), 16 | key: _key, 17 | ), 18 | home: child != null ? Builder(builder: (context) => child) : null, 19 | ); 20 | 21 | AnimationController createTestController() => AnimationController( 22 | vsync: const TestVSync(), 23 | ); 24 | 25 | Future showAndHide( 26 | WidgetTester widgetTester, 27 | EasyDialog dialog, { 28 | Duration pumpAndSettleDuration = const Duration(seconds: 3), 29 | }) async { 30 | await widgetTester.pumpWidget( 31 | app(), 32 | ); 33 | 34 | easyOverlayState.controller.show(dialog); 35 | 36 | await widgetTester.pumpAndSettle(pumpAndSettleDuration); 37 | 38 | expect(find.byKey(dialogKey), findsOneWidget); 39 | 40 | easyOverlayState.controller.hide(id: dialog.id); 41 | 42 | await widgetTester.pumpAndSettle(pumpAndSettleDuration); 43 | 44 | expect(find.byKey(dialogKey), findsNothing); 45 | } 46 | -------------------------------------------------------------------------------- /test/mock.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class FakeAnimation extends Animation { 4 | @override 5 | final T value; 6 | 7 | @override 8 | AnimationStatus get status => AnimationStatus.completed; 9 | 10 | @override 11 | const FakeAnimation(this.value); 12 | 13 | @override 14 | void addListener(VoidCallback listener) {} 15 | 16 | @override 17 | void addStatusListener(AnimationStatusListener listener) {} 18 | 19 | @override 20 | void removeListener(VoidCallback listener) {} 21 | 22 | @override 23 | void removeStatusListener(AnimationStatusListener listener) {} 24 | } 25 | -------------------------------------------------------------------------------- /test/src/core/easy_dialog_animation_configuration_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_easy_dialogs/src/core/core.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | import '../../helper.dart'; 5 | 6 | void main() { 7 | test('create configuration', () { 8 | expect(() => EasyDialogAnimationConfiguration.bounded(), returnsNormally); 9 | expect( 10 | () => EasyDialogAnimationConfiguration.withController( 11 | createTestController(), 12 | ), 13 | returnsNormally); 14 | expect(() => EasyDialogAnimationConfiguration.unbounded(), returnsNormally); 15 | }); 16 | 17 | test('create configuration and controller, all fields are passed correctly', 18 | () { 19 | const startValue = 1.0; 20 | const duration = Duration(seconds: 1); 21 | const reverseDuration = const Duration(seconds: 3); 22 | const lowerBound = 0.5; 23 | const upperBound = 2.0; 24 | 25 | final configuration = EasyDialogAnimationConfiguration.bounded( 26 | startValue: startValue, 27 | duration: duration, 28 | reverseDuration: reverseDuration, 29 | lowerBound: lowerBound, 30 | upperBound: upperBound, 31 | ) as AnimationConfigurationBounded; 32 | 33 | expect(configuration.duration, duration); 34 | expect(configuration.reverseDuration, reverseDuration); 35 | expect(configuration.lowerBound, lowerBound); 36 | expect(configuration.upperBound, upperBound); 37 | expect(configuration.startValue, startValue); 38 | 39 | final controller = configuration.createController(TestVSync()); 40 | 41 | expect(controller.duration, duration); 42 | expect(controller.reverseDuration, reverseDuration); 43 | expect(controller.lowerBound, lowerBound); 44 | expect(controller.upperBound, upperBound); 45 | expect(controller.value, startValue); 46 | }); 47 | 48 | test('create unbounded configuration, all fields are passed correctly', () { 49 | const startValue = 1.0; 50 | const duration = Duration(seconds: 1); 51 | const reverseDuration = const Duration(seconds: 3); 52 | 53 | final configuration = EasyDialogAnimationConfiguration.unbounded( 54 | startValue: startValue, 55 | duration: duration, 56 | reverseDuration: reverseDuration, 57 | ) as AnimationConfigurationUnbounded; 58 | 59 | expect(configuration.duration, duration); 60 | expect(configuration.reverseDuration, reverseDuration); 61 | expect(configuration.startValue, startValue); 62 | 63 | final controller = configuration.createController(TestVSync()); 64 | 65 | expect(controller.duration, duration); 66 | expect(controller.reverseDuration, reverseDuration); 67 | expect(controller.lowerBound, double.negativeInfinity); 68 | expect(controller.upperBound, double.infinity); 69 | expect(controller.value, startValue); 70 | }); 71 | 72 | test('create configuration with controller, controller passed correctly', () { 73 | final controller = createTestController(); 74 | 75 | final configuration = 76 | EasyDialogAnimationConfiguration.withController(controller) 77 | as AnimationConfigurationWithController; 78 | 79 | expect(identical(configuration.controller, controller), isTrue); 80 | }); 81 | } 82 | -------------------------------------------------------------------------------- /test/src/core/easy_dialog_animation_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | import '../../helper.dart'; 6 | 7 | final _animations = [ 8 | EasyDialogAnimation.expansion(), 9 | EasyDialogAnimation.fade(), 10 | EasyDialogAnimation.blurBackground(), 11 | EasyDialogAnimation.fadeBackground(), 12 | EasyDialogAnimation.bounce(), 13 | EasyDialogAnimation.slideHorizontal(), 14 | EasyDialogAnimation.slideVertical(), 15 | EasyDialogAnimation.expansion().interval(0.0, 1.0), 16 | EasyDialogAnimation.expansion().reversed(), 17 | EasyDialogAnimation.expansion().tweenSequence(TweenSequence([ 18 | TweenSequenceItem( 19 | tween: Tween( 20 | begin: 0.0, 21 | end: 0.9, 22 | ), 23 | weight: 0.3, 24 | ) 25 | ])), 26 | ]; 27 | 28 | final _combined = EasyDialogDecoration.combine(_animations); 29 | 30 | void main() { 31 | final animations = [_combined, ..._animations]; 32 | group('positioned animations', () { 33 | test('create all', () { 34 | animations.forEach((animation) { 35 | expect(() => animation, returnsNormally); 36 | }); 37 | }); 38 | 39 | testWidgets( 40 | 'show and hide positioned', 41 | (widgetTester) async { 42 | for (var element in animations) { 43 | await showAndHide( 44 | widgetTester, 45 | EasyDialog.positioned( 46 | id: EasyDialogPosition.top, 47 | autoHideDuration: null, 48 | decoration: element, 49 | content: SizedBox(key: dialogKey), 50 | ), 51 | pumpAndSettleDuration: const Duration(seconds: 3), 52 | ); 53 | } 54 | }, 55 | ); 56 | 57 | testWidgets( 58 | 'show and hide full screen', 59 | (widgetTester) async { 60 | for (var element in animations) { 61 | await showAndHide( 62 | widgetTester, 63 | EasyDialog.fullScreen( 64 | decoration: element, 65 | content: SizedBox(key: dialogKey), 66 | ), 67 | pumpAndSettleDuration: const Duration(seconds: 3), 68 | ); 69 | } 70 | }, 71 | ); 72 | }); 73 | } 74 | -------------------------------------------------------------------------------- /test/src/core/easy_overlay_box_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_easy_dialogs/src/core/core.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | void main() { 5 | late EasyDialogsOverlayBox sut; 6 | 7 | setUp(() { 8 | sut = EasyDialogsOverlayBox(); 9 | }); 10 | 11 | group('easy overlay box', () { 12 | test('create box', () { 13 | expect(() => EasyDialogsOverlayBox(), returnsNormally); 14 | }); 15 | 16 | test('insert int with string key', () { 17 | sut.put('key', 5); 18 | 19 | expect(sut.currentEntries.length, 1); 20 | expect(sut.get('key'), isNotNull); 21 | expect(sut.get('key'), 5); 22 | }); 23 | 24 | test('insert and remove', () { 25 | sut.put('key', 5); 26 | 27 | final result = sut.remove('key'); 28 | 29 | expect(result, 5); 30 | expect(sut.currentEntries.isEmpty, isTrue); 31 | expect(sut.get('key'), isNull); 32 | }); 33 | }); 34 | } 35 | -------------------------------------------------------------------------------- /test/src/core/easy_overlay_entry_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/src/core/easy_overlay.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | test('markNeedsRebuild called', () { 7 | final entry = _DummyEntry(builder: (_) => Container()); 8 | 9 | expect(() => entry.markNeedsBuild(), throwsFlutterError); 10 | }); 11 | } 12 | 13 | final class _DummyEntry extends EasyOverlayEntry { 14 | _DummyEntry({required super.builder}); 15 | } 16 | -------------------------------------------------------------------------------- /test/src/core/widget/free_positioned_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/src/core/widget/free_positioned.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | testWidgets('drag and position changes', (widgetTester) async { 7 | final key = GlobalKey(); 8 | final widget = Container( 9 | height: 100, 10 | width: 100, 11 | color: Colors.red, 12 | key: key, 13 | ); 14 | await widgetTester.pumpWidget( 15 | MaterialApp( 16 | home: FreePositioned(child: widget), 17 | ), 18 | ); 19 | 20 | expect(find.byKey(key), findsOneWidget); 21 | 22 | final box = key.currentContext!.findRenderObject() as RenderBox; 23 | final positionBeforeDrag = box.localToGlobal(Offset.zero); 24 | 25 | await widgetTester.drag(find.byKey(key), const Offset(10, 10)); 26 | await widgetTester.pumpAndSettle(); 27 | 28 | final positionAfterDrag = box.localToGlobal(Offset.zero); 29 | 30 | expect(positionBeforeDrag, isNot(equals(positionAfterDrag))); 31 | }); 32 | } 33 | -------------------------------------------------------------------------------- /test/src/full_screen/dialog/full_screen_dialog_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | import '../../../helper.dart'; 6 | 7 | final _content = Container( 8 | key: dialogKey, 9 | height: 200, 10 | width: 200, 11 | color: Colors.blue, 12 | alignment: Alignment.center, 13 | child: const Text( 14 | 'Full screen dialog', 15 | textAlign: TextAlign.center, 16 | ), 17 | ); 18 | 19 | void main() { 20 | group('full screen dialog', () { 21 | testWidgets('show and hide', (widgetTester) async { 22 | await widgetTester.pumpWidget(app()); 23 | 24 | easyOverlayState.controller.show( 25 | EasyDialog.fullScreen(content: _content), 26 | ); 27 | 28 | await widgetTester.pumpAndSettle(); 29 | 30 | expect(find.byKey(dialogKey), findsOneWidget); 31 | 32 | expect(easyOverlayState.box.currentEntries.isNotEmpty, isTrue); 33 | expect( 34 | easyOverlayState.box.get(FullScreenDialog), 35 | isA(), 36 | ); 37 | 38 | easyOverlayState.controller.hide(id: FullScreenDialog.defaultId); 39 | 40 | await widgetTester.pumpAndSettle(); 41 | 42 | expect(find.byKey(dialogKey), findsNothing); 43 | 44 | expect(easyOverlayState.box.currentEntries.isEmpty, isTrue); 45 | expect(easyOverlayState.box.get(FullScreenDialog), isNull); 46 | }); 47 | 48 | testWidgets('show one, then show another', (widgetTester) async { 49 | await widgetTester.pumpWidget( 50 | app(), 51 | ); 52 | 53 | easyOverlayState.controller.show( 54 | EasyDialog.fullScreen(content: _content), 55 | ); 56 | 57 | await widgetTester.pumpAndSettle(); 58 | 59 | easyOverlayState.controller.show( 60 | EasyDialog.fullScreen( 61 | content: Container( 62 | key: const Key('value'), 63 | ), 64 | ), 65 | ); 66 | 67 | await widgetTester.pumpAndSettle(); 68 | 69 | expect(find.byKey(dialogKey), findsNothing); 70 | expect(find.byKey(const Key('value')), findsOneWidget); 71 | 72 | expect(easyOverlayState.box.currentEntries.isNotEmpty, isTrue); 73 | expect(easyOverlayState.box.get(FullScreenDialog), isNotNull); 74 | }); 75 | }); 76 | 77 | test('clone', () { 78 | const id = 'id'; 79 | final dialog = FullScreenDialog( 80 | content: const SizedBox.shrink(), 81 | id: id, 82 | androidWillPop: () => false, 83 | animationConfiguration: EasyDialogAnimationConfiguration.bounded( 84 | startValue: 0.0, 85 | lowerBound: 0.0, 86 | upperBound: 1.0, 87 | ), 88 | autoHideDuration: Duration(seconds: 1), 89 | decoration: EasyDialogAnimation.bounce(), 90 | ); 91 | final cloned = dialog.clone() as FullScreenDialog; 92 | 93 | expect(cloned.id, id); 94 | expect(cloned.content, dialog.content); 95 | expect(cloned.androidWillPop, dialog.androidWillPop); 96 | expect(cloned.animationConfiguration, dialog.animationConfiguration); 97 | expect(cloned.autoHideDuration, dialog.autoHideDuration); 98 | expect(cloned.decoration, dialog.decoration); 99 | }); 100 | 101 | test('create with id', () { 102 | const id = 'id'; 103 | final dialog = FullScreenDialog( 104 | content: const SizedBox.shrink(), 105 | id: id, 106 | ); 107 | 108 | expect(dialog.id, id); 109 | }); 110 | 111 | test('create without id', () { 112 | final dialog = FullScreenDialog( 113 | content: const SizedBox.shrink(), 114 | ); 115 | 116 | expect(dialog.id, FullScreenDialog.defaultId); 117 | }); 118 | } 119 | -------------------------------------------------------------------------------- /test/src/full_screen/dialog/insert_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/src/full_screen/dialog/full_screen_dialog.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | import '../../../helper.dart'; 6 | 7 | void main() { 8 | group('inserting', () { 9 | testWidgets('insert', (widgetTester) async { 10 | await widgetTester.pumpWidget(app()); 11 | 12 | expect( 13 | easyOverlayState.box.currentEntries[FullScreenDialog], 14 | isNull, 15 | ); 16 | 17 | easyOverlayState.insertDialog( 18 | const FullScreenDialogInsert( 19 | dialog: SizedBox.shrink( 20 | key: dialogKey, 21 | ), 22 | ), 23 | ); 24 | 25 | expect( 26 | easyOverlayState.box.currentEntries[FullScreenDialog], 27 | isNotNull, 28 | ); 29 | 30 | await widgetTester.pump(); 31 | 32 | expect(find.byKey(dialogKey), findsOneWidget); 33 | }); 34 | }); 35 | 36 | testWidgets( 37 | 'inserted twice', 38 | (widgetTester) async { 39 | await widgetTester.pumpWidget(app()); 40 | 41 | easyOverlayState.insertDialog( 42 | const FullScreenDialogInsert( 43 | dialog: SizedBox.shrink( 44 | key: dialogKey, 45 | ), 46 | ), 47 | ); 48 | 49 | expect( 50 | () => easyOverlayState.insertDialog( 51 | const FullScreenDialogInsert( 52 | dialog: SizedBox.shrink( 53 | key: dialogKey, 54 | ), 55 | ), 56 | ), 57 | throwsAssertionError, 58 | ); 59 | 60 | await widgetTester.pump(); 61 | 62 | expect(find.byKey(dialogKey), findsOneWidget); 63 | }, 64 | ); 65 | 66 | group('removing', () { 67 | testWidgets('insert and remove', (widgetTester) async { 68 | await widgetTester.pumpWidget(app()); 69 | 70 | easyOverlayState 71 | ..insertDialog( 72 | const FullScreenDialogInsert( 73 | dialog: SizedBox.shrink( 74 | key: dialogKey, 75 | ), 76 | ), 77 | ) 78 | ..removeDialog(const FullScreenDialogRemove()); 79 | 80 | expect( 81 | easyOverlayState.box.currentEntries[FullScreenDialog], 82 | isNull, 83 | ); 84 | 85 | expect(find.byKey(dialogKey), findsNothing); 86 | }); 87 | }); 88 | } 89 | -------------------------------------------------------------------------------- /test/src/positioned/dialog/insert_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 3 | import 'package:flutter_easy_dialogs/src/positioned/dialog/positioned_dialog.dart'; 4 | import 'package:flutter_test/flutter_test.dart'; 5 | 6 | import '../../../helper.dart'; 7 | 8 | void main() { 9 | group('inserting', () { 10 | testWidgets('insert', (widgetTester) async { 11 | await widgetTester.pumpWidget( 12 | app(), 13 | ); 14 | 15 | const position = EasyDialogPosition.top; 16 | const strategy = PositionedDialogInsert( 17 | position: position, 18 | dialog: SizedBox.shrink( 19 | key: dialogKey, 20 | ), 21 | ); 22 | 23 | easyOverlayState.insertDialog(strategy); 24 | 25 | var entries = easyOverlayState.box.currentEntries[PositionedDialog]; 26 | 27 | expect( 28 | entries, 29 | isNotNull, 30 | ); 31 | 32 | expect( 33 | entries, 34 | isNotNull, 35 | ); 36 | 37 | expect(entries!, isA>()); 38 | 39 | entries = entries as Map; 40 | 41 | expect(entries.length, greaterThan(0)); 42 | 43 | await widgetTester.pump(); 44 | 45 | expect(find.byKey(dialogKey), findsOneWidget); 46 | }); 47 | 48 | testWidgets( 49 | 'insert the same position', 50 | (widgetTester) async { 51 | await widgetTester.pumpWidget(app()); 52 | const strategy = PositionedDialogInsert( 53 | position: EasyDialogPosition.bottom, 54 | dialog: SizedBox.shrink(), 55 | ); 56 | 57 | easyOverlayState.insertDialog(strategy); 58 | 59 | expect( 60 | () => easyOverlayState.insertDialog(strategy), 61 | throwsAssertionError, 62 | ); 63 | }, 64 | ); 65 | 66 | testWidgets( 67 | 'insert all positions', 68 | (widgetTester) async { 69 | await widgetTester.pumpWidget(app()); 70 | 71 | final strategies = EasyDialogPosition.values.map( 72 | (e) => PositionedDialogInsert( 73 | position: e, 74 | dialog: SizedBox.shrink( 75 | key: ValueKey(e), 76 | ), 77 | ), 78 | ); 79 | 80 | for (var strategy in strategies) { 81 | easyOverlayState.insertDialog(strategy); 82 | } 83 | 84 | expect( 85 | easyOverlayState.box 86 | .get>(PositionedDialog)! 87 | .length, 88 | EasyDialogPosition.values.length, 89 | ); 90 | 91 | await widgetTester.pump(); 92 | 93 | for (var position in EasyDialogPosition.values) { 94 | expect(find.byKey(ValueKey(position)), findsOneWidget); 95 | } 96 | }, 97 | ); 98 | }); 99 | 100 | group('removing', () { 101 | testWidgets('remove without inserting', (widgetTester) async { 102 | await widgetTester.pumpWidget(app()); 103 | 104 | expect( 105 | () => easyOverlayState.removeDialog( 106 | const PositionedDialogRemove( 107 | position: EasyDialogPosition.bottom, 108 | ), 109 | ), 110 | throwsAssertionError, 111 | ); 112 | }); 113 | testWidgets('insert one and remove one', (widgetTester) async { 114 | await widgetTester.pumpWidget(app()); 115 | 116 | const position = EasyDialogPosition.bottom; 117 | easyOverlayState.insertDialog( 118 | const PositionedDialogInsert( 119 | position: position, 120 | dialog: SizedBox.shrink( 121 | key: dialogKey, 122 | ), 123 | ), 124 | ); 125 | 126 | await widgetTester.pump(); 127 | 128 | expect(find.byKey(dialogKey), findsOneWidget); 129 | 130 | easyOverlayState.removeDialog( 131 | const PositionedDialogRemove( 132 | position: position, 133 | ), 134 | ); 135 | 136 | expect( 137 | easyOverlayState.box.currentEntries[PositionedDialog], 138 | isNotNull, 139 | ); 140 | 141 | expect( 142 | easyOverlayState.box 143 | .get>(PositionedDialog)! 144 | .length, 145 | isZero, 146 | ); 147 | 148 | await widgetTester.pump(); 149 | 150 | expect(find.byKey(dialogKey), findsNothing); 151 | }); 152 | 153 | testWidgets( 154 | 'insert all positions, and remove them', 155 | (widgetTester) async { 156 | await widgetTester.pumpWidget(app()); 157 | 158 | final insertStrategies = EasyDialogPosition.values.map( 159 | (e) => PositionedDialogInsert(position: e, dialog: Container()), 160 | ); 161 | 162 | final removeStrategies = EasyDialogPosition.values.map( 163 | (e) => PositionedDialogRemove( 164 | position: e, 165 | ), 166 | ); 167 | 168 | for (var strategy in insertStrategies) { 169 | easyOverlayState.insertDialog(strategy); 170 | } 171 | 172 | await widgetTester.pump(); 173 | expect( 174 | find.byType(Container), 175 | findsNWidgets( 176 | EasyDialogPosition.values.length, 177 | ), 178 | ); 179 | 180 | for (var strategy in removeStrategies) { 181 | easyOverlayState.removeDialog(strategy); 182 | } 183 | await widgetTester.pump(); 184 | expect( 185 | find.byType(Container), 186 | findsNothing, 187 | ); 188 | expect( 189 | easyOverlayState.box.currentEntries[PositionedDialog], 190 | isNotNull, 191 | ); 192 | 193 | expect( 194 | easyOverlayState.box 195 | .get>(PositionedDialog)! 196 | .length, 197 | isZero, 198 | ); 199 | }, 200 | ); 201 | }); 202 | } 203 | -------------------------------------------------------------------------------- /test/src/positioned/dialog/positioned_dialog_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_easy_dialogs/flutter_easy_dialogs.dart'; 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | import '../../../helper.dart'; 6 | 7 | void main() { 8 | testWidgets('show and hide all positions', (widgetTester) async { 9 | await widgetTester.pumpWidget( 10 | MaterialApp( 11 | builder: FlutterEasyDialogs.builder(), 12 | ), 13 | ); 14 | 15 | for (final position in EasyDialogPosition.values) { 16 | FlutterEasyDialogs.show( 17 | EasyDialog.positioned( 18 | id: position, 19 | decoration: PositionedShell.banner() 20 | .chained(EasyDialogAnimation.fade()) 21 | .chained(EasyDialogDismiss.tap()) 22 | .chained( 23 | EasyDialogAnimation.slideVertical(), 24 | ), 25 | content: Container( 26 | key: dialogKey, 27 | ), 28 | position: position, 29 | autoHideDuration: null, 30 | ), 31 | ); 32 | await widgetTester.pumpAndSettle(const Duration(seconds: 3)); 33 | expect(find.byKey(dialogKey), findsOneWidget); 34 | FlutterEasyDialogs.hide(id: position); 35 | await widgetTester.pumpAndSettle(const Duration(seconds: 3)); 36 | expect(find.byKey(dialogKey), findsNothing); 37 | } 38 | }); 39 | 40 | test('clone', () { 41 | const id = 'id'; 42 | final dialog = PositionedDialog( 43 | content: const SizedBox.shrink(), 44 | id: id, 45 | animationConfiguration: EasyDialogAnimationConfiguration.bounded( 46 | startValue: 0.0, 47 | lowerBound: 0.0, 48 | upperBound: 1.0, 49 | ), 50 | autoHideDuration: Duration(seconds: 1), 51 | decoration: EasyDialogAnimation.bounce(), 52 | ); 53 | final cloned = dialog.clone() as PositionedDialog; 54 | 55 | expect(cloned.id, id); 56 | expect(cloned.content, dialog.content); 57 | expect(cloned.position, dialog.position); 58 | expect(cloned.animationConfiguration, dialog.animationConfiguration); 59 | expect(cloned.autoHideDuration, dialog.autoHideDuration); 60 | expect(cloned.decoration, dialog.decoration); 61 | }); 62 | 63 | test('create with id', () { 64 | const id = 'id'; 65 | final dialog = PositionedDialog( 66 | content: const SizedBox.shrink(), 67 | id: id, 68 | ); 69 | 70 | expect(dialog.id, id); 71 | }); 72 | 73 | test('create without id', () { 74 | final dialog = PositionedDialog( 75 | content: const SizedBox.shrink(), 76 | ); 77 | 78 | expect(dialog.id, dialog.position); 79 | }); 80 | } 81 | -------------------------------------------------------------------------------- /test/src/util/multiply_animation_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_easy_dialogs/src/util/multiply_animation.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | import '../../mock.dart'; 5 | 6 | void main() { 7 | test('create', () { 8 | expect( 9 | () => MultiplyAnimation(first: FakeAnimation(0), next: FakeAnimation(2)), 10 | returnsNormally, 11 | ); 12 | 13 | final animation = 14 | MultiplyAnimation(first: FakeAnimation(2), next: FakeAnimation(2)); 15 | 16 | expect(animation.value, 4); 17 | }); 18 | } 19 | --------------------------------------------------------------------------------