├── .github └── FUNDING.yml ├── .gitignore ├── .idea ├── .gitignore ├── codeStyles │ └── Project.xml ├── encodings.xml ├── libraries │ ├── Dart_Packages.xml │ ├── Dart_SDK.xml │ ├── Flutter_Plugins.xml │ └── Flutter_for_Android.xml ├── misc.xml ├── modules.xml ├── runConfigurations │ └── example_lib_main_dart.xml ├── vcs.xml └── workspace.xml ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── animated_widgets.iml ├── example ├── .gitignore ├── .metadata ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── github │ │ │ │ │ └── florent37 │ │ │ │ │ └── animated_widgets_example │ │ │ │ │ └── MainActivity.kt │ │ │ └── res │ │ │ │ ├── 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 │ │ │ │ └── styles.xml │ │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ └── settings.gradle ├── ios │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── flutter_export_environment.sh │ ├── Podfile │ ├── Podfile.lock │ ├── Runner.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── 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 │ ├── bloc │ │ ├── first_screen.dart │ │ └── first_screen_bloc.dart │ ├── complete │ │ └── complete_screen.dart │ ├── compose │ │ └── compose_screen.dart │ ├── custom │ │ └── custom_screen.dart │ ├── main.dart │ ├── rotation │ │ └── rotation_screen.dart │ ├── scale │ │ └── scale_screen.dart │ ├── shake │ │ └── shake_screen.dart │ ├── size │ │ └── size_screen.dart │ └── statefull │ │ └── statefull_screen.dart ├── pubspec.lock ├── pubspec.yaml └── test │ └── widget_test.dart ├── lib ├── animated_widgets.dart ├── core │ └── chain_tweens.dart ├── generated │ └── i18n.dart ├── tap │ └── tap_scale_animated.dart └── widgets │ ├── custom_animated.dart │ ├── opacity_animated.dart │ ├── rotation_animated.dart │ ├── scale_animated.dart │ ├── shake_animated_widget.dart │ ├── size_animated.dart │ └── translation_animated.dart ├── medias ├── compose.gif ├── custom.gif ├── opacity.gif ├── rotation.gif ├── scale.gif ├── shake.gif ├── size.gif └── translation.gif ├── publish.sh ├── pubspec.lock ├── pubspec.yaml ├── res └── values │ └── strings_en.arb └── test └── animated_widgets_test.dart /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | ko_fi: FlorentChampigny 2 | github: florent37 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Project exclude paths 2 | /. -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | xmlns:android 14 | 15 | ^$ 16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | xmlns:.* 25 | 26 | ^$ 27 | 28 | 29 | BY_NAME 30 | 31 |
32 |
33 | 34 | 35 | 36 | .*:id 37 | 38 | http://schemas.android.com/apk/res/android 39 | 40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 | .*:name 48 | 49 | http://schemas.android.com/apk/res/android 50 | 51 | 52 | 53 |
54 |
55 | 56 | 57 | 58 | name 59 | 60 | ^$ 61 | 62 | 63 | 64 |
65 |
66 | 67 | 68 | 69 | style 70 | 71 | ^$ 72 | 73 | 74 | 75 |
76 |
77 | 78 | 79 | 80 | .* 81 | 82 | ^$ 83 | 84 | 85 | BY_NAME 86 | 87 |
88 |
89 | 90 | 91 | 92 | .* 93 | 94 | http://schemas.android.com/apk/res/android 95 | 96 | 97 | ANDROID_ATTRIBUTE_ORDER 98 | 99 |
100 |
101 | 102 | 103 | 104 | .* 105 | 106 | .* 107 | 108 | 109 | BY_NAME 110 | 111 |
112 |
113 |
114 |
115 |
116 |
-------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/libraries/Dart_Packages.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 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 | -------------------------------------------------------------------------------- /.idea/libraries/Dart_SDK.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/libraries/Flutter_Plugins.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/libraries/Flutter_for_Android.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/runConfigurations/example_lib_main_dart.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 | 23 | 24 | 25 | 27 | 28 | 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 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 1563114090683 79 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 103 | 104 | 105 | 116 | 117 | 118 | 119 | 120 | 121 | file://$PROJECT_DIR$/example/lib/main.dart 122 | 33 123 | 125 | 126 | file://$PROJECT_DIR$/lib/widgets/shake_animated_widget.dart 127 | 49 128 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /.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: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.1.0 2 | 3 | * Null Safety 4 | 5 | ## 1.0.6 6 | 7 | * fixed autostart for shake animation 8 | 9 | ## 1.0.5 10 | 11 | * fixed animationFinished on scale widget 12 | 13 | ## 1.0.4 14 | 15 | * fixed shake_animated_widget 16 | 17 | ## 1.0.3 18 | 19 | * Removed platform specific code 20 | 21 | ## 0.0.1 22 | 23 | * TODO: Describe initial release. -------------------------------------------------------------------------------- /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 2019 Florent Champigny (florent37) 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 | # animated_widgets 2 | 3 | Easily add animations on your screen with AnimatedWidgets. 4 | 5 | Optimized for MVVM using *Bloc*, updating the `enabled` value of the widget will forward or reverse the animation. 6 | 7 | Available widgets : `TranslationAnimatedWidget`, `OpacityAnimatedWidget`, `RotationAnimatedWidget`, `ScaleAnimatedWidget`, `SizeAnimatedWidget` 8 | 9 | For example : add a TranslationAnimatedWidget on a button, then activate it to display it ! 10 | 11 | ```dart 12 | TranslationAnimatedWidget( 13 | enabled: this.displayMyWidget, //update this boolean to forward/reverse the animation 14 | values: [ 15 | Offset(0, 200), // disabled value value 16 | Offset(0, 250), //intermediate value 17 | Offset(0, 0) //enabled value 18 | ], 19 | child: /* your widget */ 20 | ), 21 | ``` 22 | 23 | [![screen](https://raw.githubusercontent.com/florent37/AnimatedWidgets/master/medias/translation.gif)](https://www.github.com/florent37/AnimatedWidgets) 24 | 25 | 26 | or using a `tween constructor` 27 | 28 | ```dart 29 | RotationAnimatedWidget.tween( 30 | enabled: this.displayMyWidget, //update this boolean to forward/reverse the animation 31 | rotationDisabled: Rotation.degrees(z: 0), 32 | rotationEnabled: Rotation.degrees(z: 90), 33 | child: /* your widget */ 34 | ), 35 | ``` 36 | 37 | [![screen](https://raw.githubusercontent.com/florent37/AnimatedWidgets/master/medias/rotation.gif)](https://www.github.com/florent37/AnimatedWidgets) 38 | 39 | # Compose 40 | 41 | Don't hesitate to compose them 42 | 43 | ```dart 44 | TranslationAnimatedWidget.tween( 45 | enabled: this.displayMyWidget, 46 | translationDisabled: Offset(0, 200), 47 | translationEnabled: Offset(0, 0), 48 | child: 49 | OpacityAnimatedWidget.tween( 50 | enabled: this.displayMyWidget, 51 | opacityDisabled: 0, 52 | opacityEnabled: 1, 53 | child: /* your widget */ 54 | ), 55 | ), 56 | ``` 57 | 58 | [![screen](https://raw.githubusercontent.com/florent37/AnimatedWidgets/master/medias/compose.gif)](https://www.github.com/florent37/AnimatedWidgets) 59 | 60 | # Opacity 61 | 62 | [![screen](https://raw.githubusercontent.com/florent37/AnimatedWidgets/master/medias/opacity.gif)](https://www.github.com/florent37/AnimatedWidgets) 63 | 64 | Example using a `Stateful Widget` 65 | 66 | ```dart 67 | class _StatefulScreenState extends State { 68 | 69 | // will determine if the opacity animation is launched 70 | bool _display = false; 71 | 72 | @override 73 | Widget build(BuildContext context) { 74 | return Scaffold( 75 | appBar: AppBar(), 76 | body: Column( 77 | crossAxisAlignment: CrossAxisAlignment.stretch, 78 | mainAxisAlignment: MainAxisAlignment.center, 79 | mainAxisSize: MainAxisSize.max, 80 | children: [ 81 | 82 | //wrap your widget with OpacityAnimatedWidget 83 | OpacityAnimatedWidget.tween( 84 | opacityEnabled: 1, //define start value 85 | opacityDisabled: 0, //and end value 86 | enabled: _display, //bind with the boolean 87 | child: Container( 88 | height: 200, 89 | width: 200, 90 | child: FlutterLogo( 91 | style: FlutterLogoStyle.stacked, 92 | ), 93 | ), 94 | ), 95 | 96 | RaisedButton( 97 | color: Colors.blue, 98 | child: Text( 99 | _display ? "hide logo" : "display logo", 100 | style: TextStyle(color: Colors.white), 101 | ), 102 | onPressed: () { 103 | setState(() { 104 | 105 | //will fire the animation 106 | _display = !_display; 107 | 108 | }); 109 | }, 110 | ) 111 | ], 112 | ), 113 | ); 114 | } 115 | } 116 | ``` 117 | 118 | # Translation 119 | 120 | [![screen](https://raw.githubusercontent.com/florent37/AnimatedWidgets/master/medias/translation.gif)](https://www.github.com/florent37/AnimatedWidgets) 121 | 122 | Example using `bloc` pattern 123 | 124 | ```dart 125 | class FirstScreenBloc extends Bloc { 126 | final _viewState = BehaviorSubject.seeded(FirstScreenViewState()); 127 | Observable get viewState => _viewState; 128 | 129 | void onClicked() { 130 | _viewState.add(FirstScreenViewState(buttonVisible: true)); 131 | } 132 | 133 | void onDismissClicked() { 134 | _viewState.add(FirstScreenViewState(buttonVisible: false)); 135 | } 136 | 137 | @override 138 | void dispose() { 139 | _viewState.close(); 140 | } 141 | } 142 | 143 | class FirstScreenViewState { 144 | final bool buttonVisible; 145 | 146 | const FirstScreenViewState({ 147 | this.buttonVisible = false, 148 | }); 149 | } 150 | ``` 151 | 152 | ```dart 153 | class FirstScreenView extends StatelessWidget { 154 | @override 155 | Widget build(BuildContext context) { 156 | final bloc = BlocProvider.of(context); 157 | 158 | return StreamBuilder( 159 | stream: bloc.viewState, 160 | builder: (context, snapshot) { 161 | 162 | final viewState = snapshot.data; 163 | 164 | return Stack( 165 | fit: StackFit.expand, 166 | children: [ 167 | _buildInputButton(onClicked: () { 168 | bloc.onClicked(); 169 | }), 170 | Positioned( 171 | bottom: 20, 172 | left: 20, 173 | right: 20, 174 | 175 | child: TranslationAnimatedWidget( 176 | enabled: viewState.buttonVisible, //will forward/reverse the animation 177 | curve: Curves.easeIn, 178 | duration: Duration(seconds: 1), 179 | values: [ 180 | Offset(0, 200), 181 | Offset(0, -50), 182 | Offset(0, 0), 183 | ], 184 | child: RaisedButton( 185 | onPressed: () { 186 | bloc.onDismissClicked(); 187 | }, 188 | child: Text("Dismiss"), 189 | ), 190 | 191 | ), 192 | ), 193 | ], 194 | ); 195 | } 196 | ); 197 | } 198 | } 199 | ``` 200 | 201 | # Rotation 202 | 203 | [![screen](https://raw.githubusercontent.com/florent37/AnimatedWidgets/master/medias/rotation.gif)](https://www.github.com/florent37/AnimatedWidgets) 204 | 205 | ```dart 206 | RotationAnimatedWidget.tween( 207 | enabled: enabled, 208 | rotationDisabled: Rotation.deg(), 209 | rotationEnabled: Rotation.deg(z: 90, x: 80), 210 | child: /* your widget */ 211 | ), 212 | 213 | RotationAnimatedWidget.tween( 214 | enabled: enabled, 215 | rotation: Rotation.deg(), 216 | rotationEnabled: Rotation.deg(z: 90, x: 80), 217 | child: /* your widget */ 218 | ), 219 | ``` 220 | 221 | # Scale 222 | 223 | ```dart 224 | ScaleAnimatedWidget.tween( 225 | enabled: this._enabled, 226 | duration: Duration(milliseconds: 600), 227 | scaleDisabled: 0.5, 228 | scaleEnabled: 1, 229 | 230 | //your widget 231 | child: Container( 232 | height: 200, 233 | width: 200, 234 | child: FlutterLogo( 235 | style: FlutterLogoStyle.stacked, 236 | ), 237 | ), 238 | ), 239 | ``` 240 | 241 | [![screen](https://raw.githubusercontent.com/florent37/AnimatedWidgets/master/medias/scale.gif)](https://www.github.com/florent37/AnimatedWidgets) 242 | 243 | # Size 244 | 245 | ```dart 246 | SizeAnimatedWidget( 247 | enabled: this._enabled, 248 | duration: Duration(milliseconds: 1500), 249 | values: [Size(100, 100), Size(100, 150), Size(200, 150), Size(200, 200)], 250 | curve: Curves.linear, 251 | 252 | //your widget 253 | child: Container( 254 | decoration: BoxDecoration( 255 | border: Border.all(color: Colors.blue) 256 | ), 257 | child: FlutterLogo( 258 | style: FlutterLogoStyle.stacked, 259 | ), 260 | ), 261 | ), 262 | ``` 263 | 264 | [![screen](https://raw.githubusercontent.com/florent37/AnimatedWidgets/master/medias/size.gif)](https://www.github.com/florent37/AnimatedWidgets) 265 | 266 | # Shake 267 | 268 | ```dart 269 | ShakeAnimatedWidget( 270 | enabled: this._enabled, 271 | duration: Duration(milliseconds: 1500), 272 | shakeAngle: Rotation.deg(z: 40), 273 | curve: Curves.linear, 274 | child: FlutterLogo( 275 | style: FlutterLogoStyle.stacked, 276 | ), 277 | ), 278 | ``` 279 | 280 | [![screen](https://raw.githubusercontent.com/florent37/AnimatedWidgets/master/medias/shake.gif)](https://www.github.com/florent37/AnimatedWidgets) 281 | 282 | # Custom Animated 283 | 284 | ```dart 285 | CustomAnimatedWidget( 286 | enabled: this._enabled, 287 | duration: Duration(seconds: 3), 288 | curve: Curves.easeOut, 289 | builder: (context, percent) { //for custom animation, use builders 290 | final int displayedDate = (2018 * percent).floor(); 291 | return Text( 292 | "current year : $displayedDate", 293 | style: TextStyle(color: Colors.blue), 294 | ); 295 | }, 296 | ), 297 | ``` 298 | 299 | [![screen](https://raw.githubusercontent.com/florent37/AnimatedWidgets/master/medias/custom.gif)](https://www.github.com/florent37/AnimatedWidgets) 300 | 301 | ## Flutter Package 302 | 303 | Animated widget is available at 304 | https://pub.dev/packages/animated_widgets 305 | 306 | ``` 307 | dependencies: 308 | animated_widgets: 309 | ``` 310 | 311 | ## Getting Started with Flutter 312 | 313 | For help getting started with Flutter, view our 314 | [online documentation](https://flutter.dev/docs), which offers tutorials, 315 | samples, guidance on mobile development, and a full API reference. 316 | 317 | # License 318 | 319 | Copyright 2019 florent37, Inc. 320 | 321 | Licensed under the Apache License, Version 2.0 (the "License"); 322 | you may not use this file except in compliance with the License. 323 | You may obtain a copy of the License at 324 | 325 | http://www.apache.org/licenses/LICENSE-2.0 326 | 327 | Unless required by applicable law or agreed to in writing, software 328 | distributed under the License is distributed on an "AS IS" BASIS, 329 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 330 | See the License for the specific language governing permissions and 331 | limitations under the License. -------------------------------------------------------------------------------- /animated_widgets.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 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 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /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: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # animated_widgets_example 2 | 3 | 4 | ``` 5 | class _MyScreenState extends State { 6 | 7 | bool enabled = false; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Stack( 12 | fit: StackFit.expand, 13 | children: [ 14 | Center( 15 | child: RaisedButton( 16 | onPressed: () { 17 | 18 | setState(() { 19 | enabled = !enabled; 20 | }); 21 | 22 | }, 23 | child: Text("animate"), 24 | ), 25 | ), 26 | Positioned( 27 | bottom: 20, 28 | left: 20, 29 | right: 20, 30 | child: TranslationAnimatedWidget( 31 | enabled: enabled, 32 | values: [Offset(0, 200), Offset(0, 0)], 33 | child: RaisedButton( 34 | onPressed: () {}, 35 | child: Text("Dismiss"), 36 | ), 37 | ), 38 | ), 39 | ], 40 | ); 41 | } 42 | } 43 | ``` -------------------------------------------------------------------------------- /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 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.github.florent37.animated_widgets_example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 67 | } 68 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/github/florent37/animated_widgets_example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.github.florent37.animated_widgets_example 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.2.71' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 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 | -------------------------------------------------------------------------------- /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-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/flutter_export_environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a generated file; do not edit or check into version control. 3 | export "FLUTTER_ROOT=/Users/florentchampigny/flutter/flutter-sdk" 4 | export "FLUTTER_APPLICATION_PATH=/Users/florentchampigny/android/AnimatedWidgets/example" 5 | export "FLUTTER_TARGET=lib/main.dart" 6 | export "FLUTTER_BUILD_DIR=build" 7 | export "SYMROOT=${SOURCE_ROOT}/../build/ios" 8 | export "OTHER_LDFLAGS=$(inherited) -framework Flutter" 9 | export "FLUTTER_FRAMEWORK_DIR=/Users/florentchampigny/flutter/flutter-sdk/bin/cache/artifacts/engine/ios" 10 | export "FLUTTER_BUILD_NAME=1.0.0" 11 | export "FLUTTER_BUILD_NUMBER=1" 12 | export "DART_OBFUSCATION=false" 13 | export "TRACK_WIDGET_CREATION=false" 14 | export "TREE_SHAKE_ICONS=false" 15 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | use_frameworks! 37 | 38 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 39 | # referring to absolute paths on developers' machines. 40 | system('rm -rf .symlinks') 41 | system('mkdir -p .symlinks/plugins') 42 | 43 | # Flutter Pods 44 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 45 | if generated_xcode_build_settings.empty? 46 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 47 | end 48 | generated_xcode_build_settings.map { |p| 49 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 50 | symlink = File.join('.symlinks', 'flutter') 51 | File.symlink(File.dirname(p[:path]), symlink) 52 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 53 | end 54 | } 55 | 56 | # Plugin Pods 57 | plugin_pods = parse_KV_file('../.flutter-plugins') 58 | plugin_pods.map { |p| 59 | symlink = File.join('.symlinks', 'plugins', p[:name]) 60 | File.symlink(p[:path], symlink) 61 | pod p[:name], :path => File.join(symlink, 'ios') 62 | } 63 | end 64 | 65 | post_install do |installer| 66 | installer.pods_project.targets.each do |target| 67 | target.build_configurations.each do |config| 68 | config.build_settings['ENABLE_BITCODE'] = 'NO' 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - animated_widgets (0.0.1): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | 6 | DEPENDENCIES: 7 | - animated_widgets (from `.symlinks/plugins/animated_widgets/ios`) 8 | - Flutter (from `.symlinks/flutter/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | animated_widgets: 12 | :path: ".symlinks/plugins/animated_widgets/ios" 13 | Flutter: 14 | :path: ".symlinks/flutter/ios" 15 | 16 | SPEC CHECKSUMS: 17 | animated_widgets: 8dc46f810cfbd2e77c4ab9b4c481bfd7be4c3fa2 18 | Flutter: 58dd7d1b27887414a370fcccb9e645c08ffd7a6a 19 | 20 | PODFILE CHECKSUM: ebd43b443038e611b86ede96e613bd6033c49497 21 | 22 | COCOAPODS: 1.6.1 23 | -------------------------------------------------------------------------------- /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 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 694F9E5E709D82F4B77410B1 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4139BF10F1B20D1BB956028D /* Pods_Runner.framework */; }; 15 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 16 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 17 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 18 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = ""; 29 | dstSubfolderSpec = 10; 30 | files = ( 31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 33 | ); 34 | name = "Embed Frameworks"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 42 | 2BDFD883019223CE7062B1E9 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 43 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 44 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 45 | 4139BF10F1B20D1BB956028D /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 47 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 48 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 49 | 843F21093028B2C75557447A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 50 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 51 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 52 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 53 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | BC018A344A85706F4957CD0F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 59 | /* End PBXFileReference section */ 60 | 61 | /* Begin PBXFrameworksBuildPhase section */ 62 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 67 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 68 | 694F9E5E709D82F4B77410B1 /* Pods_Runner.framework in Frameworks */, 69 | ); 70 | runOnlyForDeploymentPostprocessing = 0; 71 | }; 72 | /* End PBXFrameworksBuildPhase section */ 73 | 74 | /* Begin PBXGroup section */ 75 | 9740EEB11CF90186004384FC /* Flutter */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 3B80C3931E831B6300D905FE /* App.framework */, 79 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 80 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 81 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 82 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 83 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 84 | ); 85 | name = Flutter; 86 | sourceTree = ""; 87 | }; 88 | 97C146E51CF9000F007C117D = { 89 | isa = PBXGroup; 90 | children = ( 91 | 9740EEB11CF90186004384FC /* Flutter */, 92 | 97C146F01CF9000F007C117D /* Runner */, 93 | 97C146EF1CF9000F007C117D /* Products */, 94 | DAAF2776F88F25D10BE8300E /* Pods */, 95 | E0CABF561B7DCD55108D59A4 /* Frameworks */, 96 | ); 97 | sourceTree = ""; 98 | }; 99 | 97C146EF1CF9000F007C117D /* Products */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 97C146EE1CF9000F007C117D /* Runner.app */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | 97C146F01CF9000F007C117D /* Runner */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 111 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 112 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 113 | 97C147021CF9000F007C117D /* Info.plist */, 114 | 97C146F11CF9000F007C117D /* Supporting Files */, 115 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 116 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 117 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 118 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 119 | ); 120 | path = Runner; 121 | sourceTree = ""; 122 | }; 123 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | ); 127 | name = "Supporting Files"; 128 | sourceTree = ""; 129 | }; 130 | DAAF2776F88F25D10BE8300E /* Pods */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | BC018A344A85706F4957CD0F /* Pods-Runner.debug.xcconfig */, 134 | 2BDFD883019223CE7062B1E9 /* Pods-Runner.release.xcconfig */, 135 | 843F21093028B2C75557447A /* Pods-Runner.profile.xcconfig */, 136 | ); 137 | name = Pods; 138 | path = Pods; 139 | sourceTree = ""; 140 | }; 141 | E0CABF561B7DCD55108D59A4 /* Frameworks */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 4139BF10F1B20D1BB956028D /* Pods_Runner.framework */, 145 | ); 146 | name = Frameworks; 147 | sourceTree = ""; 148 | }; 149 | /* End PBXGroup section */ 150 | 151 | /* Begin PBXNativeTarget section */ 152 | 97C146ED1CF9000F007C117D /* Runner */ = { 153 | isa = PBXNativeTarget; 154 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 155 | buildPhases = ( 156 | D7FB034611D089B36539211B /* [CP] Check Pods Manifest.lock */, 157 | 9740EEB61CF901F6004384FC /* Run Script */, 158 | 97C146EA1CF9000F007C117D /* Sources */, 159 | 97C146EB1CF9000F007C117D /* Frameworks */, 160 | 97C146EC1CF9000F007C117D /* Resources */, 161 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 162 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 163 | C5120CBDF571EC05B27C4083 /* [CP] Embed Pods Frameworks */, 164 | ); 165 | buildRules = ( 166 | ); 167 | dependencies = ( 168 | ); 169 | name = Runner; 170 | productName = Runner; 171 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 172 | productType = "com.apple.product-type.application"; 173 | }; 174 | /* End PBXNativeTarget section */ 175 | 176 | /* Begin PBXProject section */ 177 | 97C146E61CF9000F007C117D /* Project object */ = { 178 | isa = PBXProject; 179 | attributes = { 180 | LastUpgradeCheck = 0910; 181 | ORGANIZATIONNAME = "The Chromium Authors"; 182 | TargetAttributes = { 183 | 97C146ED1CF9000F007C117D = { 184 | CreatedOnToolsVersion = 7.3.1; 185 | LastSwiftMigration = 0910; 186 | }; 187 | }; 188 | }; 189 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 190 | compatibilityVersion = "Xcode 3.2"; 191 | developmentRegion = English; 192 | hasScannedForEncodings = 0; 193 | knownRegions = ( 194 | en, 195 | Base, 196 | ); 197 | mainGroup = 97C146E51CF9000F007C117D; 198 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 199 | projectDirPath = ""; 200 | projectRoot = ""; 201 | targets = ( 202 | 97C146ED1CF9000F007C117D /* Runner */, 203 | ); 204 | }; 205 | /* End PBXProject section */ 206 | 207 | /* Begin PBXResourcesBuildPhase section */ 208 | 97C146EC1CF9000F007C117D /* Resources */ = { 209 | isa = PBXResourcesBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 213 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 214 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 215 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 216 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | /* End PBXResourcesBuildPhase section */ 221 | 222 | /* Begin PBXShellScriptBuildPhase section */ 223 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 224 | isa = PBXShellScriptBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | ); 228 | inputPaths = ( 229 | ); 230 | name = "Thin Binary"; 231 | outputPaths = ( 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | shellPath = /bin/sh; 235 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 236 | }; 237 | 9740EEB61CF901F6004384FC /* Run Script */ = { 238 | isa = PBXShellScriptBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | ); 242 | inputPaths = ( 243 | ); 244 | name = "Run Script"; 245 | outputPaths = ( 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | shellPath = /bin/sh; 249 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 250 | }; 251 | C5120CBDF571EC05B27C4083 /* [CP] Embed Pods Frameworks */ = { 252 | isa = PBXShellScriptBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | ); 256 | inputFileListPaths = ( 257 | ); 258 | inputPaths = ( 259 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", 260 | "${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework", 261 | "${BUILT_PRODUCTS_DIR}/animated_widgets/animated_widgets.framework", 262 | ); 263 | name = "[CP] Embed Pods Frameworks"; 264 | outputFileListPaths = ( 265 | ); 266 | outputPaths = ( 267 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", 268 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/animated_widgets.framework", 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | shellPath = /bin/sh; 272 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 273 | showEnvVarsInLog = 0; 274 | }; 275 | D7FB034611D089B36539211B /* [CP] Check Pods Manifest.lock */ = { 276 | isa = PBXShellScriptBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | ); 280 | inputFileListPaths = ( 281 | ); 282 | inputPaths = ( 283 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 284 | "${PODS_ROOT}/Manifest.lock", 285 | ); 286 | name = "[CP] Check Pods Manifest.lock"; 287 | outputFileListPaths = ( 288 | ); 289 | outputPaths = ( 290 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 291 | ); 292 | runOnlyForDeploymentPostprocessing = 0; 293 | shellPath = /bin/sh; 294 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 295 | showEnvVarsInLog = 0; 296 | }; 297 | /* End PBXShellScriptBuildPhase section */ 298 | 299 | /* Begin PBXSourcesBuildPhase section */ 300 | 97C146EA1CF9000F007C117D /* Sources */ = { 301 | isa = PBXSourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 305 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 306 | ); 307 | runOnlyForDeploymentPostprocessing = 0; 308 | }; 309 | /* End PBXSourcesBuildPhase section */ 310 | 311 | /* Begin PBXVariantGroup section */ 312 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 313 | isa = PBXVariantGroup; 314 | children = ( 315 | 97C146FB1CF9000F007C117D /* Base */, 316 | ); 317 | name = Main.storyboard; 318 | sourceTree = ""; 319 | }; 320 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 321 | isa = PBXVariantGroup; 322 | children = ( 323 | 97C147001CF9000F007C117D /* Base */, 324 | ); 325 | name = LaunchScreen.storyboard; 326 | sourceTree = ""; 327 | }; 328 | /* End PBXVariantGroup section */ 329 | 330 | /* Begin XCBuildConfiguration section */ 331 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 332 | isa = XCBuildConfiguration; 333 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 334 | buildSettings = { 335 | ALWAYS_SEARCH_USER_PATHS = NO; 336 | CLANG_ANALYZER_NONNULL = YES; 337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 338 | CLANG_CXX_LIBRARY = "libc++"; 339 | CLANG_ENABLE_MODULES = YES; 340 | CLANG_ENABLE_OBJC_ARC = YES; 341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_COMMA = YES; 344 | CLANG_WARN_CONSTANT_CONVERSION = YES; 345 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 346 | CLANG_WARN_EMPTY_BODY = YES; 347 | CLANG_WARN_ENUM_CONVERSION = YES; 348 | CLANG_WARN_INFINITE_RECURSION = YES; 349 | CLANG_WARN_INT_CONVERSION = YES; 350 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 351 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 353 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 354 | CLANG_WARN_STRICT_PROTOTYPES = YES; 355 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 356 | CLANG_WARN_UNREACHABLE_CODE = YES; 357 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 358 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 359 | COPY_PHASE_STRIP = NO; 360 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 361 | ENABLE_NS_ASSERTIONS = NO; 362 | ENABLE_STRICT_OBJC_MSGSEND = YES; 363 | GCC_C_LANGUAGE_STANDARD = gnu99; 364 | GCC_NO_COMMON_BLOCKS = YES; 365 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 366 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 367 | GCC_WARN_UNDECLARED_SELECTOR = YES; 368 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 369 | GCC_WARN_UNUSED_FUNCTION = YES; 370 | GCC_WARN_UNUSED_VARIABLE = YES; 371 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 372 | MTL_ENABLE_DEBUG_INFO = NO; 373 | SDKROOT = iphoneos; 374 | TARGETED_DEVICE_FAMILY = "1,2"; 375 | VALIDATE_PRODUCT = YES; 376 | }; 377 | name = Profile; 378 | }; 379 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 380 | isa = XCBuildConfiguration; 381 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 382 | buildSettings = { 383 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 384 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 385 | DEVELOPMENT_TEAM = S8QB4VV633; 386 | ENABLE_BITCODE = NO; 387 | FRAMEWORK_SEARCH_PATHS = ( 388 | "$(inherited)", 389 | "$(PROJECT_DIR)/Flutter", 390 | ); 391 | INFOPLIST_FILE = Runner/Info.plist; 392 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 393 | LIBRARY_SEARCH_PATHS = ( 394 | "$(inherited)", 395 | "$(PROJECT_DIR)/Flutter", 396 | ); 397 | PRODUCT_BUNDLE_IDENTIFIER = com.github.florent37.animatedWidgetsExample; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | SWIFT_VERSION = 4.0; 400 | VERSIONING_SYSTEM = "apple-generic"; 401 | }; 402 | name = Profile; 403 | }; 404 | 97C147031CF9000F007C117D /* Debug */ = { 405 | isa = XCBuildConfiguration; 406 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 407 | buildSettings = { 408 | ALWAYS_SEARCH_USER_PATHS = NO; 409 | CLANG_ANALYZER_NONNULL = YES; 410 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 411 | CLANG_CXX_LIBRARY = "libc++"; 412 | CLANG_ENABLE_MODULES = YES; 413 | CLANG_ENABLE_OBJC_ARC = YES; 414 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 415 | CLANG_WARN_BOOL_CONVERSION = YES; 416 | CLANG_WARN_COMMA = YES; 417 | CLANG_WARN_CONSTANT_CONVERSION = YES; 418 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 419 | CLANG_WARN_EMPTY_BODY = YES; 420 | CLANG_WARN_ENUM_CONVERSION = YES; 421 | CLANG_WARN_INFINITE_RECURSION = YES; 422 | CLANG_WARN_INT_CONVERSION = YES; 423 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 424 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 425 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 426 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 427 | CLANG_WARN_STRICT_PROTOTYPES = YES; 428 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 429 | CLANG_WARN_UNREACHABLE_CODE = YES; 430 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 431 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 432 | COPY_PHASE_STRIP = NO; 433 | DEBUG_INFORMATION_FORMAT = dwarf; 434 | ENABLE_STRICT_OBJC_MSGSEND = YES; 435 | ENABLE_TESTABILITY = YES; 436 | GCC_C_LANGUAGE_STANDARD = gnu99; 437 | GCC_DYNAMIC_NO_PIC = NO; 438 | GCC_NO_COMMON_BLOCKS = YES; 439 | GCC_OPTIMIZATION_LEVEL = 0; 440 | GCC_PREPROCESSOR_DEFINITIONS = ( 441 | "DEBUG=1", 442 | "$(inherited)", 443 | ); 444 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 445 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 446 | GCC_WARN_UNDECLARED_SELECTOR = YES; 447 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 448 | GCC_WARN_UNUSED_FUNCTION = YES; 449 | GCC_WARN_UNUSED_VARIABLE = YES; 450 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 451 | MTL_ENABLE_DEBUG_INFO = YES; 452 | ONLY_ACTIVE_ARCH = YES; 453 | SDKROOT = iphoneos; 454 | TARGETED_DEVICE_FAMILY = "1,2"; 455 | }; 456 | name = Debug; 457 | }; 458 | 97C147041CF9000F007C117D /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 461 | buildSettings = { 462 | ALWAYS_SEARCH_USER_PATHS = NO; 463 | CLANG_ANALYZER_NONNULL = YES; 464 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 465 | CLANG_CXX_LIBRARY = "libc++"; 466 | CLANG_ENABLE_MODULES = YES; 467 | CLANG_ENABLE_OBJC_ARC = YES; 468 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 469 | CLANG_WARN_BOOL_CONVERSION = YES; 470 | CLANG_WARN_COMMA = YES; 471 | CLANG_WARN_CONSTANT_CONVERSION = YES; 472 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 473 | CLANG_WARN_EMPTY_BODY = YES; 474 | CLANG_WARN_ENUM_CONVERSION = YES; 475 | CLANG_WARN_INFINITE_RECURSION = YES; 476 | CLANG_WARN_INT_CONVERSION = YES; 477 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 478 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 479 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 480 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 481 | CLANG_WARN_STRICT_PROTOTYPES = YES; 482 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 483 | CLANG_WARN_UNREACHABLE_CODE = YES; 484 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 485 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 486 | COPY_PHASE_STRIP = NO; 487 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 488 | ENABLE_NS_ASSERTIONS = NO; 489 | ENABLE_STRICT_OBJC_MSGSEND = YES; 490 | GCC_C_LANGUAGE_STANDARD = gnu99; 491 | GCC_NO_COMMON_BLOCKS = YES; 492 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 493 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 494 | GCC_WARN_UNDECLARED_SELECTOR = YES; 495 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 496 | GCC_WARN_UNUSED_FUNCTION = YES; 497 | GCC_WARN_UNUSED_VARIABLE = YES; 498 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 499 | MTL_ENABLE_DEBUG_INFO = NO; 500 | SDKROOT = iphoneos; 501 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 502 | TARGETED_DEVICE_FAMILY = "1,2"; 503 | VALIDATE_PRODUCT = YES; 504 | }; 505 | name = Release; 506 | }; 507 | 97C147061CF9000F007C117D /* Debug */ = { 508 | isa = XCBuildConfiguration; 509 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 510 | buildSettings = { 511 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 512 | CLANG_ENABLE_MODULES = YES; 513 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 514 | ENABLE_BITCODE = NO; 515 | FRAMEWORK_SEARCH_PATHS = ( 516 | "$(inherited)", 517 | "$(PROJECT_DIR)/Flutter", 518 | ); 519 | INFOPLIST_FILE = Runner/Info.plist; 520 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 521 | LIBRARY_SEARCH_PATHS = ( 522 | "$(inherited)", 523 | "$(PROJECT_DIR)/Flutter", 524 | ); 525 | PRODUCT_BUNDLE_IDENTIFIER = com.github.florent37.animatedWidgetsExample; 526 | PRODUCT_NAME = "$(TARGET_NAME)"; 527 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 528 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 529 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 530 | SWIFT_VERSION = 4.0; 531 | VERSIONING_SYSTEM = "apple-generic"; 532 | }; 533 | name = Debug; 534 | }; 535 | 97C147071CF9000F007C117D /* Release */ = { 536 | isa = XCBuildConfiguration; 537 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 538 | buildSettings = { 539 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 540 | CLANG_ENABLE_MODULES = YES; 541 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 542 | ENABLE_BITCODE = NO; 543 | FRAMEWORK_SEARCH_PATHS = ( 544 | "$(inherited)", 545 | "$(PROJECT_DIR)/Flutter", 546 | ); 547 | INFOPLIST_FILE = Runner/Info.plist; 548 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 549 | LIBRARY_SEARCH_PATHS = ( 550 | "$(inherited)", 551 | "$(PROJECT_DIR)/Flutter", 552 | ); 553 | PRODUCT_BUNDLE_IDENTIFIER = com.github.florent37.animatedWidgetsExample; 554 | PRODUCT_NAME = "$(TARGET_NAME)"; 555 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 556 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 557 | SWIFT_VERSION = 4.0; 558 | VERSIONING_SYSTEM = "apple-generic"; 559 | }; 560 | name = Release; 561 | }; 562 | /* End XCBuildConfiguration section */ 563 | 564 | /* Begin XCConfigurationList section */ 565 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 566 | isa = XCConfigurationList; 567 | buildConfigurations = ( 568 | 97C147031CF9000F007C117D /* Debug */, 569 | 97C147041CF9000F007C117D /* Release */, 570 | 249021D3217E4FDB00AE95B9 /* Profile */, 571 | ); 572 | defaultConfigurationIsVisible = 0; 573 | defaultConfigurationName = Release; 574 | }; 575 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 576 | isa = XCConfigurationList; 577 | buildConfigurations = ( 578 | 97C147061CF9000F007C117D /* Debug */, 579 | 97C147071CF9000F007C117D /* Release */, 580 | 249021D4217E4FDB00AE95B9 /* Profile */, 581 | ); 582 | defaultConfigurationIsVisible = 0; 583 | defaultConfigurationName = Release; 584 | }; 585 | /* End XCConfigurationList section */ 586 | }; 587 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 588 | } 589 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 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: [UIApplicationLaunchOptionsKey: 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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/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 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | animated_widgets_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /example/lib/bloc/first_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/animated_widgets.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | import 'first_screen_bloc.dart'; 5 | 6 | class FirstScreen extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return BlocProvider( 10 | creator: (_context, _bag) => FirstScreenBloc(), 11 | child: FirstScreenView(), 12 | ); 13 | } 14 | } 15 | 16 | class FirstScreenView extends StatelessWidget { 17 | @override 18 | Widget build(BuildContext context) { 19 | final bloc = BlocProvider.of(context); 20 | 21 | return Scaffold( 22 | appBar: AppBar(), 23 | body: StreamBuilder( 24 | stream: bloc.viewState, 25 | builder: (context, snapshot) { 26 | if(snapshot.hasData) { 27 | final viewState = snapshot.data; 28 | return Stack( 29 | fit: StackFit.expand, 30 | children: [ 31 | Positioned( 32 | bottom: 80, 33 | left: 0, 34 | right: 0, 35 | child: _buildInputButton(onClicked: () { 36 | bloc.onClicked(); 37 | }), 38 | ), 39 | Positioned( 40 | bottom: 20, 41 | left: 20, 42 | right: 20, 43 | child: TranslationAnimatedWidget( 44 | enabled: viewState.buttonVisible, 45 | curve: Curves.easeIn, 46 | duration: Duration(seconds: 1), 47 | values: [ 48 | Offset(0, 200), 49 | Offset(0, -50), 50 | Offset(0, 0), 51 | ], 52 | child: RaisedButton( 53 | elevation: 12, 54 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), 55 | color: Colors.white, 56 | onPressed: () { 57 | bloc.onDismissClicked(); 58 | }, 59 | child: Text("Dismiss"), 60 | ), 61 | ), 62 | ), 63 | ], 64 | ); 65 | } else { 66 | return Container(); 67 | } 68 | })); 69 | } 70 | 71 | Widget _buildInputButton({Function onClicked}) { 72 | return Center( 73 | child: RaisedButton( 74 | onPressed: (){ 75 | onClicked(); 76 | }, 77 | color: Colors.blue, 78 | child: Text( 79 | "animate", 80 | style: TextStyle(color: Colors.white), 81 | )), 82 | ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /example/lib/bloc/first_screen_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc_provider/bloc_provider.dart'; 2 | import 'package:rxdart/rxdart.dart'; 3 | 4 | export 'package:bloc_provider/bloc_provider.dart'; 5 | 6 | class FirstScreenViewState { 7 | final bool buttonVisible; 8 | 9 | const FirstScreenViewState({ 10 | this.buttonVisible = false, 11 | }); 12 | } 13 | 14 | class FirstScreenBloc extends Bloc { 15 | final _viewState = BehaviorSubject.seeded(FirstScreenViewState()); 16 | Observable get viewState => _viewState; 17 | 18 | FirstScreenBloc() { 19 | _viewState.add(FirstScreenViewState(buttonVisible: false)); 20 | } 21 | 22 | void onClicked() { 23 | _viewState.add(FirstScreenViewState(buttonVisible: true)); 24 | } 25 | 26 | void onDismissClicked() { 27 | _viewState.add(FirstScreenViewState(buttonVisible: false)); 28 | } 29 | 30 | @override 31 | void dispose() { 32 | _viewState.close(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /example/lib/complete/complete_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/animated_widgets.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class CompleteScreen extends StatefulWidget { 5 | @override 6 | _CompleteScreenState createState() => _CompleteScreenState(); 7 | } 8 | 9 | class _CompleteScreenState extends State { 10 | bool _enabled = false; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar(), 16 | body: Center( 17 | child: Column( 18 | mainAxisAlignment: MainAxisAlignment.center, 19 | crossAxisAlignment: CrossAxisAlignment.center, 20 | mainAxisSize: MainAxisSize.max, 21 | children: [ 22 | TranslationAnimatedWidget.tween( 23 | enabled: this._enabled, 24 | duration: Duration(milliseconds: 600), 25 | translationDisabled: Offset(2000, 0), 26 | translationEnabled: Offset(0, 0), 27 | child: OpacityAnimatedWidget.tween( 28 | enabled: this._enabled, 29 | opacityDisabled: 0, 30 | opacityEnabled: 1, 31 | duration: Duration(milliseconds: 1200), 32 | child: Container( 33 | height: 200, 34 | width: 200, 35 | child: FlutterLogo( 36 | style: FlutterLogoStyle.stacked, 37 | ), 38 | )), 39 | ), 40 | RaisedButton( 41 | color: Colors.blue, 42 | child: Text( 43 | _enabled ? "dismiss" : "display", 44 | style: TextStyle(color: Colors.white), 45 | ), 46 | onPressed: () { 47 | setState(() { 48 | _enabled = !_enabled; 49 | }); 50 | }, 51 | ) 52 | ], 53 | ), 54 | ), 55 | ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /example/lib/compose/compose_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/animated_widgets.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class ComposeScreen extends StatefulWidget { 5 | @override 6 | _ComposeScreenState createState() => _ComposeScreenState(); 7 | } 8 | 9 | class _ComposeScreenState extends State { 10 | bool _enabled = false; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar(), 16 | body: Center( 17 | child: Column( 18 | mainAxisAlignment: MainAxisAlignment.center, 19 | crossAxisAlignment: CrossAxisAlignment.center, 20 | mainAxisSize: MainAxisSize.max, 21 | children: [ 22 | TranslationAnimatedWidget.tween( 23 | enabled: this._enabled, 24 | duration: Duration(milliseconds: 600), 25 | translationDisabled: Offset(2000, 0), 26 | translationEnabled: Offset(0, 0), 27 | child: OpacityAnimatedWidget.tween( 28 | enabled: this._enabled, 29 | opacityDisabled: 0, 30 | opacityEnabled: 1, 31 | duration: Duration(milliseconds: 1200), 32 | child: Container( 33 | height: 200, 34 | width: 200, 35 | child: FlutterLogo( 36 | style: FlutterLogoStyle.stacked, 37 | ), 38 | )), 39 | ), 40 | RaisedButton( 41 | color: Colors.blue, 42 | child: Text( 43 | _enabled ? "dismiss" : "display", 44 | style: TextStyle(color: Colors.white), 45 | ), 46 | onPressed: () { 47 | setState(() { 48 | _enabled = !_enabled; 49 | }); 50 | }, 51 | ) 52 | ], 53 | ), 54 | ), 55 | ); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /example/lib/custom/custom_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/animated_widgets.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class CustomScreen extends StatefulWidget { 5 | @override 6 | _CustomScreenState createState() => _CustomScreenState(); 7 | } 8 | 9 | class _CustomScreenState extends State { 10 | bool _enabled = false; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar(), 16 | body: Center( 17 | child: Column( 18 | mainAxisAlignment: MainAxisAlignment.center, 19 | crossAxisAlignment: CrossAxisAlignment.center, 20 | mainAxisSize: MainAxisSize.max, 21 | children: [ 22 | CustomAnimatedWidget( 23 | enabled: this._enabled, 24 | duration: Duration(seconds: 3), 25 | curve: Curves.easeOut, 26 | builder: (context, percent) { 27 | final int displayedDate = (2018 * percent).floor(); 28 | return Container( 29 | padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4), 30 | decoration: BoxDecoration(border: Border.all(color: Colors.blue)), 31 | child: Text( 32 | "current year : $displayedDate", 33 | style: TextStyle(color: Colors.blue), 34 | )); 35 | }, 36 | ), 37 | RaisedButton( 38 | color: Colors.blue, 39 | child: Text( 40 | _enabled ? "reverse" : "forward", 41 | style: TextStyle(color: Colors.white), 42 | ), 43 | onPressed: () { 44 | setState(() { 45 | _enabled = !_enabled; 46 | }); 47 | }, 48 | ) 49 | ], 50 | ), 51 | ), 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets_example/bloc/first_screen.dart'; 2 | import 'package:animated_widgets_example/rotation/rotation_screen.dart'; 3 | import 'package:animated_widgets_example/scale/scale_screen.dart'; 4 | import 'package:animated_widgets_example/shake/shake_screen.dart'; 5 | import 'package:animated_widgets_example/size/size_screen.dart'; 6 | import 'package:animated_widgets_example/statefull/statefull_screen.dart'; 7 | import 'package:flutter/material.dart'; 8 | 9 | import 'complete/complete_screen.dart'; 10 | import 'compose/compose_screen.dart'; 11 | import 'custom/custom_screen.dart'; 12 | 13 | void main() => runApp(MaterialApp(home: MyApp())); 14 | 15 | class MyApp extends StatefulWidget { 16 | @override 17 | _MyAppState createState() => _MyAppState(); 18 | } 19 | 20 | class _MyAppState extends State { 21 | bool enabled = false; 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return Scaffold( 26 | appBar: AppBar( 27 | title: const Text('Plugin example app'), 28 | ), 29 | body: ListView( 30 | children: [ 31 | ListTile( 32 | title: Text("With Bloc"), 33 | onTap: () { 34 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => FirstScreen())); 35 | }, 36 | ), 37 | ListTile( 38 | title: Text("Stateless"), 39 | onTap: () { 40 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => StatefulScreen())); 41 | }, 42 | ), 43 | ListTile( 44 | title: Text("Rotation"), 45 | onTap: () { 46 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => RotationScreen())); 47 | }, 48 | ), 49 | ListTile( 50 | title: Text("Compose"), 51 | onTap: () { 52 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => ComposeScreen())); 53 | }, 54 | ), 55 | ListTile( 56 | title: Text("Scale"), 57 | onTap: () { 58 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => ScaleScreen())); 59 | }, 60 | ), 61 | ListTile( 62 | title: Text("Size"), 63 | onTap: () { 64 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => SizeScreen())); 65 | }, 66 | ), 67 | ListTile( 68 | title: Text("Custom"), 69 | onTap: () { 70 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => CustomScreen())); 71 | }, 72 | ), 73 | ListTile( 74 | title: Text("Shake"), 75 | onTap: () { 76 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => ShakeScreen())); 77 | }, 78 | ), 79 | ListTile( 80 | title: Text("Complete"), 81 | onTap: () { 82 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => CompleteScreen())); 83 | }, 84 | ) 85 | ], 86 | ), 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /example/lib/rotation/rotation_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/animated_widgets.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class RotationScreen extends StatefulWidget { 5 | @override 6 | _RotationScreenState createState() => _RotationScreenState(); 7 | } 8 | 9 | class _RotationScreenState extends State { 10 | bool _enabled = false; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar(), 16 | body: Center( 17 | child: Column( 18 | mainAxisAlignment: MainAxisAlignment.center, 19 | crossAxisAlignment: CrossAxisAlignment.center, 20 | mainAxisSize: MainAxisSize.max, 21 | children: [ 22 | RotationAnimatedWidget( 23 | values: [Rotation.deg(), Rotation.deg(z: 90, x: 80)], 24 | enabled: _enabled, 25 | curve: Curves.easeIn, 26 | child: Container( 27 | height: 200, 28 | width: 200, 29 | child: FlutterLogo( 30 | style: FlutterLogoStyle.markOnly, 31 | ), 32 | ), 33 | ), 34 | RaisedButton( 35 | color: Colors.blue, 36 | child: Text( 37 | "rotate", 38 | style: TextStyle(color: Colors.white), 39 | ), 40 | onPressed: () { 41 | setState(() { 42 | _enabled = !_enabled; 43 | }); 44 | }, 45 | ) 46 | ], 47 | ), 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /example/lib/scale/scale_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/animated_widgets.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class ScaleScreen extends StatefulWidget { 5 | @override 6 | _ScaleScreenState createState() => _ScaleScreenState(); 7 | } 8 | 9 | class _ScaleScreenState extends State { 10 | bool _enabled = false; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar(), 16 | body: Center( 17 | child: Column( 18 | mainAxisAlignment: MainAxisAlignment.center, 19 | crossAxisAlignment: CrossAxisAlignment.center, 20 | mainAxisSize: MainAxisSize.max, 21 | children: [ 22 | ScaleAnimatedWidget.tween( 23 | enabled: this._enabled, 24 | duration: Duration(milliseconds: 600), 25 | scaleDisabled: 0.5, 26 | scaleEnabled: 1, 27 | curve: Curves.linear, 28 | child: Container( 29 | height: 200, 30 | width: 200, 31 | child: FlutterLogo( 32 | style: FlutterLogoStyle.stacked, 33 | ), 34 | ), 35 | ), 36 | RaisedButton( 37 | color: Colors.blue, 38 | child: Text( 39 | _enabled ? "reverse" : "forward", 40 | style: TextStyle(color: Colors.white), 41 | ), 42 | onPressed: () { 43 | setState(() { 44 | _enabled = !_enabled; 45 | }); 46 | }, 47 | ) 48 | ], 49 | ), 50 | ), 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /example/lib/shake/shake_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/animated_widgets.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class ShakeScreen extends StatefulWidget { 5 | @override 6 | _ShakeScreenState createState() => _ShakeScreenState(); 7 | } 8 | 9 | class _ShakeScreenState extends State { 10 | bool _enabled = false; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar(), 16 | body: Center( 17 | child: Column( 18 | mainAxisAlignment: MainAxisAlignment.center, 19 | crossAxisAlignment: CrossAxisAlignment.center, 20 | mainAxisSize: MainAxisSize.max, 21 | children: [ 22 | ShakeAnimatedWidget( 23 | enabled: this._enabled, 24 | duration: Duration(milliseconds: 1500), 25 | shakeAngle: Rotation.deg(z: 10), 26 | curve: Curves.linear, 27 | child: Container( 28 | width: 200, 29 | height: 200, 30 | decoration: BoxDecoration( 31 | border: Border.all(color: Colors.blue) 32 | ), 33 | child: FlutterLogo( 34 | style: FlutterLogoStyle.stacked, 35 | ), 36 | ), 37 | ), 38 | RaisedButton( 39 | color: Colors.blue, 40 | child: Text( 41 | _enabled ? "pause" : "start", 42 | style: TextStyle(color: Colors.white), 43 | ), 44 | onPressed: () { 45 | setState(() { 46 | _enabled = !_enabled; 47 | }); 48 | }, 49 | ) 50 | ], 51 | ), 52 | ), 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /example/lib/size/size_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/animated_widgets.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class SizeScreen extends StatefulWidget { 5 | @override 6 | _SizeScreenState createState() => _SizeScreenState(); 7 | } 8 | 9 | class _SizeScreenState extends State { 10 | bool _enabled = false; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar(), 16 | body: Center( 17 | child: Column( 18 | mainAxisAlignment: MainAxisAlignment.center, 19 | crossAxisAlignment: CrossAxisAlignment.center, 20 | mainAxisSize: MainAxisSize.max, 21 | children: [ 22 | SizeAnimatedWidget( 23 | enabled: this._enabled, 24 | duration: Duration(milliseconds: 1500), 25 | values: [Size(100, 100), Size(100, 150), Size(200, 150), Size(200, 200)], 26 | curve: Curves.linear, 27 | child: Container( 28 | decoration: BoxDecoration( 29 | border: Border.all(color: Colors.blue) 30 | ), 31 | child: FlutterLogo( 32 | style: FlutterLogoStyle.stacked, 33 | ), 34 | ), 35 | ), 36 | RaisedButton( 37 | color: Colors.blue, 38 | child: Text( 39 | _enabled ? "reverse" : "forward", 40 | style: TextStyle(color: Colors.white), 41 | ), 42 | onPressed: () { 43 | setState(() { 44 | _enabled = !_enabled; 45 | }); 46 | }, 47 | ) 48 | ], 49 | ), 50 | ), 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /example/lib/statefull/statefull_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/animated_widgets.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class StatefulScreen extends StatefulWidget { 5 | @override 6 | _StatefulScreenState createState() => _StatefulScreenState(); 7 | } 8 | 9 | class _StatefulScreenState extends State { 10 | bool _display = false; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar(), 16 | body: Center( 17 | child: Column( 18 | crossAxisAlignment: CrossAxisAlignment.center, 19 | mainAxisAlignment: MainAxisAlignment.center, 20 | mainAxisSize: MainAxisSize.max, 21 | children: [ 22 | OpacityAnimatedWidget.tween( 23 | opacityEnabled: 1, 24 | opacityDisabled: 0, 25 | curve: Curves.easeIn, 26 | duration: Duration(milliseconds: 900), 27 | enabled: _display, 28 | child: Container( 29 | height: 200, 30 | width: 200, 31 | child: FlutterLogo( 32 | style: FlutterLogoStyle.stacked, 33 | ), 34 | ), 35 | ), 36 | RaisedButton( 37 | color: Colors.blue, 38 | child: Text( 39 | _display ? "hide logo" : "display logo", 40 | style: TextStyle(color: Colors.white), 41 | ), 42 | onPressed: () { 43 | setState(() { 44 | _display = !_display; 45 | }); 46 | }, 47 | ) 48 | ], 49 | ), 50 | ), 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | animated_widgets: 5 | dependency: "direct dev" 6 | description: 7 | path: ".." 8 | relative: true 9 | source: path 10 | version: "1.0.4" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.4.1" 18 | bloc_provider: 19 | dependency: "direct dev" 20 | description: 21 | name: bloc_provider 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "0.6.2+1" 25 | boolean_selector: 26 | dependency: transitive 27 | description: 28 | name: boolean_selector 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.0.0" 32 | charcode: 33 | dependency: transitive 34 | description: 35 | name: charcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.3" 39 | clock: 40 | dependency: transitive 41 | description: 42 | name: clock 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.0.1" 46 | collection: 47 | dependency: transitive 48 | description: 49 | name: collection 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.14.12" 53 | cupertino_icons: 54 | dependency: "direct main" 55 | description: 56 | name: cupertino_icons 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "0.1.2" 60 | fake_async: 61 | dependency: transitive 62 | description: 63 | name: fake_async 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "1.1.0" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_test: 73 | dependency: "direct dev" 74 | description: flutter 75 | source: sdk 76 | version: "0.0.0" 77 | matcher: 78 | dependency: transitive 79 | description: 80 | name: matcher 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "0.12.6" 84 | meta: 85 | dependency: transitive 86 | description: 87 | name: meta 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.1.8" 91 | path: 92 | dependency: transitive 93 | description: 94 | name: path 95 | url: "https://pub.dartlang.org" 96 | source: hosted 97 | version: "1.7.0" 98 | rxdart: 99 | dependency: "direct dev" 100 | description: 101 | name: rxdart 102 | url: "https://pub.dartlang.org" 103 | source: hosted 104 | version: "0.22.0" 105 | sky_engine: 106 | dependency: transitive 107 | description: flutter 108 | source: sdk 109 | version: "0.0.99" 110 | source_span: 111 | dependency: transitive 112 | description: 113 | name: source_span 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.7.0" 117 | stack_trace: 118 | dependency: transitive 119 | description: 120 | name: stack_trace 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.9.3" 124 | stream_channel: 125 | dependency: transitive 126 | description: 127 | name: stream_channel 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "2.0.0" 131 | string_scanner: 132 | dependency: transitive 133 | description: 134 | name: string_scanner 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.0.5" 138 | term_glyph: 139 | dependency: transitive 140 | description: 141 | name: term_glyph 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.1.0" 145 | test_api: 146 | dependency: transitive 147 | description: 148 | name: test_api 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "0.2.15" 152 | typed_data: 153 | dependency: transitive 154 | description: 155 | name: typed_data 156 | url: "https://pub.dartlang.org" 157 | source: hosted 158 | version: "1.1.6" 159 | vector_math: 160 | dependency: transitive 161 | description: 162 | name: vector_math 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "2.0.8" 166 | sdks: 167 | dart: ">=2.6.0 <3.0.0" 168 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: animated_widgets_example 2 | description: Demonstrates how to use the animated_widgets plugin. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: ">=2.1.0 <3.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | # The following adds the Cupertino Icons font to your application. 13 | # Use with the CupertinoIcons class for iOS style icons. 14 | cupertino_icons: ^0.1.2 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | 20 | animated_widgets: 21 | path: ../ 22 | 23 | rxdart: ^0.22.0 24 | bloc_provider: ^0.6.2+1 25 | 26 | # For information on the generic Dart part of this file, see the 27 | # following page: https://www.dartlang.org/tools/pub/pubspec 28 | 29 | # The following section is specific to Flutter. 30 | flutter: 31 | 32 | # The following line ensures that the Material Icons font is 33 | # included with your application, so that you can use the icons in 34 | # the material Icons class. 35 | uses-material-design: true 36 | 37 | # To add assets to your application, add an assets section, like this: 38 | # assets: 39 | # - images/a_dot_burr.jpeg 40 | # - images/a_dot_ham.jpeg 41 | 42 | # An image asset can refer to one or more resolution-specific "variants", see 43 | # https://flutter.dev/assets-and-images/#resolution-aware. 44 | 45 | # For details regarding adding assets from package dependencies, see 46 | # https://flutter.dev/assets-and-images/#from-packages 47 | 48 | # To add custom fonts to your application, add a fonts section here, 49 | # in this "flutter" section. Each entry in this list should have a 50 | # "family" key with the font family name, and a "fonts" key with a 51 | # list giving the asset and other descriptors for the font. For 52 | # example: 53 | # fonts: 54 | # - family: Schyler 55 | # fonts: 56 | # - asset: fonts/Schyler-Regular.ttf 57 | # - asset: fonts/Schyler-Italic.ttf 58 | # style: italic 59 | # - family: Trajan Pro 60 | # fonts: 61 | # - asset: fonts/TrajanPro.ttf 62 | # - asset: fonts/TrajanPro_Bold.ttf 63 | # weight: 700 64 | # 65 | # For details regarding fonts from package dependencies, 66 | # see https://flutter.dev/custom-fonts/#from-packages 67 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:animated_widgets_example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Verify Platform version', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that platform version is retrieved. 19 | expect( 20 | find.byWidgetPredicate( 21 | (Widget widget) => widget is Text && 22 | widget.data.startsWith('Running on:'), 23 | ), 24 | findsOneWidget, 25 | ); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /lib/animated_widgets.dart: -------------------------------------------------------------------------------- 1 | export "widgets/rotation_animated.dart"; 2 | export "widgets/scale_animated.dart"; 3 | export "widgets/translation_animated.dart"; 4 | export "widgets/opacity_animated.dart"; 5 | export "widgets/size_animated.dart"; 6 | export "widgets/custom_animated.dart"; 7 | export "widgets/shake_animated_widget.dart"; 8 | export "tap/tap_scale_animated.dart"; 9 | export "tap/tap_scale_animated.dart"; 10 | -------------------------------------------------------------------------------- /lib/core/chain_tweens.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/animation.dart'; 2 | 3 | TweenSequence chainTweens(List values) { 4 | if (values.length < 2) { 5 | return TweenSequence([]); 6 | } 7 | 8 | List> items = >[]; 9 | 10 | var lastValue = values[0]; 11 | for (int i = 1; i < values.length; ++i) { 12 | double newValue = values[i]; 13 | items.add(TweenSequenceItem(tween: Tween(begin: lastValue, end: newValue), weight: 1)); 14 | lastValue = newValue; 15 | } 16 | 17 | return TweenSequence(items); 18 | } 19 | -------------------------------------------------------------------------------- /lib/generated/i18n.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | // ignore_for_file: non_constant_identifier_names 7 | // ignore_for_file: camel_case_types 8 | // ignore_for_file: prefer_single_quotes 9 | 10 | // This file is automatically generated. DO NOT EDIT, all your changes would be lost. 11 | class S implements WidgetsLocalizations { 12 | const S(); 13 | 14 | static S? current; 15 | 16 | static const GeneratedLocalizationsDelegate delegate = GeneratedLocalizationsDelegate(); 17 | 18 | static S? of(BuildContext context) => Localizations.of(context, S); 19 | 20 | @override 21 | TextDirection get textDirection => TextDirection.ltr; 22 | } 23 | 24 | class $en extends S { 25 | const $en(); 26 | } 27 | 28 | class GeneratedLocalizationsDelegate extends LocalizationsDelegate { 29 | const GeneratedLocalizationsDelegate(); 30 | 31 | List get supportedLocales { 32 | return const [ 33 | Locale("en", ""), 34 | ]; 35 | } 36 | 37 | LocaleListResolutionCallback listResolution({Locale? fallback, bool withCountry = true}) { 38 | return (List? locales, Iterable supported) { 39 | if (locales == null || locales.isEmpty) { 40 | return fallback ?? supported.first; 41 | } else { 42 | return _resolve(locales.first, fallback, supported, withCountry); 43 | } 44 | }; 45 | } 46 | 47 | LocaleResolutionCallback resolution({Locale? fallback, bool withCountry = true}) { 48 | return (Locale? locale, Iterable supported) { 49 | return _resolve(locale, fallback, supported, withCountry); 50 | }; 51 | } 52 | 53 | @override 54 | Future load(Locale locale) { 55 | final String lang = getLang(locale)!; 56 | switch (lang) { 57 | case "en": 58 | S.current = const $en(); 59 | return SynchronousFuture(S.current); 60 | default: 61 | // NO-OP. 62 | } 63 | S.current = const S(); 64 | return SynchronousFuture(S.current); 65 | } 66 | 67 | @override 68 | bool isSupported(Locale locale) => _isSupported(locale, true); 69 | 70 | @override 71 | bool shouldReload(GeneratedLocalizationsDelegate old) => false; 72 | 73 | /// 74 | /// Internal method to resolve a locale from a list of locales. 75 | /// 76 | Locale _resolve(Locale? locale, Locale? fallback, Iterable supported, bool withCountry) { 77 | if (locale == null || !_isSupported(locale, withCountry)) { 78 | return fallback ?? supported.first; 79 | } 80 | 81 | final Locale languageLocale = Locale(locale.languageCode, ""); 82 | if (supported.contains(locale)) { 83 | return locale; 84 | } else if (supported.contains(languageLocale)) { 85 | return languageLocale; 86 | } else { 87 | final Locale fallbackLocale = fallback ?? supported.first; 88 | return fallbackLocale; 89 | } 90 | } 91 | 92 | /// 93 | /// Returns true if the specified locale is supported, false otherwise. 94 | /// 95 | bool _isSupported(Locale locale, bool withCountry) { 96 | if (locale != null) { 97 | for (Locale supportedLocale in supportedLocales) { 98 | // Language must always match both locales. 99 | if (supportedLocale.languageCode != locale.languageCode) { 100 | continue; 101 | } 102 | 103 | // If country code matches, return this locale. 104 | if (supportedLocale.countryCode == locale.countryCode) { 105 | return true; 106 | } 107 | 108 | // If no country requirement is requested, check if this locale has no country. 109 | if (true != withCountry && 110 | (supportedLocale.countryCode == null || supportedLocale.countryCode!.isEmpty)) { 111 | return true; 112 | } 113 | } 114 | } 115 | return false; 116 | } 117 | } 118 | 119 | String? getLang(Locale l) => 120 | l.countryCode != null && l.countryCode!.isEmpty ? l.languageCode : l.toString(); 121 | -------------------------------------------------------------------------------- /lib/tap/tap_scale_animated.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/core/chain_tweens.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class TapScaleAnimated extends StatefulWidget { 5 | final Widget? child; 6 | final Function onTap; 7 | final double scale; 8 | final Curve curve; 9 | final Duration duration; 10 | final HitTestBehavior behavior; 11 | 12 | TapScaleAnimated( 13 | {this.child, 14 | required this.onTap, 15 | this.scale = 0.9, 16 | this.behavior = HitTestBehavior.deferToChild, 17 | this.duration = const Duration(milliseconds: 240), 18 | this.curve = Curves.easeIn}); 19 | 20 | @override 21 | createState() => _State(); 22 | } 23 | 24 | class _State extends State 25 | with SingleTickerProviderStateMixin { 26 | AnimationController? _animationController; 27 | late Animation _animation; 28 | 29 | @override 30 | void initState() { 31 | super.initState(); 32 | _createAnimations(); 33 | } 34 | 35 | void _createAnimations() { 36 | _animationController?.dispose(); 37 | _animationController = AnimationController( 38 | vsync: this, 39 | duration: widget.duration, 40 | ); 41 | 42 | _animation = chainTweens([1.0, widget.scale]).animate( 43 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 44 | ) as Animation..addListener(() { 45 | setState(() {}); 46 | }); 47 | } 48 | 49 | @override 50 | void dispose() { 51 | _animationController!.dispose(); 52 | super.dispose(); 53 | } 54 | 55 | @override 56 | Widget build(BuildContext context) { 57 | return GestureDetector( 58 | behavior: this.widget.behavior, 59 | onTapDown: (details) { 60 | //print("onTapDown"); 61 | _animationController!.forward(); 62 | }, 63 | onTapUp: (details) async { 64 | //print("onTapUp"); 65 | 66 | await Future.delayed(Duration( 67 | milliseconds: (widget.duration.inMilliseconds * 0.9).floor())); 68 | _animationController!.reverse(); 69 | if (widget.onTap != null) { 70 | widget.onTap(); 71 | } 72 | }, 73 | child: Transform.scale( 74 | scale: _animation.value, 75 | child: widget.child, 76 | ), 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/widgets/custom_animated.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | typedef CustomBuilder = Widget Function(BuildContext context, double percent); 4 | 5 | class CustomAnimatedWidget extends StatefulWidget { 6 | final Duration duration; 7 | final Duration delay; 8 | final CustomBuilder builder; 9 | final bool enabled; 10 | final Curve curve; 11 | final Function(bool)? animationFinished; 12 | 13 | /// A custom animation using a builder 14 | /// 15 | /// duration : the duration of the animation, including intermediate values 16 | /// delay : the delay before the animation starts 17 | /// enabled : determine if the animation is stopped or fired 18 | /// curve : An easing curve, see [Curve] 19 | /// 20 | /// builder : called at each tick to provide the animated widget, giving the actual percentage (0.0 - 1.0) 21 | /// 22 | /// animationFinished : a callback called when the animation is finished 23 | CustomAnimatedWidget({ 24 | this.duration = const Duration(milliseconds: 500), 25 | required this.builder, 26 | this.enabled = true, 27 | this.delay = const Duration(), 28 | this.animationFinished, 29 | this.curve = Curves.linear, 30 | }); 31 | 32 | @override 33 | createState() => _CustomAnimatedWidget(); 34 | 35 | //except the boolean `enabled` 36 | bool isAnimationEqual(CustomAnimatedWidget other) => 37 | duration == other.duration && curve == other.curve && delay == other.delay; 38 | } 39 | 40 | class _CustomAnimatedWidget extends State with TickerProviderStateMixin { 41 | AnimationController? _animationController; 42 | late Animation _customAnim; 43 | 44 | @override 45 | void didUpdateWidget(CustomAnimatedWidget oldWidget) { 46 | super.didUpdateWidget(oldWidget); 47 | if (widget.isAnimationEqual(oldWidget)) { 48 | if (widget.enabled != oldWidget.enabled) { 49 | _updateAnimationState(); 50 | } 51 | } else { 52 | _createAnimations(); 53 | if (widget.enabled != oldWidget.enabled) { 54 | _updateAnimationState(); 55 | } 56 | } 57 | } 58 | 59 | void _updateAnimationState() async { 60 | if (widget.enabled) { 61 | await Future.delayed(widget.delay); 62 | _animationController!.forward(); 63 | } else { 64 | _animationController!.reverse(); 65 | } 66 | } 67 | 68 | void _createAnimations() { 69 | _animationController?.dispose(); 70 | _animationController = AnimationController(duration: widget.duration, vsync: this) 71 | ..addStatusListener((status) { 72 | if (widget.animationFinished != null) { 73 | widget.animationFinished!(widget.enabled); 74 | } 75 | }); 76 | 77 | _customAnim = Tween(begin: 0.0, end: 1.0).animate( 78 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 79 | )..addListener(() { 80 | setState(() {}); 81 | }); 82 | 83 | _updateAnimationState(); 84 | } 85 | 86 | @override 87 | void initState() { 88 | _createAnimations(); 89 | super.initState(); 90 | } 91 | 92 | @override 93 | Widget build(BuildContext context) { 94 | var percent = _customAnim.value; 95 | return widget.builder(context, percent); 96 | } 97 | 98 | @override 99 | void dispose() { 100 | _animationController!.dispose(); 101 | super.dispose(); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib/widgets/opacity_animated.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/core/chain_tweens.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class OpacityAnimatedWidget extends StatefulWidget { 6 | final Widget? child; 7 | final List _values; 8 | final bool enabled; 9 | final Duration duration; 10 | final Curve curve; 11 | final Duration delay; 12 | final Function(bool)? animationFinished; 13 | 14 | /// An opacity animation using 2-* values 15 | /// 16 | /// duration : the duration of the animation, including intermediate values 17 | /// delay : the delay before the animation starts 18 | /// enabled : determine if the animation is stopped or fired 19 | /// curve : An easing curve, see [Curve] 20 | /// 21 | /// values : list of double (between 1.0 and 0.0) used for the animation, 22 | /// - the first : will be the opacityDisabled value 23 | /// - intermediate values : intermediate values between opacityDisabled & opacityEnabled 24 | /// - the last : will be the opacityEnabled value 25 | /// 26 | /// animationFinished : a callback called when the animation is finished 27 | OpacityAnimatedWidget({ 28 | this.child, 29 | this.delay = const Duration(), 30 | this.curve = Curves.linear, 31 | this.duration = const Duration(seconds: 2), 32 | this.enabled = false, 33 | this.animationFinished, 34 | List values = const [0, 1], 35 | }) : this._values = values, 36 | assert(values.length > 1); 37 | 38 | /// An opacity animation using 2 values : enabled - disabled 39 | /// 40 | /// duration : the duration of the animation, including intermediate values 41 | /// delay : the delay before the animation starts 42 | /// enabled : determine if the animation is stopped or fired 43 | /// curve : An easing curve, see [Curve] 44 | /// 45 | /// opacityDisabled : the default value of the widget (between 1.0 and 0.0) 46 | /// opacityEnabled : the animated value of the widget (between 1.0 and 0.0) 47 | /// 48 | /// animationFinished : a callback called when the animation is finished 49 | OpacityAnimatedWidget.tween({ 50 | Duration duration = const Duration(milliseconds: 500), 51 | double opacityEnabled = 1, 52 | double opacityDisabled = 0, 53 | bool enabled = true, 54 | Function(bool)? animationFinished, 55 | Curve curve = Curves.linear, 56 | required Widget child, 57 | }) : this( 58 | duration: duration, 59 | enabled: enabled, 60 | curve: curve, 61 | child: child, 62 | animationFinished: animationFinished, 63 | values: [opacityDisabled, opacityEnabled]); 64 | 65 | List get values => _values; 66 | 67 | @override 68 | createState() => _State(); 69 | 70 | //except the boolean `enabled` 71 | bool isAnimationEqual(OpacityAnimatedWidget other) => 72 | listEquals(values, other.values) && 73 | duration == other.duration && 74 | curve == other.curve && 75 | delay == other.delay; 76 | } 77 | 78 | class _State extends State with TickerProviderStateMixin { 79 | AnimationController? _animationController; 80 | late Animation _animation; 81 | 82 | @override 83 | void initState() { 84 | super.initState(); 85 | _createAnimations(); 86 | _updateAnimationState(); 87 | } 88 | 89 | @override 90 | void didUpdateWidget(OpacityAnimatedWidget oldWidget) { 91 | super.didUpdateWidget(oldWidget); 92 | if (widget.isAnimationEqual(oldWidget)) { 93 | if (widget.enabled != oldWidget.enabled) { 94 | _updateAnimationState(); 95 | } 96 | } else { 97 | _createAnimations(); 98 | if (widget.enabled != oldWidget.enabled) { 99 | _updateAnimationState(); 100 | } 101 | } 102 | } 103 | 104 | void _updateAnimationState() async { 105 | if (widget.enabled) { 106 | await Future.delayed(widget.delay); 107 | _animationController!.forward(); 108 | } else { 109 | _animationController!.reverse(); 110 | } 111 | } 112 | 113 | void _createAnimations() { 114 | _animationController?.dispose(); 115 | _animationController = AnimationController( 116 | vsync: this, 117 | duration: widget.duration, 118 | )..addStatusListener((status) { 119 | if (status == AnimationStatus.completed) { 120 | if (widget.animationFinished != null) { 121 | widget.animationFinished!(widget.enabled); 122 | } 123 | } 124 | }); 125 | 126 | _animation = chainTweens(widget.values).animate( 127 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 128 | ) as Animation 129 | ..addListener(() { 130 | setState(() {}); 131 | }); 132 | } 133 | 134 | @override 135 | void dispose() { 136 | _animationController!.dispose(); 137 | super.dispose(); 138 | } 139 | 140 | @override 141 | Widget build(BuildContext context) { 142 | return Opacity( 143 | opacity: _animation.value, 144 | child: widget.child, 145 | ); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /lib/widgets/rotation_animated.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:animated_widgets/core/chain_tweens.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:vector_math/vector_math_64.dart'; 7 | 8 | class Rotation { 9 | final double x; 10 | final double y; 11 | final double z; 12 | 13 | const Rotation.radians({this.x = 0, this.y = 0, this.z = 0}); 14 | 15 | Rotation.deg({double x = 0, double y = 0, double z = 0}) 16 | : this.radians(x: radians(x), y: radians(y), z: radians(z)); 17 | 18 | @override 19 | bool operator ==(Object other) => 20 | identical(this, other) || 21 | other is Rotation && 22 | runtimeType == other.runtimeType && 23 | x == other.x && 24 | y == other.y && 25 | z == other.z; 26 | 27 | @override 28 | int get hashCode => x.hashCode ^ y.hashCode ^ z.hashCode; 29 | } 30 | 31 | class RotationAnimatedWidget extends StatefulWidget { 32 | final List _values; 33 | final Duration duration; 34 | final Duration delay; 35 | final bool enabled; 36 | final Widget child; 37 | final Curve curve; 38 | final Function(bool)? animationFinished; 39 | 40 | /// An rotation animation using 2-* values : enabled - disabled 41 | /// 42 | /// Rotations can be 43 | /// - in in radians or degrees 44 | /// - in axis X, Y, Z 45 | /// 46 | /// duration : the duration of the animation, including intermediate values 47 | /// delay : the delay before the animation starts 48 | /// enabled : determine if the animation is stopped or fired 49 | /// curve : An easing curve, see [Curve] 50 | /// 51 | /// values : list of [Rotation] (degrees or rad) used for the animation, 52 | /// - the first : will be the rotationDisabled value 53 | /// - intermediate values : intermediate values between rotationDisabled & rotationEnabled 54 | /// - the last : will be the rotationEnabled value 55 | /// 56 | /// animationFinished : a callback called when the animation is finished 57 | RotationAnimatedWidget({ 58 | this.duration = const Duration(milliseconds: 500), 59 | List values = const [Rotation.radians(), Rotation.radians(x: pi)], 60 | this.enabled = true, 61 | this.delay = const Duration(), 62 | this.animationFinished, 63 | this.curve = Curves.linear, 64 | required this.child, 65 | }) : this._values = values, 66 | assert(values.length > 1); 67 | 68 | /// An rotation animation using 2 values : enabled - disabled 69 | /// 70 | /// Rotations can be 71 | /// - in in radians or degrees 72 | /// - in axis X, Y, Z 73 | /// 74 | /// duration : the duration of the animation, including intermediate values 75 | /// delay : the delay before the animation starts 76 | /// enabled : determine if the animation is stopped or fired 77 | /// curve : An easing curve, see [Curve] 78 | /// 79 | /// rotationDisabled : the default value of the widget (see [Rotation]) 80 | /// rotationEnabled : the animated value of the widget (see [Rotation]) 81 | /// 82 | /// animationFinished : a callback called when the animation is finished 83 | RotationAnimatedWidget.tween({ 84 | Duration duration = const Duration(milliseconds: 500), 85 | Rotation rotationEnabled = const Rotation.radians(), 86 | Rotation rotationDisabled = const Rotation.radians(x: pi), 87 | bool enabled = true, 88 | Duration delay = const Duration(), 89 | Function(bool)? animationFinished, 90 | Curve curve = Curves.linear, 91 | required Widget child, 92 | }) : this( 93 | duration: duration, 94 | enabled: enabled, 95 | curve: curve, 96 | delay: delay, 97 | child: child, 98 | animationFinished: animationFinished, 99 | values: [rotationDisabled, rotationEnabled]); 100 | 101 | List get values => _values; 102 | 103 | @override 104 | createState() => _State(); 105 | 106 | //except the boolean `enabled` 107 | bool isAnimationEqual(RotationAnimatedWidget other) => 108 | listEquals(values, other.values) && 109 | duration == other.duration && 110 | curve == other.curve && 111 | delay == other.delay; 112 | } 113 | 114 | class _State extends State with TickerProviderStateMixin { 115 | AnimationController? _animationController; 116 | late Animation _rotationXAnim; 117 | late Animation _rotationYAnim; 118 | late Animation _rotationZAnim; 119 | 120 | @override 121 | void didUpdateWidget(RotationAnimatedWidget oldWidget) { 122 | super.didUpdateWidget(oldWidget); 123 | if (widget.isAnimationEqual(oldWidget)) { 124 | if (widget.enabled != oldWidget.enabled) { 125 | _updateAnimationState(); 126 | } 127 | } else { 128 | _createAnimations(); 129 | if (widget.enabled != oldWidget.enabled) { 130 | _updateAnimationState(); 131 | } 132 | } 133 | } 134 | 135 | void _updateAnimationState() async { 136 | if (widget.enabled) { 137 | await Future.delayed(widget.delay); 138 | _animationController!.forward(); 139 | } 140 | } 141 | 142 | void _createAnimations() { 143 | _animationController?.dispose(); 144 | _animationController = AnimationController(duration: widget.duration, vsync: this) 145 | ..addStatusListener((status) { 146 | if (widget.animationFinished != null) { 147 | widget.animationFinished!(widget.enabled); 148 | } 149 | }); 150 | 151 | _rotationXAnim = chainTweens(widget._values.map((it) => it.x).toList()).animate( 152 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 153 | ) as Animation 154 | ..addListener(() { 155 | setState(() {}); 156 | }); 157 | 158 | _rotationYAnim = chainTweens(widget._values.map((it) => it.y).toList()).animate( 159 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 160 | ) as Animation 161 | ..addListener(() { 162 | setState(() {}); 163 | }); 164 | 165 | _rotationZAnim = chainTweens(widget._values.map((it) => it.z).toList()).animate( 166 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 167 | ) as Animation 168 | ..addListener(() { 169 | setState(() {}); 170 | }); 171 | _updateAnimationState(); 172 | } 173 | 174 | @override 175 | void initState() { 176 | _createAnimations(); 177 | super.initState(); 178 | } 179 | 180 | @override 181 | Widget build(BuildContext context) { 182 | return Transform( 183 | alignment: Alignment.center, 184 | transform: Matrix4.identity() 185 | ..rotateX(_rotationXAnim.value) 186 | ..rotateY(_rotationYAnim.value) 187 | ..rotateZ(_rotationZAnim.value), 188 | child: widget.child, 189 | ); 190 | } 191 | 192 | @override 193 | void dispose() { 194 | _animationController!.dispose(); 195 | super.dispose(); 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /lib/widgets/scale_animated.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/core/chain_tweens.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class ScaleAnimatedWidget extends StatefulWidget { 6 | final Widget? child; 7 | final List _values; 8 | final bool enabled; 9 | final Duration duration; 10 | final Curve curve; 11 | final Duration delay; 12 | final Function(bool)? animationFinished; 13 | 14 | /// A scale animation using 2-* values 15 | /// 16 | /// duration : the duration of the animation, including intermediate values 17 | /// enabled : determine if the animation is stopped or fired 18 | /// curve : An easing curve, see [Curve] 19 | /// 20 | /// values : list of double used for the animation, 21 | /// - the first : will be the scaleDisabled value 22 | /// - intermediate values : intermediate values between scaleDisabled & scaleEnabled 23 | /// - the last : will be the scaleEnabled value 24 | /// 25 | /// animationFinished : a callback called when the animation is finished 26 | ScaleAnimatedWidget({ 27 | this.child, 28 | this.delay = const Duration(), 29 | this.curve = Curves.linear, 30 | this.duration = const Duration(seconds: 2), 31 | this.animationFinished, 32 | this.enabled = false, 33 | List values = const [0, 1], 34 | }) : this._values = values, 35 | assert(values.length > 1); 36 | 37 | /// An scale animation using 2 values : enabled - disabled 38 | /// 39 | /// duration : the duration of the animation, including intermediate values 40 | /// delay : the delay before the animation starts 41 | /// enabled : determine if the animation is stopped or fired 42 | /// curve : An easing curve, see [Curve] 43 | /// 44 | /// scaleDisabled : the default value of the widget 45 | /// scaleEnabled : the animated value of the widget 46 | /// 47 | /// animationFinished : a callback called when the animation is finished 48 | ScaleAnimatedWidget.tween({ 49 | Duration duration = const Duration(milliseconds: 500), 50 | double scaleEnabled = 1, 51 | double scaleDisabled = 0, 52 | bool enabled = true, 53 | Function(bool)? animationFinished, 54 | Curve curve = Curves.linear, 55 | required Widget child, 56 | }) : this( 57 | duration: duration, 58 | enabled: enabled, 59 | curve: curve, 60 | child: child, 61 | animationFinished: animationFinished, 62 | values: [scaleDisabled, scaleEnabled]); 63 | 64 | List get values => _values; 65 | 66 | @override 67 | createState() => _State(); 68 | 69 | //except the boolean `enabled` 70 | bool isAnimationEqual(ScaleAnimatedWidget other) => 71 | listEquals(values, other.values) && 72 | duration == other.duration && 73 | curve == other.curve && 74 | delay == other.delay; 75 | } 76 | 77 | class _State extends State with TickerProviderStateMixin { 78 | AnimationController? _animationController; 79 | late Animation _animation; 80 | 81 | @override 82 | void initState() { 83 | super.initState(); 84 | _createAnimations(); 85 | _updateAnimationState(); 86 | } 87 | 88 | @override 89 | void didUpdateWidget(ScaleAnimatedWidget oldWidget) { 90 | super.didUpdateWidget(oldWidget); 91 | if (widget.isAnimationEqual(oldWidget)) { 92 | if (widget.enabled != oldWidget.enabled) { 93 | _updateAnimationState(); 94 | } 95 | } else { 96 | _createAnimations(); 97 | if (widget.enabled != oldWidget.enabled) { 98 | _updateAnimationState(); 99 | } 100 | } 101 | } 102 | 103 | void _updateAnimationState() async { 104 | if (widget.enabled) { 105 | await Future.delayed(widget.delay); 106 | _animationController!.forward(); 107 | } else { 108 | _animationController!.reverse(); 109 | } 110 | } 111 | 112 | void _createAnimations() { 113 | _animationController?.dispose(); 114 | _animationController = AnimationController( 115 | vsync: this, 116 | duration: widget.duration, 117 | )..addStatusListener((status) { 118 | if (widget.animationFinished != null) { 119 | widget.animationFinished!(widget.enabled); 120 | } 121 | }); 122 | 123 | _animation = chainTweens(widget.values).animate( 124 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 125 | ) as Animation 126 | ..addListener(() { 127 | setState(() {}); 128 | }); 129 | } 130 | 131 | @override 132 | void dispose() { 133 | _animationController!.dispose(); 134 | super.dispose(); 135 | } 136 | 137 | @override 138 | Widget build(BuildContext context) { 139 | return Transform.scale( 140 | scale: _animation.value, 141 | child: widget.child, 142 | ); 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /lib/widgets/shake_animated_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/core/chain_tweens.dart'; 2 | import 'package:animated_widgets/widgets/rotation_animated.dart'; 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class ShakeAnimatedWidget extends StatefulWidget { 7 | final Duration duration; 8 | final Rotation shakeAngle; 9 | final bool enabled; 10 | final Widget child; 11 | final Curve curve; 12 | final Alignment alignment; 13 | 14 | /// A shake animation 15 | /// 16 | /// duration : the duration of the animation, including intermediate values 17 | /// enabled : determine if the animation is stopped or fired 18 | /// curve : An easing curve, see [Curve] 19 | /// alignment : The center of the shake 20 | /// 21 | /// shakeAngle : oscilate between 0, -shakeAngle, 0, shakeAngle, 0 22 | /// - can be in radians or degrees (see [Rotation]) 23 | /// 24 | /// animationFinished : a callback called when the animation is finished 25 | ShakeAnimatedWidget({ 26 | this.duration = const Duration(milliseconds: 2000), 27 | this.shakeAngle = const Rotation.radians(z: 0.015), 28 | this.curve = Curves.linear, 29 | this.enabled = true, 30 | this.alignment = Alignment.center, 31 | required this.child, 32 | }); 33 | 34 | @override 35 | createState() => _State(); 36 | 37 | //except the boolean `enabled` 38 | bool isAnimationEqual(ShakeAnimatedWidget other) => 39 | shakeAngle == other.shakeAngle && duration == other.duration && curve == other.curve; 40 | } 41 | 42 | class _State extends State with TickerProviderStateMixin { 43 | AnimationController? _animationController; 44 | late Animation _rotationXAnim; 45 | late Animation _rotationYAnim; 46 | late Animation _rotationZAnim; 47 | 48 | @override 49 | void didUpdateWidget(ShakeAnimatedWidget oldWidget) { 50 | super.didUpdateWidget(oldWidget); 51 | if (widget.isAnimationEqual(oldWidget)) { 52 | if (widget.enabled != oldWidget.enabled) { 53 | _updateAnimationState(); 54 | } 55 | } else { 56 | _createAnimations(); 57 | _updateAnimationState(); 58 | } 59 | } 60 | 61 | void _updateAnimationState() async { 62 | if (widget.enabled) { 63 | _animationController!.repeat(); 64 | } else { 65 | _animationController!.reset(); 66 | } 67 | } 68 | 69 | void _createAnimations() { 70 | _animationController?.stop(); 71 | _animationController?.dispose(); 72 | _animationController = AnimationController(duration: widget.duration, vsync: this) 73 | ..addStatusListener((status) { 74 | //restart 75 | if (status == AnimationStatus.completed) { 76 | _animationController!.forward(); 77 | } 78 | }); 79 | 80 | _rotationXAnim = 81 | chainTweens([0.0, widget.shakeAngle.x, 0.0, -widget.shakeAngle.x, 0.0]).animate( 82 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 83 | ) as Animation 84 | ..addListener(() { 85 | setState(() {}); 86 | }); 87 | 88 | _rotationYAnim = 89 | chainTweens([0.0, widget.shakeAngle.y, 0.0, -widget.shakeAngle.y, 0.0]).animate( 90 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 91 | ) as Animation 92 | ..addListener(() { 93 | setState(() {}); 94 | }); 95 | 96 | _rotationZAnim = 97 | chainTweens([0.0, widget.shakeAngle.z, 0.0, -widget.shakeAngle.z, 0.0]).animate( 98 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 99 | ) as Animation 100 | ..addListener(() { 101 | setState(() {}); 102 | }); 103 | } 104 | 105 | @override 106 | void initState() { 107 | _createAnimations(); 108 | _updateAnimationState(); 109 | super.initState(); 110 | } 111 | 112 | @override 113 | Widget build(BuildContext context) { 114 | return Transform( 115 | alignment: widget.alignment, 116 | transform: Matrix4.identity() 117 | ..rotateX(_rotationXAnim.value) 118 | ..rotateY(_rotationYAnim.value) 119 | ..rotateZ(_rotationZAnim.value), 120 | child: widget.child, 121 | ); 122 | } 123 | 124 | @override 125 | void dispose() { 126 | _animationController!.dispose(); 127 | super.dispose(); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /lib/widgets/size_animated.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/core/chain_tweens.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class SizeAnimatedWidget extends StatefulWidget { 6 | final Widget? child; 7 | final List _values; 8 | final bool enabled; 9 | final Duration duration; 10 | final Curve curve; 11 | final Duration delay; 12 | final Function(bool)? animationFinished; 13 | 14 | /// A size animation using 2-* values 15 | /// 16 | /// duration : the duration of the animation, including intermediate values 17 | /// delay : the delay before the animation starts 18 | /// enabled : determine if the animation is stopped or fired 19 | /// curve : An easing curve, see [Curve] 20 | /// 21 | /// values : list of double (between 1.0 and 0.0) used for the animation, 22 | /// - the first : will be the sizeDisabled value 23 | /// - intermediate values : intermediate values between sizeDisabled & sizeEnabled 24 | /// - the last : will be the sizeEnabled value 25 | /// 26 | /// animationFinished : a callback called when the animation is finished 27 | SizeAnimatedWidget({ 28 | this.child, 29 | this.delay = const Duration(), 30 | this.curve = Curves.linear, 31 | this.duration = const Duration(seconds: 2), 32 | this.enabled = false, 33 | this.animationFinished, 34 | List values = const [Size(0, 0), Size(100, 0)], 35 | }) : this._values = values, 36 | assert(values.length > 1); 37 | 38 | /// An size animation using 2 values : enabled - disabled 39 | /// 40 | /// duration : the duration of the animation, including intermediate values 41 | /// delay : the delay before the animation starts 42 | /// enabled : determine if the animation is stopped or fired 43 | /// curve : An easing curve, see [Curve] 44 | /// 45 | /// sizeDisabled : the default value of the widget 46 | /// sizeEnabled : the animated value of the widget 47 | /// 48 | /// animationFinished : a callback called when the animation is finished 49 | SizeAnimatedWidget.tween({ 50 | Duration duration = const Duration(milliseconds: 500), 51 | Duration delay = const Duration(milliseconds: 500), 52 | Size sizeEnabled = const Size(100, 100), 53 | Size sizeDisabled = const Size(0, 0), 54 | bool enabled = true, 55 | Function(bool)? animationFinished, 56 | Curve curve = Curves.linear, 57 | required Widget child, 58 | }) : this( 59 | duration: duration, 60 | enabled: enabled, 61 | curve: curve, 62 | child: child, 63 | delay: delay, 64 | animationFinished: animationFinished, 65 | values: [sizeDisabled, sizeEnabled], 66 | ); 67 | 68 | List get values => _values; 69 | 70 | @override 71 | createState() => _State(); 72 | 73 | //except the boolean `enabled` 74 | bool isAnimationEqual(SizeAnimatedWidget other) => 75 | listEquals(values, other.values) && 76 | duration == other.duration && 77 | curve == other.curve && 78 | delay == other.delay; 79 | } 80 | 81 | class _State extends State with TickerProviderStateMixin { 82 | AnimationController? _animationController; 83 | late Animation _animationWidth; 84 | late Animation _animationHeight; 85 | 86 | @override 87 | void initState() { 88 | super.initState(); 89 | _createAnimations(); 90 | _updateAnimationState(); 91 | } 92 | 93 | @override 94 | void didUpdateWidget(SizeAnimatedWidget oldWidget) { 95 | super.didUpdateWidget(oldWidget); 96 | if (widget.isAnimationEqual(oldWidget)) { 97 | if (widget.enabled != oldWidget.enabled) { 98 | _updateAnimationState(); 99 | } 100 | } else { 101 | _createAnimations(); 102 | if (widget.enabled != oldWidget.enabled) { 103 | _updateAnimationState(); 104 | } 105 | } 106 | } 107 | 108 | void _updateAnimationState() async { 109 | if (widget.enabled) { 110 | await Future.delayed(widget.delay); 111 | _animationController!.forward(); 112 | } else { 113 | _animationController!.reverse(); 114 | } 115 | } 116 | 117 | void _createAnimations() { 118 | _animationController?.dispose(); 119 | _animationController = AnimationController( 120 | vsync: this, 121 | duration: widget.duration, 122 | )..addStatusListener((status) { 123 | if (status == AnimationStatus.completed) { 124 | if (widget.animationFinished != null) { 125 | widget.animationFinished!(widget.enabled); 126 | } 127 | } 128 | }); 129 | 130 | _animationWidth = chainTweens(widget.values.map((it) => it.width).toList()).animate( 131 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 132 | ) as Animation 133 | ..addListener(() { 134 | setState(() {}); 135 | }); 136 | 137 | _animationHeight = chainTweens(widget.values.map((it) => it.height).toList()).animate( 138 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 139 | ) as Animation 140 | ..addListener(() { 141 | setState(() {}); 142 | }); 143 | } 144 | 145 | @override 146 | void dispose() { 147 | _animationController!.dispose(); 148 | super.dispose(); 149 | } 150 | 151 | @override 152 | Widget build(BuildContext context) { 153 | return Container( 154 | width: _animationWidth.value, 155 | height: _animationHeight.value, 156 | child: widget.child, 157 | ); 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /lib/widgets/translation_animated.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_widgets/core/chain_tweens.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class TranslationAnimatedWidget extends StatefulWidget { 6 | final List _values; 7 | final Duration duration; 8 | final Duration delay; 9 | final bool enabled; 10 | final Curve curve; 11 | final Widget child; 12 | final Function(bool)? animationFinished; 13 | 14 | /// An translation animation using 2 values : enabled - disabled 15 | /// 16 | /// duration : the duration of the animation, including intermediate values 17 | /// delay : the delay before the animation starts 18 | /// enabled : determine if the animation is stopped or fired 19 | /// curve : An easing curve, see [Curve] 20 | /// 21 | /// translationDisabled : the default value of the widget 22 | /// translationEnabled : the animated value of the widget 23 | /// 24 | /// animationFinished : a callback called when the animation is finished 25 | TranslationAnimatedWidget.tween({ 26 | Duration duration = const Duration(milliseconds: 500), 27 | Duration delay = const Duration(), 28 | Offset translationDisabled = const Offset(0, 200), 29 | Offset translationEnabled = const Offset(0, 0), 30 | bool enabled = true, 31 | Function(bool)? animationFinished, 32 | Curve curve = Curves.linear, 33 | required Widget child, 34 | }) : this( 35 | duration: duration, 36 | enabled: enabled, 37 | curve: curve, 38 | delay: delay, 39 | child: child, 40 | animationFinished: animationFinished, 41 | values: [translationDisabled, translationEnabled], 42 | ); 43 | 44 | /// An translation animation using 2-* values 45 | /// 46 | /// duration : the duration of the animation, including intermediate values 47 | /// delay : the delay before the animation starts 48 | /// enabled : determine if the animation is stopped or fired 49 | /// curve : An easing curve, see [Curve] 50 | /// 51 | /// values : list of [Offset] used for the animation, 52 | /// - the first : will be the translationDisabled value 53 | /// - intermediate values : intermediate values between translationDisabled & translationEnabled 54 | /// - the last : will be the translationEnabled value 55 | /// 56 | /// animationFinished : a callback called when the animation is finished 57 | TranslationAnimatedWidget({ 58 | this.duration = const Duration(milliseconds: 500), 59 | this.delay = const Duration(), 60 | List values = const [Offset(0, 0), Offset(0, 200)], 61 | this.enabled = true, 62 | this.curve = Curves.linear, 63 | this.animationFinished, 64 | required this.child, 65 | }) : this._values = values, 66 | assert(values.length > 1); 67 | 68 | List get values => _values; 69 | 70 | @override 71 | createState() => _State(); 72 | 73 | //except the boolean `enabled` 74 | bool isAnimationEqual(TranslationAnimatedWidget other) => 75 | listEquals(values, other.values) && 76 | duration == other.duration && 77 | curve == other.curve && 78 | delay == other.delay; 79 | } 80 | 81 | class _State extends State with TickerProviderStateMixin { 82 | AnimationController? _animationController; 83 | late Animation _translationXAnim; 84 | late Animation _translationYAnim; 85 | 86 | @override 87 | void didUpdateWidget(TranslationAnimatedWidget oldWidget) { 88 | super.didUpdateWidget(oldWidget); 89 | if (widget.isAnimationEqual(oldWidget)) { 90 | if (widget.enabled != oldWidget.enabled) { 91 | _updateAnimationState(); 92 | } 93 | } else { 94 | _createAnimations(); 95 | if (widget.enabled != oldWidget.enabled) { 96 | _updateAnimationState(); 97 | } 98 | } 99 | } 100 | 101 | void _updateAnimationState() async { 102 | if (widget.enabled) { 103 | await Future.delayed(widget.delay); 104 | _animationController!.forward(); 105 | } else { 106 | _animationController!.reverse(); 107 | } 108 | } 109 | 110 | void _createAnimations() { 111 | _animationController?.dispose(); 112 | _animationController = AnimationController( 113 | duration: widget.duration, 114 | vsync: this, 115 | )..addStatusListener((status) { 116 | if (widget.animationFinished != null) { 117 | widget.animationFinished!(widget.enabled); 118 | } 119 | }); 120 | 121 | _translationXAnim = chainTweens( 122 | widget.values.map((it) => it.dx).toList(), 123 | ).animate( 124 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 125 | ) as Animation 126 | ..addListener(() { 127 | setState(() {}); 128 | }); 129 | 130 | _translationYAnim = chainTweens( 131 | widget.values.map((it) => it.dy).toList(), 132 | ).animate( 133 | CurvedAnimation(parent: _animationController!, curve: widget.curve), 134 | ) as Animation 135 | ..addListener(() { 136 | setState(() {}); 137 | }); 138 | 139 | _updateAnimationState(); 140 | } 141 | 142 | @override 143 | void initState() { 144 | _createAnimations(); 145 | super.initState(); 146 | } 147 | 148 | @override 149 | Widget build(BuildContext context) { 150 | return Transform.translate( 151 | offset: Offset(_translationXAnim.value, _translationYAnim.value), 152 | child: widget.child, 153 | ); 154 | } 155 | 156 | @override 157 | void dispose() { 158 | _animationController!.dispose(); 159 | super.dispose(); 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /medias/compose.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/medias/compose.gif -------------------------------------------------------------------------------- /medias/custom.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/medias/custom.gif -------------------------------------------------------------------------------- /medias/opacity.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/medias/opacity.gif -------------------------------------------------------------------------------- /medias/rotation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/medias/rotation.gif -------------------------------------------------------------------------------- /medias/scale.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/medias/scale.gif -------------------------------------------------------------------------------- /medias/shake.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/medias/shake.gif -------------------------------------------------------------------------------- /medias/size.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/medias/size.gif -------------------------------------------------------------------------------- /medias/translation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/medias/translation.gif -------------------------------------------------------------------------------- /publish.sh: -------------------------------------------------------------------------------- 1 | flutter format lib/ 2 | flutter format lib/generated/ 3 | flutter pub pub publish -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.5.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.2.0" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.2.0" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_test: 59 | dependency: "direct dev" 60 | description: flutter 61 | source: sdk 62 | version: "0.0.0" 63 | matcher: 64 | dependency: transitive 65 | description: 66 | name: matcher 67 | url: "https://pub.dartlang.org" 68 | source: hosted 69 | version: "0.12.10" 70 | meta: 71 | dependency: transitive 72 | description: 73 | name: meta 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "1.3.0" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.8.0" 84 | sky_engine: 85 | dependency: transitive 86 | description: flutter 87 | source: sdk 88 | version: "0.0.99" 89 | source_span: 90 | dependency: transitive 91 | description: 92 | name: source_span 93 | url: "https://pub.dartlang.org" 94 | source: hosted 95 | version: "1.8.0" 96 | stack_trace: 97 | dependency: transitive 98 | description: 99 | name: stack_trace 100 | url: "https://pub.dartlang.org" 101 | source: hosted 102 | version: "1.10.0" 103 | stream_channel: 104 | dependency: transitive 105 | description: 106 | name: stream_channel 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "2.1.0" 110 | string_scanner: 111 | dependency: transitive 112 | description: 113 | name: string_scanner 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.1.0" 117 | term_glyph: 118 | dependency: transitive 119 | description: 120 | name: term_glyph 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.2.0" 124 | test_api: 125 | dependency: transitive 126 | description: 127 | name: test_api 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "0.2.19" 131 | typed_data: 132 | dependency: transitive 133 | description: 134 | name: typed_data 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "1.3.0" 138 | vector_math: 139 | dependency: "direct main" 140 | description: 141 | name: vector_math 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "2.1.0" 145 | sdks: 146 | dart: ">=2.12.0 <3.0.0" 147 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: animated_widgets 2 | description: Easily add animations on your screen with AnimatedWidgets. Add always your animated widgets in your component's tree, then activate them when you want to activate the animations. 3 | version: 1.1.0 4 | authors: [ 5 | Florent Champigny 6 | ] 7 | homepage: https://github.com/florent37/AnimatedWidgets 8 | 9 | environment: 10 | sdk: '>=2.12.0 <3.0.0' 11 | 12 | dependencies: 13 | flutter: 14 | sdk: flutter 15 | vector_math: ^2.0.8 16 | 17 | dev_dependencies: 18 | flutter_test: 19 | sdk: flutter 20 | 21 | flutter: -------------------------------------------------------------------------------- /res/values/strings_en.arb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/florent37/AnimatedWidgets/772ab2879bd3d0a1ad31b13524ccb3dfcd39a8b0/res/values/strings_en.arb -------------------------------------------------------------------------------- /test/animated_widgets_test.dart: -------------------------------------------------------------------------------- 1 | void main() { 2 | 3 | } 4 | --------------------------------------------------------------------------------