diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 5b80310..62be7ea 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,17 +1,26 @@ <component name="libraryTable"> <library name="Dart SDK"> <CLASSES> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/async" /> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/collection" /> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/convert" /> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/core" /> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/developer" /> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/html" /> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/io" /> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/isolate" /> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/math" /> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/mirrors" /> - <root url="file://C:/FlutterSDK/flutter/bin/cache/dart-sdk/lib/typed_data" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/async" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/cli" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/collection" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/convert" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/core" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/developer" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/ffi" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/html" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/indexed_db" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/io" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/isolate" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/js" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/js_util" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/math" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/mirrors" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/svg" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/typed_data" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/web_audio" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/web_gl" /> + <root url="file://$USER_HOME$/flutter/bin/cache/dart-sdk/lib/web_sql" /> </CLASSES> <JAVADOC /> <SOURCES /> diff --git a/.idea/misc.xml b/.idea/misc.xml index dfda312..ceac72e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> + <component name="FrameworkDetectionExcludesConfiguration"> + <type id="android" /> + </component> <component name="ProjectRootManager" version="2" project-jdk-name="Android API 22 Platform" project-jdk-type="Android SDK" /> </project> \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project version="4"> + <component name="VcsDirectoryMappings"> + <mapping directory="$PROJECT_DIR$" vcs="Git" /> + </component> +</project> \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 27ff514..1ef5e0d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,123 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> + <component name="AutoImportSettings"> + <option name="autoReloadType" value="NONE" /> + </component> <component name="ChangeListManager"> - <list default="true" id="e74a2927-7388-47e1-97da-e8502d16f57d" name="Default Changelist" comment="" /> - <ignored path="$PROJECT_DIR$/.dart_tool/" /> - <ignored path="$PROJECT_DIR$/.idea/" /> - <ignored path="$PROJECT_DIR$/.pub/" /> - <ignored path="$PROJECT_DIR$/build/" /> - <ignored path="$PROJECT_DIR$/example/.pub/" /> - <ignored path="$PROJECT_DIR$/example/build/" /> - <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> + <list default="true" id="e74a2927-7388-47e1-97da-e8502d16f57d" name="Default Changelist" comment=""> + <change beforePath="$PROJECT_DIR$/.idea/libraries/Dart_SDK.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/libraries/Dart_SDK.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/.idea/libraries/Flutter_Plugins.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/libraries/Flutter_Plugins.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/example/ios/Flutter/Debug.xcconfig" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/Flutter/Debug.xcconfig" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/example/ios/Flutter/Release.xcconfig" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/Flutter/Release.xcconfig" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/example/ios/Flutter/flutter_export_environment.sh" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/Flutter/flutter_export_environment.sh" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/example/pubspec.lock" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.lock" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/lib/animation_set.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/animation_set.dart" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/lib/animator.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/animator.dart" afterDir="false" /> + <change beforePath="$PROJECT_DIR$/pubspec.lock" beforeDir="false" /> + <change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" /> + </list> <option name="SHOW_DIALOG" value="false" /> <option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="LAST_RESOLUTION" value="IGNORE" /> </component> - <component name="FUSProjectUsageTrigger"> - <session id="2141976321"> - <usages-collector id="statistics.lifecycle.project"> - <counts> - <entry key="project.closed" value="2" /> - <entry key="project.open.time.2" value="1" /> - <entry key="project.open.time.3" value="1" /> - <entry key="project.open.time.7" value="1" /> - <entry key="project.open.time.8" value="1" /> - <entry key="project.opened" value="4" /> - </counts> - </usages-collector> - <usages-collector id="statistics.file.extensions.open"> - <counts> - <entry key="LICENSE" value="2" /> - <entry key="dart" value="37" /> - <entry key="md" value="12" /> - <entry key="yaml" value="5" /> - </counts> - </usages-collector> - <usages-collector id="statistics.file.types.open"> - <counts> - <entry key="Dart" value="37" /> - <entry key="PLAIN_TEXT" value="14" /> - <entry key="YAML" value="5" /> - </counts> - </usages-collector> - <usages-collector id="statistics.file.extensions.edit"> - <counts> - <entry key="dart" value="2553" /> - <entry key="md" value="1906" /> - <entry key="txt" value="30" /> - <entry key="yaml" value="65" /> - </counts> - </usages-collector> - <usages-collector id="statistics.file.types.edit"> - <counts> - <entry key="Dart" value="2553" /> - <entry key="PLAIN_TEXT" value="1936" /> - <entry key="YAML" value="65" /> - </counts> - </usages-collector> - </session> - <session id="14751324"> - <usages-collector id="statistics.lifecycle.project"> - <counts> - <entry key="project.closed" value="1" /> - </counts> - </usages-collector> - </session> - </component> - <component name="FileEditorManager"> - <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> - <file pinned="false" current-in-tab="true"> - <entry file="file://$PROJECT_DIR$/lib/animation_set.dart"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1179"> - <caret line="141" selection-start-line="141" selection-end-line="141" /> - <folding> - <element signature="e#0#39#0" expanded="true" /> - </folding> - </state> - </provider> - </entry> - </file> - <file pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/lib/widget/transition_animations.dart"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="21"> - <caret line="543" selection-start-line="543" selection-end-line="544" /> - <folding> - <element signature="e#0#27#0" expanded="true" /> - <element signature="e#704#2308#0" /> - <element signature="e#2347#2770#0" /> - <element signature="e#3221#6884#0" /> - <element signature="e#16879#24169#0" /> - </folding> - </state> - </provider> - </entry> - </file> - <file pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/example/lib/main.dart"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="945"> - <caret line="64" column="35" selection-start-line="64" selection-start-column="35" selection-end-line="64" selection-end-column="35" /> - <folding> - <element signature="e#0#39#0" expanded="true" /> - </folding> - </state> - </provider> - </entry> - </file> - <file pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/lib/widget/behavior_animations.dart"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="461"> - <caret line="119" column="30" selection-start-line="119" selection-start-column="30" selection-end-line="119" selection-end-column="30" /> - </state> - </provider> - </entry> - </file> - </leaf> - </component> + <component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[/Users/gim/.android/avd/Pixel_2_API_Q.avd]" /> <component name="FileTemplateManagerImpl"> <option name="RECENT_TEMPLATES"> <list> @@ -187,6 +93,7 @@ <option name="width" value="1936" /> <option name="height" value="1056" /> </component> + <component name="ProjectId" id="1sZUKaRS1xWoGlolXjvCDKrUsTp" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true"> <ConfirmationsSetting value="2" id="Add" /> </component> @@ -245,6 +152,10 @@ <pane id="AndroidView" /> </panes> </component> + <component name="ProjectViewState"> + <option name="hideEmptyMiddlePackages" value="true" /> + <option name="showLibraryContents" value="true" /> + </component> <component name="PropertiesComponent"> <property name="SearchEverywhereHistoryKey" value="YYPulse 	null	null" /> <property name="dart.analysis.tool.window.force.activate" value="false" /> @@ -264,18 +175,7 @@ <recent name="C:\YYLive3\flutter_animation_set\image\gif" /> </key> </component> - <component name="RunDashboard"> - <option name="ruleStates"> - <list> - <RuleState> - <option name="name" value="ConfigurationTypeDashboardGroupingRule" /> - </RuleState> - <RuleState> - <option name="name" value="StatusDashboardGroupingRule" /> - </RuleState> - </list> - </option> - </component> + <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> <component name="SvnConfiguration"> <configuration /> </component> diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies new file mode 100644 index 0000000..88a3752 --- /dev/null +++ b/example/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_animation_set","path":"/Users/gim/Repos/pr/flutter-animation-set/","dependencies":[]}],"android":[{"name":"flutter_animation_set","path":"/Users/gim/Repos/pr/flutter-animation-set/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_animation_set","dependencies":[]}],"date_created":"2021-05-15 14:52:29.882785","version":"2.0.6"} \ No newline at end of file diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig index 592ceee..ec97fc6 100644 --- a/example/ios/Flutter/Debug.xcconfig +++ b/example/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Flutter/Release.xcconfig b/example/ios/Flutter/Release.xcconfig index 592ceee..c4855bf 100644 --- a/example/ios/Flutter/Release.xcconfig +++ b/example/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh old mode 100644 new mode 100755 index 905cfae..98cbafe --- a/example/ios/Flutter/flutter_export_environment.sh +++ b/example/ios/Flutter/flutter_export_environment.sh @@ -1,8 +1,13 @@ #!/bin/sh # This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=C:\FlutterSDK\flutter" -export "FLUTTER_APPLICATION_PATH=C:\YYLive4-OpenSource\flutter_animation_set\example" -export "FLUTTER_TARGET=lib\main.dart" +export "FLUTTER_ROOT=/Users/gim/flutter" +export "FLUTTER_APPLICATION_PATH=/Users/gim/Repos/pr/flutter-animation-set/example" +export "FLUTTER_TARGET=lib/main.dart" export "FLUTTER_BUILD_DIR=build" -export "SYMROOT=${SOURCE_ROOT}/../build\ios" -export "FLUTTER_FRAMEWORK_DIR=C:\FlutterSDK\flutter\bin\cache\artifacts\engine\ios" +export "SYMROOT=${SOURCE_ROOT}/../build/ios" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/example/ios/Podfile b/example/ios/Podfile new file mode 100644 index 0000000..f7d6a5e --- /dev/null +++ b/example/ios/Podfile @@ -0,0 +1,38 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/example/pubspec.lock b/example/pubspec.lock index 6ea7394..f2099b8 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,28 +7,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: @@ -36,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -47,7 +68,7 @@ packages: path: ".." relative: true source: path - version: "0.0.3" + version: "0.0.4" flutter_test: dependency: "direct dev" description: flutter @@ -59,35 +80,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.7" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0+1" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -99,55 +106,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" diff --git a/lib/animation_set.dart b/lib/animation_set.dart index 946227f..28f8484 100644 --- a/lib/animation_set.dart +++ b/lib/animation_set.dart @@ -12,21 +12,20 @@ enum AnimationType { } class AnimatorSet extends StatefulWidget { - AnimatorSet({ - Key key, - this.debug = false, - this.child, - this.animatorSet = const <Animator>[], - this.animationType = AnimationType.repeat, - }) : assert(child != null), - assert(animatorSet != null), - super(key: key); final bool debug; final Widget child; final List<Animator> animatorSet; final AnimationType animationType; + AnimatorSet({ + Key? key, + this.debug = false, + required this.child, + this.animatorSet = const <Animator>[], + this.animationType = AnimationType.repeat, + }) : super(key: key); + @override State<StatefulWidget> createState() { return AnimatorSetState(); @@ -36,8 +35,8 @@ class AnimatorSet extends StatefulWidget { class AnimatorSetState extends State<AnimatorSet> with SingleTickerProviderStateMixin { int _duration = 0; //时间 - AnimationController _controller; - AnimationType _animationType; + late AnimationController _controller; + late AnimationType _animationType; @override void initState() { @@ -101,40 +100,41 @@ class AnimatedLogo extends StatelessWidget { ///opacityNotify:监听透明度变化,将正在变化的动画值作为opacityValue ///opacity:透明度动画集合 ///opacityValue:最终显示的透明度 - List<ValueNotifier<double>> opacityNotify = List()..length = 16; - List<Animation<double>> opacity = List()..length = 16; - double opacityValue; - - Animation<double> width; - Animation<double> height; - Animation<EdgeInsets> padding; - Animation<BorderRadius> borderRadius; - Animation<Color> color; - List<Animation<double>> scaleX = [null, null, null, null]; - List<Animation<double>> scaleY = [null, null, null, null]; - List<Animation<double>> rotateX = [null, null, null, null]; - List<Animation<double>> rotateY = [null, null, null, null]; - List<Animation<double>> rotateZ = [null, null, null, null]; - List<Animation<double>> transX = [null, null, null, null]; - List<Animation<double>> transY = [null, null, null, null]; + List<ValueNotifier<double>?> opacityNotify = []..length = 16; + List<Animation<double>?> opacity = []..length = 16; + late double opacityValue; + + Animation<double>? width; + Animation<double>? height; + Animation<EdgeInsets>? padding; + Animation<BorderRadius>? borderRadius; + Animation<Color?>? color; + List<Animation<double>?> scaleX = [null, null, null, null]; + List<Animation<double>?> scaleY = [null, null, null, null]; + List<Animation<double>?> rotateX = [null, null, null, null]; + List<Animation<double>?> rotateY = [null, null, null, null]; + List<Animation<double>?> rotateZ = [null, null, null, null]; + List<Animation<double>?> transX = [null, null, null, null]; + List<Animation<double>?> transY = [null, null, null, null]; + + final bool debug; + final Widget? child; + final Animation<double> controller; + final List<Animator> animatorSet; + final int duration; AnimatedLogo({ - Key key, - this.debug, + Key? key, + this.debug = false, this.child, - this.controller, - this.animatorSet, - this.duration, + required this.controller, + required this.animatorSet, + required this.duration, }) : super(key: key) { this._parseAnimation(); this._initOpacityListener(); } - final bool debug; - final Widget child; - final Animation<double> controller; - final List<Animator> animatorSet; - final int duration; ///解析交错动画 void _parseAnimation() { @@ -185,12 +185,9 @@ class AnimatedLogo extends StatelessWidget { ///默认的透明度,以第一个透明度动画的初始值为准 opacityValue = opacity[0]?.value ?? 1.0; for (int i = 0; i < opacityNotify.length; i++) { - if (opacityNotify[i] != null) { - ///监听透明度变化 - opacityNotify[i].addListener(() { - opacityValue = opacity[i].value; - }); - } + opacityNotify[i]?.addListener(() { + opacityValue = opacity[i]!.value; + }); } } @@ -202,7 +199,7 @@ class AnimatedLogo extends StatelessWidget { ); } - Widget _buildAnimationWidget(BuildContext context, Widget child) { + Widget _buildAnimationWidget(BuildContext context, Widget? child) { return Container( padding: padding?.value ?? EdgeInsets.all(0), // 内边距动画 child: Transform( @@ -277,7 +274,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); @@ -291,7 +288,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); @@ -305,14 +302,14 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); } else if (anim is O) { for (int i = 0; i < opacity.length; i++) { if (opacity[i] == null) { - opacityNotify[i] = ValueNotifier(anim.from); + opacityNotify[i] = ValueNotifier(anim.from!); opacity[i] = Tween<double>( begin: anim.from, end: anim.to, @@ -322,13 +319,13 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), )..addListener(() { ///由于在播放完成后会回到初始值,需要过滤掉 - if (opacity[i].value != anim.from) { - opacityNotify[i].value = opacity[i].value; + if (opacity[i]!.value != anim.from) { + opacityNotify[i]!.value = opacity[i]!.value; } }); break; @@ -346,7 +343,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); @@ -365,7 +362,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); @@ -384,7 +381,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); @@ -403,7 +400,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); @@ -422,7 +419,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); @@ -441,7 +438,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); @@ -460,7 +457,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); @@ -477,7 +474,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); @@ -491,7 +488,7 @@ class AnimatedLogo extends StatelessWidget { curve: Interval( start, end, - curve: anim.curve, + curve: anim.curve!, ), ), ); diff --git a/lib/animator.dart b/lib/animator.dart index 284a89f..53db2f0 100644 --- a/lib/animator.dart +++ b/lib/animator.dart @@ -3,28 +3,35 @@ import 'package:flutter/material.dart'; export 'package:flutter_animation_set/animator.dart'; abstract class Animator<T> { - T from; - T to; - int duration; - int delay; - Curve curve; + T? from; + T? to; + late int duration; + late int delay; + Curve? curve; } class Serial extends Animator { + + int duration; + int delay; + List<Animator> serialList; + Serial({ this.duration = 0, - /// 无效,用Delay组件替代 this.delay = 0, this.serialList = const <Animator>[], }); +} + +class W extends Animator<double> { + double? from; + double? to; int duration; int delay; - List<Animator> serialList; -} + Curve? curve; -class W extends Animator<double> { W({ this.from, this.to, @@ -32,15 +39,16 @@ class W extends Animator<double> { this.delay = 0, this.curve = Curves.linear, }); +} + +class H extends Animator<double> { - double from; - double to; + double? from; + double? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class H extends Animator<double> { H({ this.from, this.to, @@ -48,15 +56,15 @@ class H extends Animator<double> { this.delay = 0, this.curve = Curves.linear, }); +} - double from; - double to; +class P extends Animator<EdgeInsets> { + EdgeInsets? from; + EdgeInsets? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class P extends Animator<EdgeInsets> { P({ this.from, this.to, @@ -64,15 +72,16 @@ class P extends Animator<EdgeInsets> { this.delay = 0, this.curve = Curves.linear, }); +} + +class O extends Animator<double> { - EdgeInsets from; - EdgeInsets to; + double? from; + double? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class O extends Animator<double> { O({ this.from, this.to, @@ -80,15 +89,16 @@ class O extends Animator<double> { this.delay = 0, this.curve = Curves.linear, }); +} + +class SX extends Animator<double> { - double from; - double to; + double? from; + double? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class SX extends Animator<double> { SX({ this.from, this.to, @@ -96,15 +106,16 @@ class SX extends Animator<double> { this.delay = 0, this.curve = Curves.linear, }); +} + +class SY extends Animator<double> { - double from; - double to; + double? from; + double? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class SY extends Animator<double> { SY({ this.from, this.to, @@ -112,15 +123,16 @@ class SY extends Animator<double> { this.delay = 0, this.curve = Curves.linear, }); +} + +class RX extends Animator<double> { - double from; - double to; + double? from; + double? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class RX extends Animator<double> { RX({ this.from, this.to, @@ -128,15 +140,15 @@ class RX extends Animator<double> { this.delay = 0, this.curve = Curves.linear, }); +} - double from; - double to; +class RY extends Animator<double> { + double? from; + double? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class RY extends Animator<double> { RY({ this.from, this.to, @@ -144,15 +156,16 @@ class RY extends Animator<double> { this.delay = 0, this.curve = Curves.linear, }); +} - double from; - double to; +class RZ extends Animator<double> { + + double? from; + double? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class RZ extends Animator<double> { RZ({ this.from, this.to, @@ -160,15 +173,16 @@ class RZ extends Animator<double> { this.delay = 0, this.curve = Curves.linear, }); +} - double from; - double to; +class TX extends Animator<double> { + + double? from; + double? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class TX extends Animator<double> { TX({ this.from, this.to, @@ -176,15 +190,16 @@ class TX extends Animator<double> { this.delay = 0, this.curve = Curves.linear, }); +} - double from; - double to; +class TY extends Animator<double> { + + double? from; + double? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class TY extends Animator<double> { TY({ this.from, this.to, @@ -192,15 +207,16 @@ class TY extends Animator<double> { this.delay = 0, this.curve = Curves.linear, }); +} - double from; - double to; +class C extends Animator<Color> { + + Color? from; + Color? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class C extends Animator<Color> { C({ this.from, this.to, @@ -208,15 +224,16 @@ class C extends Animator<Color> { this.delay = 0, this.curve = Curves.linear, }); +} - Color from; - Color to; +class B extends Animator<BorderRadius> { + + BorderRadius? from; + BorderRadius? to; int duration; int delay; - Curve curve; -} + Curve? curve; -class B extends Animator<BorderRadius> { B({ this.from, this.to, @@ -224,22 +241,16 @@ class B extends Animator<BorderRadius> { this.delay = 0, this.curve = Curves.linear, }); +} + +class Delay extends Animator { - BorderRadius from; - BorderRadius to; int duration; int delay; - Curve curve; -} -class Delay extends Animator { Delay({ this.duration = 0, - /// 无效 this.delay = 0, }); - - int duration; - int delay; } diff --git a/pubspec.lock b/pubspec.lock index 7642229..19e8f69 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,28 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -45,35 +66,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.7.0" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.3" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -85,55 +92,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 655d2ec..439bc86 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,8 @@ author: AndroidHensen <xyj510402535@qq.com> homepage: https://github.com/efoxTeam/flutter-animation-set environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" + flutter: ">=2.0.0" dependencies: flutter: