diff --git a/example/checkbox/pubspec.lock b/example/checkbox/pubspec.lock new file mode 100644 index 0000000..7f515ba --- /dev/null +++ b/example/checkbox/pubspec.lock @@ -0,0 +1,211 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.11" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.2" + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.11" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" + flare_dart: + dependency: transitive + description: + path: flare_dart + ref: dev + resolved-ref: "393c22461e127714a3a25c986bb59a666cba72ac" + url: "git://github.com/2d-inc/Flare-Flutter.git" + source: git + version: "2.3.0" + flare_flutter: + dependency: "direct main" + description: + path: "../../flare_flutter" + relative: true + source: path + version: "1.8.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + image: + dependency: transitive + description: + name: image + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.4" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.6" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.8" + 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" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "2.4.0" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.5" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.5" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.3" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.11" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "3.5.0" +sdks: + dart: ">=2.4.0 <3.0.0" diff --git a/flare_flutter/CHANGELOG.md b/flare_flutter/CHANGELOG.md index e948099..01d0b46 100644 --- a/flare_flutter/CHANGELOG.md +++ b/flare_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.8.1] - 2019-12-09 19:33:06 + +- Disable blur effects if they are less than a certain threshold. Skia seems to drop the whole layer if it's too close to zero (but not zero). + ## [1.8.0] - 2019-12-05 17:34:01 - Support for layer effects including masking, drop shadows, inner shadows, and blurs. diff --git a/flare_flutter/lib/flare.dart b/flare_flutter/lib/flare.dart index 2ebc4fa..ba7f1b6 100644 --- a/flare_flutter/lib/flare.dart +++ b/flare_flutter/lib/flare.dart @@ -1305,6 +1305,14 @@ class FlutterActorInnerShadow extends ActorInnerShadow { ui.BlendMode blendMode; } +ui.ImageFilter _blurFilter(double x, double y) { + double bx = x.abs() < 0.1 ? 0 : x; + double by = y.abs() < 0.1 ? 0 : y; + return bx == 0 && by == 0 + ? null + : ui.ImageFilter.blur(sigmaX: bx, sigmaY: by); +} + class FlutterActorLayerEffectRenderer extends ActorLayerEffectRenderer with FlutterActorDrawable { @override @@ -1320,8 +1328,7 @@ class FlutterActorLayerEffectRenderer extends ActorLayerEffectRenderer if (blur?.isActive ?? false) { baseBlurX = blur.blurX; baseBlurY = blur.blurY; - layerPaint.imageFilter = - ui.ImageFilter.blur(sigmaX: baseBlurX, sigmaY: baseBlurY); + layerPaint.imageFilter = _blurFilter(baseBlurX, baseBlurY); } if (dropShadows.isNotEmpty) { @@ -1337,9 +1344,8 @@ class FlutterActorLayerEffectRenderer extends ActorLayerEffectRenderer canvas.translate(dropShadow.offsetX, dropShadow.offsetY); var shadowPaint = Paint() ..color = layerColor - ..imageFilter = ui.ImageFilter.blur( - sigmaX: dropShadow.blurX + baseBlurX, - sigmaY: dropShadow.blurY + baseBlurY) + ..imageFilter = _blurFilter( + dropShadow.blurX + baseBlurX, dropShadow.blurY + baseBlurY) ..colorFilter = ui.ColorFilter.mode( ui.Color.fromRGBO( (color[0] * 255.0).round(), @@ -1382,9 +1388,8 @@ class FlutterActorLayerEffectRenderer extends ActorLayerEffectRenderer ..color = layerColor ..blendMode = extraBlendPass ? ui.BlendMode.srcIn : ui.BlendMode.srcATop - ..imageFilter = ui.ImageFilter.blur( - sigmaX: innerShadow.blurX + baseBlurX, - sigmaY: innerShadow.blurY + baseBlurY) + ..imageFilter = _blurFilter( + innerShadow.blurX + baseBlurX, innerShadow.blurY + baseBlurY) ..colorFilter = ui.ColorFilter.mode( ui.Color.fromRGBO( (color[0] * 255.0).round(), diff --git a/flare_flutter/pubspec.yaml b/flare_flutter/pubspec.yaml index a3a9bfc..d6af2ed 100644 --- a/flare_flutter/pubspec.yaml +++ b/flare_flutter/pubspec.yaml @@ -1,6 +1,6 @@ name: flare_flutter description: Vector design and runtime animation for Flutter. -version: 1.8.0 +version: 1.8.1 author: "Rive Team " homepage: https://github.com/2d-inc/Flare-Flutter environment: