├── .github
├── ISSUE_TEMPLATE
│ ├── config.yml
│ ├── issue-template-.md
│ └── issue模板.md
└── workflows
│ └── code-analysis.yml
├── .gitignore
├── .metadata
├── CHANGELOG.md
├── CODEOWNERS
├── LICENSE
├── README.md
├── analysis_options.yaml
├── docs
├── 3.x migrate 4.0.md
└── web
│ ├── .last_build_id
│ ├── assets
│ ├── AssetManifest.bin
│ ├── AssetManifest.bin.json
│ ├── AssetManifest.json
│ ├── FontManifest.json
│ ├── NOTICES
│ ├── fonts
│ │ └── MaterialIcons-Regular.otf
│ ├── packages
│ │ └── cupertino_icons
│ │ │ └── assets
│ │ │ └── CupertinoIcons.ttf
│ └── shaders
│ │ └── ink_sparkle.frag
│ ├── canvaskit
│ ├── canvaskit.js
│ ├── canvaskit.js.symbols
│ ├── canvaskit.wasm
│ ├── chromium
│ │ ├── canvaskit.js
│ │ ├── canvaskit.js.symbols
│ │ └── canvaskit.wasm
│ ├── skwasm.js
│ ├── skwasm.js.symbols
│ ├── skwasm.wasm
│ └── skwasm.worker.js
│ ├── favicon.png
│ ├── flutter.js
│ ├── flutter_bootstrap.js
│ ├── flutter_service_worker.js
│ ├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
│ ├── index.html
│ ├── main.dart.js
│ ├── manifest.json
│ └── version.json
├── example
├── .gitignore
├── .metadata
├── README.md
├── analysis_options.yaml
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle.kts
│ │ └── 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.kts
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle.kts
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ │ └── WorkspaceSettings.xcsettings
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ ├── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ │ ├── AppIcon.appiconset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ │ └── LaunchImage.imageset
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ └── README.md
│ │ ├── Base.lproj
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
│ └── RunnerTests
│ │ └── RunnerTests.swift
├── lib
│ ├── demo
│ │ ├── issue165_animation.dart
│ │ ├── issue181_overstep.dart
│ │ ├── issue183_visibility.dart
│ │ ├── issue188_quick_close.dart
│ │ ├── issue190_release.dart
│ │ ├── issue191_jump_page.dart
│ │ ├── issue191_toast.dart
│ │ ├── issue200_loading.dart
│ │ ├── issue205_dark_model.dart
│ │ ├── issue209.dart
│ │ ├── issue235_toast.dart
│ │ ├── issue251_tag.dart
│ │ └── issue259_Inappwebview.dart
│ └── main.dart
├── linux
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter
│ │ ├── CMakeLists.txt
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ ├── main.cc
│ ├── my_application.cc
│ ├── my_application.h
│ └── runner
│ │ ├── CMakeLists.txt
│ │ ├── 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
│ └── RunnerTests
│ │ └── RunnerTests.swift
├── pubspec.yaml
├── test
│ └── widget_test.dart
├── web
│ ├── favicon.png
│ ├── icons
│ │ ├── Icon-192.png
│ │ ├── Icon-512.png
│ │ ├── Icon-maskable-192.png
│ │ └── Icon-maskable-512.png
│ ├── index.html
│ └── manifest.json
└── windows
│ ├── .gitignore
│ ├── CMakeLists.txt
│ ├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
│ └── runner
│ ├── CMakeLists.txt
│ ├── Runner.rc
│ ├── flutter_window.cpp
│ ├── flutter_window.h
│ ├── main.cpp
│ ├── resource.h
│ ├── resources
│ └── app_icon.ico
│ ├── run_loop.cpp
│ ├── run_loop.h
│ ├── runner.exe.manifest
│ ├── utils.cpp
│ ├── utils.h
│ ├── win32_window.cpp
│ └── win32_window.h
├── lib
├── flutter_smart_dialog.dart
└── src
│ ├── config
│ ├── enum_config.dart
│ ├── smart_config.dart
│ ├── smart_config_attach.dart
│ ├── smart_config_custom.dart
│ ├── smart_config_loading.dart
│ ├── smart_config_notify.dart
│ └── smart_config_toast.dart
│ ├── custom
│ ├── custom_dialog.dart
│ ├── custom_loading.dart
│ ├── custom_notify.dart
│ ├── main_dialog.dart
│ └── toast
│ │ ├── custom_toast.dart
│ │ └── toast_tool.dart
│ ├── data
│ ├── animation_param.dart
│ ├── attach_model.dart
│ ├── base_controller.dart
│ ├── base_dialog.dart
│ ├── dialog_info.dart
│ ├── loading_info.dart
│ ├── notify_info.dart
│ ├── notify_style.dart
│ └── smart_tag.dart
│ ├── helper
│ ├── dialog_proxy.dart
│ ├── monitor_widget_helper.dart
│ ├── navigator_observer.dart
│ ├── pop_monitor
│ │ ├── boost_route_monitor.dart
│ │ └── monitor_pop_route.dart
│ └── route_record.dart
│ ├── init_dialog.dart
│ ├── kit
│ ├── debounce_utils.dart
│ ├── dialog_kit.dart
│ ├── log.dart
│ ├── typedef.dart
│ └── view_utils.dart
│ ├── smart_dialog.dart
│ └── widget
│ ├── animation
│ ├── fade_animation.dart
│ ├── highlight_mask_animation.dart
│ ├── mask_animation.dart
│ ├── scale_animation.dart
│ ├── size_animation.dart
│ └── slide_animation.dart
│ ├── attach_dialog_widget.dart
│ ├── default
│ ├── loading_widget.dart
│ ├── notify_alter.dart
│ ├── notify_error.dart
│ ├── notify_failure.dart
│ ├── notify_success.dart
│ ├── notify_warning.dart
│ └── toast_widget.dart
│ ├── helper
│ ├── attach_widget.dart
│ ├── dialog_scope.dart
│ ├── mask_event.dart
│ ├── smart_dialog_controller.dart
│ ├── smart_overlay_entry.dart
│ └── toast_helper.dart
│ └── smart_dialog_widget.dart
├── linux
└── flutter
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── macos
└── Flutter
│ ├── GeneratedPluginRegistrant.swift
│ └── ephemeral
│ ├── Flutter-Generated.xcconfig
│ └── flutter_export_environment.sh
├── pubspec.yaml
├── test
└── flutter_smart_dialog_test.dart
└── windows
└── flutter
├── generated_plugin_registrant.cc
├── generated_plugin_registrant.h
└── generated_plugins.cmake
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/issue-template-.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: 'Issue Template '
3 | about: General issues
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### Version Information
11 | - Flutter version: [e.g. v3.22.0]
12 | - flutter_smart_dialog version: [e.g. v4.6.6]
13 |
14 | ### Describe the bug/requirement
15 | Please describe the bug or requirement accurately
16 |
17 | ### Problem demo
18 |
19 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/issue模板.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Issue模板
3 | about: 通用模板
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | ### 版本信息
11 | - Flutter版本:[举例:v2.10.4]
12 | - flutter_smart_dialog版本:[举例:v3.4.1]
13 |
14 | ### 描述bug/需求
15 | 请准确描述bug或需求
16 |
17 | ### 问题demo
18 |
22 |
--------------------------------------------------------------------------------
/.github/workflows/code-analysis.yml:
--------------------------------------------------------------------------------
1 | name: Code Analysis
2 |
3 | on:
4 | workflow_dispatch:
5 | push:
6 | branches:
7 | - master
8 | paths-ignore:
9 | - '**.md'
10 | pull_request:
11 | branches:
12 | - master
13 | paths-ignore:
14 | - '**.md'
15 |
16 | jobs:
17 | code-analysis:
18 | runs-on: ubuntu-latest
19 | steps:
20 | - uses: actions/checkout@v4
21 | - uses: subosito/flutter-action@v2
22 | with:
23 | channel: 'stable'
24 | - name: Prepare dependencies
25 | run: |
26 | flutter --version
27 | flutter pub get
28 | - name: Check Dart code formatting
29 | run: |
30 | dart format . -o none --set-exit-if-changed
31 | - name: Analyze Dart code
32 | run: |
33 | flutter analyze .
34 | - name: Generate dartdoc
35 | run: |
36 | dart pub global activate dartdoc
37 | dart pub global run dartdoc .
38 | test:
39 | needs: [code-analysis]
40 | runs-on: ubuntu-latest
41 | strategy:
42 | matrix:
43 | flutter-version: ['']
44 | steps:
45 | - uses: actions/checkout@v4
46 | - uses: subosito/flutter-action@v2
47 | with:
48 | channel: 'stable'
49 | flutter-version: ${{ matrix.flutter-version }}
50 | - name: Prepare dependencies
51 | run: |
52 | flutter --version
53 | flutter pub get
54 | - name: Test
55 | run: flutter test
56 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | pubspec.lock
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 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | build/
33 |
34 | # Android related
35 | **/android/**/gradle-wrapper.jar
36 | **/android/.gradle
37 | **/android/captures/
38 | **/android/gradlew
39 | **/android/gradlew.bat
40 | **/android/local.properties
41 | **/android/**/GeneratedPluginRegistrant.java
42 |
43 | # iOS/XCode related
44 | **/ios/**/*.mode1v3
45 | **/ios/**/*.mode2v3
46 | **/ios/**/*.moved-aside
47 | **/ios/**/*.pbxuser
48 | **/ios/**/*.perspectivev3
49 | **/ios/**/*sync/
50 | **/ios/**/.sconsign.dblite
51 | **/ios/**/.tags*
52 | **/ios/**/.vagrant/
53 | **/ios/**/DerivedData/
54 | **/ios/**/Icon?
55 | **/ios/**/Pods/
56 | **/ios/**/.symlinks/
57 | **/ios/**/profile
58 | **/ios/**/xcuserdata
59 | **/ios/.generated/
60 | **/ios/Flutter/App.framework
61 | **/ios/Flutter/Flutter.framework
62 | **/ios/Flutter/Flutter.podspec
63 | **/ios/Flutter/Generated.xcconfig
64 | **/ios/Flutter/app.flx
65 | **/ios/Flutter/app.zip
66 | **/ios/Flutter/flutter_assets/
67 | **/ios/Flutter/flutter_export_environment.sh
68 | **/ios/ServiceDefinitions.json
69 | **/ios/Runner/GeneratedPluginRegistrant.*
70 |
71 | # Exceptions to above rules.
72 | !**/ios/**/default.mode1v3
73 | !**/ios/**/default.mode2v3
74 | !**/ios/**/default.pbxuser
75 | !**/ios/**/default.perspectivev3
76 |
77 |
--------------------------------------------------------------------------------
/.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: 2783f8e2e14efec8b7e08f668dde61c40d128c24
8 | channel: dev
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @xdd666t
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 小呆呆666
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 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
5 | linter:
6 | # The lint rules applied to this project can be customized in the
7 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
8 | # included above or to enable additional rules. A list of all available lints
9 | # and their documentation is published at
10 | # https://dart-lang.github.io/linter/lints/index.html.
11 | #
12 | # Instead of disabling a lint rule for the entire project in the
13 | # section below, it can also be suppressed for a single line of code
14 | # or a specific dart file by using the `// ignore: name_of_lint` and
15 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
16 | # producing the lint.
17 | rules:
18 | constant_identifier_names: false
19 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
20 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
--------------------------------------------------------------------------------
/docs/web/.last_build_id:
--------------------------------------------------------------------------------
1 | 7931dfbc48fad63796d93afe1d48e29f
--------------------------------------------------------------------------------
/docs/web/assets/AssetManifest.bin:
--------------------------------------------------------------------------------
1 |
2packages/cupertino_icons/assets/CupertinoIcons.ttf
asset2packages/cupertino_icons/assets/CupertinoIcons.ttf
--------------------------------------------------------------------------------
/docs/web/assets/AssetManifest.bin.json:
--------------------------------------------------------------------------------
1 | "DQEHMnBhY2thZ2VzL2N1cGVydGlub19pY29ucy9hc3NldHMvQ3VwZXJ0aW5vSWNvbnMudHRmDAENAQcFYXNzZXQHMnBhY2thZ2VzL2N1cGVydGlub19pY29ucy9hc3NldHMvQ3VwZXJ0aW5vSWNvbnMudHRm"
--------------------------------------------------------------------------------
/docs/web/assets/AssetManifest.json:
--------------------------------------------------------------------------------
1 | {"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"]}
--------------------------------------------------------------------------------
/docs/web/assets/FontManifest.json:
--------------------------------------------------------------------------------
1 | [{"family":"MaterialIcons","fonts":[{"asset":"fonts/MaterialIcons-Regular.otf"}]},{"family":"packages/cupertino_icons/CupertinoIcons","fonts":[{"asset":"packages/cupertino_icons/assets/CupertinoIcons.ttf"}]}]
--------------------------------------------------------------------------------
/docs/web/assets/fonts/MaterialIcons-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/docs/web/assets/fonts/MaterialIcons-Regular.otf
--------------------------------------------------------------------------------
/docs/web/assets/packages/cupertino_icons/assets/CupertinoIcons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/docs/web/assets/packages/cupertino_icons/assets/CupertinoIcons.ttf
--------------------------------------------------------------------------------
/docs/web/canvaskit/canvaskit.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/docs/web/canvaskit/canvaskit.wasm
--------------------------------------------------------------------------------
/docs/web/canvaskit/chromium/canvaskit.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/docs/web/canvaskit/chromium/canvaskit.wasm
--------------------------------------------------------------------------------
/docs/web/canvaskit/skwasm.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/docs/web/canvaskit/skwasm.wasm
--------------------------------------------------------------------------------
/docs/web/canvaskit/skwasm.worker.js:
--------------------------------------------------------------------------------
1 | "use strict";var Module={};var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",data=>onmessage({data:data}));var fs=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:f=>(0,eval)(fs.readFileSync(f,"utf8")+"//# sourceURL="+f),postMessage:msg=>parentPort.postMessage(msg),performance:global.performance||{now:Date.now}})}var initializedJS=false;function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,text+"\n");return}console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=(info,receiveInstance)=>{var module=Module["wasmModule"];Module["wasmModule"]=null;var instance=new WebAssembly.Instance(module,info);return receiveInstance(instance)};self.onunhandledrejection=e=>{throw e.reason??e};function handleMessage(e){try{if(e.data.cmd==="load"){let messageQueue=[];self.onmessage=e=>messageQueue.push(e);self.startWorker=instance=>{Module=instance;postMessage({"cmd":"loaded"});for(let msg of messageQueue){handleMessage(msg)}self.onmessage=handleMessage};Module["wasmModule"]=e.data.wasmModule;for(const handler of e.data.handlers){Module[handler]=(...args)=>{postMessage({cmd:"callHandler",handler:handler,args:args})}}Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob=="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}skwasm(Module)}else if(e.data.cmd==="run"){Module["__emscripten_thread_init"](e.data.pthread_ptr,/*isMainBrowserThread=*/0,/*isMainRuntimeThread=*/0,/*canBlock=*/1);Module["__emscripten_thread_mailbox_await"](e.data.pthread_ptr);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInitTLS();if(!initializedJS){initializedJS=true}try{Module["invokeEntryPoint"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!="unwind"){throw ex}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="checkMailbox"){if(initializedJS){Module["checkMailbox"]()}}else if(e.data.cmd){err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){if(Module["__emscripten_thread_crashed"]){Module["__emscripten_thread_crashed"]()}throw ex}}self.onmessage=handleMessage;
2 |
--------------------------------------------------------------------------------
/docs/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/docs/web/favicon.png
--------------------------------------------------------------------------------
/docs/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/docs/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/docs/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/docs/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/docs/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/docs/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/docs/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/docs/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/docs/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | example
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/docs/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 |
--------------------------------------------------------------------------------
/docs/web/version.json:
--------------------------------------------------------------------------------
1 | {"app_name":"example","version":"1.0.0","build_number":"1","package_name":"example"}
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | pubspec.lock
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 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: "35c388afb57ef061d06a39b537336c87e0e3d1b1"
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: 35c388afb57ef061d06a39b537336c87e0e3d1b1
17 | base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
18 | - platform: android
19 | create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
20 | base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
21 | - platform: ios
22 | create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
23 | base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
24 | - platform: linux
25 | create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
26 | base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
27 | - platform: macos
28 | create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
29 | base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
30 | - platform: web
31 | create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
32 | base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
33 | - platform: windows
34 | create_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
35 | base_revision: 35c388afb57ef061d06a39b537336c87e0e3d1b1
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 | A new Flutter application.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 | .cxx/
9 |
10 | # Remember to never publicly share your keystore.
11 | # See https://flutter.dev/to/reference-keystore
12 | key.properties
13 | **/*.keystore
14 | **/*.jks
15 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle.kts:
--------------------------------------------------------------------------------
1 | plugins {
2 | id("com.android.application")
3 | id("kotlin-android")
4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
5 | id("dev.flutter.flutter-gradle-plugin")
6 | }
7 |
8 | android {
9 | namespace = "com.example.example"
10 | compileSdk = flutter.compileSdkVersion
11 | ndkVersion = flutter.ndkVersion
12 |
13 | compileOptions {
14 | sourceCompatibility = JavaVersion.VERSION_11
15 | targetCompatibility = JavaVersion.VERSION_11
16 | }
17 |
18 | kotlinOptions {
19 | jvmTarget = JavaVersion.VERSION_11.toString()
20 | }
21 |
22 | defaultConfig {
23 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24 | applicationId = "com.example.example"
25 | // You can update the following values to match your application needs.
26 | // For more information, see: https://flutter.dev/to/review-gradle-config.
27 | minSdk = flutter.minSdkVersion
28 | targetSdk = flutter.targetSdkVersion
29 | versionCode = flutter.versionCode
30 | versionName = flutter.versionName
31 | }
32 |
33 | buildTypes {
34 | release {
35 | // TODO: Add your own signing config for the release build.
36 | // Signing with the debug keys for now, so `flutter run --release` works.
37 | signingConfig = signingConfigs.getByName("debug")
38 | }
39 | }
40 | }
41 |
42 | flutter {
43 | source = "../.."
44 | }
45 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/build.gradle.kts:
--------------------------------------------------------------------------------
1 | allprojects {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | }
7 |
8 | val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
9 | rootProject.layout.buildDirectory.value(newBuildDir)
10 |
11 | subprojects {
12 | val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
13 | project.layout.buildDirectory.value(newSubprojectBuildDir)
14 | }
15 | subprojects {
16 | project.evaluationDependsOn(":app")
17 | }
18 |
19 | tasks.register("clean") {
20 | delete(rootProject.layout.buildDirectory)
21 | }
22 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
6 |
--------------------------------------------------------------------------------
/example/android/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | val flutterSdkPath = run {
3 | val properties = java.util.Properties()
4 | file("local.properties").inputStream().use { properties.load(it) }
5 | val flutterSdkPath = properties.getProperty("flutter.sdk")
6 | require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
7 | flutterSdkPath
8 | }
9 |
10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11 |
12 | repositories {
13 | google()
14 | mavenCentral()
15 | gradlePluginPortal()
16 | }
17 | }
18 |
19 | plugins {
20 | id("dev.flutter.flutter-plugin-loader") version "1.0.0"
21 | id("com.android.application") version "8.7.0" apply false
22 | id("org.jetbrains.kotlin.android") version "1.8.22" apply false
23 | }
24 |
25 | include(":app")
26 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 12.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '12.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 |
4 | DEPENDENCIES:
5 | - Flutter (from `Flutter`)
6 |
7 | EXTERNAL SOURCES:
8 | Flutter:
9 | :path: Flutter
10 |
11 | SPEC CHECKSUMS:
12 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
13 |
14 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
15 |
16 | COCOAPODS: 1.11.3
17 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 | CADisableMinimumFrameDurationOnPhone
45 |
46 | UIApplicationSupportsIndirectInputEvents
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/ios/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/example/lib/demo/issue165_animation.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 |
4 | void main() => runApp(const MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | const MyApp({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return MaterialApp(
12 | home: Scaffold(
13 | body: Center(
14 | child: ElevatedButton(
15 | onPressed: () => _show(),
16 | child: const Text('show'),
17 | ),
18 | ),
19 | ),
20 | navigatorObservers: [FlutterSmartDialog.observer],
21 | builder: FlutterSmartDialog.init(),
22 | );
23 | }
24 |
25 | void _show() {
26 | SmartDialog.show(
27 | animationTime: const Duration(milliseconds: 3000),
28 | animationBuilder: (
29 | AnimationController controller,
30 | Widget child,
31 | AnimationParam animationParam,
32 | ) {
33 | return CustomAnimation(animationParam: animationParam, child: child);
34 | },
35 | builder: (_) {
36 | return Container(
37 | color: Colors.white,
38 | padding: const EdgeInsets.all(30),
39 | child: const Text('custom animation dialog'),
40 | );
41 | },
42 | );
43 | }
44 | }
45 |
46 | class CustomAnimation extends StatefulWidget {
47 | const CustomAnimation({
48 | Key? key,
49 | required this.child,
50 | required this.animationParam,
51 | }) : super(key: key);
52 |
53 | final Widget child;
54 |
55 | final AnimationParam animationParam;
56 |
57 | @override
58 | State createState() => _CustomAnimationState();
59 | }
60 |
61 | class _CustomAnimationState extends State
62 | with TickerProviderStateMixin {
63 | late AnimationController _controller;
64 | var needReverse = false;
65 |
66 | @override
67 | void initState() {
68 | _controller = AnimationController(
69 | vsync: this,
70 | duration: widget.animationParam.animationTime,
71 | );
72 | widget.animationParam.onForward = () {
73 | _controller.value = 0;
74 | _controller.forward();
75 | };
76 | widget.animationParam.onDismiss = () {
77 | needReverse = true;
78 | setState(() {});
79 | _controller.reverse();
80 | };
81 | super.initState();
82 | }
83 |
84 | @override
85 | Widget build(BuildContext context) {
86 | return needReverse
87 | ? RotationTransition(
88 | turns:
89 | CurvedAnimation(parent: _controller, curve: Curves.elasticIn),
90 | child: widget.child,
91 | )
92 | : FadeTransition(
93 | opacity: CurvedAnimation(
94 | parent: _controller.view,
95 | curve: Curves.easeInOut,
96 | ),
97 | child: ScaleTransition(
98 | scale: _controller.drive(
99 | Tween(begin: 1.5, end: 1.0)
100 | .chain(CurveTween(curve: Curves.easeInOut)),
101 | ),
102 | child: widget.child,
103 | ),
104 | );
105 | }
106 |
107 | @override
108 | void dispose() {
109 | _controller.dispose();
110 | super.dispose();
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/example/lib/demo/issue188_quick_close.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 |
4 | void main() => runApp(const MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | const MyApp({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return MaterialApp(
12 | home: Scaffold(
13 | body: Center(
14 | child: ElevatedButton(
15 | onPressed: () => _show(),
16 | child: const Text('show'),
17 | ),
18 | ),
19 | ),
20 | navigatorObservers: [FlutterSmartDialog.observer],
21 | builder: FlutterSmartDialog.init(),
22 | );
23 | }
24 |
25 | void _show() async {
26 | SmartDialog.show(
27 | builder: (_) {
28 | return Container(
29 | color: Colors.white,
30 | padding: const EdgeInsets.all(30),
31 | child: const Text('quick close dialog'),
32 | );
33 | },
34 | );
35 |
36 | // await Future.delayed(const Duration(milliseconds: 1000));
37 | SmartDialog.dismiss();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/example/lib/demo/issue190_release.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 |
4 | void main() => runApp(const MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | const MyApp({super.key});
8 |
9 | // This widget is the root of your application.
10 | @override
11 | Widget build(BuildContext context) {
12 | return MaterialApp(
13 | title: 'Flutter Demo',
14 | builder: FlutterSmartDialog.init(),
15 | navigatorObservers: [FlutterSmartDialog.observer],
16 | theme: ThemeData(
17 | colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
18 | useMaterial3: true,
19 | ),
20 | home: Scaffold(
21 | body: Center(
22 | child: GestureDetector(
23 | onTap: () {
24 | SmartDialog.show(
25 | tag: '11',
26 | builder: (context) {
27 | return Center(
28 | child: Container(
29 | height: 300,
30 | width: 300,
31 | color: Colors.blue,
32 | ),
33 | );
34 | },
35 | animationType: SmartAnimationType.centerFade_otherSlide,
36 | backType: SmartBackType.normal,
37 | keepSingle: true,
38 | debounce: true,
39 | );
40 | },
41 | child: Container(
42 | width: 200,
43 | height: 200,
44 | color: Colors.red,
45 | ),
46 | ),
47 | ),
48 | ),
49 | );
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/example/lib/demo/issue191_jump_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 |
4 | void main() => runApp(const MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | const MyApp({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return MaterialApp(
12 | navigatorObservers: [FlutterSmartDialog.observer],
13 | builder: FlutterSmartDialog.init(),
14 | home: Scaffold(
15 | body: Center(
16 | child: Builder(builder: (ctx) {
17 | return ElevatedButton(
18 | onPressed: () {
19 | Navigator.push(
20 | ctx,
21 | MaterialPageRoute(builder: (context) => const TestPage()),
22 | );
23 | },
24 | child: const Text('jump page'),
25 | );
26 | }),
27 | ),
28 | ),
29 | );
30 | }
31 | }
32 |
33 | class TestPage extends StatefulWidget {
34 | const TestPage({Key? key}) : super(key: key);
35 |
36 | @override
37 | State createState() => _TestPageState();
38 | }
39 |
40 | class _TestPageState extends State {
41 | @override
42 | void initState() {
43 | super.initState();
44 | SmartDialog.showLoading();
45 | }
46 |
47 | @override
48 | Widget build(BuildContext context) {
49 | return MaterialApp(
50 | home: const Scaffold(body: Center(child: Text('test page'))),
51 | navigatorObservers: [FlutterSmartDialog.observer],
52 | builder: FlutterSmartDialog.init(),
53 | );
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/example/lib/demo/issue191_toast.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 |
4 | void main() => runApp(const MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | const MyApp({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return MaterialApp(
12 | home: Scaffold(
13 | body: Center(
14 | child: ElevatedButton(
15 | onPressed: () => _show(),
16 | child: const Text('show'),
17 | ),
18 | ),
19 | ),
20 | navigatorObservers: [FlutterSmartDialog.observer],
21 | builder: FlutterSmartDialog.init(),
22 | );
23 | }
24 |
25 | void _show() async {
26 | SmartDialog.showLoading(msg: "test one");
27 | SmartDialog.dismiss(status: SmartStatus.loading);
28 | SmartDialog.show(
29 | clickMaskDismiss: false,
30 | builder: (_) {
31 | Widget child = Container(
32 | height: 80,
33 | width: 180,
34 | color: Colors.black,
35 | alignment: Alignment.center,
36 | child: const Text(
37 | 'test two',
38 | style: TextStyle(color: Colors.white),
39 | ),
40 | );
41 | return child;
42 | },
43 | displayTime: const Duration(milliseconds: 2000),
44 | keepSingle: true,
45 | backType: SmartBackType.block,
46 | );
47 |
48 | // SmartDialog.showLoading();
49 | // await Future.delayed(const Duration(seconds: 1));
50 | // await SmartDialog.dismiss(status: SmartStatus.loading);
51 | // SmartDialog.showToast('test toast');
52 | // SmartDialog.show(
53 | // builder: (_) {
54 | // return Container(
55 | // color: Colors.white,
56 | // padding: const EdgeInsets.all(30),
57 | // child: const Text('test dialog'),
58 | // );
59 | // },
60 | // );
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/example/lib/demo/issue205_dark_model.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 |
4 | void main() {
5 | runApp(const MyApp());
6 | }
7 |
8 | class MyApp extends StatelessWidget {
9 | const MyApp({super.key});
10 |
11 | // This widget is the root of your application.
12 | @override
13 | Widget build(BuildContext context) {
14 | return MaterialApp(
15 | title: 'Flutter Demo',
16 | theme: ThemeData(
17 | colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
18 | useMaterial3: true,
19 | ),
20 | darkTheme: ThemeData(
21 | colorScheme: ColorScheme.fromSeed(
22 | seedColor: Colors.deepPurple,
23 | brightness: Brightness.dark,
24 | ),
25 | brightness: Brightness.dark,
26 | useMaterial3: true,
27 | ),
28 | home: const MyHomePage(title: 'Flutter Demo Home Page'),
29 | navigatorObservers: [FlutterSmartDialog.observer],
30 | builder: FlutterSmartDialog.init(),
31 | );
32 | }
33 | }
34 |
35 | class MyHomePage extends StatefulWidget {
36 | const MyHomePage({super.key, required this.title});
37 |
38 | final String title;
39 |
40 | @override
41 | State createState() => _MyHomePageState();
42 | }
43 |
44 | class _MyHomePageState extends State {
45 | int _counter = 0;
46 |
47 | void _incrementCounter() {
48 | SmartDialog.showToast('你按了一下按钮');
49 | setState(() {
50 | _counter++;
51 | });
52 | }
53 |
54 | @override
55 | Widget build(BuildContext context) {
56 | return Scaffold(
57 | appBar: AppBar(
58 | backgroundColor: Theme.of(context).colorScheme.inversePrimary,
59 | title: Text(widget.title),
60 | ),
61 | body: Center(
62 | child: Column(
63 | mainAxisAlignment: MainAxisAlignment.center,
64 | children: [
65 | const Text(
66 | 'You have pushed the button this many times:',
67 | ),
68 | Text(
69 | '$_counter',
70 | style: Theme.of(context).textTheme.headlineMedium,
71 | ),
72 | ],
73 | ),
74 | ),
75 | floatingActionButton: FloatingActionButton(
76 | onPressed: _incrementCounter,
77 | tooltip: 'Increment',
78 | child: const Icon(Icons.add),
79 | ), // This trailing comma makes auto-formatting nicer for build methods.
80 | );
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/example/lib/demo/issue209.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 |
4 | void main() => runApp(const MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | const MyApp({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return MaterialApp(
12 | home: Scaffold(
13 | body: Center(
14 | child: ElevatedButton(
15 | onPressed: () => _show(),
16 | child: const Text('show'),
17 | ),
18 | ),
19 | ),
20 | navigatorObservers: [FlutterSmartDialog.observer],
21 | builder: FlutterSmartDialog.init(),
22 | );
23 | }
24 |
25 | void _show() async {
26 | debugPrint("before:${DateTime.now().millisecondsSinceEpoch}");
27 | var result = await SmartDialog.show(
28 | tag: 'tag',
29 | backType: SmartBackType.block,
30 | clickMaskDismiss: false,
31 | builder: (_) {
32 | return ElevatedButton(
33 | onPressed: () {
34 | SmartDialog.dismiss(tag: 'tag', result: true);
35 | },
36 | child: const Text('关闭Dialog,显示Loading'),
37 | );
38 | },
39 | onDismiss: () {
40 | debugPrint("onDismiss:${DateTime.now().millisecondsSinceEpoch}");
41 | // showLoading()放在这里能正常显示
42 | // SmartDialog.showLoading();
43 | });
44 |
45 | debugPrint("aftermiss:${DateTime.now().millisecondsSinceEpoch}");
46 | if (result == true) {
47 | // showLoading() 放在这里需要加一点延时才能显示Loading
48 | // await Future.delayed(const Duration(seconds: 1));
49 | SmartDialog.showLoading();
50 |
51 | // 延时关闭Loading
52 | await Future.delayed(const Duration(seconds: 2));
53 | SmartDialog.dismiss();
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/example/lib/demo/issue235_toast.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 |
4 | void main() {
5 | runApp(MaterialApp(
6 | navigatorObservers: [FlutterSmartDialog.observer],
7 | builder: FlutterSmartDialog.init(),
8 | home: const MyApp(),
9 | ));
10 | }
11 |
12 | class MyApp extends StatelessWidget {
13 | const MyApp({super.key});
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return Scaffold(
18 | appBar: AppBar(
19 | title: const Text(
20 | "Test",
21 | ),
22 | ),
23 | body: Center(
24 | child: ElevatedButton(
25 | onPressed: () async {
26 | show("toast1");
27 | show("toast2");
28 | },
29 | child: const Text(
30 | "Click",
31 | ),
32 | ),
33 | ),
34 | );
35 | }
36 |
37 | Future show(String msg) {
38 | return SmartDialog.showToast(
39 | msg,
40 | alignment: Alignment.center,
41 | displayType: SmartToastType.last,
42 | displayTime: const Duration(seconds: 3),
43 | );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/example/lib/demo/issue251_tag.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 |
4 | void main() {
5 | runApp(MaterialApp(
6 | navigatorObservers: [FlutterSmartDialog.observer],
7 | builder: FlutterSmartDialog.init(),
8 | home: const MyApp(),
9 | ));
10 | }
11 |
12 | class MyApp extends StatelessWidget {
13 | const MyApp({super.key});
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return Scaffold(
18 | appBar: AppBar(
19 | title: const Text("Test"),
20 | ),
21 | body: Center(
22 | child: Builder(builder: (ctx) {
23 | return ElevatedButton(
24 | onPressed: () => show(ctx),
25 | child: const Text("Click"),
26 | );
27 | }),
28 | ),
29 | );
30 | }
31 |
32 | show(BuildContext context) {
33 | SmartDialog.showAttach(
34 | targetContext: context,
35 | alignment: Alignment.topCenter,
36 | maskColor: Colors.transparent,
37 | usePenetrate: true,
38 | keepSingle: true,
39 | tag: "tag2",
40 | animationType: SmartAnimationType.scale,
41 | builder: (_) {
42 | return Container(
43 | height: 300,
44 | width: 500,
45 | decoration: BoxDecoration(
46 | borderRadius: BorderRadius.circular(20),
47 | color: Colors.white,
48 | ),
49 | alignment: Alignment.center,
50 | child: ElevatedButton(
51 | onPressed: () {
52 | final checkMsg = SmartDialog.checkExist(tag: "tag2").toString();
53 | SmartDialog.showToast(checkMsg);
54 | },
55 | child: const Text('check tag status'),
56 | ),
57 | );
58 | },
59 | );
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/example/lib/demo/issue259_Inappwebview.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_inappwebview/flutter_inappwebview.dart';
3 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
4 |
5 | void main() {
6 | runApp(MaterialApp(
7 | navigatorObservers: [FlutterSmartDialog.observer],
8 | builder: FlutterSmartDialog.init(),
9 | home: const MyApp(),
10 | ));
11 | }
12 |
13 | class MyApp extends StatelessWidget {
14 | const MyApp({super.key});
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | return Scaffold(
19 | appBar: AppBar(
20 | title: const Text("Test"),
21 | ),
22 | body: Center(
23 | child: Builder(builder: (ctx) {
24 | return ElevatedButton(
25 | onPressed: () => showWebDialog(ctx),
26 | child: const Text("Click"),
27 | );
28 | }),
29 | ),
30 | );
31 | }
32 |
33 | void showWebDialog(BuildContext context) {
34 | SmartDialog.show(
35 | clickMaskDismiss: true,
36 | alignment: Alignment.bottomCenter,
37 | builder: (context) => Container(
38 | height: 400,
39 | padding: const EdgeInsets.symmetric(horizontal: 12),
40 | child: InAppWebView(
41 | initialData: InAppWebViewInitialData(
42 | data: _buildHtmlContent(''),
43 | mimeType: 'text/html',
44 | encoding: 'utf-8',
45 | ),
46 | ),
47 | ),
48 | );
49 | }
50 |
51 | String _buildHtmlContent(String content) {
52 | return '''
53 |
54 |
55 |
56 |
57 |
70 |
71 |
72 | $content
73 |
74 |
75 | ''';
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/example/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(runner LANGUAGES CXX)
3 |
4 | set(BINARY_NAME "example")
5 | set(APPLICATION_ID "com.smartdialog.example")
6 |
7 | cmake_policy(SET CMP0063 NEW)
8 |
9 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
10 |
11 | # Configure build options.
12 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
13 | set(CMAKE_BUILD_TYPE "Debug" CACHE
14 | STRING "Flutter build mode" FORCE)
15 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
16 | "Debug" "Profile" "Release")
17 | endif()
18 |
19 | # Compilation settings that should be applied to most targets.
20 | function(APPLY_STANDARD_SETTINGS TARGET)
21 | target_compile_features(${TARGET} PUBLIC cxx_std_14)
22 | target_compile_options(${TARGET} PRIVATE -Wall -Werror)
23 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")
24 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>")
25 | endfunction()
26 |
27 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
28 |
29 | # Flutter library and tool build rules.
30 | add_subdirectory(${FLUTTER_MANAGED_DIR})
31 |
32 | # System-level dependencies.
33 | find_package(PkgConfig REQUIRED)
34 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
35 |
36 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
37 |
38 | # Application build
39 | add_executable(${BINARY_NAME}
40 | "main.cc"
41 | "my_application.cc"
42 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
43 | )
44 | apply_standard_settings(${BINARY_NAME})
45 | target_link_libraries(${BINARY_NAME} PRIVATE flutter)
46 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
47 | add_dependencies(${BINARY_NAME} flutter_assemble)
48 | # Only the install-generated bundle's copy of the executable will launch
49 | # correctly, since the resources must in the right relative locations. To avoid
50 | # people trying to run the unbundled copy, put it in a subdirectory instead of
51 | # the default top-level location.
52 | set_target_properties(${BINARY_NAME}
53 | PROPERTIES
54 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
55 | )
56 |
57 | # Generated plugin build rules, which manage building the plugins and adding
58 | # them to the application.
59 | include(flutter/generated_plugins.cmake)
60 |
61 |
62 | # === Installation ===
63 | # By default, "installing" just makes a relocatable bundle in the build
64 | # directory.
65 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
66 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
67 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
68 | endif()
69 |
70 | # Start with a clean build bundle directory every time.
71 | install(CODE "
72 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
73 | " COMPONENT Runtime)
74 |
75 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
76 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
77 |
78 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
79 | COMPONENT Runtime)
80 |
81 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
82 | COMPONENT Runtime)
83 |
84 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
85 | COMPONENT Runtime)
86 |
87 | if(PLUGIN_BUNDLED_LIBRARIES)
88 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
89 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
90 | COMPONENT Runtime)
91 | endif()
92 |
93 | # Fully re-copy the assets directory on each build to avoid having stale files
94 | # from a previous install.
95 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
96 | install(CODE "
97 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
98 | " COMPONENT Runtime)
99 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
100 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
101 |
102 | # Install the AOT library on non-Debug builds only.
103 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
104 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
105 | COMPONENT Runtime)
106 | endif()
107 |
--------------------------------------------------------------------------------
/example/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 |
3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4 |
5 | # Configuration provided via flutter tool.
6 | include(${EPHEMERAL_DIR}/generated_config.cmake)
7 |
8 | # TODO: Move the rest of this into files in ephemeral. See
9 | # https://github.com/flutter/flutter/issues/57146.
10 |
11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
12 | # which isn't available in 3.10.
13 | function(list_prepend LIST_NAME PREFIX)
14 | set(NEW_LIST "")
15 | foreach(element ${${LIST_NAME}})
16 | list(APPEND NEW_LIST "${PREFIX}${element}")
17 | endforeach(element)
18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
19 | endfunction()
20 |
21 | # === Flutter Library ===
22 | # System-level dependencies.
23 | find_package(PkgConfig REQUIRED)
24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
27 | pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid)
28 | pkg_check_modules(LZMA REQUIRED IMPORTED_TARGET liblzma)
29 |
30 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
31 |
32 | # Published to parent scope for install step.
33 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
34 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
35 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
36 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
37 |
38 | list(APPEND FLUTTER_LIBRARY_HEADERS
39 | "fl_basic_message_channel.h"
40 | "fl_binary_codec.h"
41 | "fl_binary_messenger.h"
42 | "fl_dart_project.h"
43 | "fl_engine.h"
44 | "fl_json_message_codec.h"
45 | "fl_json_method_codec.h"
46 | "fl_message_codec.h"
47 | "fl_method_call.h"
48 | "fl_method_channel.h"
49 | "fl_method_codec.h"
50 | "fl_method_response.h"
51 | "fl_plugin_registrar.h"
52 | "fl_plugin_registry.h"
53 | "fl_standard_message_codec.h"
54 | "fl_standard_method_codec.h"
55 | "fl_string_codec.h"
56 | "fl_value.h"
57 | "fl_view.h"
58 | "flutter_linux.h"
59 | )
60 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
61 | add_library(flutter INTERFACE)
62 | target_include_directories(flutter INTERFACE
63 | "${EPHEMERAL_DIR}"
64 | )
65 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
66 | target_link_libraries(flutter INTERFACE
67 | PkgConfig::GTK
68 | PkgConfig::GLIB
69 | PkgConfig::GIO
70 | PkgConfig::BLKID
71 | PkgConfig::LZMA
72 | )
73 | add_dependencies(flutter flutter_assemble)
74 |
75 | # === Flutter tool backend ===
76 | # _phony_ is a non-existent file to force this command to run every time,
77 | # since currently there's no way to get a full input/output list from the
78 | # flutter tool.
79 | add_custom_command(
80 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
81 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
82 | COMMAND ${CMAKE_COMMAND} -E env
83 | ${FLUTTER_TOOL_ENVIRONMENT}
84 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
85 | linux-x64 ${CMAKE_BUILD_TYPE}
86 | VERBATIM
87 | )
88 | add_custom_target(flutter_assemble DEPENDS
89 | "${FLUTTER_LIBRARY}"
90 | ${FLUTTER_LIBRARY_HEADERS}
91 | )
92 |
--------------------------------------------------------------------------------
/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 | }
47 | else {
48 | gtk_window_set_title(window, "example");
49 | }
50 |
51 | gtk_window_set_default_size(window, 1280, 720);
52 | gtk_widget_show(GTK_WIDGET(window));
53 |
54 | g_autoptr(FlDartProject) project = fl_dart_project_new();
55 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
56 |
57 | FlView* view = fl_view_new(project);
58 | gtk_widget_show(GTK_WIDGET(view));
59 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
60 |
61 | fl_register_plugins(FL_PLUGIN_REGISTRY(view));
62 |
63 | gtk_widget_grab_focus(GTK_WIDGET(view));
64 | }
65 |
66 | // Implements GApplication::local_command_line.
67 | static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) {
68 | MyApplication* self = MY_APPLICATION(application);
69 | // Strip out the first argument as it is the binary name.
70 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
71 |
72 | g_autoptr(GError) error = nullptr;
73 | if (!g_application_register(application, nullptr, &error)) {
74 | g_warning("Failed to register: %s", error->message);
75 | *exit_status = 1;
76 | return TRUE;
77 | }
78 |
79 | g_application_activate(application);
80 | *exit_status = 0;
81 |
82 | return TRUE;
83 | }
84 |
85 | // Implements GObject::dispose.
86 | static void my_application_dispose(GObject *object) {
87 | MyApplication* self = MY_APPLICATION(object);
88 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
89 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
90 | }
91 |
92 | static void my_application_class_init(MyApplicationClass* klass) {
93 | G_APPLICATION_CLASS(klass)->activate = my_application_activate;
94 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
95 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
96 | }
97 |
98 | static void my_application_init(MyApplication* self) {}
99 |
100 | MyApplication* my_application_new() {
101 | return MY_APPLICATION(g_object_new(my_application_get_type(),
102 | "application-id", APPLICATION_ID,
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/linux/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.13)
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}
10 | "main.cc"
11 | "my_application.cc"
12 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
13 | )
14 |
15 | # Apply the standard set of build settings. This can be removed for applications
16 | # that need different build settings.
17 | apply_standard_settings(${BINARY_NAME})
18 |
19 | # Add preprocessor definitions for the application ID.
20 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
21 |
22 | # Add dependency libraries. Add any application-specific dependencies here.
23 | target_link_libraries(${BINARY_NAME} PRIVATE flutter)
24 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
25 |
26 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
27 |
--------------------------------------------------------------------------------
/example/linux/runner/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/runner/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 | import flutter_inappwebview_macos
9 |
10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
11 | InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
12 | }
13 |
--------------------------------------------------------------------------------
/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/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.smartdialog.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.smartdialog. 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/macos/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: A new Flutter application.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 1.0.0+1
19 |
20 | environment:
21 | sdk: ">=2.17.0 <3.0.0"
22 |
23 | dependencies:
24 | flutter:
25 | sdk: flutter
26 |
27 |
28 | # The following adds the Cupertino Icons font to your application.
29 | # Use with the CupertinoIcons class for iOS style icons.
30 | cupertino_icons: ^1.0.0
31 | # 用于处理widget是否可见检测 https://pub.flutter-io.cn/packages/visibility_detector
32 | visibility_detector:
33 | flutter_inappwebview: ^6.1.5
34 | # mac
35 | flutter_smart_dialog:
36 | path: ../
37 | # windows
38 | # flutter_smart_dialog:
39 | # path: ..\
40 |
41 | dev_dependencies:
42 | flutter_test:
43 | sdk: flutter
44 | flutter_lints: ^2.0.0
45 |
46 | # For information on the generic Dart part of this file, see the
47 | # following page: https://dart.dev/tools/pub/pubspec
48 |
49 | # The following section is specific to Flutter.
50 | flutter:
51 |
52 | # The following line ensures that the Material Icons font is
53 | # included with your application, so that you can use the icons in
54 | # the material Icons class.
55 | uses-material-design: true
56 |
57 | # To add assets to your application, add an assets section, like this:
58 | # assets:
59 | # - images/a_dot_burr.jpeg
60 | # - images/a_dot_ham.jpeg
61 |
62 | # An image asset can refer to one or more resolution-specific "variants", see
63 | # https://flutter.dev/assets-and-images/#resolution-aware.
64 |
65 | # For details regarding adding assets from package dependencies, see
66 | # https://flutter.dev/assets-and-images/#from-packages
67 |
68 | # To add custom fonts to your application, add a fonts section here,
69 | # in this "flutter" section. Each entry in this list should have a
70 | # "family" key with the font family name, and a "fonts" key with a
71 | # list giving the asset and other descriptors for the font. For
72 | # example:
73 | # fonts:
74 | # - family: Schyler
75 | # fonts:
76 | # - asset: fonts/Schyler-Regular.ttf
77 | # - asset: fonts/Schyler-Italic.ttf
78 | # style: italic
79 | # - family: Trajan Pro
80 | # fonts:
81 | # - asset: fonts/TrajanPro.ttf
82 | # - asset: fonts/TrajanPro_Bold.ttf
83 | # weight: 700
84 | #
85 | # For details regarding fonts from package dependencies,
86 | # see https://flutter.dev/custom-fonts/#from-packages
87 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:example/main.dart';
9 | import 'package:flutter/material.dart';
10 | import 'package:flutter_test/flutter_test.dart';
11 |
12 | void main() {
13 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
14 | // Build our app and trigger a frame.
15 | await tester.pumpWidget(const MyApp());
16 |
17 | // Verify that our counter starts at 0.
18 | expect(find.text('0'), findsOneWidget);
19 | expect(find.text('1'), findsNothing);
20 |
21 | // Tap the '+' icon and trigger a frame.
22 | await tester.tap(find.byIcon(Icons.add));
23 | await tester.pump();
24 |
25 | // Verify that our counter has incremented.
26 | expect(find.text('0'), findsNothing);
27 | expect(find.text('1'), findsOneWidget);
28 | });
29 | }
30 |
--------------------------------------------------------------------------------
/example/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/example/web/favicon.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/example/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/example/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/example/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/example/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/example/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | example
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/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 | cmake_minimum_required(VERSION 3.15)
2 | project(example LANGUAGES CXX)
3 |
4 | set(BINARY_NAME "example")
5 |
6 | cmake_policy(SET CMP0063 NEW)
7 |
8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
9 |
10 | # Configure build options.
11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
12 | if(IS_MULTICONFIG)
13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
14 | CACHE STRING "" FORCE)
15 | else()
16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
17 | set(CMAKE_BUILD_TYPE "Debug" CACHE
18 | STRING "Flutter build mode" FORCE)
19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
20 | "Debug" "Profile" "Release")
21 | endif()
22 | endif()
23 |
24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
28 |
29 | # Use Unicode for all projects.
30 | add_definitions(-DUNICODE -D_UNICODE)
31 |
32 | # Compilation settings that should be applied to most targets.
33 | function(APPLY_STANDARD_SETTINGS TARGET)
34 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
36 | target_compile_options(${TARGET} PRIVATE /EHsc)
37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
39 | endfunction()
40 |
41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
42 |
43 | # Flutter library and tool build rules.
44 | add_subdirectory(${FLUTTER_MANAGED_DIR})
45 |
46 | # Application build
47 | add_subdirectory("runner")
48 |
49 | # Generated plugin build rules, which manage building the plugins and adding
50 | # them to the application.
51 | include(flutter/generated_plugins.cmake)
52 |
53 |
54 | # === Installation ===
55 | # Support files are copied into place next to the executable, so that it can
56 | # run in place. This is done instead of making a separate bundle (as on Linux)
57 | # so that building and running from within Visual Studio will work.
58 | set(BUILD_BUNDLE_DIR "$")
59 | # Make the "install" step default, as it's required to run.
60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
63 | endif()
64 |
65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
67 |
68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
69 | COMPONENT Runtime)
70 |
71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
72 | COMPONENT Runtime)
73 |
74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
75 | COMPONENT Runtime)
76 |
77 | if(PLUGIN_BUNDLED_LIBRARIES)
78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
80 | COMPONENT Runtime)
81 | endif()
82 |
83 | # Fully re-copy the assets directory on each build to avoid having stale files
84 | # from a previous install.
85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
86 | install(CODE "
87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
88 | " COMPONENT Runtime)
89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
91 |
92 | # Install the AOT library on non-Debug builds only.
93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
94 | CONFIGURATIONS Profile;Release
95 | COMPONENT Runtime)
96 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 | #include
10 |
11 | void RegisterPlugins(flutter::PluginRegistry* registry) {
12 | FlutterInappwebviewWindowsPluginCApiRegisterWithRegistrar(
13 | registry->GetRegistrarForPlugin("FlutterInappwebviewWindowsPluginCApi"));
14 | }
15 |
--------------------------------------------------------------------------------
/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 | flutter_inappwebview_windows
7 | )
8 |
9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | project(runner LANGUAGES CXX)
3 |
4 | add_executable(${BINARY_NAME} WIN32
5 | "flutter_window.cpp"
6 | "main.cpp"
7 | "run_loop.cpp"
8 | "utils.cpp"
9 | "win32_window.cpp"
10 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
11 | "Runner.rc"
12 | "runner.exe.manifest"
13 | )
14 | apply_standard_settings(${BINARY_NAME})
15 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
16 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
17 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
18 | add_dependencies(${BINARY_NAME} flutter_assemble)
19 |
--------------------------------------------------------------------------------
/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 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0,0
67 | #endif
68 |
69 | #if defined(FLUTTER_VERSION)
70 | #define VERSION_AS_STRING FLUTTER_VERSION
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.smartdialog" "\0"
93 | VALUE "FileDescription", "A new Flutter project." "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "example" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2021 com.smartdialog. 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(RunLoop* run_loop,
8 | const flutter::DartProject& project)
9 | : run_loop_(run_loop), project_(project) {}
10 |
11 | FlutterWindow::~FlutterWindow() {}
12 |
13 | bool FlutterWindow::OnCreate() {
14 | if (!Win32Window::OnCreate()) {
15 | return false;
16 | }
17 |
18 | RECT frame = GetClientArea();
19 |
20 | // The size here must match the window dimensions to avoid unnecessary surface
21 | // creation / destruction in the startup path.
22 | flutter_controller_ = std::make_unique(
23 | frame.right - frame.left, frame.bottom - frame.top, project_);
24 | // Ensure that basic setup of the controller was successful.
25 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
26 | return false;
27 | }
28 | RegisterPlugins(flutter_controller_->engine());
29 | run_loop_->RegisterFlutterInstance(flutter_controller_->engine());
30 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
31 | return true;
32 | }
33 |
34 | void FlutterWindow::OnDestroy() {
35 | if (flutter_controller_) {
36 | run_loop_->UnregisterFlutterInstance(flutter_controller_->engine());
37 | flutter_controller_ = nullptr;
38 | }
39 |
40 | Win32Window::OnDestroy();
41 | }
42 |
43 | LRESULT
44 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
45 | WPARAM const wparam,
46 | LPARAM const lparam) noexcept {
47 | // Give Flutter, including plugins, an opporutunity to handle window messages.
48 | if (flutter_controller_) {
49 | std::optional result =
50 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
51 | lparam);
52 | if (result) {
53 | return *result;
54 | }
55 | }
56 |
57 | switch (message) {
58 | case WM_FONTCHANGE:
59 | flutter_controller_->engine()->ReloadSystemFonts();
60 | break;
61 | }
62 |
63 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
64 | }
65 |
--------------------------------------------------------------------------------
/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 "run_loop.h"
10 | #include "win32_window.h"
11 |
12 | // A window that does nothing but host a Flutter view.
13 | class FlutterWindow : public Win32Window {
14 | public:
15 | // Creates a new FlutterWindow driven by the |run_loop|, hosting a
16 | // Flutter view running |project|.
17 | explicit FlutterWindow(RunLoop* run_loop,
18 | const flutter::DartProject& project);
19 | virtual ~FlutterWindow();
20 |
21 | protected:
22 | // Win32Window:
23 | bool OnCreate() override;
24 | void OnDestroy() override;
25 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
26 | LPARAM const lparam) noexcept override;
27 |
28 | private:
29 | // The run loop driving events for this window.
30 | RunLoop* run_loop_;
31 |
32 | // The project to run.
33 | flutter::DartProject project_;
34 |
35 | // The Flutter instance hosted by this window.
36 | std::unique_ptr flutter_controller_;
37 | };
38 |
39 | #endif // RUNNER_FLUTTER_WINDOW_H_
40 |
--------------------------------------------------------------------------------
/example/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "run_loop.h"
7 | #include "utils.h"
8 |
9 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
10 | _In_ wchar_t *command_line, _In_ int show_command) {
11 | // Attach to console when present (e.g., 'flutter run') or create a
12 | // new console when running with a debugger.
13 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
14 | CreateAndAttachConsole();
15 | }
16 |
17 | // Initialize COM, so that it is available for use in the library and/or
18 | // plugins.
19 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
20 |
21 | RunLoop run_loop;
22 |
23 | flutter::DartProject project(L"data");
24 |
25 | std::vector command_line_arguments =
26 | GetCommandLineArguments();
27 |
28 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
29 |
30 | FlutterWindow window(&run_loop, project);
31 | Win32Window::Point origin(10, 10);
32 | Win32Window::Size size(1280, 720);
33 | if (!window.CreateAndShow(L"example", origin, size)) {
34 | return EXIT_FAILURE;
35 | }
36 | window.SetQuitOnClose(true);
37 |
38 | run_loop.Run();
39 |
40 | ::CoUninitialize();
41 | return EXIT_SUCCESS;
42 | }
43 |
--------------------------------------------------------------------------------
/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/fluttercandies/flutter_smart_dialog/1f55ffca0112c917de362ee074390192ea438903/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/example/windows/runner/run_loop.cpp:
--------------------------------------------------------------------------------
1 | #include "run_loop.h"
2 |
3 | #include
4 |
5 | #include
6 |
7 | RunLoop::RunLoop() {}
8 |
9 | RunLoop::~RunLoop() {}
10 |
11 | void RunLoop::Run() {
12 | bool keep_running = true;
13 | TimePoint next_flutter_event_time = TimePoint::clock::now();
14 | while (keep_running) {
15 | std::chrono::nanoseconds wait_duration =
16 | std::max(std::chrono::nanoseconds(0),
17 | next_flutter_event_time - TimePoint::clock::now());
18 | ::MsgWaitForMultipleObjects(
19 | 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000),
20 | QS_ALLINPUT);
21 | bool processed_events = false;
22 | MSG message;
23 | // All pending Windows messages must be processed; MsgWaitForMultipleObjects
24 | // won't return again for items left in the queue after PeekMessage.
25 | while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) {
26 | processed_events = true;
27 | if (message.message == WM_QUIT) {
28 | keep_running = false;
29 | break;
30 | }
31 | ::TranslateMessage(&message);
32 | ::DispatchMessage(&message);
33 | // Allow Flutter to process messages each time a Windows message is
34 | // processed, to prevent starvation.
35 | next_flutter_event_time =
36 | std::min(next_flutter_event_time, ProcessFlutterMessages());
37 | }
38 | // If the PeekMessage loop didn't run, process Flutter messages.
39 | if (!processed_events) {
40 | next_flutter_event_time =
41 | std::min(next_flutter_event_time, ProcessFlutterMessages());
42 | }
43 | }
44 | }
45 |
46 | void RunLoop::RegisterFlutterInstance(
47 | flutter::FlutterEngine* flutter_instance) {
48 | flutter_instances_.insert(flutter_instance);
49 | }
50 |
51 | void RunLoop::UnregisterFlutterInstance(
52 | flutter::FlutterEngine* flutter_instance) {
53 | flutter_instances_.erase(flutter_instance);
54 | }
55 |
56 | RunLoop::TimePoint RunLoop::ProcessFlutterMessages() {
57 | TimePoint next_event_time = TimePoint::max();
58 | for (auto instance : flutter_instances_) {
59 | std::chrono::nanoseconds wait_duration = instance->ProcessMessages();
60 | if (wait_duration != std::chrono::nanoseconds::max()) {
61 | next_event_time =
62 | std::min(next_event_time, TimePoint::clock::now() + wait_duration);
63 | }
64 | }
65 | return next_event_time;
66 | }
67 |
--------------------------------------------------------------------------------
/example/windows/runner/run_loop.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_RUN_LOOP_H_
2 | #define RUNNER_RUN_LOOP_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | // A runloop that will service events for Flutter instances as well
10 | // as native messages.
11 | class RunLoop {
12 | public:
13 | RunLoop();
14 | ~RunLoop();
15 |
16 | // Prevent copying
17 | RunLoop(RunLoop const&) = delete;
18 | RunLoop& operator=(RunLoop const&) = delete;
19 |
20 | // Runs the run loop until the application quits.
21 | void Run();
22 |
23 | // Registers the given Flutter instance for event servicing.
24 | void RegisterFlutterInstance(
25 | flutter::FlutterEngine* flutter_instance);
26 |
27 | // Unregisters the given Flutter instance from event servicing.
28 | void UnregisterFlutterInstance(
29 | flutter::FlutterEngine* flutter_instance);
30 |
31 | private:
32 | using TimePoint = std::chrono::steady_clock::time_point;
33 |
34 | // Processes all currently pending messages for registered Flutter instances.
35 | TimePoint ProcessFlutterMessages();
36 |
37 | std::set flutter_instances_;
38 | };
39 |
40 | #endif // RUNNER_RUN_LOOP_H_
41 |
--------------------------------------------------------------------------------
/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 | if (target_length == 0) {
52 | return std::string();
53 | }
54 | std::string utf8_string;
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_smart_dialog.dart:
--------------------------------------------------------------------------------
1 | library flutter_smart_dialog;
2 |
3 | /// config
4 | export 'src/config/enum_config.dart';
5 | export 'src/config/smart_config_attach.dart';
6 | export 'src/config/smart_config_custom.dart';
7 | export 'src/config/smart_config_loading.dart';
8 | export 'src/config/smart_config_notify.dart';
9 | export 'src/config/smart_config_toast.dart';
10 | export 'src/data/animation_param.dart' show AnimationParam;
11 |
12 | /// model
13 | export 'src/data/attach_model.dart';
14 | export 'src/data/notify_style.dart';
15 |
16 | /// dialog
17 | export 'src/init_dialog.dart';
18 | export 'src/smart_dialog.dart';
19 | export 'src/widget/helper/dialog_scope.dart' show SmartDialogController;
20 |
--------------------------------------------------------------------------------
/lib/src/config/smart_config.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
2 |
3 | import '../kit/dialog_kit.dart';
4 |
5 | /// Global configuration is unified here
6 | ///
7 | /// 全局配置统一在此处处理
8 | class SmartConfig {
9 | /// show(): custom dialog global config
10 | ///
11 | /// show(): custom dialog全局配置项
12 | SmartConfigCustom custom = SmartConfigCustom();
13 |
14 | /// showAttach(): attach dialog global config
15 | ///
16 | /// showAttach(): attach dialog全局配置项
17 | SmartConfigAttach attach = SmartConfigAttach();
18 |
19 | /// showNotify(): notify dialog global config
20 | ///
21 | /// showNotify(): notify dialog全局配置项
22 | SmartConfigNotify notify = SmartConfigNotify();
23 |
24 | /// showLoading(): loading global config
25 | ///
26 | /// showLoading(): loading全局配置项
27 | SmartConfigLoading loading = SmartConfigLoading();
28 |
29 | /// showToast(): toast global config
30 | ///
31 | /// showToast(): toast全局配置项
32 | SmartConfigToast toast = SmartConfigToast();
33 |
34 | /// Check whether the relevant dialog exists on the interface,
35 | /// if the tag attribute is used, dialogTypes will be invalid
36 | ///
37 | /// 检查相关dialog是否存在于界面上,如果使用tag属性,dialogTypes将失效
38 | @Deprecated("please use SmartDialog.checkExist()")
39 | bool checkExist({
40 | String? tag,
41 | Set dialogTypes = const {
42 | SmartAllDialogType.custom,
43 | SmartAllDialogType.attach,
44 | SmartAllDialogType.loading,
45 | },
46 | }) {
47 | return DialogKit.instance.checkExist(tag: tag, dialogTypes: dialogTypes);
48 | }
49 |
50 | /// whether custom dialog,attach and loading exist on the screen
51 | ///
52 | /// 自定义dialog,attach或loading,是否存在在界面上
53 | @Deprecated("Please use checkExist")
54 | bool get isExist => custom.isExist || attach.isExist || loading.isExist;
55 |
56 | /// whether custom dialog exist on the screen
57 | ///
58 | /// 自定义dialog或attach是否存在在界面上
59 | @Deprecated("Please use checkExist")
60 | bool get isExistDialog => custom.isExist || attach.isExist;
61 |
62 | /// whether loading exist on the screen
63 | ///
64 | /// loading是否存在界面上
65 | @Deprecated("Please use checkExist")
66 | bool get isExistLoading => loading.isExist;
67 |
68 | /// whether toast exist on the screen
69 | ///
70 | /// toast是否存在在界面上
71 | @Deprecated("Please use checkExist")
72 | bool get isExistToast => toast.isExist;
73 | }
74 |
--------------------------------------------------------------------------------
/lib/src/custom/custom_loading.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
5 | import 'package:flutter_smart_dialog/src/helper/dialog_proxy.dart';
6 |
7 | import '../data/animation_param.dart';
8 | import '../data/base_dialog.dart';
9 | import '../widget/helper/smart_overlay_entry.dart';
10 |
11 | class CustomLoading extends BaseDialog {
12 | CustomLoading({required SmartOverlayEntry overlayEntry})
13 | : super(overlayEntry);
14 |
15 | Timer? _timer;
16 | Timer? _displayTimer;
17 | bool _canDismiss = false;
18 | Future Function()? _canDismissCallback;
19 |
20 | Future showLoading({
21 | required Widget widget,
22 | required Alignment alignment,
23 | required bool clickMaskDismiss,
24 | required SmartAnimationType animationType,
25 | required List nonAnimationTypes,
26 | required AnimationBuilder? animationBuilder,
27 | required bool usePenetrate,
28 | required bool useAnimation,
29 | required Duration animationTime,
30 | required Color maskColor,
31 | required Widget? maskWidget,
32 | required VoidCallback? onDismiss,
33 | required VoidCallback? onMask,
34 | required Duration? displayTime,
35 | }) {
36 | List nonAnimations = [...nonAnimationTypes];
37 | var continueLoading = SmartNonAnimationType.continueLoading_nonAnimation;
38 | if (SmartDialog.config.loading.isExist &&
39 | nonAnimations.contains(continueLoading)) {
40 | nonAnimations.add(SmartNonAnimationType.openDialog_nonAnimation);
41 | }
42 |
43 | SmartDialog.config.loading.isExist = true;
44 |
45 | _canDismiss = false;
46 | _canDismissCallback = null;
47 | _timer?.cancel();
48 | _timer = Timer(SmartDialog.config.loading.leastLoadingTime, () {
49 | _canDismiss = true;
50 | _canDismissCallback?.call();
51 | });
52 |
53 | return mainDialog.show(
54 | widget: widget,
55 | animationType: animationType,
56 | nonAnimationTypes: nonAnimations,
57 | animationBuilder: animationBuilder,
58 | alignment: alignment,
59 | maskColor: maskColor,
60 | maskWidget: maskWidget,
61 | usePenetrate: usePenetrate,
62 | useAnimation: useAnimation,
63 | animationTime: animationTime,
64 | onDismiss: _handleDismiss(onDismiss, displayTime),
65 | useSystem: false,
66 | reuse: false,
67 | awaitOverType: SmartDialog.config.loading.awaitOverType,
68 | maskTriggerType: SmartDialog.config.loading.maskTriggerType,
69 | ignoreArea: null,
70 | keepSingle: false,
71 | onMask: () {
72 | onMask?.call();
73 | if (!clickMaskDismiss) return;
74 | _realDismiss();
75 | },
76 | );
77 | }
78 |
79 | VoidCallback _handleDismiss(VoidCallback? onDismiss, Duration? displayTime) {
80 | _displayTimer?.cancel();
81 | if (displayTime != null) {
82 | _displayTimer = Timer(displayTime, () => dismiss());
83 | }
84 |
85 | return () {
86 | _displayTimer?.cancel();
87 | onDismiss?.call();
88 | };
89 | }
90 |
91 | Future _realDismiss({CloseType closeType = CloseType.normal}) async {
92 | SmartDialog.config.loading.isExist = false;
93 | await mainDialog.dismiss(closeType: closeType);
94 | }
95 |
96 | Future dismiss({CloseType closeType = CloseType.normal}) async {
97 | _canDismissCallback = () => _realDismiss(closeType: closeType);
98 | if (_canDismiss) {
99 | _canDismiss = false;
100 | SmartDialog.config.loading.isExist = false;
101 | await _canDismissCallback?.call();
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/lib/src/custom/toast/toast_tool.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'dart:collection';
3 |
4 | import 'package:flutter/cupertino.dart';
5 |
6 | import '../../../flutter_smart_dialog.dart';
7 | import 'custom_toast.dart';
8 |
9 | class ToastTool {
10 | static ToastTool? _instance;
11 |
12 | static ToastTool get instance => _instance ??= ToastTool._();
13 |
14 | ToastTool._();
15 |
16 | Timer? _curTime;
17 | Completer? _curCompleter;
18 |
19 | Queue toastQueue = ListQueue();
20 |
21 | Future dismiss({bool closeAll = false}) async {
22 | if (toastQueue.isEmpty) {
23 | return;
24 | }
25 |
26 | if (closeAll) {
27 | clearAllToast();
28 | SmartDialog.config.toast.isExist = false;
29 | return;
30 | }
31 |
32 | var curToast = toastQueue.first;
33 | toastQueue.remove(curToast);
34 | if (toastQueue.isEmpty) {
35 | SmartDialog.config.toast.isExist = false;
36 | }
37 |
38 | await curToast.mainDialog.dismiss();
39 | if (curToast.mainDialog.overlayEntry.mounted) {
40 | curToast.mainDialog.overlayEntry.remove();
41 | }
42 | await Future.delayed(SmartDialog.config.toast.intervalTime);
43 | }
44 |
45 | void clearAllToast() {
46 | if (toastQueue.isEmpty) {
47 | return;
48 | }
49 |
50 | cancelLastDelay();
51 | for (var element in toastQueue) {
52 | if (element.mainDialog.overlayEntry.mounted) {
53 | element.mainDialog.overlayEntry.remove();
54 | }
55 | }
56 | toastQueue.clear();
57 | }
58 |
59 | Future delay(Duration duration, {VoidCallback? onInvoke}) {
60 | var completer = _curCompleter = Completer();
61 | _curTime = Timer(duration, () {
62 | if (!completer.isCompleted) completer.complete();
63 | onInvoke?.call();
64 | });
65 | return completer.future;
66 | }
67 |
68 | void cancelLastDelay() async {
69 | _curTime?.cancel();
70 | if (!(_curCompleter?.isCompleted ?? true)) _curCompleter?.complete();
71 | }
72 |
73 | Future dispatchNext() async {
74 | if (toastQueue.isEmpty) {
75 | return;
76 | }
77 |
78 | var nextToast = toastQueue.first;
79 | if (nextToast.type == SmartToastType.normal) {
80 | await CustomToast.normalToast(
81 | time: nextToast.time,
82 | onShowToast: nextToast.onShowToast,
83 | mainDialog: nextToast.mainDialog,
84 | newToast: false,
85 | );
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/lib/src/data/attach_model.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 |
3 | class AttachParam {
4 | const AttachParam({
5 | required this.targetOffset,
6 | required this.targetSize,
7 | required this.selfWidget,
8 | required this.selfOffset,
9 | required this.selfSize,
10 | });
11 |
12 | final Offset targetOffset;
13 | final Size targetSize;
14 |
15 | final Widget selfWidget;
16 | final Offset selfOffset;
17 | final Size selfSize;
18 | }
19 |
20 | class AttachAdjustParam {
21 | const AttachAdjustParam({
22 | this.builder,
23 | this.alignment,
24 | });
25 |
26 | final WidgetBuilder? builder;
27 | final Alignment? alignment;
28 | }
29 |
--------------------------------------------------------------------------------
/lib/src/data/base_controller.dart:
--------------------------------------------------------------------------------
1 | import '../config/enum_config.dart';
2 | import '../helper/dialog_proxy.dart';
3 |
4 | /// widget controller
5 | abstract class BaseController {
6 | Future dismiss({CloseType closeType = CloseType.normal});
7 |
8 | bool judgeDismissDialogType(
9 | CloseType closeType,
10 | SmartNonAnimationType nonAnimationType,
11 | ) {
12 | if (nonAnimationType == SmartNonAnimationType.closeDialog_nonAnimation) {
13 | return true;
14 | } else if (closeType == CloseType.route &&
15 | nonAnimationType == SmartNonAnimationType.routeClose_nonAnimation) {
16 | return true;
17 | } else if (closeType == CloseType.mask &&
18 | nonAnimationType == SmartNonAnimationType.maskClose_nonAnimation) {
19 | return true;
20 | } else if (closeType == CloseType.back &&
21 | nonAnimationType == SmartNonAnimationType.maskClose_nonAnimation) {
22 | return true;
23 | }
24 |
25 | return false;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/lib/src/data/base_dialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../custom/main_dialog.dart';
4 | import '../widget/helper/smart_overlay_entry.dart';
5 |
6 | /// base dialog:encapsulate common logic
7 | class BaseDialog {
8 | BaseDialog(this.overlayEntry)
9 | : mainDialog = MainDialog(overlayEntry: overlayEntry);
10 |
11 | ///OverlayEntry instance
12 | final SmartOverlayEntry overlayEntry;
13 |
14 | MainDialog mainDialog;
15 |
16 | /// get Widget : must implement
17 | Widget getWidget() => mainDialog.getWidget();
18 |
19 | void appear() {
20 | if (mainDialog.visible) {
21 | return;
22 | }
23 |
24 | mainDialog.visible = true;
25 | overlayEntry.markNeedsBuild();
26 | }
27 |
28 | void hide() {
29 | if (!mainDialog.visible) {
30 | return;
31 | }
32 | mainDialog.visible = false;
33 | overlayEntry.markNeedsBuild();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/lib/src/data/dialog_info.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_smart_dialog/src/kit/typedef.dart';
5 |
6 | import '../../flutter_smart_dialog.dart';
7 | import '../helper/dialog_proxy.dart';
8 | import 'base_dialog.dart';
9 |
10 | class DialogInfo {
11 | DialogInfo({
12 | required this.dialog,
13 | required this.type,
14 | required this.tag,
15 | required this.permanent,
16 | required this.useSystem,
17 | required this.bindPage,
18 | required this.route,
19 | required this.bindWidget,
20 | required this.backType,
21 | required this.onBack,
22 | });
23 |
24 | final BaseDialog dialog;
25 |
26 | final DialogType type;
27 |
28 | String? tag;
29 |
30 | final bool permanent;
31 |
32 | final bool useSystem;
33 |
34 | final bool bindPage;
35 |
36 | final Route? route;
37 |
38 | final BuildContext? bindWidget;
39 |
40 | Timer? displayTimer;
41 |
42 | final SmartBackType? backType;
43 |
44 | final SmartOnBack? onBack;
45 | }
46 |
--------------------------------------------------------------------------------
/lib/src/data/loading_info.dart:
--------------------------------------------------------------------------------
1 | import '../../flutter_smart_dialog.dart';
2 | import '../custom/custom_loading.dart';
3 | import '../kit/typedef.dart';
4 |
5 | class LoadingInfo {
6 | late CustomLoading loadingWidget;
7 |
8 | SmartBackType? backType;
9 |
10 | SmartOnBack? onBack;
11 | }
12 |
--------------------------------------------------------------------------------
/lib/src/data/notify_info.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import '../../flutter_smart_dialog.dart';
4 | import '../kit/typedef.dart';
5 | import 'base_dialog.dart';
6 |
7 | class NotifyInfo {
8 | NotifyInfo({
9 | required this.dialog,
10 | required this.tag,
11 | required this.backType,
12 | required this.onBack,
13 | });
14 |
15 | final BaseDialog dialog;
16 |
17 | String? tag;
18 |
19 | SmartBackType backType;
20 |
21 | Timer? displayTimer;
22 |
23 | final SmartOnBack? onBack;
24 | }
25 |
--------------------------------------------------------------------------------
/lib/src/data/notify_style.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class FlutterSmartNotifyStyle {
4 | const FlutterSmartNotifyStyle({
5 | this.successBuilder,
6 | this.failureBuilder,
7 | this.warningBuilder,
8 | this.alertBuilder,
9 | this.errorBuilder,
10 | });
11 |
12 | final Widget Function(String msg)? successBuilder;
13 | final Widget Function(String msg)? failureBuilder;
14 | final Widget Function(String msg)? warningBuilder;
15 | final Widget Function(String msg)? alertBuilder;
16 | final Widget Function(String msg)? errorBuilder;
17 | }
18 |
--------------------------------------------------------------------------------
/lib/src/data/smart_tag.dart:
--------------------------------------------------------------------------------
1 | class SmartTag {
2 | /// DialogRoute setting name
3 | static const String systemDialog = 'smartSystemDialog';
4 |
5 | ///SmartDialog tag:keepSingle
6 | static const String keepSingle = 'smartKeepSingle';
7 | }
8 |
--------------------------------------------------------------------------------
/lib/src/helper/monitor_widget_helper.dart:
--------------------------------------------------------------------------------
1 | import 'dart:collection';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
5 | import 'package:flutter_smart_dialog/src/helper/dialog_proxy.dart';
6 | import 'package:flutter_smart_dialog/src/helper/route_record.dart';
7 | import 'package:flutter_smart_dialog/src/kit/log.dart';
8 | import 'package:flutter_smart_dialog/src/kit/view_utils.dart';
9 |
10 | import '../data/dialog_info.dart';
11 |
12 | class MonitorWidgetHelper {
13 | factory MonitorWidgetHelper() => instance;
14 | static MonitorWidgetHelper? _instance;
15 |
16 | static MonitorWidgetHelper get instance =>
17 | _instance ??= MonitorWidgetHelper._internal();
18 |
19 | late Queue monitorDialogQueue;
20 |
21 | bool prohibitMonitor = false;
22 |
23 | MonitorWidgetHelper._internal() {
24 | monitorDialogQueue = ListQueue();
25 |
26 | schedulerBinding.addPersistentFrameCallback((timeStamp) {
27 | if (monitorDialogQueue.isEmpty || prohibitMonitor) {
28 | return;
29 | }
30 | prohibitMonitor = true;
31 | var removeList = [];
32 | for (var item in monitorDialogQueue) {
33 | try {
34 | var context = item.bindWidget;
35 | if (context == null) {
36 | throw Error();
37 | }
38 | _calculate(context, item);
39 | } catch (e) {
40 | removeList.add(item);
41 | SmartLog.d(
42 | "The element(hashcode: ${item.bindWidget.hashCode}) is recycled and"
43 | " the 'bindWidget' dialog dismiss automatically",
44 | );
45 | }
46 | }
47 | for (var i = removeList.length; i > 0; i--) {
48 | DialogProxy.instance.dismiss(
49 | status: SmartStatus.dialog,
50 | tag: removeList[i - 1].tag,
51 | );
52 | }
53 | prohibitMonitor = false;
54 | });
55 | }
56 |
57 | void _calculate(BuildContext context, DialogInfo item) {
58 | var renderObject = context.findRenderObject() as RenderBox?;
59 | if (renderObject == null) {
60 | throw Error();
61 | }
62 |
63 | if (RouteRecord.curRoute == item.route) {
64 | // NonPage Scene
65 | _handleDialog(renderObject, item);
66 | } else {
67 | // Page Scene
68 | if (!item.bindPage) {
69 | _handleDialog(renderObject, item);
70 | }
71 | }
72 | // var viewport = RenderAbstractViewport.of(renderObject);
73 | // var revealedOffset = viewport?.getOffsetToReveal(renderObject, 0.0);
74 | // if (revealedOffset != null) {
75 | // // NonPage Scene
76 | // handleDialog();
77 | // } else {
78 | // // Page Scene
79 | // if (!item.bindPage) {
80 | // handleDialog();
81 | // }
82 | // }
83 | }
84 |
85 | _handleDialog(RenderBox renderObject, DialogInfo item) {
86 | var selfOffset = renderObject.localToGlobal(Offset.zero);
87 | if (selfOffset.dx < 0 ||
88 | selfOffset.dy < 0 ||
89 | selfOffset.dx.isNaN ||
90 | selfOffset.dy.isNaN) {
91 | item.dialog.hide();
92 | } else {
93 | item.dialog.appear();
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/lib/src/helper/navigator_observer.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 | import 'package:flutter_smart_dialog/src/data/smart_tag.dart';
4 | import 'package:flutter_smart_dialog/src/helper/route_record.dart';
5 |
6 | import '../data/dialog_info.dart';
7 | import 'dialog_proxy.dart';
8 |
9 | class SmartNavigatorObserver extends NavigatorObserver {
10 | @override
11 | void didPush(Route route, Route? previousRoute) {
12 | RouteRecord.curRoute = route;
13 | RouteRecord.instance.push(route, previousRoute);
14 | navigateChange();
15 | }
16 |
17 | @override
18 | void didReplace({Route? newRoute, Route? oldRoute}) {
19 | RouteRecord.curRoute = newRoute;
20 | RouteRecord.instance.replace(newRoute: newRoute, oldRoute: oldRoute);
21 | _removeDialog(oldRoute);
22 | }
23 |
24 | @override
25 | void didRemove(Route route, Route? previousRoute) {
26 | RouteRecord.instance.remove(route);
27 | _removeDialog(route);
28 | }
29 |
30 | @override
31 | void didPop(Route route, Route? previousRoute) async {
32 | RouteRecord.curRoute = previousRoute;
33 | RouteRecord.instance.pop(route, previousRoute);
34 | _removeDialog(route);
35 | }
36 |
37 | void navigateChange() {
38 | final navigatorContext = navigator?.context;
39 | if (navigatorContext != null) {
40 | DialogProxy.contextNavigator = navigatorContext;
41 | }
42 | }
43 |
44 | void _removeDialog(Route? route) {
45 | navigateChange();
46 | if (route == null) {
47 | return;
48 | }
49 |
50 | var checkDialog = SmartDialog.checkExist(dialogTypes: {
51 | SmartAllDialogType.custom,
52 | SmartAllDialogType.attach,
53 | SmartAllDialogType.loading,
54 | });
55 | if (!checkDialog || route.settings.name == SmartTag.systemDialog) {
56 | return;
57 | }
58 |
59 | if (SmartDialog.config.loading.isExist) {
60 | DialogProxy.instance.dismiss(
61 | status: SmartStatus.loading,
62 | closeType: CloseType.route,
63 | );
64 | }
65 |
66 | //smart close dialog
67 | var removeList = [];
68 | for (var item in DialogProxy.instance.dialogQueue) {
69 | if (item.route == route && item.bindPage && item.route is! PopupRoute) {
70 | removeList.add(item);
71 | }
72 | }
73 | for (var i = removeList.length; i > 0; i--) {
74 | DialogProxy.instance.dismiss(
75 | status: SmartStatus.dialog,
76 | closeType: CloseType.route,
77 | tag: removeList[i - 1].tag,
78 | );
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/lib/src/helper/pop_monitor/boost_route_monitor.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/src/helper/dialog_proxy.dart';
3 | import 'package:flutter_smart_dialog/src/kit/log.dart';
4 | import 'package:flutter_smart_dialog/src/kit/view_utils.dart';
5 |
6 | import 'monitor_pop_route.dart';
7 |
8 | class BoostRouteMonitor {
9 | static BoostRouteMonitor? _instance;
10 |
11 | static BoostRouteMonitor get instance => _instance ??= BoostRouteMonitor._();
12 |
13 | BoostRouteMonitor._();
14 |
15 | int threshold = 1000;
16 |
17 | Route? push(Route? route) {
18 | ViewUtils.addSafeUse(() {
19 | _monitorRouteMount(route, 0);
20 | });
21 | return route;
22 | }
23 |
24 | void _monitorRouteMount(Route? route, int count) async {
25 | try {
26 | if (count > threshold) {
27 | return;
28 | }
29 |
30 | await Future.delayed(const Duration(milliseconds: 1));
31 | if (route?.isActive == false) {
32 | _monitorRouteMount(route, ++count);
33 | return;
34 | }
35 |
36 | if (route is ModalRoute) {
37 | // WillPopCallback 该回调函数返回一个 Future
38 | // 如果返回 true,则允许返回操作;如果返回 false,则阻止返回操作
39 | willPopCallback() async {
40 | return !(await MonitorPopRoute.handBackEvent());
41 | }
42 |
43 | // TODO: `addScopedWillPopCallback()` was deprecated after v3.12.0-1.0.pre.
44 | // ignore: deprecated_member_use
45 | route.addScopedWillPopCallback(willPopCallback);
46 | DialogProxy.contextNavigator = route.subtreeContext;
47 | }
48 | } catch (e) {
49 | SmartLog.d(e);
50 | _monitorRouteMount(route, ++count);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/lib/src/helper/pop_monitor/monitor_pop_route.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/src/helper/dialog_proxy.dart';
3 | import 'package:flutter_smart_dialog/src/helper/route_record.dart';
4 | import 'package:flutter_smart_dialog/src/kit/view_utils.dart';
5 |
6 | import '../../../flutter_smart_dialog.dart';
7 | import '../../data/smart_tag.dart';
8 |
9 | class MonitorPopRoute with WidgetsBindingObserver {
10 | factory MonitorPopRoute() => instance;
11 |
12 | static MonitorPopRoute? _instance;
13 |
14 | static MonitorPopRoute get instance => _instance ??= MonitorPopRoute._();
15 |
16 | MonitorPopRoute._() {
17 | WidgetsFlutterBinding.ensureInitialized();
18 | //to prevent ensureInitialized changes, still use WidgetsBinding.instance
19 | widgetsBinding.addObserver(this);
20 | }
21 |
22 | @override
23 | Future didPopRoute() async {
24 | return MonitorPopRoute.handBackEvent();
25 | }
26 |
27 | // 返回出true, 表示当前已处理, 需要拦截
28 | // 返回出false, 表示当前无需处理, 无需拦截
29 | static Future handBackEvent() async {
30 | //loading
31 | if (SmartDialog.config.loading.isExist) {
32 | final loadingInfo = DialogProxy.instance.loadingInfo;
33 | if (await loadingInfo.onBack?.call() == true) {
34 | return true;
35 | }
36 | if (loadingInfo.backType == SmartBackType.normal) {
37 | DialogProxy.instance.dismiss(
38 | status: SmartStatus.loading,
39 | closeType: CloseType.back,
40 | );
41 | return true;
42 | } else if (loadingInfo.backType == SmartBackType.block) {
43 | return true;
44 | }
45 | }
46 |
47 | //notify
48 | if (SmartDialog.config.notify.isExist) {
49 | var notifyQueue = DialogProxy.instance.notifyQueue;
50 | for (var i = notifyQueue.length - 1; i >= 0; i--) {
51 | var item = notifyQueue.elementAt(i);
52 |
53 | if (await item.onBack?.call() == true) {
54 | return true;
55 | }
56 | if (item.backType == SmartBackType.normal) {
57 | DialogProxy.instance.dismiss(
58 | status: SmartStatus.notify,
59 | closeType: CloseType.back,
60 | tag: item.tag,
61 | );
62 | return true;
63 | } else if (item.backType == SmartBackType.block) {
64 | return true;
65 | }
66 | }
67 | }
68 |
69 | // handle contain system dialog and common condition
70 | if (MonitorPopRoute.handleSmartDialog()) {
71 | var lastDialog = DialogProxy.instance.dialogQueue.last;
72 | if (lastDialog.backType == SmartBackType.normal &&
73 | await lastDialog.onBack?.call() != true) {
74 | DialogProxy.instance.dismiss(
75 | status: SmartStatus.dialog,
76 | closeType: CloseType.back,
77 | );
78 | return true;
79 | } else if (lastDialog.backType == SmartBackType.block) {
80 | return true;
81 | }
82 | }
83 |
84 | return false;
85 | }
86 |
87 | static bool handleSmartDialog() {
88 | bool shouldHandle = true;
89 | var routeQueue = RouteRecord.instance.routeQueue;
90 | try {
91 | //handle dialog
92 | if (DialogProxy.instance.dialogQueue.isEmpty) {
93 | if (routeQueue.isNotEmpty) routeQueue.clear();
94 | shouldHandle = false;
95 | } else {
96 | var info = DialogProxy.instance.dialogQueue.last;
97 |
98 | //deal with system dialog
99 | if (info.useSystem && routeQueue.isNotEmpty) {
100 | var route = routeQueue.last;
101 | if (route.settings.name != SmartTag.systemDialog) {
102 | shouldHandle = false;
103 | }
104 | } else {
105 | // deal with bindPage and permanent dialog
106 | if (!info.dialog.mainDialog.visible || info.permanent) {
107 | shouldHandle = false;
108 | }
109 | }
110 | }
111 | } catch (e) {
112 | shouldHandle = false;
113 | debugPrint('SmartDialog back event error:${e.toString()}');
114 | }
115 |
116 | return shouldHandle;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/lib/src/helper/route_record.dart:
--------------------------------------------------------------------------------
1 | import 'dart:collection';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_smart_dialog/src/helper/dialog_proxy.dart';
5 |
6 | import '../data/dialog_info.dart';
7 |
8 | class RouteRecord {
9 | factory RouteRecord() => instance;
10 | static RouteRecord? _instance;
11 |
12 | static RouteRecord get instance => _instance ??= RouteRecord._internal();
13 |
14 | late Queue> routeQueue;
15 | static Route? curRoute;
16 |
17 | RouteRecord._internal() {
18 | routeQueue = DoubleLinkedQueue();
19 | }
20 |
21 | void push(Route route, Route? previousRoute) {
22 | _hideDialog(previousRoute, route);
23 | if (DialogProxy.instance.dialogQueue.isEmpty) return;
24 | routeQueue.add(route);
25 | }
26 |
27 | void replace({Route? newRoute, Route? oldRoute}) {
28 | if (DialogProxy.instance.dialogQueue.isEmpty) return;
29 | routeQueue.remove(oldRoute);
30 | if (newRoute != null) {
31 | routeQueue.add(newRoute);
32 | }
33 | }
34 |
35 | void pop(Route route, Route? previousRoute) {
36 | _appearDialog(route, previousRoute);
37 | if (routeQueue.isEmpty) return;
38 | routeQueue.remove(route);
39 | }
40 |
41 | void remove(Route route) {
42 | if (routeQueue.isEmpty) return;
43 | routeQueue.remove(route);
44 | }
45 |
46 | /// curRoute: 当前可见的路由 nextRoute: 下一路由
47 | void _hideDialog(Route? curRoute, Route nextRoute) {
48 | if (_banContinue(nextRoute)) return;
49 |
50 | for (var item in DialogProxy.instance.dialogQueue) {
51 | if (_needHandle(item, curRoute)) {
52 | item.dialog.hide();
53 | }
54 | }
55 | }
56 |
57 | /// curRoute: 当前可见的路由 preRoute: 前一路由
58 | void _appearDialog(Route curRoute, Route? preRoute) {
59 | if (_banContinue(curRoute)) return;
60 |
61 | for (var item in DialogProxy.instance.dialogQueue) {
62 | if (_needHandle(item, preRoute)) {
63 | item.dialog.appear();
64 | }
65 | }
66 | }
67 |
68 | bool _banContinue(Route? route) {
69 | return route == null ||
70 | DialogProxy.instance.dialogQueue.isEmpty ||
71 | (route is PopupRoute);
72 | }
73 |
74 | bool _needHandle(DialogInfo item, Route? route) {
75 | if (item.useSystem || item.permanent || (item.route is PopupRoute)) {
76 | return false;
77 | }
78 |
79 | return item.route == route && item.bindPage;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/lib/src/kit/debounce_utils.dart:
--------------------------------------------------------------------------------
1 | import '../../flutter_smart_dialog.dart';
2 |
3 | enum DebounceType {
4 | custom,
5 | attach,
6 | notify,
7 | toast,
8 | mask,
9 | }
10 |
11 | class DebounceUtils {
12 | static DebounceUtils? _instance;
13 |
14 | static DebounceUtils get instance => _instance ??= DebounceUtils._();
15 |
16 | DebounceUtils._();
17 |
18 | Map map = {};
19 |
20 | bool banContinue(DebounceType type, bool debounce) {
21 | if (!debounce) {
22 | return false;
23 | }
24 |
25 | var limitTime = Duration.zero;
26 | if (type == DebounceType.custom) {
27 | limitTime = SmartDialog.config.custom.debounceTime;
28 | } else if (type == DebounceType.attach) {
29 | limitTime = SmartDialog.config.attach.debounceTime;
30 | } else if (type == DebounceType.notify) {
31 | limitTime = SmartDialog.config.notify.debounceTime;
32 | } else if (type == DebounceType.toast) {
33 | limitTime = SmartDialog.config.toast.debounceTime;
34 | } else if (type == DebounceType.mask) {
35 | limitTime = const Duration(milliseconds: 500);
36 | }
37 |
38 | var curTime = DateTime.now();
39 | DateTime? lastTime = map[type];
40 | map[type] = curTime;
41 | var banContinue = false;
42 | if (lastTime != null) {
43 | banContinue = curTime.difference(lastTime) < limitTime;
44 | }
45 |
46 | return banContinue;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/lib/src/kit/dialog_kit.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
2 | import 'package:flutter_smart_dialog/src/helper/dialog_proxy.dart';
3 |
4 | class DialogKit {
5 | static DialogKit? _instance;
6 |
7 | static DialogKit get instance => _instance ??= DialogKit._();
8 |
9 | DialogKit._();
10 |
11 | bool checkExist({
12 | String? tag,
13 | required Set dialogTypes,
14 | }) {
15 | var dialogProxy = DialogProxy.instance;
16 | if (tag != null) {
17 | for (var element in dialogProxy.dialogQueue) {
18 | if (element.tag == tag) {
19 | return true;
20 | }
21 | }
22 | for (var element in dialogProxy.notifyQueue) {
23 | if (element.tag == tag) {
24 | return true;
25 | }
26 | }
27 | return false;
28 | }
29 |
30 | var result = false;
31 | if (dialogTypes.contains(SmartAllDialogType.custom)) {
32 | result = SmartDialog.config.custom.isExist || result;
33 | }
34 | if (dialogTypes.contains(SmartAllDialogType.attach)) {
35 | result = SmartDialog.config.attach.isExist || result;
36 | }
37 | if (dialogTypes.contains(SmartAllDialogType.notify)) {
38 | result = SmartDialog.config.notify.isExist || result;
39 | }
40 | if (dialogTypes.contains(SmartAllDialogType.loading)) {
41 | result = SmartDialog.config.loading.isExist || result;
42 | }
43 | if (dialogTypes.contains(SmartAllDialogType.toast)) {
44 | result = SmartDialog.config.toast.isExist || result;
45 | }
46 |
47 | return result;
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/lib/src/kit/log.dart:
--------------------------------------------------------------------------------
1 | import 'dart:developer' as developer;
2 |
3 | import 'package:flutter/foundation.dart';
4 |
5 | class SmartLog {
6 | static d(Object? object) {
7 | if (kDebugMode) {
8 | developer.log("$object", name: 'SmartDialog');
9 | }
10 | }
11 |
12 | static i(Object? object) {
13 | developer.log("$object", name: 'SmartDialog');
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/lib/src/kit/typedef.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | typedef FutureVoidCallback = Future Function();
4 |
5 | typedef SmartOnBack = FutureOr Function();
6 |
--------------------------------------------------------------------------------
/lib/src/kit/view_utils.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter/scheduler.dart';
5 |
6 | import '../helper/dialog_proxy.dart';
7 |
8 | class ViewUtils {
9 | static void addSafeUse(VoidCallback callback) {
10 | var schedulerPhase = schedulerBinding.schedulerPhase;
11 | if (schedulerPhase == SchedulerPhase.persistentCallbacks) {
12 | widgetsBinding.addPostFrameCallback((timeStamp) => callback());
13 | } else {
14 | callback();
15 | }
16 | }
17 |
18 | static Future awaitSafeUse({VoidCallback? onPostFrame}) async {
19 | final completer = Completer();
20 | var schedulerPhase = schedulerBinding.schedulerPhase;
21 | if (schedulerPhase == SchedulerPhase.persistentCallbacks) {
22 | widgetsBinding.addPostFrameCallback((timeStamp) {
23 | onPostFrame?.call();
24 | if (!completer.isCompleted) completer.complete();
25 | });
26 | } else {
27 | onPostFrame?.call();
28 | if (!completer.isCompleted) completer.complete();
29 | }
30 |
31 | await completer.future;
32 | }
33 |
34 | static Future awaitPostFrame({VoidCallback? onPostFrame}) async {
35 | final completer = Completer();
36 | widgetsBinding.addPostFrameCallback((timeStamp) {
37 | onPostFrame?.call();
38 | if (!completer.isCompleted) completer.complete();
39 | });
40 | await completer.future;
41 | }
42 |
43 | static bool isDarkModel() {
44 | if (DialogProxy.contextNavigator == null) {
45 | return false;
46 | }
47 |
48 | var brightness = Theme.of(DialogProxy.contextNavigator!).brightness;
49 | return brightness == Brightness.dark;
50 | }
51 | }
52 |
53 | class ThemeStyle {
54 | static Color get backgroundColor {
55 | return ViewUtils.isDarkModel() ? const Color(0xFF606060) : Colors.black;
56 | }
57 |
58 | static Color get textColor {
59 | return ViewUtils.isDarkModel() ? Colors.white : Colors.white;
60 | }
61 | }
62 |
63 | WidgetsBinding get widgetsBinding => WidgetsBinding.instance;
64 |
65 | SchedulerBinding get schedulerBinding => SchedulerBinding.instance;
66 |
67 | OverlayState overlay(BuildContext context) => Overlay.of(context);
68 |
--------------------------------------------------------------------------------
/lib/src/widget/animation/fade_animation.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class FadeAnimation extends StatelessWidget {
4 | const FadeAnimation({
5 | Key? key,
6 | required this.controller,
7 | required this.child,
8 | }) : super(key: key);
9 |
10 | final AnimationController controller;
11 |
12 | final Widget child;
13 |
14 | @override
15 | Widget build(BuildContext context) {
16 | return FadeTransition(
17 | opacity: CurvedAnimation(parent: controller, curve: Curves.linear),
18 | child: child,
19 | );
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/lib/src/widget/animation/highlight_mask_animation.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
3 |
4 | import '../attach_dialog_widget.dart';
5 |
6 | class HighlightMaskAnimation extends StatelessWidget {
7 | const HighlightMaskAnimation({
8 | Key? key,
9 | required this.controller,
10 | required this.maskWidget,
11 | required this.maskColor,
12 | required this.usePenetrate,
13 | required this.targetOffset,
14 | required this.targetSize,
15 | required this.highlightBuilder,
16 | required this.nonAnimationTypes,
17 | }) : super(key: key);
18 |
19 | final AnimationController controller;
20 |
21 | final Widget? maskWidget;
22 |
23 | final Color maskColor;
24 |
25 | final bool usePenetrate;
26 |
27 | final Offset targetOffset;
28 | final Size targetSize;
29 |
30 | final HighlightBuilder? highlightBuilder;
31 |
32 | final List nonAnimationTypes;
33 |
34 | @override
35 | Widget build(BuildContext context) {
36 | //handle mask
37 | late Widget mask;
38 | if (usePenetrate) {
39 | mask = Container();
40 | } else if (maskWidget != null) {
41 | mask = maskWidget!;
42 | } else if (highlightBuilder == null) {
43 | mask = Container(color: maskColor);
44 | } else {
45 | mask = ColorFiltered(
46 | colorFilter: ColorFilter.mode(
47 | // mask color
48 | maskColor,
49 | BlendMode.srcOut,
50 | ),
51 | child: Stack(children: [
52 | Container(
53 | decoration: const BoxDecoration(
54 | // any color
55 | color: Colors.white,
56 | backgroundBlendMode: BlendMode.dstOut,
57 | ),
58 | ),
59 |
60 | //dissolve mask, highlight location
61 | highlightBuilder!.call(targetOffset, targetSize)
62 | ]),
63 | );
64 | }
65 |
66 | Widget maskAnimation = FadeTransition(
67 | opacity: CurvedAnimation(parent: controller, curve: Curves.linear),
68 | child: mask,
69 | );
70 | if (highlightBuilder != null) {
71 | for (var element in nonAnimationTypes) {
72 | if (element == SmartNonAnimationType.highlightMask_nonAnimation) {
73 | maskAnimation = mask;
74 | }
75 | }
76 | }
77 |
78 | return maskAnimation;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/lib/src/widget/animation/mask_animation.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class MaskAnimation extends StatelessWidget {
4 | const MaskAnimation({
5 | Key? key,
6 | required this.controller,
7 | required this.maskWidget,
8 | required this.maskColor,
9 | required this.usePenetrate,
10 | }) : super(key: key);
11 |
12 | final AnimationController controller;
13 |
14 | final Widget? maskWidget;
15 |
16 | final Color maskColor;
17 |
18 | final bool usePenetrate;
19 |
20 | @override
21 | Widget build(BuildContext context) {
22 | return FadeTransition(
23 | opacity: CurvedAnimation(parent: controller, curve: Curves.linear),
24 | child: (maskWidget != null && !usePenetrate)
25 | ? maskWidget
26 | : Container(color: usePenetrate ? null : maskColor),
27 | );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/lib/src/widget/animation/scale_animation.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class ScaleAnimation extends StatelessWidget {
4 | const ScaleAnimation({
5 | Key? key,
6 | required this.controller,
7 | required this.child,
8 | this.alignment,
9 | }) : super(key: key);
10 |
11 | final AnimationController controller;
12 |
13 | final Widget child;
14 |
15 | final Alignment? alignment;
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | return ScaleTransition(
20 | alignment: alignment ?? const Alignment(0, 0),
21 | scale: CurvedAnimation(parent: controller, curve: Curves.linear),
22 | child: child,
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/lib/src/widget/animation/size_animation.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class SizeAnimation extends StatelessWidget {
4 | const SizeAnimation({
5 | Key? key,
6 | required this.controller,
7 | required this.alignment,
8 | required this.child,
9 | }) : super(key: key);
10 |
11 | final AnimationController controller;
12 |
13 | final Alignment alignment;
14 |
15 | final Widget child;
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | return SizeTransition(
20 | axis: _handleAxis(),
21 | sizeFactor: controller,
22 | child: child,
23 | );
24 | }
25 |
26 | Axis _handleAxis() {
27 | var axis = Axis.vertical;
28 |
29 | if (alignment == Alignment.centerLeft ||
30 | alignment == Alignment.centerRight) {
31 | axis = Axis.horizontal;
32 | }
33 | return axis;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/lib/src/widget/animation/slide_animation.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class SlideAnimation extends StatefulWidget {
4 | const SlideAnimation({
5 | Key? key,
6 | required this.alignment,
7 | required this.controller,
8 | required this.child,
9 | }) : super(key: key);
10 |
11 | final Alignment alignment;
12 |
13 | final Widget child;
14 |
15 | final AnimationController controller;
16 |
17 | @override
18 | State createState() => _SlideAnimationState();
19 | }
20 |
21 | class _SlideAnimationState extends State
22 | with TickerProviderStateMixin {
23 | late Tween _tween;
24 |
25 | @override
26 | void initState() {
27 | _dealContentAnimate();
28 | super.initState();
29 | }
30 |
31 | @override
32 | void didUpdateWidget(covariant SlideAnimation oldWidget) {
33 | if (oldWidget.child != widget.child) _dealContentAnimate();
34 | super.didUpdateWidget(oldWidget);
35 | }
36 |
37 | @override
38 | Widget build(BuildContext context) {
39 | return SlideTransition(
40 | position: _tween.animate(widget.controller),
41 | child: widget.child,
42 | );
43 | }
44 |
45 | ///处理下内容widget动画方向
46 | void _dealContentAnimate() {
47 | Alignment? alignment = widget.alignment;
48 | var offset = const Offset(0, 0);
49 |
50 | if (alignment == Alignment.bottomCenter ||
51 | alignment == Alignment.bottomLeft ||
52 | alignment == Alignment.bottomRight) {
53 | //靠下
54 | offset = const Offset(0, 1);
55 | } else if (alignment == Alignment.topCenter ||
56 | alignment == Alignment.topLeft ||
57 | alignment == Alignment.topRight) {
58 | //靠上
59 | offset = const Offset(0, -1);
60 | } else if (alignment == Alignment.centerLeft) {
61 | //靠左
62 | offset = const Offset(-1, 0);
63 | } else if (alignment == Alignment.centerRight) {
64 | //靠右
65 | offset = const Offset(1, 0);
66 | } else {
67 | //居中使用缩放动画,空结构体,不需要操作
68 | }
69 |
70 | _tween = Tween(begin: offset, end: Offset.zero);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/src/widget/default/loading_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/src/kit/view_utils.dart';
3 |
4 | class LoadingWidget extends StatelessWidget {
5 | const LoadingWidget({Key? key, required this.msg}) : super(key: key);
6 |
7 | ///loading msg
8 | final String msg;
9 |
10 | @override
11 | Widget build(BuildContext context) {
12 | return Container(
13 | padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
14 | decoration: BoxDecoration(
15 | color: ThemeStyle.backgroundColor,
16 | borderRadius: BorderRadius.circular(15),
17 | ),
18 | child: Column(mainAxisSize: MainAxisSize.min, children: [
19 | //loading animation
20 | CircularProgressIndicator(
21 | strokeWidth: 3,
22 | valueColor: AlwaysStoppedAnimation(ThemeStyle.textColor),
23 | ),
24 |
25 | //msg
26 | Container(
27 | margin: const EdgeInsets.only(top: 20),
28 | child: Text(msg, style: TextStyle(color: ThemeStyle.textColor)),
29 | ),
30 | ]),
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/lib/src/widget/default/notify_alter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../kit/view_utils.dart';
4 |
5 | class NotifyAlter extends StatelessWidget {
6 | const NotifyAlter({
7 | Key? key,
8 | required this.msg,
9 | }) : super(key: key);
10 |
11 | final String msg;
12 |
13 | @override
14 | Widget build(BuildContext context) {
15 | return Container(
16 | decoration: BoxDecoration(
17 | borderRadius: BorderRadius.circular(8),
18 | color: ThemeStyle.backgroundColor,
19 | ),
20 | padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
21 | child: Column(mainAxisSize: MainAxisSize.min, children: [
22 | Icon(
23 | Icons.priority_high_outlined,
24 | size: 22,
25 | color: ThemeStyle.textColor,
26 | ),
27 | Container(
28 | margin: const EdgeInsets.only(top: 5),
29 | child: Text(msg, style: TextStyle(color: ThemeStyle.textColor)),
30 | ),
31 | ]),
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/lib/src/widget/default/notify_error.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../kit/view_utils.dart';
4 |
5 | class NotifyError extends StatelessWidget {
6 | const NotifyError({
7 | Key? key,
8 | required this.msg,
9 | }) : super(key: key);
10 |
11 | final String msg;
12 |
13 | @override
14 | Widget build(BuildContext context) {
15 | return Container(
16 | decoration: BoxDecoration(
17 | borderRadius: BorderRadius.circular(8),
18 | color: ThemeStyle.backgroundColor,
19 | ),
20 | padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
21 | child: Column(mainAxisSize: MainAxisSize.min, children: [
22 | Icon(Icons.error_outline, size: 22, color: ThemeStyle.textColor),
23 | Container(
24 | margin: const EdgeInsets.only(top: 5),
25 | child: Text(msg, style: TextStyle(color: ThemeStyle.textColor)),
26 | ),
27 | ]),
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib/src/widget/default/notify_failure.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../kit/view_utils.dart';
4 |
5 | class NotifyFailure extends StatelessWidget {
6 | const NotifyFailure({
7 | Key? key,
8 | required this.msg,
9 | }) : super(key: key);
10 |
11 | final String msg;
12 |
13 | @override
14 | Widget build(BuildContext context) {
15 | return Container(
16 | decoration: BoxDecoration(
17 | borderRadius: BorderRadius.circular(8),
18 | color: ThemeStyle.backgroundColor,
19 | ),
20 | padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
21 | child: Column(mainAxisSize: MainAxisSize.min, children: [
22 | Icon(Icons.close, size: 22, color: ThemeStyle.textColor),
23 | Container(
24 | margin: const EdgeInsets.only(top: 5),
25 | child: Text(msg, style: TextStyle(color: ThemeStyle.textColor)),
26 | ),
27 | ]),
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib/src/widget/default/notify_success.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../kit/view_utils.dart';
4 |
5 | class NotifySuccess extends StatelessWidget {
6 | const NotifySuccess({
7 | Key? key,
8 | required this.msg,
9 | }) : super(key: key);
10 |
11 | final String msg;
12 |
13 | @override
14 | Widget build(BuildContext context) {
15 | return Container(
16 | decoration: BoxDecoration(
17 | borderRadius: BorderRadius.circular(8),
18 | color: ThemeStyle.backgroundColor,
19 | ),
20 | padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
21 | child: Column(mainAxisSize: MainAxisSize.min, children: [
22 | Icon(Icons.check, size: 22, color: ThemeStyle.textColor),
23 | Container(
24 | margin: const EdgeInsets.only(top: 5),
25 | child: Text(msg, style: TextStyle(color: ThemeStyle.textColor)),
26 | ),
27 | ]),
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib/src/widget/default/notify_warning.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../kit/view_utils.dart';
4 |
5 | class NotifyWarning extends StatelessWidget {
6 | const NotifyWarning({
7 | Key? key,
8 | required this.msg,
9 | }) : super(key: key);
10 |
11 | final String msg;
12 |
13 | @override
14 | Widget build(BuildContext context) {
15 | return Container(
16 | decoration: BoxDecoration(
17 | borderRadius: BorderRadius.circular(8),
18 | color: ThemeStyle.backgroundColor,
19 | ),
20 | padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
21 | child: Column(mainAxisSize: MainAxisSize.min, children: [
22 | Icon(
23 | Icons.warning_amber_outlined,
24 | size: 22,
25 | color: ThemeStyle.textColor,
26 | ),
27 | Container(
28 | margin: const EdgeInsets.only(top: 5),
29 | child: Text(msg, style: TextStyle(color: ThemeStyle.textColor)),
30 | ),
31 | ]),
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/lib/src/widget/default/toast_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../kit/view_utils.dart';
4 |
5 | class ToastWidget extends StatelessWidget {
6 | const ToastWidget({Key? key, required this.msg}) : super(key: key);
7 |
8 | ///toast msg
9 | final String msg;
10 |
11 | @override
12 | Widget build(BuildContext context) {
13 | return Container(
14 | margin: const EdgeInsets.symmetric(horizontal: 30, vertical: 50),
15 | padding: const EdgeInsets.symmetric(horizontal: 25, vertical: 10),
16 | decoration: BoxDecoration(
17 | color: ThemeStyle.backgroundColor,
18 | borderRadius: BorderRadius.circular(20),
19 | ),
20 | child: Text(msg, style: TextStyle(color: ThemeStyle.textColor)),
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/src/widget/helper/dialog_scope.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/src/kit/view_utils.dart';
3 |
4 | part 'smart_dialog_controller.dart';
5 |
6 | abstract class DialogScopeAction {
7 | void setController(SmartDialogController? controller);
8 |
9 | void replaceBuilder(Widget? child);
10 | }
11 |
12 | class DialogScopeInfo {
13 | DialogScopeAction? action;
14 | }
15 |
16 | class DialogScope extends StatefulWidget {
17 | DialogScope({
18 | Key? key,
19 | required this.controller,
20 | required this.builder,
21 | }) : super(key: key);
22 |
23 | final SmartDialogController? controller;
24 |
25 | final WidgetBuilder builder;
26 |
27 | final DialogScopeInfo info = DialogScopeInfo();
28 |
29 | @override
30 | State createState() => _DialogScopeState();
31 | }
32 |
33 | class _DialogScopeState extends State
34 | implements DialogScopeAction {
35 | VoidCallback? _callback;
36 | Widget? _child;
37 |
38 | @override
39 | void initState() {
40 | widget.info.action = this;
41 | setController(widget.controller);
42 | super.initState();
43 | }
44 |
45 | @override
46 | Widget build(BuildContext context) {
47 | return _child ?? widget.builder(context);
48 | }
49 |
50 | @override
51 | void setController(SmartDialogController? controller) {
52 | controller?._setListener(_callback = () {
53 | ViewUtils.addSafeUse(() {
54 | if (mounted) {
55 | setState(() {});
56 | }
57 | });
58 | });
59 | }
60 |
61 | @override
62 | void replaceBuilder(Widget? child) {
63 | _child = child;
64 | }
65 |
66 | @override
67 | void dispose() {
68 | if (_callback == widget.controller?._callback) {
69 | widget.controller?._dismiss();
70 | }
71 |
72 | super.dispose();
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/lib/src/widget/helper/mask_event.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../config/enum_config.dart';
4 |
5 | class MaskEvent extends StatefulWidget {
6 | const MaskEvent({
7 | Key? key,
8 | required this.maskTriggerType,
9 | required this.onMask,
10 | required this.child,
11 | }) : super(key: key);
12 |
13 | final SmartMaskTriggerType maskTriggerType;
14 |
15 | final VoidCallback onMask;
16 |
17 | final Widget child;
18 |
19 | @override
20 | State createState() => _MaskEventState();
21 | }
22 |
23 | class _MaskEventState extends State {
24 | bool _maskTrigger = false;
25 |
26 | @override
27 | Widget build(BuildContext context) {
28 | Function()? onPointerDown;
29 | Function()? onPointerMove;
30 | Function()? onPointerUp;
31 | if (widget.maskTriggerType == SmartMaskTriggerType.down) {
32 | onPointerDown = widget.onMask;
33 | } else if (widget.maskTriggerType == SmartMaskTriggerType.move) {
34 | onPointerMove = widget.onMask;
35 | } else {
36 | onPointerUp = widget.onMask;
37 | }
38 |
39 | return Listener(
40 | behavior: HitTestBehavior.translucent,
41 | onPointerDown: (event) {
42 | onPointerDown?.call();
43 | if (onPointerDown != null) _maskTrigger = true;
44 | },
45 | onPointerMove: (event) {
46 | if (!_maskTrigger) onPointerMove?.call();
47 | if (onPointerMove != null) _maskTrigger = true;
48 | },
49 | onPointerUp: (event) {
50 | onPointerUp?.call();
51 | if (onPointerUp == null && !_maskTrigger) widget.onMask.call();
52 | _maskTrigger = false;
53 | },
54 | child: widget.child,
55 | );
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/lib/src/widget/helper/smart_dialog_controller.dart:
--------------------------------------------------------------------------------
1 | part of 'dialog_scope.dart';
2 |
3 | /// SmartDialog Controller
4 | class SmartDialogController {
5 | VoidCallback? _callback;
6 |
7 | /// refresh dialog
8 | ///
9 | /// 刷新dialog
10 | void refresh() {
11 | _callback?.call();
12 | }
13 |
14 | void _setListener(VoidCallback? voidCallback) {
15 | _callback = voidCallback;
16 | }
17 |
18 | void _dismiss() {
19 | _callback = null;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/lib/src/widget/helper/smart_overlay_entry.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/src/kit/view_utils.dart';
3 |
4 | class SmartOverlayEntry extends OverlayEntry {
5 | SmartOverlayEntry({
6 | required WidgetBuilder builder,
7 | bool opaque = false,
8 | bool maintainState = false,
9 | }) : super(builder: builder, opaque: opaque, maintainState: maintainState);
10 |
11 | @override
12 | void markNeedsBuild() {
13 | ViewUtils.addSafeUse(() => super.markNeedsBuild());
14 | }
15 |
16 | @override
17 | void remove() {
18 | if (!mounted) {
19 | return;
20 | }
21 | super.remove();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/src/widget/helper/toast_helper.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_smart_dialog/src/kit/view_utils.dart';
3 |
4 | class ToastHelper extends StatefulWidget {
5 | const ToastHelper({
6 | Key? key,
7 | required this.consumeEvent,
8 | required this.child,
9 | }) : super(key: key);
10 |
11 | final bool consumeEvent;
12 |
13 | final Widget child;
14 |
15 | @override
16 | State createState() => _ToastHelperState();
17 | }
18 |
19 | class _ToastHelperState extends State with WidgetsBindingObserver {
20 | //solve problem of keyboard shelter toast
21 | double _keyboardHeight = 0;
22 | BuildContext? _childContext;
23 |
24 | //offset size
25 | Offset? selfOffset;
26 | Size? selfSize;
27 |
28 | @override
29 | void initState() {
30 | widgetsBinding.addObserver(this);
31 |
32 | ViewUtils.addSafeUse(() {
33 | if (!mounted) return;
34 |
35 | final renderBox = _childContext?.findRenderObject() as RenderBox?;
36 | if (renderBox != null) {
37 | selfOffset = renderBox.localToGlobal(Offset.zero);
38 | selfSize = renderBox.size;
39 | }
40 | _dealKeyboard();
41 | });
42 | super.initState();
43 | }
44 |
45 | @override
46 | Widget build(BuildContext context) {
47 | var child = Builder(builder: (context) {
48 | _childContext = context;
49 | return widget.child;
50 | });
51 |
52 | return Container(
53 | margin: EdgeInsets.only(bottom: _keyboardHeight),
54 | child: widget.consumeEvent ? child : IgnorePointer(child: child),
55 | );
56 | }
57 |
58 | @override
59 | void didChangeMetrics() {
60 | super.didChangeMetrics();
61 | _dealKeyboard();
62 | }
63 |
64 | @override
65 | void dispose() {
66 | widgetsBinding.removeObserver(this);
67 | super.dispose();
68 | }
69 |
70 | void _dealKeyboard() {
71 | ViewUtils.addSafeUse(() {
72 | if (!mounted || selfOffset == null || selfSize == null) return;
73 |
74 | var screen = MediaQuery.of(context).size;
75 | var childToBottom = screen.height - (selfOffset!.dy + selfSize!.height);
76 | var keyboardHeight = MediaQuery.of(context).viewInsets.bottom;
77 | if (childToBottom < 0) {
78 | _keyboardHeight = keyboardHeight;
79 | setState(() {});
80 | return;
81 | }
82 | if (childToBottom - keyboardHeight > -30) {
83 | return;
84 | }
85 | _keyboardHeight = keyboardHeight - childToBottom;
86 | setState(() {});
87 | });
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/macos/Flutter/ephemeral/Flutter-Generated.xcconfig:
--------------------------------------------------------------------------------
1 | // This is a generated file; do not edit or check into version control.
2 | FLUTTER_ROOT=D:\Develop\SDK\flutter_sdk
3 | FLUTTER_APPLICATION_PATH=D:\Develop\GitHub\flutter_smart_dialog
4 | COCOAPODS_PARALLEL_CODE_SIGN=true
5 | FLUTTER_BUILD_DIR=build
6 | FLUTTER_BUILD_NAME=4.9.7
7 | FLUTTER_BUILD_NUMBER=10
8 | DART_OBFUSCATION=false
9 | TRACK_WIDGET_CREATION=true
10 | TREE_SHAKE_ICONS=false
11 | PACKAGE_CONFIG=.dart_tool/package_config.json
12 |
--------------------------------------------------------------------------------
/macos/Flutter/ephemeral/flutter_export_environment.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # This is a generated file; do not edit or check into version control.
3 | export "FLUTTER_ROOT=D:\Develop\SDK\flutter_sdk"
4 | export "FLUTTER_APPLICATION_PATH=D:\Develop\GitHub\flutter_smart_dialog"
5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true"
6 | export "FLUTTER_BUILD_DIR=build"
7 | export "FLUTTER_BUILD_NAME=4.9.7"
8 | export "FLUTTER_BUILD_NUMBER=10"
9 | export "DART_OBFUSCATION=false"
10 | export "TRACK_WIDGET_CREATION=true"
11 | export "TREE_SHAKE_ICONS=false"
12 | export "PACKAGE_CONFIG=.dart_tool/package_config.json"
13 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_smart_dialog
2 | description:
3 | An elegant Flutter Dialog solution,
4 | Easily implement Toast, Loading and custom Dialog,
5 | Make the use of the dialog easier!
6 | version: 4.9.8+8
7 | homepage: https://github.com/fluttercandies/flutter_smart_dialog
8 | # flutter pub publish --server=https://pub.dartlang.org
9 | # flutter build web --release --base-href="/flutter_smart_dialog/web/"
10 |
11 | environment:
12 | sdk: '>=2.12.0 <4.0.0'
13 | flutter: ">=3.0.0"
14 |
15 | dependencies:
16 | flutter:
17 | sdk: flutter
18 |
19 | dev_dependencies:
20 | flutter_test:
21 | sdk: flutter
22 | # https://pub.dev/packages/flutter_lints
23 | flutter_lints: ^2.0.0
24 |
25 | # The following section is specific to Flutter.
26 | flutter:
27 |
--------------------------------------------------------------------------------
/test/flutter_smart_dialog_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_test/flutter_test.dart';
2 |
3 | void main() {
4 | test('adds one to input values', () {});
5 | }
6 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------