diff --git a/README.md b/README.md index 81ab7aa..108c83c 100644 --- a/README.md +++ b/README.md @@ -225,6 +225,7 @@ Blob.animatedRandom( size:200, edgesCount:5, minGrowth:4, + animationCurve:Curves.easeInOutCubic, duration: Duration(milliseconds:500), ), diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index ce8d879..d856f66 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 5b1cb62..f21bb78 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,7 @@ additional functionality it is fine to subclass or reimplement FlutterApplication and put your custom class here. --> =2.12.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=1.20.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index fe08f26..9f37156 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -21,6 +21,7 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: + platform: ^3.1.0 flutter: sdk: flutter blobs: diff --git a/lib/src/services/blob_animator.dart b/lib/src/services/blob_animator.dart index e3a1257..b585639 100644 --- a/lib/src/services/blob_animator.dart +++ b/lib/src/services/blob_animator.dart @@ -5,13 +5,14 @@ class BlobAnimator { AnimationController animationController; List> tweens = []; List> anims = []; + final Curve? animationCurve; - BlobAnimator({required this.pathPoints, required this.animationController}); + BlobAnimator({required this.pathPoints, required this.animationController, this.animationCurve = Curves.linear}); init(Function(List) callback) { Animation animation = CurvedAnimation( parent: animationController, - curve: Curves.linear, + curve: animationCurve!, ); pathPoints.asMap().forEach((i, p) { tweens.insert(i, []); diff --git a/lib/src/widgets/animated_blob.dart b/lib/src/widgets/animated_blob.dart index 9546be8..b537075 100644 --- a/lib/src/widgets/animated_blob.dart +++ b/lib/src/widgets/animated_blob.dart @@ -15,6 +15,7 @@ class AnimatedBlob extends StatefulWidget { final Duration? duration; final BlobData? fromBlobData; final BlobData toBlobData; + final Curve? animationCurve; const AnimatedBlob({ this.size = 200, @@ -26,6 +27,7 @@ class AnimatedBlob extends StatefulWidget { this.id, this.duration, this.child, + this.animationCurve }); @override @@ -51,7 +53,8 @@ class _AnimatedBlobState extends State AnimationController(duration: widget.duration, vsync: this); animator = BlobAnimator( animationController: _animationController, - pathPoints: widget.toBlobData.points!.destPoints!); + pathPoints: widget.toBlobData.points!.destPoints!, + animationCurve: widget.animationCurve); animator.init((o) { setState(() { data = BlobGenerator( diff --git a/lib/src/widgets/blob.dart b/lib/src/widgets/blob.dart index a009184..4e93bb5 100644 --- a/lib/src/widgets/blob.dart +++ b/lib/src/widgets/blob.dart @@ -20,6 +20,7 @@ class Blob extends StatefulWidget { final Duration? duration; final bool loop; final bool isAnimated; + final Curve? animationCurve; static int count = 0; @@ -34,7 +35,8 @@ class Blob extends StatefulWidget { }) : loop = false, id = null, duration = null, - isAnimated = false; + isAnimated = false, + animationCurve = null; Blob.animatedRandom({ required this.size, this.edgesCount = BlobConfig.edgesCount, @@ -47,6 +49,7 @@ class Blob extends StatefulWidget { this.loop = false, this.controller, this.child, + this.animationCurve = Curves.easeInOutCubic, }) : isAnimated = true, id = null; @@ -61,7 +64,8 @@ class Blob extends StatefulWidget { edgesCount = null, minGrowth = null, duration = null, - isAnimated = false; + isAnimated = false, + animationCurve = null; Blob.animatedFromID({ required this.id, @@ -74,6 +78,7 @@ class Blob extends StatefulWidget { this.loop = false, this.controller, this.child, + this.animationCurve = Curves.easeInOutCubic, }) : isAnimated = true, edgesCount = null, minGrowth = null; @@ -136,6 +141,7 @@ class _BlobState extends State { debug: widget.debug, duration: widget.duration, child: widget.child, + animationCurve: widget.animationCurve, ); } diff --git a/pubspec.lock b/pubspec.lock index 5b3fb9d..58f338f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -21,14 +21,14 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" clock: dependency: transitive description: @@ -42,14 +42,14 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" flutter: dependency: "direct main" description: flutter @@ -66,28 +66,35 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" pedantic: dependency: "direct dev" description: name: pedantic url: "https://pub.dartlang.org" source: hosted - version: "1.11.0" + version: "1.11.1" sky_engine: dependency: transitive description: flutter @@ -99,7 +106,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -134,21 +141,14 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.9" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=0.2.5"