From f377fd187f53fd79f615fb79bbf48da5ecd12ddd Mon Sep 17 00:00:00 2001 From: Binozo <70137898+Binozo@users.noreply.github.com> Date: Fri, 19 Aug 2022 17:46:20 +0200 Subject: [PATCH 1/6] finished migration to Flutter v2 embedding --- example/android/app/build.gradle | 2 +- example/android/app/src/main/AndroidManifest.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index ce8d879..d44c920 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 29 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. --> <application - android:name="io.flutter.app.FlutterApplication" + android:name="${applicationName}" android:label="demo" android:icon="@mipmap/ic_launcher"> <activity From ace6e55c8dd08c448ea0719855fafe1b84a0a8da Mon Sep 17 00:00:00 2001 From: Binozo <70137898+Binozo@users.noreply.github.com> Date: Fri, 19 Aug 2022 18:04:20 +0200 Subject: [PATCH 2/6] upgraded gradle and flutter --- example/android/app/build.gradle | 2 +- example/android/build.gradle | 8 ++++---- example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- example/pubspec.yaml | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index d44c920..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 29 + compileSdkVersion 31 sourceSets { main.java.srcDirs += 'src/main/kotlin' diff --git a/example/android/build.gradle b/example/android/build.gradle index 3100ad2..83ae220 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.6.10' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:7.1.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -14,7 +14,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } } diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 296b146..595fb86 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip 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: From 32f0b5fc4ceb040e70197cfe06e3f2855c2d2f15 Mon Sep 17 00:00:00 2001 From: Binozo <70137898+Binozo@users.noreply.github.com> Date: Fri, 19 Aug 2022 18:04:35 +0200 Subject: [PATCH 3/6] upgraded packages --- example/pubspec.lock | 35 +++++++++++++++++++++-------------- pubspec.lock | 40 ++++++++++++++++++++-------------------- 2 files changed, 41 insertions(+), 34 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index a575457..03bec9c 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.8.2" blobs: dependency: "direct main" description: @@ -28,14 +28,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: @@ -49,7 +49,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" crypto: dependency: transitive description: @@ -70,7 +70,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" ffi: dependency: transitive description: @@ -122,21 +122,28 @@ 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" path_provider: dependency: transitive description: @@ -180,12 +187,12 @@ packages: source: hosted version: "1.11.0" platform: - dependency: transitive + dependency: "direct main" description: name: platform url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: @@ -211,7 +218,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: @@ -246,7 +253,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.4.9" typed_data: dependency: transitive description: @@ -260,7 +267,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" win32: dependency: transitive description: @@ -276,5 +283,5 @@ packages: source: hosted version: "0.2.0" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=1.20.0" 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" From 134fee8f0d1cd06d0ed3728c231baa1854e749db Mon Sep 17 00:00:00 2001 From: Binozo <70137898+Binozo@users.noreply.github.com> Date: Fri, 19 Aug 2022 18:23:36 +0200 Subject: [PATCH 4/6] added functionality to change animation curve --- lib/src/services/blob_animator.dart | 5 +++-- lib/src/widgets/animated_blob.dart | 5 ++++- lib/src/widgets/blob.dart | 10 ++++++++-- 3 files changed, 15 insertions(+), 5 deletions(-) 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<List<Tween>> tweens = []; List<List<Animation>> 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<Offset>) callback) { Animation<double> 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<AnimatedBlob> 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<Blob> { debug: widget.debug, duration: widget.duration, child: widget.child, + animationCurve: widget.animationCurve, ); } From afd6d7225aa7a4da0b32ccbd2f0af7bbd4d60ead Mon Sep 17 00:00:00 2001 From: Binozo <70137898+Binozo@users.noreply.github.com> Date: Fri, 19 Aug 2022 18:23:49 +0200 Subject: [PATCH 5/6] updated animation example --- README.md | 1 + example/lib/examples/animated/annimated_loop.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 81ab7aa..5de3090 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,7 @@ Blob.animatedRandom( size:200, edgesCount:5, minGrowth:4, + animationCurve:Curves.easeInOutCubic, loop: true, ), diff --git a/example/lib/examples/animated/annimated_loop.dart b/example/lib/examples/animated/annimated_loop.dart index 3bc08a8..45b05cb 100644 --- a/example/lib/examples/animated/annimated_loop.dart +++ b/example/lib/examples/animated/annimated_loop.dart @@ -19,6 +19,7 @@ class AnimatedLoopExample extends StatelessWidget { loop: true, edgesCount: 6, minGrowth: 7, + animationCurve: Curves.easeInOutCubic, duration: Duration(milliseconds: 1500), styles: BlobStyles(color: Color(0xffB33771)), ), From b1225106f8f1fab1c76638891de20e2a176cb968 Mon Sep 17 00:00:00 2001 From: Binozo <70137898+Binozo@users.noreply.github.com> Date: Fri, 19 Aug 2022 18:30:23 +0200 Subject: [PATCH 6/6] moved example parameter in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5de3090..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), ), @@ -246,7 +247,6 @@ Blob.animatedRandom( size:200, edgesCount:5, minGrowth:4, - animationCurve:Curves.easeInOutCubic, loop: true, ),