Compare commits

..

2 Commits

399 changed files with 285 additions and 274 deletions

View File

@ -34,7 +34,7 @@ jobs:
&& exit 1) && exit 1)
shell: bash shell: bash
build_web_version: build_web_version:
name: Check that the web version compile name: Check that the web version can compile
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@ -1,3 +1,28 @@
## [2.0.0]
- **Breaking change**: the lottie widget will be smaller if it relies on the intrinsic size of the composition.
Previously the lottie parser was automatically multiplying the size of the composition by `window.devicePixelRatio`.
This was incorrect as it results in a widget of a different size depending on the pixel ratio of the monitor.
Furthermore, it created some bugs when the property `window.devicePixelRatio` was not available immediately at the start
of the app (on Android release builds).
The code can be adapted to specify explicitly the size of the animation with `width`, `height` and `fit` properties.
```dart
Scaffold(
body: Center(
child: Lottie.asset(
'assets/LottieLogo1.json',
height: 800,
fit: BoxFit.contain,
),
),
);
```
## [1.4.3]
- Fixed some lints with Flutter 3.3.
## [1.4.2] ## [1.4.2]
- Use `FilterQuality.low` as default to draw image layers. - Use `FilterQuality.low` as default to draw image layers.

View File

@ -24,37 +24,37 @@ class App extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
title: const Text('Lottie Flutter'), title: const Text('Lottie Flutter'),
), ),
body: Scrollbar( body: GridView.builder(
child: GridView.builder( primary: true,
itemCount: files.length, itemCount: files.length,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4), crossAxisCount: 4),
itemBuilder: (context, index) { itemBuilder: (context, index) {
var assetName = files[index]; var assetName = files[index];
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute<void>( MaterialPageRoute<void>(
builder: (context) => Detail(assetName))); builder: (context) => Detail(assetName)));
}, },
child: _Item( child: _Item(
child: Lottie.asset( child: Lottie.asset(
assetName, assetName,
onWarning: (w) => _logger.info('$assetName - $w'), fit: BoxFit.contain,
frameBuilder: (context, child, composition) { onWarning: (w) => _logger.info('$assetName - $w'),
return AnimatedOpacity( frameBuilder: (context, child, composition) {
opacity: composition == null ? 0 : 1, return AnimatedOpacity(
duration: const Duration(seconds: 1), opacity: composition == null ? 0 : 1,
curve: Curves.easeOut, duration: const Duration(seconds: 1),
child: child, curve: Curves.easeOut,
); child: child,
}, );
), },
), ),
); ),
}, );
), },
), ),
), ),
); );

View File

@ -0,0 +1,11 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
void fl_register_plugins(FlPluginRegistry* registry) {
}

View File

@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter_linux/flutter_linux.h>
// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_

View File

@ -0,0 +1,23 @@
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)

View File

@ -14,8 +14,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos
SPEC CHECKSUMS: SPEC CHECKSUMS:
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c

View File

@ -7,14 +7,14 @@ packages:
name: archive name: archive
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.3.1" version: "3.3.2"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.8.2" version: "2.9.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -28,21 +28,14 @@ packages:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@ -63,7 +56,7 @@ packages:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
ffi: ffi:
dependency: transitive dependency: transitive
description: description:
@ -77,7 +70,7 @@ packages:
name: file name: file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.2" version: "6.1.4"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -115,63 +108,63 @@ packages:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.13.4" version: "0.13.5"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.1" version: "4.0.2"
lints: lints:
dependency: transitive dependency: transitive
description: description:
name: lints name: lints
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.1"
logging: logging:
dependency: "direct main" dependency: "direct main"
description: description:
name: logging name: logging
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.1.0"
lottie: lottie:
dependency: "direct main" dependency: "direct main"
description: description:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "1.4.2" version: "2.0.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.11" version: "0.12.12"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.4" version: "0.1.5"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.0" version: "1.8.0"
path: path:
dependency: "direct main" dependency: "direct main"
description: description:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
path_provider: path_provider:
dependency: "direct main" dependency: "direct main"
description: description:
@ -185,14 +178,14 @@ packages:
name: path_provider_android name: path_provider_android
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.16" version: "2.0.21"
path_provider_ios: path_provider_ios:
dependency: transitive dependency: transitive
description: description:
name: path_provider_ios name: path_provider_ios
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.10" version: "2.0.11"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
@ -213,14 +206,14 @@ packages:
name: path_provider_platform_interface name: path_provider_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.4" version: "2.0.5"
path_provider_windows: path_provider_windows:
dependency: transitive dependency: transitive
description: description:
name: path_provider_windows name: path_provider_windows
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.3"
platform: platform:
dependency: transitive dependency: transitive
description: description:
@ -234,7 +227,7 @@ packages:
name: plugin_platform_interface name: plugin_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.2" version: "2.1.3"
process: process:
dependency: transitive dependency: transitive
description: description:
@ -253,7 +246,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.2" version: "1.9.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -274,21 +267,21 @@ packages:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.9" version: "0.4.12"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -309,14 +302,14 @@ packages:
name: win32 name: win32
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.7.0" version: "3.0.1"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
name: xdg_directories name: xdg_directories
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0+1" version: "0.2.0+2"
sdks: sdks:
dart: ">=2.17.0 <3.0.0" dart: ">=2.18.0 <3.0.0"
flutter: ">=3.0.0" flutter: ">=3.3.0"

View File

@ -3,7 +3,7 @@ description: A sample app for the Lottie player
publish_to: none publish_to: none
environment: environment:
sdk: ">=2.12.0-0 <3.0.0" sdk: ">=2.18.0 <3.0.0"
dependencies: dependencies:
flutter: flutter:

View File

