├── .github └── workflows │ ├── pub_publish.yml │ └── runnable.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── example_for_oktoast │ │ │ │ └── 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 │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ ├── Flutter.podspec │ │ └── Release.xcconfig │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── main.dart │ └── miui10_anim.dart ├── macos │ ├── .gitignore │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── Runner │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ │ ├── Base.lproj │ │ └── MainMenu.xib │ │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ │ ├── DebugProfile.entitlements │ │ ├── Info.plist │ │ ├── MainFlutterWindow.swift │ │ └── Release.entitlements ├── pubspec.yaml └── web │ ├── favicon.png │ ├── icons │ ├── Icon-192.png │ └── Icon-512.png │ ├── index.html │ └── manifest.json ├── lib ├── oktoast.dart └── src │ ├── core │ ├── default_themes.dart │ ├── position.dart │ ├── toast.dart │ ├── toast_future.dart │ └── toast_manager.dart │ └── widget │ ├── animation │ ├── animation_builder.dart │ ├── offset_builder.dart │ └── opacity_builder.dart │ ├── container.dart │ ├── oktoast.dart │ ├── overlay.dart │ └── theme.dart ├── pubspec.yaml └── test └── toast_test.dart /.github/workflows/pub_publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish 2 | 3 | on: 4 | release: 5 | types: [published] 6 | workflow_dispatch: 7 | 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v4 14 | - name: Publish 15 | uses: k-paxian/dart-package-publisher@v1.6 16 | with: 17 | credentialJson: ${{ secrets.CREDENTIAL_JSON }} 18 | flutter: true 19 | dryRunOnly: false 20 | skipTests: true 21 | force: true 22 | accessToken: 23 | refreshToken: -------------------------------------------------------------------------------- /.github/workflows/runnable.yml: -------------------------------------------------------------------------------- 1 | name: Runnable (stable) 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | analyze: 13 | name: Analyze on ${{ matrix.os }} with flutter ${{ matrix.version }} 14 | runs-on: ${{ matrix.os }} 15 | strategy: 16 | matrix: 17 | os: [ ubuntu-latest ] 18 | version: [ 19 | '3.16.0', # Stable 20 | '3.7.0' # Minimum 21 | ] 22 | steps: 23 | - uses: actions/checkout@v4 24 | - uses: actions/setup-java@v3 25 | with: 26 | distribution: 'adopt' 27 | java-version: '11.x' 28 | - uses: subosito/flutter-action@v2 29 | with: 30 | cache: true 31 | flutter-version: ${{ matrix.version }} 32 | channel: 'stable' 33 | - name: Log Dart/Flutter versions 34 | run: | 35 | dart --version 36 | flutter --version 37 | - name: Prepare dependencies 38 | run: flutter pub get 39 | - name: Analyse the repo 40 | run: flutter analyze lib example/lib 41 | - name: Run tests 42 | run: flutter test 43 | 44 | test_iOS: 45 | needs: analyze 46 | name: Test iOS on ${{ matrix.os }} 47 | runs-on: ${{ matrix.os }} 48 | strategy: 49 | matrix: 50 | os: [ macos-latest ] 51 | steps: 52 | - uses: actions/checkout@v4 53 | - uses: actions/setup-java@v3 54 | with: 55 | distribution: 'adopt' 56 | java-version: '11.x' 57 | - uses: subosito/flutter-action@v2 58 | with: 59 | architecture: x64 60 | channel: 'stable' 61 | - run: dart --version 62 | - run: flutter --version 63 | - run: flutter pub get 64 | - run: cd example; flutter build ios --no-codesign 65 | 66 | test_android: 67 | needs: analyze 68 | name: Test Android on ${{ matrix.os }} 69 | runs-on: ${{ matrix.os }} 70 | strategy: 71 | matrix: 72 | os: [ ubuntu-latest ] 73 | steps: 74 | - uses: actions/checkout@v4 75 | - uses: actions/setup-java@v3 76 | with: 77 | distribution: 'adopt' 78 | java-version: '11.x' 79 | - uses: subosito/flutter-action@v2 80 | with: 81 | channel: 'stable' 82 | - run: dart --version 83 | - run: flutter --version 84 | - run: flutter pub get 85 | - run: cd example; flutter build apk --debug 86 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | ios/.generated/ 9 | ios/Flutter/Generated.xcconfig 10 | ios/Runner/GeneratedPluginRegistrant.* 11 | 12 | *.iml 13 | .vscode 14 | .idea 15 | .fvm 16 | pubspec.lock 17 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change log 2 | 3 | ## 3.4.0 4 | 5 | Feat: 6 | 7 | - Wrapper a `Material` widget when the `OKToast` widget is not wrapped with `Material`. 8 | - The min support of flutter SDK version to 3.7.0. 9 | 10 | ## 3.3.2+1 11 | 12 | - Fix `Theatre` constructor and get rid of `View` for compatibilities. (#103) 13 | 14 | ## 3.3.2 15 | 16 | - Fix position offset do not work when `movingOnWindowChange` is false. (#100) 17 | 18 | ## 3.3.1 19 | 20 | - Replace `context.debugDoingBuild` flag with `SchedulerBinding.instance.schedulerPhase`. (#97) 21 | 22 | ## 3.3.0 23 | 24 | - Abstract `BuildContextPredicate`. (#95) 25 | - More text fields for `showToast`. (#96) 26 | 27 | ## 3.2.0 28 | 29 | Migrate to Flutter 3, drop supports for previous Flutter versions. 30 | 31 | - Remove deprecated `Miui10AnimBuilder`. 32 | 33 | ## 3.1.5 34 | 35 | - `_ToastContainer` -> `ToastContainer`. 36 | - Add tests. 37 | 38 | ## 3.1.4 39 | 40 | - Fix dismiss is invalid when called synchronously. (#88) 41 | - Deprecated inner `Miui10AnimBuilder`. 42 | 43 | ## 3.1.3+1 44 | 45 | - Quick fix for the `_throwIfNoContext`. 46 | 47 | ## 3.1.3 48 | 49 | - Throw a more precise error if the `OKToast` widget is not wrapped correctly. 50 | - Bind `ToastFuture` with `OverlayEntry` mounted state. 51 | 52 | ## 3.1.2 53 | 54 | - Deliver overlay insertion into microtask. 55 | 56 | ## 3.1.1 57 | 58 | - Expose `constraints` and `margin` for `showToast` method. (#84) 59 | 60 | ## 3.1.0 61 | 62 | - Support `copyWith` for `ToastPosition`. (#82) 63 | - Integrate `animationBuilder` properly. (#81) 64 | - **BREAKING CHANGE**: `handleTouth` -> `handleTouch`. 65 | - Code cleanup. 66 | 67 | ## 3.0.0 68 | 69 | - Null safety version. 70 | 71 | ## 2.3.2 72 | 73 | - Fixed a memory leak issue. 74 | 75 | ## 2.3.1+1 76 | 77 | - Fix health for pub. 78 | 79 | ## 2.3.1 80 | 81 | - Fix [#46](https://github.com/OpenFlutter/flutter_oktoast/issues/46). 82 | 83 | ## 2.3.0 84 | 85 | New feature: 86 | 87 | - Add animation for show/hide the oktoast. 88 | 89 | ## 2.2.1 90 | 91 | Fix: 92 | 93 | - `textAlign` of method `showToast`. 94 | 95 | ## 2.2.0 96 | 97 | New feature: 98 | 99 | - handleTouch: Caller can use this property to respond to click events. 100 | 101 | Change: 102 | 103 | - This is a **breaking change** : The default value of dismissOtherToast of showToast is changed to better match the OKToast overall settings. . 104 | 105 | ## 2.1.9 106 | 107 | Fix: 108 | 109 | - `position` is not valid in `showToastWidget`. 110 | 111 | ## 2.1.8 112 | 113 | Add param `showAnim` param for dismiss method: 114 | 115 | - dismissAllToast 116 | - ToastManager.dismissAll 117 | - ToastFuture.dismiss 118 | 119 | ## 2.1.7 120 | 121 | Add for `OKToast`: 122 | 123 | - textAlign 124 | - textPadding 125 | 126 | Add for `showToast`: 127 | 128 | - textAlign 129 | 130 | ## 2.1.6 131 | 132 | add textPadding for showToast method. 133 | 134 | ## 2.1.5 135 | 136 | fix `ToastPosition` offset params 137 | 138 | ## 2.1.4 139 | 140 | add textDirection params 141 | 142 | ## 2.1.3 143 | 144 | When ui.window's size changes, toast is moved. 145 | 146 | ## 2.1.2 147 | 148 | Now, `OKToast` add a params `dismissOtherOnShow` to dismiss other toast. 149 | 150 | ## 2.1.1 151 | 152 | use manager to manage ToastFuture 153 | 154 | add a method `dismissAllToast` to dismiss all toast. 155 | 156 | add a param with showToast to dismiss other toast. 157 | 158 | ## 2.1.0 159 | 160 | add new params to helper user listen toast dismiss 161 | 162 | showToast and showToastWidget will return `ToastFuture` the toastFuture call `dismiss()` to dismiss toast. 163 | 164 | ## 2.0.1 165 | 166 | oktoast support page level. 167 | 168 | you can use oktoast wrap your Scaffold. 169 | 170 | ## 2.0.0 171 | 172 | use BuildContext cache. then `showToast` not need context, you can use the `showToast` in anywhere. 173 | 174 | ## 1.0.4 175 | 176 | support flutter sdk 0.10 ,fix bug 177 | 178 | ## 1.0.3 179 | 180 | update the textAlign : TextAlign.center 181 | update the overflow: TextOverflow.ellipsis, 182 | 183 | ## 1.0.2 184 | 185 | fix `defaultPosition` is invalid. 186 | 187 | ## [1.0.1+2] 188 | 189 | update readme 190 | 191 | ## [1.0.1+1] 192 | 193 | update readme 194 | 195 | ## [1.0.1] rename library name 196 | 197 | now libray is oktoast 198 | 199 | ## [1.0.0] first release version 200 | 201 | stable version 202 | 203 | ## [0.0.3] add the toast position 204 | 205 | the toast can set position 206 | 207 | 1. showToast 208 | 2. defaultPosition 209 | 210 | ## [0.0.2] - add toast style 211 | 212 | add the textStyle 213 | radius 214 | backgroundColor 215 | 216 | ## [0.0.1] - first version 217 | 218 | init commit 219 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [2018] [Caijinglong] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # oktoast 2 | 3 | [![oktoast](https://img.shields.io/badge/OpenFlutter-OKToast-blue.svg)](https://github.com/OpenFlutter/flutter_oktoast) 4 | [![pub package](https://img.shields.io/pub/v/oktoast.svg)](https://pub.dartlang.org/packages/oktoast) 5 | ![GitHub](https://img.shields.io/github/license/OpenFlutter/flutter_oktoast.svg) 6 | [![GitHub stars](https://img.shields.io/github/stars/OpenFlutter/flutter_oktoast.svg?style=social&label=Stars)](https://github.com/OpenFlutter/flutter_oktoast) 7 | 8 | A library for flutter. 9 | 10 | A pure dart toast Library. 11 | 12 | You can completely customize the style of toast. 13 | 14 | [中文博客介绍](https://www.kikt.top/posts/flutter/toast/oktoast/) 15 | 16 | ## Screenshot 17 | 18 | | Default | Custom | GIF | 19 | |----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------| 20 | | ![pic](https://raw.githubusercontent.com/CccFans/images/master/img/20181207161700.png) | ![pic](https://raw.githubusercontent.com/CccFans/images/master/img/20181207161742.png) | ![pic](https://raw.githubusercontent.com/CaiJingLong/some_asset/master/ktoast2.gif) | 21 | 22 | ## Versions 23 | 24 | ### 3.x.x 25 | 26 | Starting from the 3.x version, OKToast provides a null-safety version, 27 | the specific introduction of null-safety can be viewed in [dart][dart-safe] or [flutter][flutter-safe]. 28 | 29 | [flutter-safe]: https://flutter.dev/docs/null-safety 30 | [dart-safe]: https://dart.dev/null-safety 31 | 32 | The 2.3.2 version is the last version that does not support null-safety. 33 | 34 | ### About version 1.x 35 | 36 | if you use OKToast 1.x, Please use the 1.x branch, and read version readme. 37 | 38 | Proposed migration to 2.x version. The new version does not require buildContext. 39 | 40 | And you can completely customize the style of toast, because now you can use `showToastWidget`. 41 | 42 | ## Usage 43 | 44 | ### 1. Add library to your pubspec.yaml 45 | 46 | ```shell 47 | flutter pub add oktoast 48 | ``` 49 | 50 | ### 2. Import library in dart file 51 | 52 | ```dart 53 | import 'package:oktoast/oktoast.dart'; 54 | ``` 55 | 56 | ### 3. Wrap your app widget 57 | 58 | ```dart 59 | OKToast( 60 | /// set toast style, optional 61 | child:MaterialApp() 62 | ); 63 | ``` 64 | 65 | Tips: 66 | If you happened error like: `No MediaQuery widget found`, 67 | you can try to use this [code](https://github.com/OpenFlutter/flutter_oktoast/issues/53#issuecomment-628431625) 68 | to include `OKToast` to your App. 69 | 70 | ```dart 71 | MaterialApp( 72 | builder: (BuildContext context, Widget? widget) { 73 | return OKToast(child: widget); 74 | }, 75 | ); 76 | ``` 77 | 78 | ### 4. Call method `showToast` 79 | 80 | ```dart 81 | showToast('content'); 82 | 83 | // position and second have default value, is optional 84 | showToastWidget(Text('hello oktoast')); 85 | ``` 86 | 87 | ## Explain 88 | 89 | There are two reasons why you need to wrap MaterialApp 90 | 91 | 1. Because this ensures that toast can be displayed in front of all other controls 92 | 2. Context can be cached so that it can be invoked anywhere without passing in context 93 | 94 | ## Properties 95 | 96 | ### OKToast params 97 | 98 | OKToast have default style, and you also can custom style or other behavior. 99 | 100 | | name | type | need | desc | 101 | |:--------------------:|:-----------------------:|:--------:|:-------------------------------------------------------------:| 102 | | child | Widget | required | Usually Material App | 103 | | textStyle | TextStyle | optional | | 104 | | radius | double | optional | | 105 | | backgroundColor | Color | optional | backroundColor | 106 | | position | ToastPosition | optional | | 107 | | dismissOtherOnShow | bool | optional | If true, other toasts will be dismissed. Default false. | 108 | | movingOnWindowChange | bool | optional | If true, when the size changes, toast is moved. Default true. | 109 | | textDirection | TextDirection | optional | | 110 | | textPadding | EdgeInsetsGeometry | optional | Outer margin of text | 111 | | textAlign | TextAlign | optional | When the text wraps, the align of the text. | 112 | | handleTouch | bool | optional | Default is false, if it's true, can responed use touch event. | 113 | | animationBuilder | OKToastAnimationBuilder | optional | Add animation to show / hide toast. | 114 | | animationDuration | Duration | optional | The duration of animation. | 115 | | animationCurve | Curve | optional | Curve of animation. | 116 | | duration | Duration | optional | Default duration of toast. | 117 | 118 | ### Method `showToast` 119 | 120 | Display text on toast. 121 | 122 | Description of params see `OKToast`. 123 | 124 | | name | type | need | desc | 125 | |:-----------------:|:-----------------------:|:--------:|:--------------:| 126 | | msg | String | required | Text of toast. | 127 | | context | BuildContext | optional | | 128 | | duration | Duration | optional | | 129 | | position | ToastPosition | optional | | 130 | | textStyle | TextStyle | optional | | 131 | | textPadding | EdgeInsetsGeometry | optional | | 132 | | backgroundColor | Color | optional | | 133 | | radius | double | optional | | 134 | | onDismiss | Function | optional | | 135 | | textDirection | TextDirection | optional | | 136 | | dismissOtherToast | bool | optional | | 137 | | textAlign | TextAlign | optional | | 138 | | animationBuilder | OKToastAnimationBuilder | optional | | 139 | | animationDuration | Duration | optional | | 140 | | animationCurve | Curve | optional | | 141 | 142 | ### Method `showToastWidget` 143 | 144 | Display custom widgets on toast 145 | 146 | Description of params see `showToast`. 147 | 148 | | name | type | need | desc | 149 | |:-----------------:|:-----------------------:|:--------:|:-------------------------------:| 150 | | widget | Widget | required | The widget you want to display. | 151 | | context | BuildContext | optional | | 152 | | duration | Duration | optional | | 153 | | position | ToastPosition | optional | | 154 | | onDismiss | Function | optional | | 155 | | dismissOtherToast | bool | optional | | 156 | | textDirection | TextDirection | optional | | 157 | | handleTouch | bool | optional | | 158 | | animationBuilder | OKToastAnimationBuilder | optional | | 159 | | animationDuration | Duration | optional | | 160 | | animationCurve | Curve | optional | | 161 | 162 | ### Method `dismissAllToast` 163 | 164 | Dismiss all toast. 165 | 166 | ### Return value of `showToast` and `showToastWidget` 167 | 168 | about return type: 169 | `showToast` and `showToastWidget` return type is `ToastFuture`, 170 | The `ToastFuture` can be use to dismiss the toast. 171 | 172 | ### For all dismiss toast method 173 | 174 | An optional parameter `showAnim` is added to control whether fading animation is required for dismiss. 175 | 176 | The praram default value is `false`. 177 | 178 | ## Examples 179 | 180 | ```dart 181 | import 'package:flutter/material.dart'; 182 | import 'package:oktoast/oktoast.dart'; // 1. import library 183 | 184 | void main() => runApp( MyApp()); 185 | 186 | class MyApp extends StatelessWidget { 187 | @override 188 | Widget build(BuildContext context) { 189 | return OKToast( 190 | // 2. wrap your app with OKToast 191 | child: MaterialApp( 192 | title: 'Flutter Demo', 193 | theme: ThemeData( 194 | primarySwatch: Colors.blue, 195 | ), 196 | home: MyHomePage(), 197 | ), 198 | ); 199 | } 200 | } 201 | 202 | class MyHomePage extends StatefulWidget { 203 | MyHomePage({Key key}) : super(key: key); 204 | 205 | @override 206 | _MyHomePageState createState() => _MyHomePageState(); 207 | } 208 | 209 | class _MyHomePageState extends State { 210 | int _counter = 0; 211 | 212 | void _incrementCounter() { 213 | _counter++; 214 | 215 | // 3.1 use showToast method 216 | showToast( 217 | "$_counter", 218 | duration: Duration(seconds: 2), 219 | position: ToastPosition.bottom, 220 | backgroundColor: Colors.black.withOpacity(0.8), 221 | radius: 13.0, 222 | textStyle: TextStyle(fontSize: 18.0), 223 | ); 224 | 225 | showToast( 226 | "$_counter", 227 | duration: Duration(seconds: 2), 228 | position: ToastPosition.top, 229 | backgroundColor: Colors.black.withOpacity(0.8), 230 | radius: 3.0, 231 | textStyle: TextStyle(fontSize: 30.0), 232 | ); 233 | 234 | // 3.2 use showToastWidget method to custom widget 235 | Widget widget = Center( 236 | child: ClipRRect( 237 | borderRadius: BorderRadius.circular(30.0), 238 | child: Container( 239 | width: 40.0, 240 | height: 40.0, 241 | color: Colors.grey.withOpacity(0.3), 242 | child: Icon( 243 | Icons.add, 244 | size: 30.0, 245 | color: Colors.green, 246 | ), 247 | ), 248 | ), 249 | ); 250 | 251 | ToastFuture toastFuture = showToastWidget( 252 | widget, 253 | duration: Duration(seconds: 3), 254 | onDismiss: () { 255 | print("the toast dismiss"); // the method will be called on toast dismiss. 256 | }, 257 | ); 258 | 259 | // can use future 260 | Future.delayed(Duration(seconds: 1), () { 261 | toastFuture.dismiss(); // dismiss 262 | }); 263 | 264 | setState(() { 265 | 266 | }); 267 | } 268 | 269 | @override 270 | Widget build(BuildContext context) { 271 | return Scaffold( 272 | appBar: AppBar( 273 | title: Text("ktoast demo"), 274 | ), 275 | body: Stack( 276 | children: [ 277 | Center( 278 | child: ListView( 279 | children: [ 280 | Text( 281 | 'You have pushed the button this many times:', 282 | ), 283 | Text( 284 | '$_counter', 285 | style: Theme.of(context).textTheme.display1, 286 | ), 287 | Padding( 288 | padding: const EdgeInsets.all(8.0), 289 | child: RaisedButton( 290 | onPressed: () { 291 | Navigator.push(context, 292 | MaterialPageRoute(builder: (ctx) => MyHomePage())); 293 | }, 294 | ), 295 | ), 296 | Padding( 297 | padding: const EdgeInsets.all(8.0), 298 | child: RaisedButton( 299 | onPressed: _incrementCounter, 300 | child: Text('toast'), 301 | ), 302 | ), 303 | ], 304 | ), 305 | ), 306 | ], 307 | ), 308 | ); 309 | } 310 | } 311 | 312 | 313 | ``` 314 | 315 | ## CHANGELOG 316 | 317 | [Link](https://github.com/OpenFlutter/flutter_oktoast/blob/master/CHANGELOG.md) 318 | 319 | ## LICENSE 320 | 321 | [Apache-2.0](https://github.com/OpenFlutter/flutter_oktoast/blob/master/LICENSE) 322 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | linter: 4 | rules: 5 | - avoid_print 6 | - avoid_redundant_argument_values 7 | - prefer_const_constructors 8 | - prefer_const_constructors_in_immutables 9 | - prefer_const_declarations 10 | - prefer_final_fields 11 | - prefer_final_in_for_each 12 | - prefer_final_locals 13 | - prefer_single_quotes 14 | - require_trailing_commas 15 | - sort_constructors_first 16 | - sort_unnamed_constructors_first 17 | - unnecessary_await_in_return 18 | - unnecessary_parenthesis 19 | - use_super_parameters 20 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | pubspec.lock 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Generated.xcconfig 62 | **/ios/Flutter/app.flx 63 | **/ios/Flutter/app.zip 64 | **/ios/Flutter/flutter_assets/ 65 | **/ios/Flutter/flutter_export_environment.sh 66 | **/ios/ServiceDefinitions.json 67 | **/ios/Runner/GeneratedPluginRegistrant.* 68 | 69 | # Exceptions to above rules. 70 | !**/ios/**/default.mode1v3 71 | !**/ios/**/default.mode2v3 72 | !**/ios/**/default.pbxuser 73 | !**/ios/**/default.perspectivev3 74 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 75 | -------------------------------------------------------------------------------- /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: cc949a8e8b9cf394b9290a8e80f87af3e207dce5 8 | channel: beta 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example_for_oktoast 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: ../analysis_options.yaml 2 | -------------------------------------------------------------------------------- /example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | applicationId "com.example.example_for_oktoast" 41 | minSdkVersion flutter.minSdkVersion 42 | targetSdkVersion flutter.targetSdkVersion 43 | versionCode flutterVersionCode.toInteger() 44 | versionName flutterVersionName 45 | } 46 | 47 | buildTypes { 48 | release { 49 | // TODO: Add your own signing config for the release build. 50 | // Signing with the debug keys for now, so `flutter run --release` works. 51 | signingConfig signingConfigs.debug 52 | } 53 | } 54 | } 55 | 56 | flutter { 57 | source '../..' 58 | } 59 | 60 | dependencies { 61 | } 62 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 9 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example_for_oktoast/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example_for_oktoast 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | // The default activity that extends flutter's activity. 7 | } 8 | -------------------------------------------------------------------------------- /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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/ios/Flutter/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 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Flutter.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: This podspec is NOT to be published. It is only used as a local source! 3 | # 4 | 5 | Pod::Spec.new do |s| 6 | s.name = 'Flutter' 7 | s.version = '1.0.0' 8 | s.summary = 'High-performance, high-fidelity mobile apps.' 9 | s.description = <<-DESC 10 | Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS. 11 | DESC 12 | s.homepage = 'https://flutter.io' 13 | s.license = { :type => 'MIT' } 14 | s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' } 15 | s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s } 16 | s.ios.deployment_target = '8.0' 17 | s.vendored_frameworks = 'Flutter.framework' 18 | end 19 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = ""; 24 | dstSubfolderSpec = 10; 25 | files = ( 26 | ); 27 | name = "Embed Frameworks"; 28 | runOnlyForDeploymentPostprocessing = 0; 29 | }; 30 | /* End PBXCopyFilesBuildPhase section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 34 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 35 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 36 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 37 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 38 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 39 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 40 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 41 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 44 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 45 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | ); 54 | runOnlyForDeploymentPostprocessing = 0; 55 | }; 56 | /* End PBXFrameworksBuildPhase section */ 57 | 58 | /* Begin PBXGroup section */ 59 | 9740EEB11CF90186004384FC /* Flutter */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 63 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 64 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 65 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 66 | ); 67 | name = Flutter; 68 | sourceTree = ""; 69 | }; 70 | 97C146E51CF9000F007C117D = { 71 | isa = PBXGroup; 72 | children = ( 73 | 9740EEB11CF90186004384FC /* Flutter */, 74 | 97C146F01CF9000F007C117D /* Runner */, 75 | 97C146EF1CF9000F007C117D /* Products */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | 97C146EF1CF9000F007C117D /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 97C146EE1CF9000F007C117D /* Runner.app */, 83 | ); 84 | name = Products; 85 | sourceTree = ""; 86 | }; 87 | 97C146F01CF9000F007C117D /* Runner */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 91 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 92 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 93 | 97C147021CF9000F007C117D /* Info.plist */, 94 | 97C146F11CF9000F007C117D /* Supporting Files */, 95 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 96 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 97 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 98 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 99 | ); 100 | path = Runner; 101 | sourceTree = ""; 102 | }; 103 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 104 | isa = PBXGroup; 105 | children = ( 106 | ); 107 | name = "Supporting Files"; 108 | sourceTree = ""; 109 | }; 110 | /* End PBXGroup section */ 111 | 112 | /* Begin PBXNativeTarget section */ 113 | 97C146ED1CF9000F007C117D /* Runner */ = { 114 | isa = PBXNativeTarget; 115 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 116 | buildPhases = ( 117 | 9740EEB61CF901F6004384FC /* Run Script */, 118 | 97C146EA1CF9000F007C117D /* Sources */, 119 | 97C146EB1CF9000F007C117D /* Frameworks */, 120 | 97C146EC1CF9000F007C117D /* Resources */, 121 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 122 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 123 | ); 124 | buildRules = ( 125 | ); 126 | dependencies = ( 127 | ); 128 | name = Runner; 129 | productName = Runner; 130 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 131 | productType = "com.apple.product-type.application"; 132 | }; 133 | /* End PBXNativeTarget section */ 134 | 135 | /* Begin PBXProject section */ 136 | 97C146E61CF9000F007C117D /* Project object */ = { 137 | isa = PBXProject; 138 | attributes = { 139 | LastUpgradeCheck = 1020; 140 | ORGANIZATIONNAME = "The Chromium Authors"; 141 | TargetAttributes = { 142 | 97C146ED1CF9000F007C117D = { 143 | CreatedOnToolsVersion = 7.3.1; 144 | LastSwiftMigration = 0910; 145 | }; 146 | }; 147 | }; 148 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 149 | compatibilityVersion = "Xcode 3.2"; 150 | developmentRegion = en; 151 | hasScannedForEncodings = 0; 152 | knownRegions = ( 153 | en, 154 | Base, 155 | ); 156 | mainGroup = 97C146E51CF9000F007C117D; 157 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 158 | projectDirPath = ""; 159 | projectRoot = ""; 160 | targets = ( 161 | 97C146ED1CF9000F007C117D /* Runner */, 162 | ); 163 | }; 164 | /* End PBXProject section */ 165 | 166 | /* Begin PBXResourcesBuildPhase section */ 167 | 97C146EC1CF9000F007C117D /* Resources */ = { 168 | isa = PBXResourcesBuildPhase; 169 | buildActionMask = 2147483647; 170 | files = ( 171 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 172 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 173 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 174 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 175 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 176 | ); 177 | runOnlyForDeploymentPostprocessing = 0; 178 | }; 179 | /* End PBXResourcesBuildPhase section */ 180 | 181 | /* Begin PBXShellScriptBuildPhase section */ 182 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 183 | isa = PBXShellScriptBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | ); 187 | inputPaths = ( 188 | ); 189 | name = "Thin Binary"; 190 | outputPaths = ( 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | shellPath = /bin/sh; 194 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 195 | }; 196 | 9740EEB61CF901F6004384FC /* Run Script */ = { 197 | isa = PBXShellScriptBuildPhase; 198 | buildActionMask = 2147483647; 199 | files = ( 200 | ); 201 | inputPaths = ( 202 | ); 203 | name = "Run Script"; 204 | outputPaths = ( 205 | ); 206 | runOnlyForDeploymentPostprocessing = 0; 207 | shellPath = /bin/sh; 208 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 209 | }; 210 | /* End PBXShellScriptBuildPhase section */ 211 | 212 | /* Begin PBXSourcesBuildPhase section */ 213 | 97C146EA1CF9000F007C117D /* Sources */ = { 214 | isa = PBXSourcesBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 218 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXSourcesBuildPhase section */ 223 | 224 | /* Begin PBXVariantGroup section */ 225 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 226 | isa = PBXVariantGroup; 227 | children = ( 228 | 97C146FB1CF9000F007C117D /* Base */, 229 | ); 230 | name = Main.storyboard; 231 | sourceTree = ""; 232 | }; 233 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 234 | isa = PBXVariantGroup; 235 | children = ( 236 | 97C147001CF9000F007C117D /* Base */, 237 | ); 238 | name = LaunchScreen.storyboard; 239 | sourceTree = ""; 240 | }; 241 | /* End PBXVariantGroup section */ 242 | 243 | /* Begin XCBuildConfiguration section */ 244 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | CLANG_ANALYZER_NONNULL = YES; 249 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 250 | CLANG_CXX_LIBRARY = "libc++"; 251 | CLANG_ENABLE_MODULES = YES; 252 | CLANG_ENABLE_OBJC_ARC = YES; 253 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 254 | CLANG_WARN_BOOL_CONVERSION = YES; 255 | CLANG_WARN_COMMA = YES; 256 | CLANG_WARN_CONSTANT_CONVERSION = YES; 257 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 258 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 259 | CLANG_WARN_EMPTY_BODY = YES; 260 | CLANG_WARN_ENUM_CONVERSION = YES; 261 | CLANG_WARN_INFINITE_RECURSION = YES; 262 | CLANG_WARN_INT_CONVERSION = YES; 263 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 264 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 265 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 266 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 267 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 268 | CLANG_WARN_STRICT_PROTOTYPES = YES; 269 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 270 | CLANG_WARN_UNREACHABLE_CODE = YES; 271 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 272 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 273 | COPY_PHASE_STRIP = NO; 274 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 275 | ENABLE_NS_ASSERTIONS = NO; 276 | ENABLE_STRICT_OBJC_MSGSEND = YES; 277 | GCC_C_LANGUAGE_STANDARD = gnu99; 278 | GCC_NO_COMMON_BLOCKS = YES; 279 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 280 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 281 | GCC_WARN_UNDECLARED_SELECTOR = YES; 282 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 283 | GCC_WARN_UNUSED_FUNCTION = YES; 284 | GCC_WARN_UNUSED_VARIABLE = YES; 285 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 286 | MTL_ENABLE_DEBUG_INFO = NO; 287 | SDKROOT = iphoneos; 288 | TARGETED_DEVICE_FAMILY = "1,2"; 289 | VALIDATE_PRODUCT = YES; 290 | }; 291 | name = Profile; 292 | }; 293 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 294 | isa = XCBuildConfiguration; 295 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | CLANG_ENABLE_MODULES = YES; 299 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 300 | ENABLE_BITCODE = NO; 301 | FRAMEWORK_SEARCH_PATHS = ( 302 | "$(inherited)", 303 | "$(PROJECT_DIR)/Flutter", 304 | ); 305 | INFOPLIST_FILE = Runner/Info.plist; 306 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 307 | LIBRARY_SEARCH_PATHS = ( 308 | "$(inherited)", 309 | "$(PROJECT_DIR)/Flutter", 310 | ); 311 | PRODUCT_BUNDLE_IDENTIFIER = com.example.exampleForOktoast; 312 | PRODUCT_NAME = "$(TARGET_NAME)"; 313 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 314 | SWIFT_VERSION = 4.0; 315 | VERSIONING_SYSTEM = "apple-generic"; 316 | }; 317 | name = Profile; 318 | }; 319 | 97C147031CF9000F007C117D /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ALWAYS_SEARCH_USER_PATHS = NO; 323 | CLANG_ANALYZER_NONNULL = YES; 324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 325 | CLANG_CXX_LIBRARY = "libc++"; 326 | CLANG_ENABLE_MODULES = YES; 327 | CLANG_ENABLE_OBJC_ARC = YES; 328 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 329 | CLANG_WARN_BOOL_CONVERSION = YES; 330 | CLANG_WARN_COMMA = YES; 331 | CLANG_WARN_CONSTANT_CONVERSION = YES; 332 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 333 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 334 | CLANG_WARN_EMPTY_BODY = YES; 335 | CLANG_WARN_ENUM_CONVERSION = YES; 336 | CLANG_WARN_INFINITE_RECURSION = YES; 337 | CLANG_WARN_INT_CONVERSION = YES; 338 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 339 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 340 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 341 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 342 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 343 | CLANG_WARN_STRICT_PROTOTYPES = YES; 344 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 345 | CLANG_WARN_UNREACHABLE_CODE = YES; 346 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 347 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 348 | COPY_PHASE_STRIP = NO; 349 | DEBUG_INFORMATION_FORMAT = dwarf; 350 | ENABLE_STRICT_OBJC_MSGSEND = YES; 351 | ENABLE_TESTABILITY = YES; 352 | GCC_C_LANGUAGE_STANDARD = gnu99; 353 | GCC_DYNAMIC_NO_PIC = NO; 354 | GCC_NO_COMMON_BLOCKS = YES; 355 | GCC_OPTIMIZATION_LEVEL = 0; 356 | GCC_PREPROCESSOR_DEFINITIONS = ( 357 | "DEBUG=1", 358 | "$(inherited)", 359 | ); 360 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 361 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 362 | GCC_WARN_UNDECLARED_SELECTOR = YES; 363 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 364 | GCC_WARN_UNUSED_FUNCTION = YES; 365 | GCC_WARN_UNUSED_VARIABLE = YES; 366 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 367 | MTL_ENABLE_DEBUG_INFO = YES; 368 | ONLY_ACTIVE_ARCH = YES; 369 | SDKROOT = iphoneos; 370 | TARGETED_DEVICE_FAMILY = "1,2"; 371 | }; 372 | name = Debug; 373 | }; 374 | 97C147041CF9000F007C117D /* Release */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | ALWAYS_SEARCH_USER_PATHS = NO; 378 | CLANG_ANALYZER_NONNULL = YES; 379 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 380 | CLANG_CXX_LIBRARY = "libc++"; 381 | CLANG_ENABLE_MODULES = YES; 382 | CLANG_ENABLE_OBJC_ARC = YES; 383 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 384 | CLANG_WARN_BOOL_CONVERSION = YES; 385 | CLANG_WARN_COMMA = YES; 386 | CLANG_WARN_CONSTANT_CONVERSION = YES; 387 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 388 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 389 | CLANG_WARN_EMPTY_BODY = YES; 390 | CLANG_WARN_ENUM_CONVERSION = YES; 391 | CLANG_WARN_INFINITE_RECURSION = YES; 392 | CLANG_WARN_INT_CONVERSION = YES; 393 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 394 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 395 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 396 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 397 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 398 | CLANG_WARN_STRICT_PROTOTYPES = YES; 399 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 400 | CLANG_WARN_UNREACHABLE_CODE = YES; 401 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 402 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 403 | COPY_PHASE_STRIP = NO; 404 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 405 | ENABLE_NS_ASSERTIONS = NO; 406 | ENABLE_STRICT_OBJC_MSGSEND = YES; 407 | GCC_C_LANGUAGE_STANDARD = gnu99; 408 | GCC_NO_COMMON_BLOCKS = YES; 409 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 410 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 411 | GCC_WARN_UNDECLARED_SELECTOR = YES; 412 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 413 | GCC_WARN_UNUSED_FUNCTION = YES; 414 | GCC_WARN_UNUSED_VARIABLE = YES; 415 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 416 | MTL_ENABLE_DEBUG_INFO = NO; 417 | SDKROOT = iphoneos; 418 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 419 | TARGETED_DEVICE_FAMILY = "1,2"; 420 | VALIDATE_PRODUCT = YES; 421 | }; 422 | name = Release; 423 | }; 424 | 97C147061CF9000F007C117D /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 427 | buildSettings = { 428 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 429 | CLANG_ENABLE_MODULES = YES; 430 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 431 | ENABLE_BITCODE = NO; 432 | FRAMEWORK_SEARCH_PATHS = ( 433 | "$(inherited)", 434 | "$(PROJECT_DIR)/Flutter", 435 | ); 436 | INFOPLIST_FILE = Runner/Info.plist; 437 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 438 | LIBRARY_SEARCH_PATHS = ( 439 | "$(inherited)", 440 | "$(PROJECT_DIR)/Flutter", 441 | ); 442 | PRODUCT_BUNDLE_IDENTIFIER = com.example.exampleForOktoast; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 445 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 446 | SWIFT_VERSION = 4.0; 447 | VERSIONING_SYSTEM = "apple-generic"; 448 | }; 449 | name = Debug; 450 | }; 451 | 97C147071CF9000F007C117D /* Release */ = { 452 | isa = XCBuildConfiguration; 453 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 454 | buildSettings = { 455 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 456 | CLANG_ENABLE_MODULES = YES; 457 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 458 | ENABLE_BITCODE = NO; 459 | FRAMEWORK_SEARCH_PATHS = ( 460 | "$(inherited)", 461 | "$(PROJECT_DIR)/Flutter", 462 | ); 463 | INFOPLIST_FILE = Runner/Info.plist; 464 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 465 | LIBRARY_SEARCH_PATHS = ( 466 | "$(inherited)", 467 | "$(PROJECT_DIR)/Flutter", 468 | ); 469 | PRODUCT_BUNDLE_IDENTIFIER = com.example.exampleForOktoast; 470 | PRODUCT_NAME = "$(TARGET_NAME)"; 471 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 472 | SWIFT_VERSION = 4.0; 473 | VERSIONING_SYSTEM = "apple-generic"; 474 | }; 475 | name = Release; 476 | }; 477 | /* End XCBuildConfiguration section */ 478 | 479 | /* Begin XCConfigurationList section */ 480 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 481 | isa = XCConfigurationList; 482 | buildConfigurations = ( 483 | 97C147031CF9000F007C117D /* Debug */, 484 | 97C147041CF9000F007C117D /* Release */, 485 | 249021D3217E4FDB00AE95B9 /* Profile */, 486 | ); 487 | defaultConfigurationIsVisible = 0; 488 | defaultConfigurationName = Release; 489 | }; 490 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | 97C147061CF9000F007C117D /* Debug */, 494 | 97C147071CF9000F007C117D /* Release */, 495 | 249021D4217E4FDB00AE95B9 /* Profile */, 496 | ); 497 | defaultConfigurationIsVisible = 0; 498 | defaultConfigurationName = Release; 499 | }; 500 | /* End XCConfigurationList section */ 501 | 502 | }; 503 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 504 | } 505 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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_for_oktoast 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 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:oktoast/oktoast.dart'; 5 | 6 | import 'miui10_anim.dart'; 7 | 8 | void main() => runApp(const MyApp()); 9 | 10 | class MyApp extends StatelessWidget { 11 | const MyApp({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return buildApp(); 16 | } 17 | 18 | // 2-A: Wrap MaterialApp with OKToast. 19 | Widget buildWrapperApp() { 20 | return OKToast( 21 | // 2-A: wrap your app with OKToast 22 | child: MaterialApp( 23 | title: 'Demo for OKToast', 24 | theme: ThemeData( 25 | primarySwatch: Colors.blue, 26 | ), 27 | home: const MyHomePage(), 28 | ), 29 | ); 30 | } 31 | 32 | // 2-B: Or wrap child of the builder method. 33 | Widget buildApp() { 34 | return MaterialApp( 35 | home: const MyHomePage(), 36 | builder: (_, Widget? child) => OKToast( 37 | textStyle: const TextStyle(fontSize: 19.0, color: Colors.white), 38 | backgroundColor: Colors.grey, 39 | animationCurve: Curves.easeIn, 40 | animationBuilder: const Miui10AnimBuilder().call, 41 | animationDuration: const Duration(milliseconds: 200), 42 | duration: const Duration(seconds: 3), 43 | child: child!, 44 | ), 45 | ); 46 | } 47 | } 48 | 49 | class MyHomePage extends StatefulWidget { 50 | const MyHomePage({super.key}); 51 | 52 | @override 53 | State createState() => _MyHomePageState(); 54 | } 55 | 56 | class _MyHomePageState extends State { 57 | int _counter = 0; 58 | 59 | void _incrementCounter() { 60 | _counter++; 61 | setState(() {}); 62 | } 63 | 64 | void _showToast() { 65 | // 3-A use showToast method 66 | showToast( 67 | '$_counter', 68 | position: ToastPosition.bottom, 69 | backgroundColor: Colors.black.withOpacity(0.8), 70 | radius: 13.0, 71 | textStyle: const TextStyle(fontSize: 18.0, color: Colors.white), 72 | animationBuilder: const Miui10AnimBuilder().call, 73 | ); 74 | 75 | showToast( 76 | '$_counter', 77 | duration: const Duration(milliseconds: 3500), 78 | position: ToastPosition.top, 79 | backgroundColor: Colors.black.withOpacity(0.8), 80 | radius: 3.0, 81 | textStyle: const TextStyle(fontSize: 30.0, color: Colors.white), 82 | ); 83 | 84 | // 3-B use showToastWidget method 85 | final Widget widget = Center( 86 | child: ClipRRect( 87 | borderRadius: BorderRadius.circular(30.0), 88 | child: Container( 89 | width: 40.0, 90 | height: 40.0, 91 | color: Colors.grey.withOpacity(0.3), 92 | child: const Icon( 93 | Icons.add, 94 | size: 30.0, 95 | color: Colors.green, 96 | ), 97 | ), 98 | ), 99 | ); 100 | final ToastFuture toastFuture = showToastWidget( 101 | widget, 102 | duration: const Duration(seconds: 3), 103 | onDismiss: () { 104 | // The method will be called on toast dismiss. 105 | debugPrint('Toast has been dismissed.'); 106 | }, 107 | ); 108 | 109 | // can use future 110 | Future.delayed(const Duration(seconds: 2), () { 111 | toastFuture.dismiss(); // dismiss 112 | }); 113 | } 114 | 115 | ToastFuture? _persistToast; 116 | 117 | void _showPersistToast() { 118 | _persistToast = showToastWidget( 119 | Center( 120 | child: ElevatedButton( 121 | onPressed: () => _persistToast?.dismiss(), 122 | child: const Text('Click this button to dismiss'), 123 | ), 124 | ), 125 | duration: Duration.zero, 126 | handleTouch: true, 127 | ); 128 | } 129 | 130 | void _dismissToastSynchronously() { 131 | final ToastFuture toast = showToast('Synchronously dismiss'); 132 | toast.dismiss(); 133 | } 134 | 135 | @override 136 | Widget build(BuildContext context) { 137 | return Scaffold( 138 | appBar: AppBar(title: const Text('Example for OKToast')), 139 | body: Center( 140 | child: Column( 141 | mainAxisAlignment: MainAxisAlignment.center, 142 | children: [ 143 | const Center( 144 | child: Text('You have pushed the button this many times:'), 145 | ), 146 | Center( 147 | child: Text( 148 | '$_counter', 149 | style: const TextStyle( 150 | fontSize: 20.0, 151 | fontWeight: FontWeight.w600, 152 | ), 153 | ), 154 | ), 155 | Padding( 156 | padding: const EdgeInsets.all(8.0), 157 | child: ElevatedButton( 158 | onPressed: _showToast, 159 | child: const Text('Show toast'), 160 | ), 161 | ), 162 | Padding( 163 | padding: const EdgeInsets.all(8.0), 164 | child: ElevatedButton( 165 | onPressed: _showPersistToast, 166 | child: const Text('Show a persist toast'), 167 | ), 168 | ), 169 | Padding( 170 | padding: const EdgeInsets.all(8.0), 171 | child: ElevatedButton( 172 | child: const Text('Toast during pushing to a new page'), 173 | onPressed: () { 174 | _showToast(); 175 | Navigator.push( 176 | context, 177 | MaterialPageRoute(builder: (_) => const MyHomePage()), 178 | ); 179 | }, 180 | ), 181 | ), 182 | Padding( 183 | padding: const EdgeInsets.all(8.0), 184 | child: ElevatedButton( 185 | onPressed: _dismissToastSynchronously, 186 | child: const Text('Synchronously dismiss toast'), 187 | ), 188 | ), 189 | ], 190 | ), 191 | ), 192 | floatingActionButton: FloatingActionButton( 193 | onPressed: _incrementCounter, 194 | tooltip: 'Add number', 195 | child: const Icon(Icons.add), 196 | ), 197 | ); 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /example/lib/miui10_anim.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' show min; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:oktoast/oktoast.dart'; 5 | 6 | class Miui10AnimBuilder extends BaseAnimationBuilder { 7 | const Miui10AnimBuilder(); 8 | 9 | @Deprecated('Please build animation builders outside the package') 10 | @override 11 | Widget buildWidget( 12 | BuildContext context, 13 | Widget child, 14 | AnimationController controller, 15 | double percent, 16 | ) { 17 | final double opacity = min(1.0, percent + 0.2); 18 | final double offset = (1 - percent) * 20; 19 | 20 | return Opacity( 21 | opacity: opacity, 22 | child: Transform.translate(offset: Offset(0, offset), child: child), 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/xcuserdata/ 7 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 51; 7 | objects = { 8 | 9 | /* Begin PBXAggregateTarget section */ 10 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { 11 | isa = PBXAggregateTarget; 12 | buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; 13 | buildPhases = ( 14 | 33CC111E2044C6BF0003C045 /* ShellScript */, 15 | ); 16 | dependencies = ( 17 | ); 18 | name = "Flutter Assemble"; 19 | productName = FLX; 20 | }; 21 | /* End PBXAggregateTarget section */ 22 | 23 | /* Begin PBXBuildFile section */ 24 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; 25 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; 26 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 27 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 28 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 33CC10E52044A3C60003C045 /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 33CC111A2044C6BA0003C045; 37 | remoteInfo = FLX; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXCopyFilesBuildPhase section */ 42 | 33CC110E2044A8840003C045 /* Bundle Framework */ = { 43 | isa = PBXCopyFilesBuildPhase; 44 | buildActionMask = 2147483647; 45 | dstPath = ""; 46 | dstSubfolderSpec = 10; 47 | files = ( 48 | ); 49 | name = "Bundle Framework"; 50 | runOnlyForDeploymentPostprocessing = 0; 51 | }; 52 | /* End PBXCopyFilesBuildPhase section */ 53 | 54 | /* Begin PBXFileReference section */ 55 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 56 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; 57 | 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 58 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 59 | 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 60 | 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 61 | 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; 62 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; 63 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; 64 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; 65 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; 66 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 67 | 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 68 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; 69 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 70 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; 71 | /* End PBXFileReference section */ 72 | 73 | /* Begin PBXFrameworksBuildPhase section */ 74 | 33CC10EA2044A3C60003C045 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 33BA886A226E78AF003329D5 /* Configs */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 33E5194F232828860026EE4D /* AppInfo.xcconfig */, 88 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 89 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 90 | 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, 91 | ); 92 | path = Configs; 93 | sourceTree = ""; 94 | }; 95 | 33CC10E42044A3C60003C045 = { 96 | isa = PBXGroup; 97 | children = ( 98 | 33FAB671232836740065AC1E /* Runner */, 99 | 33CEB47122A05771004F2AC0 /* Flutter */, 100 | 33CC10EE2044A3C60003C045 /* Products */, 101 | D73912EC22F37F3D000D13A0 /* Frameworks */, 102 | ); 103 | sourceTree = ""; 104 | }; 105 | 33CC10EE2044A3C60003C045 /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 33CC10ED2044A3C60003C045 /* example.app */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 33CC11242044D66E0003C045 /* Resources */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 33CC10F22044A3C60003C045 /* Assets.xcassets */, 117 | 33CC10F42044A3C60003C045 /* MainMenu.xib */, 118 | 33CC10F72044A3C60003C045 /* Info.plist */, 119 | ); 120 | name = Resources; 121 | path = ..; 122 | sourceTree = ""; 123 | }; 124 | 33CEB47122A05771004F2AC0 /* Flutter */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, 128 | 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 129 | 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 130 | 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, 131 | ); 132 | path = Flutter; 133 | sourceTree = ""; 134 | }; 135 | 33FAB671232836740065AC1E /* Runner */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | 33CC10F02044A3C60003C045 /* AppDelegate.swift */, 139 | 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, 140 | 33E51913231747F40026EE4D /* DebugProfile.entitlements */, 141 | 33E51914231749380026EE4D /* Release.entitlements */, 142 | 33CC11242044D66E0003C045 /* Resources */, 143 | 33BA886A226E78AF003329D5 /* Configs */, 144 | ); 145 | path = Runner; 146 | sourceTree = ""; 147 | }; 148 | D73912EC22F37F3D000D13A0 /* Frameworks */ = { 149 | isa = PBXGroup; 150 | children = ( 151 | ); 152 | name = Frameworks; 153 | sourceTree = ""; 154 | }; 155 | /* End PBXGroup section */ 156 | 157 | /* Begin PBXNativeTarget section */ 158 | 33CC10EC2044A3C60003C045 /* Runner */ = { 159 | isa = PBXNativeTarget; 160 | buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; 161 | buildPhases = ( 162 | 33CC10E92044A3C60003C045 /* Sources */, 163 | 33CC10EA2044A3C60003C045 /* Frameworks */, 164 | 33CC10EB2044A3C60003C045 /* Resources */, 165 | 33CC110E2044A8840003C045 /* Bundle Framework */, 166 | 3399D490228B24CF009A79C7 /* ShellScript */, 167 | ); 168 | buildRules = ( 169 | ); 170 | dependencies = ( 171 | 33CC11202044C79F0003C045 /* PBXTargetDependency */, 172 | ); 173 | name = Runner; 174 | productName = Runner; 175 | productReference = 33CC10ED2044A3C60003C045 /* example.app */; 176 | productType = "com.apple.product-type.application"; 177 | }; 178 | /* End PBXNativeTarget section */ 179 | 180 | /* Begin PBXProject section */ 181 | 33CC10E52044A3C60003C045 /* Project object */ = { 182 | isa = PBXProject; 183 | attributes = { 184 | LastSwiftUpdateCheck = 0920; 185 | LastUpgradeCheck = 0930; 186 | ORGANIZATIONNAME = "The Flutter Authors"; 187 | TargetAttributes = { 188 | 33CC10EC2044A3C60003C045 = { 189 | CreatedOnToolsVersion = 9.2; 190 | LastSwiftMigration = 1100; 191 | ProvisioningStyle = Automatic; 192 | SystemCapabilities = { 193 | com.apple.Sandbox = { 194 | enabled = 1; 195 | }; 196 | }; 197 | }; 198 | 33CC111A2044C6BA0003C045 = { 199 | CreatedOnToolsVersion = 9.2; 200 | ProvisioningStyle = Manual; 201 | }; 202 | }; 203 | }; 204 | buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; 205 | compatibilityVersion = "Xcode 8.0"; 206 | developmentRegion = en; 207 | hasScannedForEncodings = 0; 208 | knownRegions = ( 209 | en, 210 | Base, 211 | ); 212 | mainGroup = 33CC10E42044A3C60003C045; 213 | productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; 214 | projectDirPath = ""; 215 | projectRoot = ""; 216 | targets = ( 217 | 33CC10EC2044A3C60003C045 /* Runner */, 218 | 33CC111A2044C6BA0003C045 /* Flutter Assemble */, 219 | ); 220 | }; 221 | /* End PBXProject section */ 222 | 223 | /* Begin PBXResourcesBuildPhase section */ 224 | 33CC10EB2044A3C60003C045 /* Resources */ = { 225 | isa = PBXResourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, 229 | 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXResourcesBuildPhase section */ 234 | 235 | /* Begin PBXShellScriptBuildPhase section */ 236 | 3399D490228B24CF009A79C7 /* ShellScript */ = { 237 | isa = PBXShellScriptBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | ); 241 | inputFileListPaths = ( 242 | ); 243 | inputPaths = ( 244 | ); 245 | outputFileListPaths = ( 246 | ); 247 | outputPaths = ( 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | shellPath = /bin/sh; 251 | shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; 252 | }; 253 | 33CC111E2044C6BF0003C045 /* ShellScript */ = { 254 | isa = PBXShellScriptBuildPhase; 255 | buildActionMask = 2147483647; 256 | files = ( 257 | ); 258 | inputFileListPaths = ( 259 | Flutter/ephemeral/FlutterInputs.xcfilelist, 260 | ); 261 | inputPaths = ( 262 | Flutter/ephemeral/tripwire, 263 | ); 264 | outputFileListPaths = ( 265 | Flutter/ephemeral/FlutterOutputs.xcfilelist, 266 | ); 267 | outputPaths = ( 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | shellPath = /bin/sh; 271 | shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh\ntouch Flutter/ephemeral/tripwire\n"; 272 | }; 273 | /* End PBXShellScriptBuildPhase section */ 274 | 275 | /* Begin PBXSourcesBuildPhase section */ 276 | 33CC10E92044A3C60003C045 /* Sources */ = { 277 | isa = PBXSourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, 281 | 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, 282 | 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | }; 286 | /* End PBXSourcesBuildPhase section */ 287 | 288 | /* Begin PBXTargetDependency section */ 289 | 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { 290 | isa = PBXTargetDependency; 291 | target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; 292 | targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; 293 | }; 294 | /* End PBXTargetDependency section */ 295 | 296 | /* Begin PBXVariantGroup section */ 297 | 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { 298 | isa = PBXVariantGroup; 299 | children = ( 300 | 33CC10F52044A3C60003C045 /* Base */, 301 | ); 302 | name = MainMenu.xib; 303 | path = Runner; 304 | sourceTree = ""; 305 | }; 306 | /* End PBXVariantGroup section */ 307 | 308 | /* Begin XCBuildConfiguration section */ 309 | 338D0CE9231458BD00FA5F75 /* Profile */ = { 310 | isa = XCBuildConfiguration; 311 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 312 | buildSettings = { 313 | ALWAYS_SEARCH_USER_PATHS = NO; 314 | CLANG_ANALYZER_NONNULL = YES; 315 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 316 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 317 | CLANG_CXX_LIBRARY = "libc++"; 318 | CLANG_ENABLE_MODULES = YES; 319 | CLANG_ENABLE_OBJC_ARC = YES; 320 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 321 | CLANG_WARN_BOOL_CONVERSION = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 325 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 326 | CLANG_WARN_EMPTY_BODY = YES; 327 | CLANG_WARN_ENUM_CONVERSION = YES; 328 | CLANG_WARN_INFINITE_RECURSION = YES; 329 | CLANG_WARN_INT_CONVERSION = YES; 330 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 331 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 332 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 333 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 334 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 335 | CODE_SIGN_IDENTITY = "-"; 336 | COPY_PHASE_STRIP = NO; 337 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 338 | ENABLE_NS_ASSERTIONS = NO; 339 | ENABLE_STRICT_OBJC_MSGSEND = YES; 340 | GCC_C_LANGUAGE_STANDARD = gnu11; 341 | GCC_NO_COMMON_BLOCKS = YES; 342 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 343 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 344 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 345 | GCC_WARN_UNUSED_FUNCTION = YES; 346 | GCC_WARN_UNUSED_VARIABLE = YES; 347 | MACOSX_DEPLOYMENT_TARGET = 10.11; 348 | MTL_ENABLE_DEBUG_INFO = NO; 349 | SDKROOT = macosx; 350 | SWIFT_COMPILATION_MODE = wholemodule; 351 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 352 | }; 353 | name = Profile; 354 | }; 355 | 338D0CEA231458BD00FA5F75 /* Profile */ = { 356 | isa = XCBuildConfiguration; 357 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 358 | buildSettings = { 359 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 360 | CLANG_ENABLE_MODULES = YES; 361 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 362 | CODE_SIGN_STYLE = Automatic; 363 | COMBINE_HIDPI_IMAGES = YES; 364 | FRAMEWORK_SEARCH_PATHS = ( 365 | "$(inherited)", 366 | "$(PROJECT_DIR)/Flutter/ephemeral", 367 | ); 368 | INFOPLIST_FILE = Runner/Info.plist; 369 | LD_RUNPATH_SEARCH_PATHS = ( 370 | "$(inherited)", 371 | "@executable_path/../Frameworks", 372 | ); 373 | PROVISIONING_PROFILE_SPECIFIER = ""; 374 | SWIFT_VERSION = 5.0; 375 | }; 376 | name = Profile; 377 | }; 378 | 338D0CEB231458BD00FA5F75 /* Profile */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | CODE_SIGN_STYLE = Manual; 382 | PRODUCT_NAME = "$(TARGET_NAME)"; 383 | }; 384 | name = Profile; 385 | }; 386 | 33CC10F92044A3C60003C045 /* Debug */ = { 387 | isa = XCBuildConfiguration; 388 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_ANALYZER_NONNULL = YES; 392 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 393 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 394 | CLANG_CXX_LIBRARY = "libc++"; 395 | CLANG_ENABLE_MODULES = YES; 396 | CLANG_ENABLE_OBJC_ARC = YES; 397 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 398 | CLANG_WARN_BOOL_CONVERSION = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 401 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 402 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 403 | CLANG_WARN_EMPTY_BODY = YES; 404 | CLANG_WARN_ENUM_CONVERSION = YES; 405 | CLANG_WARN_INFINITE_RECURSION = YES; 406 | CLANG_WARN_INT_CONVERSION = YES; 407 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 409 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 410 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 411 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 412 | CODE_SIGN_IDENTITY = "-"; 413 | COPY_PHASE_STRIP = NO; 414 | DEBUG_INFORMATION_FORMAT = dwarf; 415 | ENABLE_STRICT_OBJC_MSGSEND = YES; 416 | ENABLE_TESTABILITY = YES; 417 | GCC_C_LANGUAGE_STANDARD = gnu11; 418 | GCC_DYNAMIC_NO_PIC = NO; 419 | GCC_NO_COMMON_BLOCKS = YES; 420 | GCC_OPTIMIZATION_LEVEL = 0; 421 | GCC_PREPROCESSOR_DEFINITIONS = ( 422 | "DEBUG=1", 423 | "$(inherited)", 424 | ); 425 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 426 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | MACOSX_DEPLOYMENT_TARGET = 10.11; 431 | MTL_ENABLE_DEBUG_INFO = YES; 432 | ONLY_ACTIVE_ARCH = YES; 433 | SDKROOT = macosx; 434 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 435 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 436 | }; 437 | name = Debug; 438 | }; 439 | 33CC10FA2044A3C60003C045 /* Release */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 442 | buildSettings = { 443 | ALWAYS_SEARCH_USER_PATHS = NO; 444 | CLANG_ANALYZER_NONNULL = YES; 445 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 446 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 447 | CLANG_CXX_LIBRARY = "libc++"; 448 | CLANG_ENABLE_MODULES = YES; 449 | CLANG_ENABLE_OBJC_ARC = YES; 450 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 451 | CLANG_WARN_BOOL_CONVERSION = YES; 452 | CLANG_WARN_CONSTANT_CONVERSION = YES; 453 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 454 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 455 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 456 | CLANG_WARN_EMPTY_BODY = YES; 457 | CLANG_WARN_ENUM_CONVERSION = YES; 458 | CLANG_WARN_INFINITE_RECURSION = YES; 459 | CLANG_WARN_INT_CONVERSION = YES; 460 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 461 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 462 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 463 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 464 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 465 | CODE_SIGN_IDENTITY = "-"; 466 | COPY_PHASE_STRIP = NO; 467 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 468 | ENABLE_NS_ASSERTIONS = NO; 469 | ENABLE_STRICT_OBJC_MSGSEND = YES; 470 | GCC_C_LANGUAGE_STANDARD = gnu11; 471 | GCC_NO_COMMON_BLOCKS = YES; 472 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 473 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 474 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 475 | GCC_WARN_UNUSED_FUNCTION = YES; 476 | GCC_WARN_UNUSED_VARIABLE = YES; 477 | MACOSX_DEPLOYMENT_TARGET = 10.11; 478 | MTL_ENABLE_DEBUG_INFO = NO; 479 | SDKROOT = macosx; 480 | SWIFT_COMPILATION_MODE = wholemodule; 481 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 482 | }; 483 | name = Release; 484 | }; 485 | 33CC10FC2044A3C60003C045 /* Debug */ = { 486 | isa = XCBuildConfiguration; 487 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 488 | buildSettings = { 489 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 490 | CLANG_ENABLE_MODULES = YES; 491 | CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; 492 | CODE_SIGN_STYLE = Automatic; 493 | COMBINE_HIDPI_IMAGES = YES; 494 | FRAMEWORK_SEARCH_PATHS = ( 495 | "$(inherited)", 496 | "$(PROJECT_DIR)/Flutter/ephemeral", 497 | ); 498 | INFOPLIST_FILE = Runner/Info.plist; 499 | LD_RUNPATH_SEARCH_PATHS = ( 500 | "$(inherited)", 501 | "@executable_path/../Frameworks", 502 | ); 503 | PROVISIONING_PROFILE_SPECIFIER = ""; 504 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 505 | SWIFT_VERSION = 5.0; 506 | }; 507 | name = Debug; 508 | }; 509 | 33CC10FD2044A3C60003C045 /* Release */ = { 510 | isa = XCBuildConfiguration; 511 | baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; 512 | buildSettings = { 513 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 514 | CLANG_ENABLE_MODULES = YES; 515 | CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; 516 | CODE_SIGN_STYLE = Automatic; 517 | COMBINE_HIDPI_IMAGES = YES; 518 | FRAMEWORK_SEARCH_PATHS = ( 519 | "$(inherited)", 520 | "$(PROJECT_DIR)/Flutter/ephemeral", 521 | ); 522 | INFOPLIST_FILE = Runner/Info.plist; 523 | LD_RUNPATH_SEARCH_PATHS = ( 524 | "$(inherited)", 525 | "@executable_path/../Frameworks", 526 | ); 527 | PROVISIONING_PROFILE_SPECIFIER = ""; 528 | SWIFT_VERSION = 5.0; 529 | }; 530 | name = Release; 531 | }; 532 | 33CC111C2044C6BA0003C045 /* Debug */ = { 533 | isa = XCBuildConfiguration; 534 | buildSettings = { 535 | CODE_SIGN_STYLE = Manual; 536 | PRODUCT_NAME = "$(TARGET_NAME)"; 537 | }; 538 | name = Debug; 539 | }; 540 | 33CC111D2044C6BA0003C045 /* Release */ = { 541 | isa = XCBuildConfiguration; 542 | buildSettings = { 543 | CODE_SIGN_STYLE = Automatic; 544 | PRODUCT_NAME = "$(TARGET_NAME)"; 545 | }; 546 | name = Release; 547 | }; 548 | /* End XCBuildConfiguration section */ 549 | 550 | /* Begin XCConfigurationList section */ 551 | 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { 552 | isa = XCConfigurationList; 553 | buildConfigurations = ( 554 | 33CC10F92044A3C60003C045 /* Debug */, 555 | 33CC10FA2044A3C60003C045 /* Release */, 556 | 338D0CE9231458BD00FA5F75 /* Profile */, 557 | ); 558 | defaultConfigurationIsVisible = 0; 559 | defaultConfigurationName = Release; 560 | }; 561 | 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { 562 | isa = XCConfigurationList; 563 | buildConfigurations = ( 564 | 33CC10FC2044A3C60003C045 /* Debug */, 565 | 33CC10FD2044A3C60003C045 /* Release */, 566 | 338D0CEA231458BD00FA5F75 /* Profile */, 567 | ); 568 | defaultConfigurationIsVisible = 0; 569 | defaultConfigurationName = Release; 570 | }; 571 | 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { 572 | isa = XCConfigurationList; 573 | buildConfigurations = ( 574 | 33CC111C2044C6BA0003C045 /* Debug */, 575 | 33CC111D2044C6BA0003C045 /* Release */, 576 | 338D0CEB231458BD00FA5F75 /* Profile */, 577 | ); 578 | defaultConfigurationIsVisible = 0; 579 | defaultConfigurationName = Release; 580 | }; 581 | /* End XCConfigurationList section */ 582 | }; 583 | rootObject = 33CC10E52044A3C60003C045 /* Project object */; 584 | } 585 | -------------------------------------------------------------------------------- /example/macos/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/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/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /example/macos/Runner/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 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 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2020 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example_for_oktoast 2 | description: A new Flutter project. 3 | version: 3.3.0+3 4 | publish_to: none 5 | 6 | environment: 7 | sdk: ">=2.17.0 <4.0.0" 8 | flutter: ">=3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | oktoast: 15 | path: ../ 16 | 17 | dev_dependencies: 18 | flutter_lints: any 19 | 20 | flutter: 21 | uses-material-design: true 22 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/example/web/favicon.png -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenFlutter/flutter_oktoast/b7216f8d81e497b039c1da959d3db129fc14b73f/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | example 15 | 16 | 17 | 18 | 21 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "minimal-ui", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /lib/oktoast.dart: -------------------------------------------------------------------------------- 1 | library oktoast; 2 | 3 | export 'src/core/position.dart'; 4 | export 'src/core/toast.dart' 5 | show showToast, showToastWidget, OKToast, ToastFuture, dismissAllToast; 6 | 7 | export 'src/widget/animation/animation_builder.dart'; 8 | export 'src/widget/animation/offset_builder.dart'; 9 | export 'src/widget/animation/opacity_builder.dart'; 10 | -------------------------------------------------------------------------------- /lib/src/core/default_themes.dart: -------------------------------------------------------------------------------- 1 | part of 'toast.dart'; 2 | 3 | Widget _defaultBuildAnimation( 4 | BuildContext context, 5 | Widget child, 6 | AnimationController controller, 7 | double percent, 8 | ) { 9 | return Opacity(opacity: percent, child: child); 10 | } 11 | 12 | const Duration _defaultDuration = Duration(milliseconds: 2300); 13 | const Duration _defaultAnimDuration = Duration(milliseconds: 250); 14 | const Color _defaultBackgroundColor = Color(0xDD000000); 15 | 16 | const TextStyle _defaultTextStyle = TextStyle( 17 | fontSize: 15, 18 | fontWeight: FontWeight.normal, 19 | color: Colors.white, 20 | ); 21 | const ToastTheme defaultTheme = ToastTheme( 22 | radius: 10, 23 | textStyle: _defaultTextStyle, 24 | position: ToastPosition.center, 25 | textDirection: TextDirection.ltr, 26 | handleTouch: false, 27 | child: SizedBox(), 28 | ); 29 | -------------------------------------------------------------------------------- /lib/src/core/position.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class ToastPosition { 4 | const ToastPosition({this.align = Alignment.center, this.offset = 0.0}); 5 | 6 | final AlignmentGeometry align; 7 | final double offset; 8 | 9 | static const ToastPosition center = ToastPosition(); 10 | 11 | static const ToastPosition bottom = 12 | ToastPosition(align: Alignment.bottomCenter, offset: -30.0); 13 | 14 | static const ToastPosition top = 15 | ToastPosition(align: Alignment.topCenter, offset: 75.0); 16 | 17 | ToastPosition copyWith({AlignmentGeometry? align, double? offset}) { 18 | return ToastPosition( 19 | align: align ?? this.align, 20 | offset: offset ?? this.offset, 21 | ); 22 | } 23 | 24 | @override 25 | String toString() => 'ToastPosition(align: $align, offset: $offset)'; 26 | } 27 | -------------------------------------------------------------------------------- /lib/src/core/toast.dart: -------------------------------------------------------------------------------- 1 | library oktoast; 2 | 3 | import 'dart:async'; 4 | import 'dart:collection'; 5 | import 'dart:ui' as ui; 6 | 7 | import 'package:flutter/material.dart' hide Overlay, OverlayEntry, OverlayState; 8 | import 'package:flutter/scheduler.dart'; 9 | 10 | import '../widget/animation/animation_builder.dart'; 11 | import '../widget/overlay.dart'; 12 | import 'position.dart'; 13 | import 'toast_manager.dart'; 14 | 15 | part 'default_themes.dart'; 16 | 17 | part 'toast_future.dart'; 18 | 19 | part '../widget/theme.dart'; 20 | 21 | part '../widget/oktoast.dart'; 22 | 23 | part '../widget/container.dart'; 24 | 25 | final LinkedHashMap<_OKToastState, BuildContext> _contextMap = 26 | LinkedHashMap<_OKToastState, BuildContext>(); 27 | 28 | typedef BuildContextPredicate = BuildContext Function( 29 | Iterable list, 30 | ); 31 | 32 | BuildContext _defaultContextPredicate(Iterable list) { 33 | return list.first; 34 | } 35 | 36 | /// Show toast with [msg], 37 | ToastFuture showToast( 38 | String msg, { 39 | BuildContext? context, 40 | BuildContextPredicate buildContextPredicate = _defaultContextPredicate, 41 | Duration? duration, 42 | ToastPosition? position, 43 | Color? backgroundColor, 44 | double? radius, 45 | VoidCallback? onDismiss, 46 | bool? dismissOtherToast, 47 | bool? movingOnWindowChange, 48 | OKToastAnimationBuilder? animationBuilder, 49 | Duration? animationDuration, 50 | Curve? animationCurve, 51 | BoxConstraints? constraints, 52 | EdgeInsetsGeometry? margin = const EdgeInsets.all(50), 53 | TextDirection? textDirection, 54 | EdgeInsetsGeometry? textPadding, 55 | TextAlign? textAlign, 56 | TextStyle? textStyle, 57 | int? textMaxLines, 58 | TextOverflow? textOverflow, 59 | }) { 60 | if (context == null) { 61 | _throwIfNoContext(_contextMap.values, 'showToast'); 62 | } 63 | context ??= buildContextPredicate(_contextMap.values); 64 | 65 | final ToastTheme theme = ToastTheme.of(context); 66 | position ??= theme.position; 67 | backgroundColor ??= theme.backgroundColor; 68 | radius ??= theme.radius; 69 | textDirection ??= theme.textDirection; 70 | textPadding ??= theme.textPadding; 71 | textAlign ??= theme.textAlign; 72 | textStyle ??= theme.textStyle; 73 | textMaxLines ??= theme.textMaxLines; 74 | textOverflow ??= theme.textOverflow; 75 | movingOnWindowChange ??= theme.movingOnWindowChange; 76 | 77 | final Widget widget = Container( 78 | constraints: constraints, 79 | margin: margin, 80 | padding: textPadding, 81 | decoration: BoxDecoration( 82 | borderRadius: BorderRadius.circular(radius), 83 | color: backgroundColor, 84 | ), 85 | child: ClipRect( 86 | child: Text( 87 | msg, 88 | style: textStyle, 89 | textAlign: textAlign, 90 | maxLines: textMaxLines, 91 | overflow: textOverflow, 92 | ), 93 | ), 94 | ); 95 | 96 | return showToastWidget( 97 | widget, 98 | context: context, 99 | buildContextPredicate: buildContextPredicate, 100 | duration: duration, 101 | onDismiss: onDismiss, 102 | position: position, 103 | dismissOtherToast: dismissOtherToast, 104 | movingOnWindowChange: movingOnWindowChange, 105 | textDirection: textDirection, 106 | animationBuilder: animationBuilder, 107 | animationDuration: animationDuration, 108 | animationCurve: animationCurve, 109 | ); 110 | } 111 | 112 | /// Show a [widget] and returns a [ToastFuture]. 113 | ToastFuture showToastWidget( 114 | Widget widget, { 115 | BuildContext? context, 116 | BuildContextPredicate buildContextPredicate = _defaultContextPredicate, 117 | Duration? duration, 118 | ToastPosition? position, 119 | VoidCallback? onDismiss, 120 | bool? dismissOtherToast, 121 | bool? movingOnWindowChange, 122 | TextDirection? textDirection, 123 | bool? handleTouch, 124 | OKToastAnimationBuilder? animationBuilder, 125 | Duration? animationDuration, 126 | Curve? animationCurve, 127 | }) { 128 | if (context == null) { 129 | _throwIfNoContext(_contextMap.values, 'showToastWidget'); 130 | } 131 | context ??= buildContextPredicate(_contextMap.values); 132 | 133 | final ToastTheme theme = ToastTheme.of(context); 134 | position ??= theme.position; 135 | handleTouch ??= theme.handleTouch; 136 | animationBuilder ??= theme.animationBuilder; 137 | animationDuration ??= theme.animationDuration; 138 | animationCurve ??= theme.animationCurve; 139 | duration ??= theme.duration; 140 | movingOnWindowChange ??= theme.movingOnWindowChange; 141 | 142 | final TextDirection direction = textDirection ?? theme.textDirection; 143 | 144 | final GlobalKey<_ToastContainerState> key = GlobalKey(); 145 | 146 | widget = Align(alignment: position.align, child: widget); 147 | 148 | final OverlayEntry entry = OverlayEntry( 149 | builder: (BuildContext ctx) { 150 | return IgnorePointer( 151 | ignoring: !handleTouch!, 152 | child: Directionality( 153 | textDirection: direction, 154 | child: ToastContainer( 155 | key: key, 156 | duration: duration!, 157 | position: position!, 158 | movingOnWindowChange: movingOnWindowChange!, 159 | animationBuilder: animationBuilder!, 160 | animationDuration: animationDuration!, 161 | animationCurve: animationCurve!, 162 | child: widget, 163 | ), 164 | ), 165 | ); 166 | }, 167 | ); 168 | 169 | dismissOtherToast ??= theme.dismissOtherOnShow; 170 | 171 | if (dismissOtherToast == true) { 172 | ToastManager().dismissAll(); 173 | } 174 | 175 | final ToastFuture future = ToastFuture._( 176 | entry, 177 | onDismiss, 178 | key, 179 | animationDuration, 180 | ); 181 | 182 | if (duration != Duration.zero) { 183 | future.timer = Timer(duration, () { 184 | future.dismiss(); 185 | }); 186 | } 187 | 188 | ToastManager().addFuture(future); 189 | 190 | void insertOverlayEntry() { 191 | if (!future.dismissed) { 192 | future._insertEntry(context!); 193 | } 194 | } 195 | 196 | if (SchedulerBinding.instance.schedulerPhase != 197 | SchedulerPhase.persistentCallbacks) { 198 | insertOverlayEntry(); 199 | } else { 200 | WidgetsBinding.instance.addPostFrameCallback((_) { 201 | insertOverlayEntry(); 202 | }); 203 | } 204 | 205 | return future; 206 | } 207 | 208 | void dismissAllToast({bool showAnim = false}) { 209 | ToastManager().dismissAll(showAnim: showAnim); 210 | } 211 | 212 | void _throwIfNoContext(Iterable contexts, String methodName) { 213 | if (contexts.isNotEmpty) { 214 | return; 215 | } 216 | final List information = [ 217 | ErrorSummary('No OKToast widget found.'), 218 | ErrorDescription( 219 | '$methodName requires an OKToast widget ancestor ' 220 | 'for correct operation.', 221 | ), 222 | ErrorHint( 223 | 'The most common way to add an OKToast to an application ' 224 | 'is to wrap a OKToast upon a WidgetsApp(MaterialApp/CupertinoApp).', 225 | ), 226 | ]; 227 | throw FlutterError.fromParts(information); 228 | } 229 | -------------------------------------------------------------------------------- /lib/src/core/toast_future.dart: -------------------------------------------------------------------------------- 1 | part of 'toast.dart'; 2 | 3 | /// Use the [dismiss] to dismiss toast. 4 | class ToastFuture { 5 | ToastFuture._( 6 | this._entry, 7 | this._onDismiss, 8 | this._containerKey, 9 | this.animationDuration, 10 | ) { 11 | _entry.addListener(_mountedListener); 12 | } 13 | 14 | final OverlayEntry _entry; 15 | final VoidCallback? _onDismiss; 16 | final GlobalKey<_ToastContainerState> _containerKey; 17 | final Duration animationDuration; 18 | 19 | Timer? timer; 20 | bool _isShow = false; 21 | bool _dismissed = false; 22 | bool _isEntryInserted = false; 23 | 24 | bool get mounted => _isShow; 25 | 26 | bool get dismissed => _dismissed; 27 | 28 | void _mountedListener() { 29 | _isShow = _entry.mounted; 30 | } 31 | 32 | void _insertEntry(BuildContext context) { 33 | final OverlayState? state = Overlay.of(context); 34 | _isEntryInserted = state != null; 35 | state?.insert(_entry); 36 | } 37 | 38 | void _removeEntry() { 39 | _entry.removeListener(_mountedListener); 40 | if (_isEntryInserted) { 41 | _entry.remove(); 42 | } 43 | } 44 | 45 | void dismiss({bool showAnim = false}) { 46 | if (!_isShow) { 47 | ToastManager().removeFuture(this); 48 | timer?.cancel(); 49 | _dismissed = true; 50 | _removeEntry(); 51 | return; 52 | } 53 | 54 | _isShow = false; 55 | _onDismiss?.call(); 56 | ToastManager().removeFuture(this); 57 | 58 | if (showAnim) { 59 | _containerKey.currentState?.showDismissAnim(); 60 | Future.delayed(animationDuration, _removeEntry); 61 | } else { 62 | _removeEntry(); 63 | } 64 | 65 | timer?.cancel(); 66 | _dismissed = true; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/src/core/toast_manager.dart: -------------------------------------------------------------------------------- 1 | import 'toast.dart'; 2 | 3 | class ToastManager { 4 | factory ToastManager() => _instance; 5 | 6 | ToastManager._(); 7 | 8 | static final ToastManager _instance = ToastManager._(); 9 | 10 | final Set toastSet = {}; 11 | 12 | void dismissAll({bool showAnim = false}) { 13 | toastSet.toList().forEach((ToastFuture v) { 14 | v.dismiss(showAnim: showAnim); 15 | }); 16 | } 17 | 18 | void removeFuture(ToastFuture future) { 19 | toastSet.remove(future); 20 | } 21 | 22 | void addFuture(ToastFuture future) { 23 | toastSet.add(future); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/src/widget/animation/animation_builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | typedef OKToastAnimationBuilder = Widget Function( 4 | BuildContext context, 5 | Widget child, 6 | AnimationController controller, 7 | double percent, 8 | ); 9 | 10 | abstract class BaseAnimationBuilder { 11 | const BaseAnimationBuilder(); 12 | 13 | Widget call( 14 | BuildContext context, 15 | Widget child, 16 | AnimationController controller, 17 | double percent, 18 | ) { 19 | return buildWidget(context, child, controller, percent); 20 | } 21 | 22 | Widget buildWidget( 23 | BuildContext context, 24 | Widget child, 25 | AnimationController controller, 26 | double percent, 27 | ); 28 | } 29 | -------------------------------------------------------------------------------- /lib/src/widget/animation/offset_builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'animation_builder.dart'; 4 | 5 | class OffsetAnimationBuilder extends BaseAnimationBuilder { 6 | const OffsetAnimationBuilder({ 7 | this.maxOffsetX = 0, 8 | this.maxOffsetY = 100, 9 | }); 10 | 11 | final double maxOffsetX; 12 | final double maxOffsetY; 13 | 14 | @override 15 | Widget buildWidget( 16 | BuildContext context, 17 | Widget child, 18 | AnimationController controller, 19 | double percent, 20 | ) { 21 | return Transform.translate( 22 | offset: Offset(maxOffsetX * percent, maxOffsetY * (1 - percent)), 23 | child: child, 24 | ); 25 | // return FractionalTranslation( 26 | // translation: Offset(0, -1 * percent), 27 | // child: child, 28 | // ); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/src/widget/animation/opacity_builder.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | import 'animation_builder.dart'; 4 | 5 | class OpacityAnimationBuilder extends BaseAnimationBuilder { 6 | const OpacityAnimationBuilder(); 7 | 8 | @override 9 | Widget buildWidget( 10 | BuildContext context, 11 | Widget child, 12 | AnimationController controller, 13 | double percent, 14 | ) { 15 | return Opacity(opacity: percent, child: child); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/src/widget/container.dart: -------------------------------------------------------------------------------- 1 | part of '../core/toast.dart'; 2 | 3 | class ToastContainer extends StatefulWidget { 4 | const ToastContainer({ 5 | super.key, 6 | required this.duration, 7 | required this.child, 8 | required this.position, 9 | required this.animationBuilder, 10 | required this.animationDuration, 11 | required this.animationCurve, 12 | this.movingOnWindowChange = false, 13 | }); 14 | 15 | final Duration duration; 16 | final Widget child; 17 | final bool movingOnWindowChange; 18 | final ToastPosition position; 19 | final OKToastAnimationBuilder animationBuilder; 20 | final Duration animationDuration; 21 | 22 | final Curve animationCurve; 23 | 24 | @override 25 | State createState() => _ToastContainerState(); 26 | } 27 | 28 | class _ToastContainerState extends State 29 | with WidgetsBindingObserver, SingleTickerProviderStateMixin { 30 | bool get movingOnWindowChange => widget.movingOnWindowChange; 31 | 32 | double get offset => widget.position.offset; 33 | 34 | Duration get animationDuration => widget.animationDuration; 35 | 36 | late final AnimationController _animationController = AnimationController( 37 | vsync: this, 38 | duration: animationDuration, 39 | reverseDuration: animationDuration, 40 | ); 41 | 42 | @override 43 | void initState() { 44 | super.initState(); 45 | WidgetsBinding.instance.addObserver(this); 46 | 47 | Future.delayed(const Duration(milliseconds: 30), () { 48 | _animateTo(1.0); 49 | }); 50 | if (widget.duration != Duration.zero) { 51 | Future.delayed(widget.duration - animationDuration, () { 52 | _animateTo(0.0); 53 | }); 54 | } 55 | } 56 | 57 | @override 58 | void didChangeMetrics() { 59 | super.didChangeMetrics(); 60 | if (mounted) { 61 | setState(() {}); 62 | } 63 | } 64 | 65 | @override 66 | void dispose() { 67 | _animationController.dispose(); 68 | WidgetsBinding.instance.removeObserver(this); 69 | super.dispose(); 70 | } 71 | 72 | @override 73 | Widget build(BuildContext context) { 74 | final Widget w = AnimatedBuilder( 75 | animation: _animationController, 76 | builder: (_, Widget? child) => widget.animationBuilder( 77 | context, 78 | child!, 79 | _animationController, 80 | _animationController.value, 81 | ), 82 | child: widget.child, 83 | ); 84 | 85 | final EdgeInsets offsetPadding; 86 | if (offset > 0) { 87 | offsetPadding = EdgeInsets.only(top: offset); 88 | } else { 89 | offsetPadding = EdgeInsets.only(bottom: offset.abs()); 90 | } 91 | 92 | final EdgeInsets windowInsets; 93 | if (movingOnWindowChange) { 94 | // ignore: deprecated_member_use 95 | final mediaQuery = MediaQueryData.fromWindow(ui.window); 96 | // final mediaQuery = MediaQueryData.fromView(currentView); 97 | windowInsets = EdgeInsets.only(bottom: mediaQuery.viewInsets.bottom); 98 | } else { 99 | windowInsets = EdgeInsets.zero; 100 | } 101 | 102 | return AnimatedPadding( 103 | padding: offsetPadding + windowInsets, 104 | duration: animationDuration, 105 | child: w, 106 | ); 107 | } 108 | 109 | void showDismissAnim() { 110 | _animateTo(0); 111 | } 112 | 113 | void _animateTo(double value) { 114 | if (!mounted) { 115 | return; 116 | } 117 | if (value == 0) { 118 | _animationController.animateTo( 119 | value, 120 | duration: animationDuration, 121 | curve: widget.animationCurve, 122 | ); 123 | } else { 124 | _animationController.animateBack( 125 | value, 126 | duration: animationDuration, 127 | curve: widget.animationCurve, 128 | ); 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /lib/src/widget/oktoast.dart: -------------------------------------------------------------------------------- 1 | part of '../core/toast.dart'; 2 | 3 | class OKToast extends StatefulWidget { 4 | const OKToast({ 5 | super.key, 6 | required this.child, 7 | this.textStyle, 8 | this.radius = 10.0, 9 | this.position = ToastPosition.center, 10 | this.textDirection = TextDirection.ltr, 11 | this.dismissOtherOnShow = false, 12 | this.movingOnWindowChange = true, 13 | Color? backgroundColor, 14 | this.textPadding, 15 | this.textAlign, 16 | this.handleTouch = false, 17 | this.animationBuilder, 18 | this.animationDuration = _defaultAnimDuration, 19 | this.animationCurve, 20 | this.duration, 21 | }) : backgroundColor = backgroundColor ?? _defaultBackgroundColor; 22 | 23 | /// Typically with a [WidgetsApp]. 24 | final Widget child; 25 | 26 | /// Default textStyle of [showToast]. 27 | final TextStyle? textStyle; 28 | 29 | /// Default backgroundColor of [showToast]. 30 | final Color backgroundColor; 31 | 32 | /// Default radius of [showToast]. 33 | final double radius; 34 | 35 | /// Default align and padding of [showToast]. 36 | final ToastPosition position; 37 | 38 | /// Default textDirection of [showToast]. 39 | final TextDirection textDirection; 40 | 41 | /// Default dismissOtherOnShow of [showToast]. 42 | final bool dismissOtherOnShow; 43 | 44 | /// When the screen size changes due to the soft keyboard / rotation screen, 45 | /// toast will reposition. 46 | final bool movingOnWindowChange; 47 | 48 | /// TDefault textAlign of [textPadding]. 49 | final EdgeInsets? textPadding; 50 | 51 | /// Default textAlign of [showToast]. 52 | final TextAlign? textAlign; 53 | 54 | /// Whether toast can respond to click events. 55 | final bool handleTouch; 56 | 57 | final Duration? duration; 58 | 59 | /// The animation builder of show/hide toast. 60 | final OKToastAnimationBuilder? animationBuilder; 61 | 62 | /// The animation duration of show/hide toast. 63 | final Duration animationDuration; 64 | 65 | /// The animation curve of show/hide toast. 66 | final Curve? animationCurve; 67 | 68 | @override 69 | State createState() => _OKToastState(); 70 | } 71 | 72 | class _OKToastState extends State { 73 | @override 74 | void dispose() { 75 | _contextMap.remove(this); 76 | super.dispose(); 77 | } 78 | 79 | @override 80 | Widget build(BuildContext context) { 81 | final Overlay overlay = Overlay( 82 | initialEntries: [ 83 | OverlayEntry( 84 | builder: (BuildContext ctx) { 85 | _contextMap[this] = ctx; 86 | return widget.child; 87 | }, 88 | ), 89 | ], 90 | ); 91 | 92 | Widget w = Directionality( 93 | textDirection: widget.textDirection, 94 | child: overlay, 95 | ); 96 | 97 | final TextStyle textStyle = widget.textStyle ?? _defaultTextStyle; 98 | final TextAlign textAlign = widget.textAlign ?? TextAlign.center; 99 | final EdgeInsets textPadding = widget.textPadding ?? 100 | const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0); 101 | 102 | final OKToastAnimationBuilder animationBuilder = 103 | widget.animationBuilder ?? _defaultBuildAnimation; 104 | 105 | final haveMaterialParent = Material.maybeOf(context) != null; 106 | 107 | if (!haveMaterialParent) { 108 | w = Material( 109 | color: Colors.transparent, 110 | child: w, 111 | ); 112 | } 113 | 114 | return ToastTheme( 115 | backgroundColor: widget.backgroundColor, 116 | radius: widget.radius, 117 | textStyle: textStyle, 118 | position: widget.position, 119 | dismissOtherOnShow: widget.dismissOtherOnShow, 120 | movingOnWindowChange: widget.movingOnWindowChange, 121 | textDirection: widget.textDirection, 122 | textAlign: textAlign, 123 | textPadding: textPadding, 124 | handleTouch: widget.handleTouch, 125 | animationBuilder: animationBuilder, 126 | animationDuration: widget.animationDuration, 127 | animationCurve: widget.animationCurve ?? Curves.easeIn, 128 | duration: widget.duration ?? _defaultDuration, 129 | child: w, 130 | ); 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /lib/src/widget/theme.dart: -------------------------------------------------------------------------------- 1 | part of '../core/toast.dart'; 2 | 3 | class ToastTheme extends InheritedWidget { 4 | const ToastTheme({ 5 | super.key, 6 | required this.textStyle, 7 | required this.textDirection, 8 | required this.handleTouch, 9 | required this.radius, 10 | required this.position, 11 | required super.child, 12 | this.backgroundColor = Colors.black, 13 | this.dismissOtherOnShow = true, 14 | this.movingOnWindowChange = true, 15 | this.animationBuilder = _defaultBuildAnimation, 16 | this.animationDuration = _defaultAnimDuration, 17 | this.animationCurve = Curves.easeIn, 18 | this.duration = _defaultDuration, 19 | this.textPadding, 20 | this.textAlign, 21 | this.textMaxLines, 22 | this.textOverflow, 23 | }); 24 | 25 | static ToastTheme of(BuildContext context) => 26 | context.dependOnInheritedWidgetOfExactType() ?? defaultTheme; 27 | 28 | final TextStyle textStyle; 29 | final TextDirection textDirection; 30 | final bool handleTouch; 31 | final double radius; 32 | final ToastPosition position; 33 | final Color backgroundColor; 34 | final bool dismissOtherOnShow; 35 | final bool movingOnWindowChange; 36 | final OKToastAnimationBuilder animationBuilder; 37 | final Duration animationDuration; 38 | final Curve animationCurve; 39 | final Duration duration; 40 | final TextAlign? textAlign; 41 | final EdgeInsets? textPadding; 42 | final int? textMaxLines; 43 | final TextOverflow? textOverflow; 44 | 45 | @override 46 | bool updateShouldNotify(ToastTheme oldWidget) => true; 47 | } 48 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: oktoast 2 | description: A pure flutter toast library, support custom style/widget, easy achieve the same effect with native toasts. 3 | repository: https://github.com/OpenFlutter/flutter_oktoast 4 | version: 3.4.0 5 | 6 | environment: 7 | sdk: '>=2.17.0 <4.0.0' 8 | flutter: '>=3.7.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | flutter_lints: any 16 | flutter_test: 17 | sdk: flutter 18 | -------------------------------------------------------------------------------- /test/toast_test.dart: -------------------------------------------------------------------------------- 1 | // 2 | // [Author] Alex (https://github.com/AlexV525) 3 | // [Date] 2021/11/5 15:53 4 | // 5 | import 'package:flutter/material.dart' hide Overlay, OverlayEntry, OverlayState; 6 | import 'package:flutter_test/flutter_test.dart'; 7 | import 'package:oktoast/src/core/position.dart'; 8 | import 'package:oktoast/src/core/toast.dart'; 9 | 10 | void main() { 11 | testWidgets('Show toast test', (WidgetTester tester) async { 12 | await _pumpWidget( 13 | tester, 14 | onPressed: () { 15 | showToast('Test toast'); 16 | }, 17 | ); 18 | await tester.tap(find.byKey(_wButtonKey)); 19 | await tester.pumpAndSettle(); 20 | expect(find.byType(ToastContainer), findsOneWidget); 21 | await tester.pumpAndSettle(_defaultAnimDuration); 22 | expect(find.byType(ToastContainer), findsOneWidget); 23 | await tester.pumpAndSettle(_defaultDuration); 24 | expect(find.byType(ToastContainer), findsNothing); 25 | }); 26 | 27 | testWidgets('Dismiss synchronously', (WidgetTester tester) async { 28 | await _pumpWidget( 29 | tester, 30 | onPressed: () { 31 | final ToastFuture future = showToast('Test toast'); 32 | future.dismiss(); 33 | }, 34 | ); 35 | await tester.tap(find.byKey(_wButtonKey)); 36 | expect(find.byType(ToastContainer), findsNothing); 37 | await tester.pumpAndSettle(_defaultAnimDuration); 38 | expect(find.byType(ToastContainer), findsNothing); 39 | }); 40 | 41 | testWidgets('Offset test when movingOnWindowChange is true', 42 | (WidgetTester tester) async { 43 | const double verticalOffset = 400.0; 44 | 45 | await _pumpWidget( 46 | tester, 47 | onPressed: () { 48 | showToast( 49 | 'Test toast', 50 | position: const ToastPosition(offset: verticalOffset), 51 | ); 52 | }, 53 | ); 54 | 55 | await tester.tap(find.byKey(_wButtonKey)); 56 | await tester.pumpAndSettle(); 57 | final AnimatedPadding widget = tester.firstWidget( 58 | find.byType(AnimatedPadding), 59 | ) as AnimatedPadding; 60 | final findMediaQuery = find.ancestor( 61 | of: find.byType(AnimatedPadding), 62 | matching: find.byType(MediaQuery), 63 | ); 64 | final MediaQueryData mediaQueryData; 65 | if (tester.any(findMediaQuery)) { 66 | mediaQueryData = tester.widget(findMediaQuery).data; 67 | } else { 68 | // ignore: deprecated_member_use 69 | mediaQueryData = MediaQueryData.fromWindow( 70 | // ignore: deprecated_member_use 71 | TestWidgetsFlutterBinding.instance.window, 72 | ); 73 | } 74 | final windowInsets = EdgeInsets.only( 75 | bottom: mediaQueryData.viewInsets.bottom, 76 | ); 77 | expect( 78 | const EdgeInsets.only(top: verticalOffset) + windowInsets, 79 | widget.padding, 80 | ); 81 | await tester.pumpAndSettle(_defaultDuration); 82 | expect(find.byType(ToastContainer), findsNothing); 83 | }); 84 | 85 | testWidgets('Offset test when movingOnWindowChange is false', 86 | (WidgetTester tester) async { 87 | const double verticalOffset = 400.0; 88 | 89 | await _pumpWidget( 90 | tester, 91 | movingOnWindowChange: false, 92 | onPressed: () { 93 | showToast( 94 | 'Test toast', 95 | position: const ToastPosition(offset: verticalOffset), 96 | ); 97 | }, 98 | ); 99 | 100 | await tester.tap(find.byKey(_wButtonKey)); 101 | await tester.pumpAndSettle(); 102 | final AnimatedPadding widget = 103 | tester.firstWidget(find.byType(AnimatedPadding)) as AnimatedPadding; 104 | expect(const EdgeInsets.only(top: verticalOffset), widget.padding); 105 | await tester.pumpAndSettle(_defaultDuration); 106 | expect(find.byType(ToastContainer), findsNothing); 107 | }); 108 | } 109 | 110 | const Duration _defaultDuration = Duration(milliseconds: 2300); 111 | const Duration _defaultAnimDuration = Duration(milliseconds: 250); 112 | 113 | const String _wTitle = 'OKToast test app'; 114 | final GlobalKey _wButtonKey = GlobalKey(); 115 | 116 | Future _pumpWidget( 117 | WidgetTester tester, { 118 | bool movingOnWindowChange = true, 119 | VoidCallback? onPressed, 120 | }) async { 121 | await tester.pumpWidget( 122 | OKToast( 123 | movingOnWindowChange: movingOnWindowChange, 124 | child: MaterialApp( 125 | home: Scaffold( 126 | appBar: AppBar(title: const Text(_wTitle)), 127 | body: Center( 128 | child: ElevatedButton( 129 | key: _wButtonKey, 130 | onPressed: onPressed, 131 | child: const Text('Button'), 132 | ), 133 | ), 134 | ), 135 | ), 136 | ), 137 | ); 138 | await tester.pumpAndSettle(const Duration(seconds: 2)); 139 | } 140 | --------------------------------------------------------------------------------