diff --git a/CHANGELOG.md b/CHANGELOG.md index e256696b..2a43671d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,16 @@ # CHANGES +## 0.7.0+1 + +- By default, `SvgPicture.asset` will now cache the asset. We already cached the + final picture, but the caching included any color filtering provided on the + image. This is problematic if the color is animated. See + https://github.com/dnfield/flutter_svg/issues/33 + ## 0.7.0 -- **BREAKING** Correct erroneous `width` and `height` processing on the root element. +- **BREAKING** Correct erroneous `width` and `height` processing on the root + element. - Previously, `width` and `height` were treated as synonyms for the width and height of the `viewBox`. This is not correct, and resulted in meaningful rendering errors in some scenarios compared to Chrome. Fixing this makes the diff --git a/example/pubspec.lock b/example/pubspec.lock index f5d2001f..15572bb3 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -19,7 +19,7 @@ packages: path: ".." relative: true source: path - version: "0.7.0" + version: "0.7.0+1" meta: dependency: transitive description: diff --git a/lib/avd.dart b/lib/avd.dart index dd6747d1..5d8298ef 100644 --- a/lib/avd.dart +++ b/lib/avd.dart @@ -119,8 +119,8 @@ class AvdPicture extends SvgPicture { : this( ExactAssetPicture( allowDrawingOutsideViewBox == true - ? avdByteDecoderOutsideViewBox - : avdByteDecoder, + ? avdStringDecoderOutsideViewBox + : avdStringDecoder, assetName, bundle: bundle, package: package, diff --git a/lib/src/picture_provider.dart b/lib/src/picture_provider.dart index 382706e0..796983a8 100644 --- a/lib/src/picture_provider.dart +++ b/lib/src/picture_provider.dart @@ -397,7 +397,7 @@ abstract class AssetBundlePictureProvider /// const constructors so that they can be used in const expressions. const AssetBundlePictureProvider(this.decoder) : assert(decoder != null); - final PictureInfoDecoder decoder; + final PictureInfoDecoder decoder; /// Converts a key into an [PictureStreamCompleter], and begins fetching the /// picture using [_loadAsync]. @@ -416,13 +416,12 @@ abstract class AssetBundlePictureProvider /// This function is used by [load]. @protected Future _loadAsync(AssetBundlePictureKey key) async { - final ByteData data = await key.bundle.load(key.name); + final String data = await key.bundle.loadString(key.name); if (data == null) { throw 'Unable to read data'; } - return await decoder( - data.buffer.asUint8List(), key.colorFilter, key.toString()); + return await decoder(data, key.colorFilter, key.toString()); } } @@ -760,7 +759,7 @@ class ExactAssetPicture extends AssetBundlePictureProvider { /// included in a package. See the documentation for the [ExactAssetPicture] class /// itself for details. const ExactAssetPicture( - PictureInfoDecoder decoder, + PictureInfoDecoder decoder, this.assetName, { this.bundle, this.package, diff --git a/lib/svg.dart b/lib/svg.dart index a49b6a08..5e8bc532 100644 --- a/lib/svg.dart +++ b/lib/svg.dart @@ -254,8 +254,8 @@ class SvgPicture extends StatefulWidget { BlendMode colorBlendMode = BlendMode.srcIn, }) : pictureProvider = ExactAssetPicture( allowDrawingOutsideViewBox == true - ? svgByteDecoderOutsideViewBox - : svgByteDecoder, + ? svgStringDecoderOutsideViewBox + : svgStringDecoder, assetName, bundle: bundle, package: package, diff --git a/pubspec.yaml b/pubspec.yaml index 6d2754f2..e0373d4a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: flutter_svg description: An SVG rendering and widget library for Flutter, which allows painting and displaying Scalable Vector Graphics 1.1 files. author: Dan Field homepage: https://github.com/dnfield/flutter_svg -version: 0.7.0 +version: 0.7.0+1 dependencies: path_drawing: ^0.4.0