@ -1,5 +1,4 @@
import 'dart:async'; import 'dart:async';
import 'dart:typed_data';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'composition.dart'; import 'composition.dart';
@ -33,12 +32,12 @@ typedef LottieErrorWidgetBuilder = Widget Function(
/// Several constructors are provided for the various ways that a Lottie file /// Several constructors are provided for the various ways that a Lottie file
/// can be provided: /// can be provided:
/// ///
/// * [new Lottie], for obtaining a composition from a [LottieProvider]. /// * [Lottie], for obtaining a composition from a [LottieProvider].
/// * [new Lottie.asset], for obtaining a Lottie file from an [AssetBundle] /// * [Lottie.asset], for obtaining a Lottie file from an [AssetBundle]
/// using a key. /// using a key.
/// * [new Lottie.network], for obtaining a lottie file from a URL. /// * [Lottie.network], for obtaining a lottie file from a URL.
/// * [new Lottie.file], for obtaining a lottie file from a [File]. /// * [Lottie.file], for obtaining a lottie file from a [File].
/// * [new Lottie.memory], for obtaining a lottie file from a [Uint8List]. /// * [Lottie.memory], for obtaining a lottie file from a [Uint8List].
/// ///
class LottieBuilder extends StatefulWidget { class LottieBuilder extends StatefulWidget {
const LottieBuilder({ const LottieBuilder({

View File

@ -82,5 +82,5 @@ class LottieDelegates {
values == other.values; values == other.values;
@override @override
int get hashCode => hashValues(text, textStyle, values); int get hashCode => Object.hash(text, textStyle, values);
} }

View File

@ -31,7 +31,7 @@ class DocumentData {
@override @override
int get hashCode { int get hashCode {
return hashValues( return Object.hash(
text, text,
fontName, fontName,
size, size,

View File

@ -23,7 +23,6 @@ class ImageLayer extends BaseLayer {
if (bitmap == null) { if (bitmap == null) {
return; return;
} }
var density = window.devicePixelRatio;
paint.filterQuality = lottieDrawable.filterQuality ?? FilterQuality.low; paint.filterQuality = lottieDrawable.filterQuality ?? FilterQuality.low;
paint.setAlpha(parentAlpha); paint.setAlpha(parentAlpha);
@ -34,8 +33,8 @@ class ImageLayer extends BaseLayer {
canvas.transform(parentMatrix.storage); canvas.transform(parentMatrix.storage);
var src = var src =
Rect.fromLTWH(0, 0, bitmap.width.toDouble(), bitmap.height.toDouble()); Rect.fromLTWH(0, 0, bitmap.width.toDouble(), bitmap.height.toDouble());
var dst = Rect.fromLTWH( var dst =
0, 0, bitmap.width * density, bitmap.height.toDouble() * density); Rect.fromLTWH(0, 0, bitmap.width.toDouble(), bitmap.height.toDouble());
canvas.drawImageRect(bitmap, src, dst, paint); canvas.drawImageRect(bitmap, src, dst, paint);
canvas.restore(); canvas.restore();
} }
@ -45,8 +44,8 @@ class ImageLayer extends BaseLayer {
var superBounds = super.getBounds(parentMatrix, applyParents: applyParents); var superBounds = super.getBounds(parentMatrix, applyParents: applyParents);
var bitmap = getBitmap(); var bitmap = getBitmap();
if (bitmap != null) { if (bitmap != null) {
var bounds = Rect.fromLTWH(0, 0, bitmap.width * window.devicePixelRatio, var bounds = Rect.fromLTWH(
bitmap.height * window.devicePixelRatio); 0, 0, bitmap.width.toDouble(), bitmap.height.toDouble());
return boundsMatrix.mapRect(bounds); return boundsMatrix.mapRect(bounds);
} }
return superBounds; return superBounds;

View File

@ -1,4 +1,3 @@
import 'dart:ui';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import '../../animation/content/content_group.dart'; import '../../animation/content/content_group.dart';
import '../../animation/keyframe/base_keyframe_animation.dart'; import '../../animation/keyframe/base_keyframe_animation.dart';
@ -132,8 +131,7 @@ class TextLayer extends BaseLayer {
_strokePaint.strokeWidth = _strokeWidthAnimation!.value; _strokePaint.strokeWidth = _strokeWidthAnimation!.value;
} else { } else {
var parentScale = parentMatrix.getScale(); var parentScale = parentMatrix.getScale();
_strokePaint.strokeWidth = _strokePaint.strokeWidth = documentData.strokeWidth * parentScale;
documentData.strokeWidth * window.devicePixelRatio * parentScale;
} }
if (lottieDrawable.useTextGlyphs) { if (lottieDrawable.useTextGlyphs) {
@ -161,7 +159,7 @@ class TextLayer extends BaseLayer {
var text = documentData.text; var text = documentData.text;
// Line height // Line height
var lineHeight = documentData.lineHeight * window.devicePixelRatio; var lineHeight = documentData.lineHeight;
// Split full text in multiple lines // Split full text in multiple lines
var textLines = _getTextLines(text); var textLines = _getTextLines(text);
@ -208,8 +206,7 @@ class TextLayer extends BaseLayer {
} }
_drawCharacterAsGlyph( _drawCharacterAsGlyph(
character, parentMatrix, fontScale, documentData, canvas); character, parentMatrix, fontScale, documentData, canvas);
var tx = var tx = character.width * fontScale * parentScale;
character.width * fontScale * window.devicePixelRatio * parentScale;
// Add tracking // Add tracking
var tracking = documentData.tracking / 10.0; var tracking = documentData.tracking / 10.0;
if (_trackingCallbackAnimation != null) { if (_trackingCallbackAnimation != null) {
@ -238,11 +235,10 @@ class TextLayer extends BaseLayer {
} else { } else {
textSize = documentData.size; textSize = documentData.size;
} }
textStyle = textStyle = textStyle.copyWith(fontSize: textSize);
textStyle.copyWith(fontSize: textSize * window.devicePixelRatio);
// Line height // Line height
var lineHeight = documentData.lineHeight * window.devicePixelRatio; var lineHeight = documentData.lineHeight;
// Calculate tracking // Calculate tracking
var tracking = documentData.tracking / 10; var tracking = documentData.tracking / 10;
@ -251,7 +247,7 @@ class TextLayer extends BaseLayer {
} else if (_trackingAnimation != null) { } else if (_trackingAnimation != null) {
tracking += _trackingAnimation!.value; tracking += _trackingAnimation!.value;
} }
tracking = tracking * window.devicePixelRatio * textSize / 100.0; tracking = tracking * textSize / 100.0;
// Split full text in multiple lines // Split full text in multiple lines
var textLines = _getTextLines(text); var textLines = _getTextLines(text);
@ -316,8 +312,7 @@ class TextLayer extends BaseLayer {
if (character == null) { if (character == null) {
continue; continue;
} }
textLineWidth += textLineWidth += character.width * fontScale * parentScale;
character.width * fontScale * window.devicePixelRatio * parentScale;
} }
return textLineWidth; return textLineWidth;
} }
@ -344,8 +339,7 @@ class TextLayer extends BaseLayer {
var path = contentGroups[j].getPath(); var path = contentGroups[j].getPath();
path.getBounds(); path.getBounds();
_matrix.set(parentMatrix); _matrix.set(parentMatrix);
_matrix.translate( _matrix.translate(0.0, -documentData.baselineShift);
0.0, -documentData.baselineShift * window.devicePixelRatio);
_matrix.scale(fontScale, fontScale); _matrix.scale(fontScale, fontScale);
path = path.transform(_matrix.storage); path = path.transform(_matrix.storage);
if (documentData.strokeOverFill) { if (documentData.strokeOverFill) {

View File

@ -27,8 +27,8 @@ class AnimatablePathValueParser {
reader.endArray(); reader.endArray();
KeyframesParser.setEndFrames(keyframes); KeyframesParser.setEndFrames(keyframes);
} else { } else {
keyframes.add(Keyframe<Offset>.nonAnimated( keyframes
JsonUtils.jsonToPoint(reader, window.devicePixelRatio))); .add(Keyframe<Offset>.nonAnimated(JsonUtils.jsonToPoint(reader)));
} }
return AnimatablePathValue.fromKeyframes(keyframes); return AnimatablePathValue.fromKeyframes(keyframes);
} }

View File

@ -74,8 +74,7 @@ class AnimatableTransformParser {
// ] // ]
// }, // },
// which doesn't parse to a real keyframe. // which doesn't parse to a real keyframe.
rotation = AnimatableValueParser.parseFloat(reader, composition, rotation = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
if (rotation.keyframes.isEmpty) { if (rotation.keyframes.isEmpty) {
rotation.keyframes.add(Keyframe(composition, rotation.keyframes.add(Keyframe(composition,
startValue: 0.0, startValue: 0.0,
@ -96,20 +95,16 @@ class AnimatableTransformParser {
opacity = AnimatableValueParser.parseInteger(reader, composition); opacity = AnimatableValueParser.parseInteger(reader, composition);
break; break;
case 6: case 6:
startOpacity = AnimatableValueParser.parseFloat(reader, composition, startOpacity = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 7: case 7:
endOpacity = AnimatableValueParser.parseFloat(reader, composition, endOpacity = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 8: case 8:
skew = AnimatableValueParser.parseFloat(reader, composition, skew = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 9: case 9:
skewAngle = AnimatableValueParser.parseFloat(reader, composition, skewAngle = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
default: default:
reader.skipName(); reader.skipName();

View File

@ -1,4 +1,3 @@
import 'dart:ui';
import '../composition.dart'; import '../composition.dart';
import '../model/animatable/animatable_color_value.dart'; import '../model/animatable/animatable_color_value.dart';
import '../model/animatable/animatable_double_value.dart'; import '../model/animatable/animatable_double_value.dart';
@ -25,12 +24,9 @@ class AnimatableValueParser {
AnimatableValueParser._(); AnimatableValueParser._();
static AnimatableDoubleValue parseFloat( static AnimatableDoubleValue parseFloat(
JsonReader reader, LottieComposition composition, JsonReader reader, LottieComposition composition) {
{bool? isDp}) { return AnimatableDoubleValue.fromKeyframes(
isDp ??= true; parse(reader, composition, floatParser));
return AnimatableDoubleValue.fromKeyframes(parse(
reader, composition, floatParser,
scale: isDp ? window.devicePixelRatio : 1.0));
} }
static AnimatableIntegerValue parseInteger( static AnimatableIntegerValue parseInteger(
@ -42,7 +38,7 @@ class AnimatableValueParser {
static AnimatablePointValue parsePoint( static AnimatablePointValue parsePoint(
JsonReader reader, LottieComposition composition) { JsonReader reader, LottieComposition composition) {
return AnimatablePointValue.fromKeyframes(KeyframesParser.parse( return AnimatablePointValue.fromKeyframes(KeyframesParser.parse(
reader, composition, window.devicePixelRatio, offsetParser, reader, composition, offsetParser,
multiDimensional: true)); multiDimensional: true));
} }
@ -54,9 +50,8 @@ class AnimatableValueParser {
static AnimatableShapeValue parseShapeData( static AnimatableShapeValue parseShapeData(
JsonReader reader, LottieComposition composition) { JsonReader reader, LottieComposition composition) {
return AnimatableShapeValue.fromKeyframes(parse( return AnimatableShapeValue.fromKeyframes(
reader, composition, shapeDataParser, parse(reader, composition, shapeDataParser));
scale: window.devicePixelRatio));
} }
static AnimatableTextFrame parseDocumentData( static AnimatableTextFrame parseDocumentData(
@ -81,6 +76,6 @@ class AnimatableValueParser {
LottieComposition composition, ValueParser<T> valueParser, LottieComposition composition, ValueParser<T> valueParser,
{double? scale}) { {double? scale}) {
scale ??= 1.0; scale ??= 1.0;
return KeyframesParser.parse(reader, composition, scale, valueParser); return KeyframesParser.parse(reader, composition, valueParser);
} }
} }

View File

@ -1,7 +1,7 @@
import 'dart:ui'; import 'dart:ui';
import 'moshi/json_reader.dart'; import 'moshi/json_reader.dart';
Color colorParser(JsonReader reader, {required double scale}) { Color colorParser(JsonReader reader) {
var isArray = reader.peek() == Token.beginArray; var isArray = reader.peek() == Token.beginArray;
if (isArray) { if (isArray) {
reader.beginArray(); reader.beginArray();

View File

@ -17,7 +17,7 @@ final JsonReaderOptions _names = JsonReaderOptions.of([
'of', // 10 'of', // 10
]); ]);
DocumentData documentDataParser(JsonReader reader, {required double scale}) { DocumentData documentDataParser(JsonReader reader) {
String? text; String? text;
String? fontName; String? fontName;
var size = 0.0; var size = 0.0;

View File

@ -69,12 +69,11 @@ class DropShadowEffectParser {
_color = AnimatableValueParser.parseColor(reader, composition); _color = AnimatableValueParser.parseColor(reader, composition);
break; break;
case 'Opacity': case 'Opacity':
_opacity = AnimatableValueParser.parseFloat(reader, composition, _opacity = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 'Direction': case 'Direction':
_direction = AnimatableValueParser.parseFloat(reader, composition, _direction =
isDp: false); AnimatableValueParser.parseFloat(reader, composition);
break; break;
case 'Distance': case 'Distance':
_distance = AnimatableValueParser.parseFloat(reader, composition); _distance = AnimatableValueParser.parseFloat(reader, composition);

View File

@ -1,6 +1,6 @@
import 'json_utils.dart'; import 'json_utils.dart';
import 'moshi/json_reader.dart'; import 'moshi/json_reader.dart';
double floatParser(JsonReader reader, {required double scale}) { double floatParser(JsonReader reader) {
return JsonUtils.valueFromObject(reader) * scale; return JsonUtils.valueFromObject(reader);
} }

View File

@ -26,7 +26,7 @@ class GradientColorParser {
/// opacity, /// opacity,
/// ... /// ...
/// ] /// ]
GradientColor parse(JsonReader reader, {required double scale}) { GradientColor parse(JsonReader reader) {
var array = <double>[]; var array = <double>[];
// The array was started by Keyframe because it thought that this may be an array of keyframes // The array was started by Keyframe because it thought that this may be an array of keyframes
// but peek returned a number so it considered it a static array of numbers. // but peek returned a number so it considered it a static array of numbers.

View File

@ -1,6 +1,6 @@
import 'json_utils.dart'; import 'json_utils.dart';
import 'moshi/json_reader.dart'; import 'moshi/json_reader.dart';
int integerParser(JsonReader reader, {required double scale}) { int integerParser(JsonReader reader) {
return (JsonUtils.valueFromObject(reader) * scale).round(); return JsonUtils.valueFromObject(reader).round();
} }

View File

@ -14,43 +14,43 @@ class JsonUtils {
return Color.fromARGB(255, r, g, b); return Color.fromARGB(255, r, g, b);
} }
static List<Offset> jsonToPoints(JsonReader reader, double scale) { static List<Offset> jsonToPoints(JsonReader reader) {
var points = <Offset>[]; var points = <Offset>[];
reader.beginArray(); reader.beginArray();
while (reader.peek() == Token.beginArray) { while (reader.peek() == Token.beginArray) {
reader.beginArray(); reader.beginArray();
points.add(jsonToPoint(reader, scale)); points.add(jsonToPoint(reader));
reader.endArray(); reader.endArray();
} }
reader.endArray(); reader.endArray();
return points; return points;
} }
static Offset jsonToPoint(JsonReader reader, double scale) { static Offset jsonToPoint(JsonReader reader) {
switch (reader.peek()) { switch (reader.peek()) {
case Token.number: case Token.number:
return _jsonNumbersToPoint(reader, scale); return _jsonNumbersToPoint(reader);
case Token.beginArray: case Token.beginArray:
return _jsonArrayToPoint(reader, scale); return _jsonArrayToPoint(reader);
case Token.beginObject: case Token.beginObject:
return _jsonObjectToPoint(reader, scale: scale); return _jsonObjectToPoint(reader);
// ignore: no_default_cases // ignore: no_default_cases
default: default:
throw Exception('Unknown point starts with ${reader.peek()}'); throw Exception('Unknown point starts with ${reader.peek()}');
} }
} }
static Offset _jsonNumbersToPoint(JsonReader reader, double scale) { static Offset _jsonNumbersToPoint(JsonReader reader) {
var x = reader.nextDouble(); var x = reader.nextDouble();
var y = reader.nextDouble(); var y = reader.nextDouble();
while (reader.hasNext()) { while (reader.hasNext()) {
reader.skipValue(); reader.skipValue();
} }
return Offset(x * scale, y * scale); return Offset(x, y);
} }
static Offset _jsonArrayToPoint(JsonReader reader, double scale) { static Offset _jsonArrayToPoint(JsonReader reader) {
double x; double x;
double y; double y;
reader.beginArray(); reader.beginArray();
@ -60,12 +60,12 @@ class JsonUtils {
reader.skipValue(); reader.skipValue();
} }
reader.endArray(); reader.endArray();
return Offset(x * scale, y * scale); return Offset(x, y);
} }
static final JsonReaderOptions _pointNames = JsonReaderOptions.of(['x', 'y']); static final JsonReaderOptions _pointNames = JsonReaderOptions.of(['x', 'y']);
static Offset _jsonObjectToPoint(JsonReader reader, {required double scale}) { static Offset _jsonObjectToPoint(JsonReader reader) {
var x = 0.0; var x = 0.0;
var y = 0.0; var y = 0.0;
reader.beginObject(); reader.beginObject();
@ -83,7 +83,7 @@ class JsonUtils {
} }
} }
reader.endObject(); reader.endObject();
return Offset(x * scale, y * scale); return Offset(x, y);
} }
static double valueFromObject(JsonReader reader) { static double valueFromObject(JsonReader reader) {

View File

@ -26,22 +26,21 @@ class KeyframeParser {
/// @param multiDimensional When true, the keyframe interpolators can be independent for the X and Y axis. /// @param multiDimensional When true, the keyframe interpolators can be independent for the X and Y axis.
static Keyframe<T> parse<T>(JsonReader reader, LottieComposition composition, static Keyframe<T> parse<T>(JsonReader reader, LottieComposition composition,
double scale, ValueParser<T> valueParser, ValueParser<T> valueParser,
{required bool animated, bool multiDimensional = false}) { {required bool animated, bool multiDimensional = false}) {
if (animated && multiDimensional) { if (animated && multiDimensional) {
return _parseMultiDimensionalKeyframe( return _parseMultiDimensionalKeyframe(composition, reader, valueParser);
composition, reader, scale, valueParser);
} else if (animated) { } else if (animated) {
return _parseKeyframe(composition, reader, scale, valueParser); return _parseKeyframe(composition, reader, valueParser);
} else { } else {
return _parseStaticValue(reader, scale, valueParser); return _parseStaticValue(reader, valueParser);
} }
} }
/// beginObject will already be called on the keyframe so it can be differentiated with /// beginObject will already be called on the keyframe so it can be differentiated with
/// a non animated value. /// a non animated value.
static Keyframe<T> _parseKeyframe<T>(LottieComposition composition, static Keyframe<T> _parseKeyframe<T>(LottieComposition composition,
JsonReader reader, double scale, ValueParser<T> valueParser) { JsonReader reader, ValueParser<T> valueParser) {
Offset? cp1; Offset? cp1;
Offset? cp2; Offset? cp2;
var startFrame = 0.0; var startFrame = 0.0;
@ -61,25 +60,25 @@ class KeyframeParser {
startFrame = reader.nextDouble(); startFrame = reader.nextDouble();
break; break;
case 1: case 1:
startValue = valueParser(reader, scale: scale); startValue = valueParser(reader);
break; break;
case 2: case 2:
endValue = valueParser(reader, scale: scale); endValue = valueParser(reader);
break; break;
case 3: case 3:
cp1 = JsonUtils.jsonToPoint(reader, 1); cp1 = JsonUtils.jsonToPoint(reader);
break; break;
case 4: case 4:
cp2 = JsonUtils.jsonToPoint(reader, 1); cp2 = JsonUtils.jsonToPoint(reader);
break; break;
case 5: case 5:
hold = reader.nextInt() == 1; hold = reader.nextInt() == 1;
break; break;
case 6: case 6:
pathCp1 = JsonUtils.jsonToPoint(reader, scale); pathCp1 = JsonUtils.jsonToPoint(reader);
break; break;
case 7: case 7:
pathCp2 = JsonUtils.jsonToPoint(reader, scale); pathCp2 = JsonUtils.jsonToPoint(reader);
break; break;
default: default:
reader.skipValue(); reader.skipValue();
@ -111,7 +110,6 @@ class KeyframeParser {
static Keyframe<T> _parseMultiDimensionalKeyframe<T>( static Keyframe<T> _parseMultiDimensionalKeyframe<T>(
LottieComposition composition, LottieComposition composition,
JsonReader reader, JsonReader reader,
double scale,
ValueParser<T> valueParser) { ValueParser<T> valueParser) {
Offset? cp1; Offset? cp1;
Offset? cp2; Offset? cp2;
@ -140,10 +138,10 @@ class KeyframeParser {
startFrame = reader.nextDouble(); startFrame = reader.nextDouble();
break; break;
case 1: // s case 1: // s
startValue = valueParser(reader, scale: scale); startValue = valueParser(reader);
break; break;
case 2: // e case 2: // e
endValue = valueParser(reader, scale: scale); endValue = valueParser(reader);
break; break;
case 3: // o case 3: // o
if (reader.peek() == Token.beginObject) { if (reader.peek() == Token.beginObject) {
@ -192,7 +190,7 @@ class KeyframeParser {
yCp1 = Offset(yCp1x, yCp1y); yCp1 = Offset(yCp1x, yCp1y);
reader.endObject(); reader.endObject();
} else { } else {
cp1 = JsonUtils.jsonToPoint(reader, scale); cp1 = JsonUtils.jsonToPoint(reader);
} }
break; break;
case 4: // i case 4: // i
@ -242,17 +240,17 @@ class KeyframeParser {
yCp2 = Offset(yCp2x, yCp2y); yCp2 = Offset(yCp2x, yCp2y);
reader.endObject(); reader.endObject();
} else { } else {
cp2 = JsonUtils.jsonToPoint(reader, scale); cp2 = JsonUtils.jsonToPoint(reader);
} }
break; break;
case 5: // h case 5: // h
hold = reader.nextInt() == 1; hold = reader.nextInt() == 1;
break; break;
case 6: // to case 6: // to
pathCp1 = JsonUtils.jsonToPoint(reader, scale); pathCp1 = JsonUtils.jsonToPoint(reader);
break; break;
case 7: // ti case 7: // ti
pathCp2 = JsonUtils.jsonToPoint(reader, scale); pathCp2 = JsonUtils.jsonToPoint(reader);
break; break;
default: default:
reader.skipValue(); reader.skipValue();
@ -322,8 +320,8 @@ class KeyframeParser {
} }
static Keyframe<T> _parseStaticValue<T>( static Keyframe<T> _parseStaticValue<T>(
JsonReader reader, double scale, ValueParser<T> valueParser) { JsonReader reader, ValueParser<T> valueParser) {
var value = valueParser(reader, scale: scale); var value = valueParser(reader);
return Keyframe<T>.nonAnimated(value); return Keyframe<T>.nonAnimated(value);
} }
} }

View File

@ -11,7 +11,7 @@ class KeyframesParser {
KeyframesParser._(); KeyframesParser._();
static List<Keyframe<T>> parse<T>(JsonReader reader, static List<Keyframe<T>> parse<T>(JsonReader reader,
LottieComposition composition, double scale, ValueParser<T> valueParser, LottieComposition composition, ValueParser<T> valueParser,
{bool multiDimensional = false}) { {bool multiDimensional = false}) {
var keyframes = <Keyframe<T>>[]; var keyframes = <Keyframe<T>>[];
@ -30,19 +30,18 @@ class KeyframesParser {
if (reader.peek() == Token.number) { if (reader.peek() == Token.number) {
// For properties in which the static value is an array of numbers. // For properties in which the static value is an array of numbers.
keyframes.add(KeyframeParser.parse( keyframes.add(KeyframeParser.parse(
reader, composition, scale, valueParser, reader, composition, valueParser,
animated: false, multiDimensional: multiDimensional)); animated: false, multiDimensional: multiDimensional));
} else { } else {
while (reader.hasNext()) { while (reader.hasNext()) {
keyframes.add(KeyframeParser.parse( keyframes.add(KeyframeParser.parse(
reader, composition, scale, valueParser, reader, composition, valueParser,
animated: true, multiDimensional: multiDimensional)); animated: true, multiDimensional: multiDimensional));
} }
} }
reader.endArray(); reader.endArray();
} else { } else {
keyframes.add(KeyframeParser.parse( keyframes.add(KeyframeParser.parse(reader, composition, valueParser,
reader, composition, scale, valueParser,
animated: false, multiDimensional: multiDimensional)); animated: false, multiDimensional: multiDimensional));
} }
break; break;

View File

@ -136,10 +136,10 @@ class LayerParser {
parentId = reader.nextInt(); parentId = reader.nextInt();
break; break;
case 5: case 5:
solidWidth = (reader.nextInt() * window.devicePixelRatio).round(); solidWidth = reader.nextInt();
break; break;
case 6: case 6:
solidHeight = (reader.nextInt() * window.devicePixelRatio).round(); solidHeight = reader.nextInt();
break; break;
case 7: case 7:
solidColor = MiscUtils.parseColor(reader.nextString(), solidColor = MiscUtils.parseColor(reader.nextString(),
@ -246,10 +246,10 @@ class LayerParser {
startFrame = reader.nextDouble(); startFrame = reader.nextDouble();
break; break;
case 16: case 16:
preCompWidth = (reader.nextInt() * window.devicePixelRatio).round(); preCompWidth = reader.nextInt();
break; break;
case 17: case 17:
preCompHeight = (reader.nextInt() * window.devicePixelRatio).round(); preCompHeight = reader.nextInt();
break; break;
case 18: case 18:
inFrame = reader.nextDouble(); inFrame = reader.nextDouble();
@ -258,8 +258,7 @@ class LayerParser {
outFrame = reader.nextDouble(); outFrame = reader.nextDouble();
break; break;
case 20: case 20:
timeRemapping = AnimatableValueParser.parseFloat(reader, composition, timeRemapping = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 21: case 21:
cl = reader.nextString(); cl = reader.nextString();

View File

@ -1,4 +1,3 @@
import 'dart:ui';
import '../composition.dart'; import '../composition.dart';
import '../lottie_image_asset.dart'; import '../lottie_image_asset.dart';
import '../model/font.dart'; import '../model/font.dart';
@ -29,16 +28,15 @@ class LottieCompositionParser {
static LottieComposition parse( static LottieComposition parse(
LottieComposition composition, JsonReader reader) { LottieComposition composition, JsonReader reader) {
var parameters = CompositionParameters.forComposition(composition); var parameters = CompositionParameters.forComposition(composition);
var scale = window.devicePixelRatio;
reader.beginObject(); reader.beginObject();
while (reader.hasNext()) { while (reader.hasNext()) {
switch (reader.selectName(_names)) { switch (reader.selectName(_names)) {
case 0: case 0:
parameters.bounds.width = (reader.nextInt() * scale).round(); parameters.bounds.width = (reader.nextInt()).round();
break; break;
case 1: case 1:
parameters.bounds.height = (reader.nextInt() * scale).round(); parameters.bounds.height = (reader.nextInt()).round();
break; break;
case 2: case 2:
parameters.startFrame = reader.nextDouble(); parameters.startFrame = reader.nextDouble();

View File

@ -2,18 +2,17 @@ import 'dart:ui';
import 'json_utils.dart'; import 'json_utils.dart';
import 'moshi/json_reader.dart'; import 'moshi/json_reader.dart';
Offset offsetParser(JsonReader reader, {required double scale}) { Offset offsetParser(JsonReader reader) {
var token = reader.peek(); var token = reader.peek();
if (token == Token.beginArray) { if (token == Token.beginArray) {
return JsonUtils.jsonToPoint(reader, scale); return JsonUtils.jsonToPoint(reader);
} else if (token == Token.beginObject) { } else if (token == Token.beginObject) {
return JsonUtils.jsonToPoint(reader, scale); return JsonUtils.jsonToPoint(reader);
} else if (token == Token.number) { } else if (token == Token.number) {
// This is the case where the static value for a property is an array of numbers. // This is the case where the static value for a property is an array of numbers.
// We begin the array to see if we have an array of keyframes but it's just an array // We begin the array to see if we have an array of keyframes but it's just an array
// of static numbers instead. // of static numbers instead.
var point = var point = Offset(reader.nextDouble(), reader.nextDouble());
Offset(reader.nextDouble() * scale, reader.nextDouble() * scale);
while (reader.hasNext()) { while (reader.hasNext()) {
reader.skipValue(); reader.skipValue();
} }

View File

@ -10,8 +10,7 @@ class PathKeyframeParser {
static PathKeyframe parse(JsonReader reader, LottieComposition composition) { static PathKeyframe parse(JsonReader reader, LottieComposition composition) {
var animated = reader.peek() == Token.beginObject; var animated = reader.peek() == Token.beginObject;
var keyframe = KeyframeParser.parse<Offset>( var keyframe = KeyframeParser.parse<Offset>(reader, composition, pathParser,
reader, composition, window.devicePixelRatio, pathParser,
animated: animated); animated: animated);
return PathKeyframe(composition, keyframe); return PathKeyframe(composition, keyframe);

View File

@ -2,6 +2,6 @@ import 'dart:ui';
import 'json_utils.dart'; import 'json_utils.dart';
import 'moshi/json_reader.dart'; import 'moshi/json_reader.dart';
Offset pathParser(JsonReader reader, {required double scale}) { Offset pathParser(JsonReader reader) {
return JsonUtils.jsonToPoint(reader, scale); return JsonUtils.jsonToPoint(reader);
} }

View File

@ -36,32 +36,28 @@ class PolystarShapeParser {
type = PolystarShapeType.forValue(reader.nextInt()); type = PolystarShapeType.forValue(reader.nextInt());
break; break;
case 2: case 2:
points = AnimatableValueParser.parseFloat(reader, composition, points = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 3: case 3:
position = position =
AnimatablePathValueParser.parseSplitPath(reader, composition); AnimatablePathValueParser.parseSplitPath(reader, composition);
break; break;
case 4: case 4:
rotation = AnimatableValueParser.parseFloat(reader, composition, rotation = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 5: case 5:
outerRadius = AnimatableValueParser.parseFloat(reader, composition); outerRadius = AnimatableValueParser.parseFloat(reader, composition);
break; break;
case 6: case 6:
outerRoundedness = AnimatableValueParser.parseFloat( outerRoundedness =
reader, composition, AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 7: case 7:
innerRadius = AnimatableValueParser.parseFloat(reader, composition); innerRadius = AnimatableValueParser.parseFloat(reader, composition);
break; break;
case 8: case 8:
innerRoundedness = AnimatableValueParser.parseFloat( innerRoundedness =
reader, composition, AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 9: case 9:
hidden = reader.nextBoolean(); hidden = reader.nextBoolean();

View File

@ -25,12 +25,10 @@ class RepeaterParser {
name = reader.nextString(); name = reader.nextString();
break; break;
case 1: case 1:
copies = AnimatableValueParser.parseFloat(reader, composition, copies = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 2: case 2:
offset = AnimatableValueParser.parseFloat(reader, composition, offset = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 3: case 3:
transform = AnimatableTransformParser.parse(reader, composition); transform = AnimatableTransformParser.parse(reader, composition);

View File

@ -23,8 +23,7 @@ class RoundedCornersParser {
name = reader.nextString(); name = reader.nextString();
break; break;
case 1: // r case 1: // r
cornerRadius = cornerRadius = AnimatableValueParser.parseFloat(reader, composition);
AnimatableValueParser.parseFloat(reader, composition, isDp: true);
break; break;
case 2: // hd case 2: // hd
hidden = reader.nextBoolean(); hidden = reader.nextBoolean();

View File

@ -1,7 +1,7 @@
import 'dart:ui'; import 'dart:ui';
import 'moshi/json_reader.dart'; import 'moshi/json_reader.dart';
Offset scaleXYParser(JsonReader reader, {required double scale}) { Offset scaleXYParser(JsonReader reader) {
var isArray = reader.peek() == Token.beginArray; var isArray = reader.peek() == Token.beginArray;
if (isArray) { if (isArray) {
reader.beginArray(); reader.beginArray();
@ -14,5 +14,5 @@ Offset scaleXYParser(JsonReader reader, {required double scale}) {
if (isArray) { if (isArray) {
reader.endArray(); reader.endArray();
} }
return Offset(sx / 100.0 * scale, sy / 100.0 * scale); return Offset(sx / 100.0, sy / 100.0);
} }

View File

@ -6,7 +6,7 @@ import 'moshi/json_reader.dart';
final JsonReaderOptions _names = JsonReaderOptions.of(['c', 'v', 'i', 'o']); final JsonReaderOptions _names = JsonReaderOptions.of(['c', 'v', 'i', 'o']);
ShapeData shapeDataParser(JsonReader reader, {required double scale}) { ShapeData shapeDataParser(JsonReader reader) {
// Sometimes the points data is in a array of length 1. Sometimes the data is at the top // Sometimes the points data is in a array of length 1. Sometimes the data is at the top
// level. // level.
if (reader.peek() == Token.beginArray) { if (reader.peek() == Token.beginArray) {
@ -25,13 +25,13 @@ ShapeData shapeDataParser(JsonReader reader, {required double scale}) {
closed = reader.nextBoolean(); closed = reader.nextBoolean();
break; break;
case 1: case 1:
pointsArray = JsonUtils.jsonToPoints(reader, scale); pointsArray = JsonUtils.jsonToPoints(reader);
break; break;
case 2: case 2:
inTangents = JsonUtils.jsonToPoints(reader, scale); inTangents = JsonUtils.jsonToPoints(reader);
break; break;
case 3: case 3:
outTangents = JsonUtils.jsonToPoints(reader, scale); outTangents = JsonUtils.jsonToPoints(reader);
break; break;
default: default:
reader.skipName(); reader.skipName();

View File

@ -19,16 +19,13 @@ class ShapeTrimPathParser {
while (reader.hasNext()) { while (reader.hasNext()) {
switch (reader.selectName(_names)) { switch (reader.selectName(_names)) {
case 0: case 0:
start = AnimatableValueParser.parseFloat(reader, composition, start = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 1: case 1:
end = AnimatableValueParser.parseFloat(reader, composition, end = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 2: case 2:
offset = AnimatableValueParser.parseFloat(reader, composition, offset = AnimatableValueParser.parseFloat(reader, composition);
isDp: false);
break; break;
case 3: case 3:
name = reader.nextString(); name = reader.nextString();

View File

@ -1,3 +1,3 @@
import 'moshi/json_reader.dart'; import 'moshi/json_reader.dart';
typedef ValueParser<V> = V Function(JsonReader reader, {required double scale}); typedef ValueParser<V> = V Function(JsonReader reader);

View File

@ -67,7 +67,7 @@ class AssetLottie extends LottieProvider {
} }
@override @override
int get hashCode => hashValues(keyName, bundle); int get hashCode => Object.hash(keyName, bundle);
@override @override
String toString() => '$runtimeType(bundle: $bundle, name: "$keyName")'; String toString() => '$runtimeType(bundle: $bundle, name: "$keyName")';

View File

@ -1,5 +1,4 @@
import 'dart:io'; import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;

View File

@ -1,4 +1,3 @@
import 'dart:typed_data';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';

View File

@ -33,7 +33,7 @@ class DropShadow {
} }
@override @override
int get hashCode => hashValues(color, direction, distance, radius); int get hashCode => Object.hash(color, direction, distance, radius);
@override @override
String toString() => 'DropShadow(color: $color, direction: $direction, ' String toString() => 'DropShadow(color: $color, direction: $direction, '

View File

@ -1,4 +1,3 @@
import 'dart:ui';
import 'package:flutter/animation.dart'; import 'package:flutter/animation.dart';
import '../composition.dart'; import '../composition.dart';

View File

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared name: _fe_analyzer_shared
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "43.0.0" version: "48.0.0"
analyzer: analyzer:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: analyzer name: analyzer
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.3.1" version: "5.0.0"
archive: archive:
dependency: "direct main" dependency: "direct main"
description: description:
@ -35,7 +35,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.8.2" version: "2.9.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -49,7 +49,7 @@ packages:
name: build name: build
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.3.0" version: "2.3.1"
build_config: build_config:
dependency: transitive dependency: transitive
description: description:
@ -70,21 +70,21 @@ packages:
name: build_resolvers name: build_resolvers
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.9" version: "2.0.10"
build_runner: build_runner:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: build_runner name: build_runner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.0" version: "2.2.1"
build_runner_core: build_runner_core:
dependency: transitive dependency: transitive
description: description:
name: build_runner_core name: build_runner_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "7.2.3" version: "7.2.4"
built_collection: built_collection:
dependency: transitive dependency: transitive
description: description:
@ -98,21 +98,14 @@ packages:
name: built_value name: built_value
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.4.0" version: "8.4.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.1"
checked_yaml: checked_yaml:
dependency: transitive dependency: transitive
description: description:
@ -126,14 +119,14 @@ packages:
name: clock name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
code_builder: code_builder:
dependency: transitive dependency: transitive
description: description:
name: code_builder name: code_builder
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.1.0" version: "4.2.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@ -161,21 +154,21 @@ packages:
name: dart_style name: dart_style
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.3" version: "2.2.4"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0" version: "1.3.1"
file: file:
dependency: transitive dependency: transitive
description: description:
name: file name: file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.2" version: "6.1.4"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
@ -276,21 +269,21 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.11" version: "0.12.12"
material_color_utilities: material_color_utilities:
dependency: transitive dependency: transitive
description: description:
name: material_color_utilities name: material_color_utilities
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.4" version: "0.1.5"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.7.0" version: "1.8.0"
mime: mime:
dependency: transitive dependency: transitive
description: description:
@ -311,7 +304,7 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.1" version: "1.8.2"
pool: pool:
dependency: transitive dependency: transitive
description: description:
@ -332,14 +325,14 @@ packages:
name: pubspec_parse name: pubspec_parse
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
name: shelf name: shelf
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.1" version: "1.3.2"
shelf_web_socket: shelf_web_socket:
dependency: transitive dependency: transitive
description: description:
@ -358,7 +351,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.2" version: "1.9.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -386,21 +379,21 @@ packages:
name: string_scanner name: string_scanner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.1"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.1"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.9" version: "0.4.12"
timing: timing:
dependency: transitive dependency: transitive
description: description:
@ -444,5 +437,5 @@ packages:
source: hosted source: hosted
version: "3.1.1" version: "3.1.1"
sdks: sdks:
dart: ">=2.17.0 <3.0.0" dart: ">=2.18.0 <3.0.0"
flutter: ">=2.10.0" flutter: ">=3.3.0"

View File

@ -1,11 +1,11 @@
name: lottie name: lottie
description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player. description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
version: 1.4.2 version: 2.0.0
homepage: https://github.com/xvrh/lottie-flutter homepage: https://github.com/xvrh/lottie-flutter
environment: environment:
sdk: '>=2.12.0 <3.0.0' sdk: '>=2.18.0 <3.0.0'
flutter: '>=2.10.0' flutter: '>=3.3.0'
dependencies: dependencies:
archive: ^3.0.0 archive: ^3.0.0

View File

@ -291,7 +291,7 @@ void main() {
'Blur', 'Blur',
ValueDelegate.blurRadius( ValueDelegate.blurRadius(
['**'], ['**'],
value: 22, value: 10,
), ),
); );

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Some files were not shown because too many files have changed in this diff Show More